Commit 8f7389e6 authored by Bruno Araujo's avatar Bruno Araujo

Instalacao do uuid e alert js

parent 7464cb5c
......@@ -117,6 +117,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/var-dumper" />
<excludeFolder url="file://$MODULE_DIR$/vendor/theseer/tokenizer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/tijsverkoyen/css-to-inline-styles" />
<excludeFolder url="file://$MODULE_DIR$/vendor/uxweb/sweet-alert" />
<excludeFolder url="file://$MODULE_DIR$/vendor/vlucas/phpdotenv" />
<excludeFolder url="file://$MODULE_DIR$/vendor/voku/portable-ascii" />
<excludeFolder url="file://$MODULE_DIR$/vendor/webmozart/assert" />
......
......@@ -114,6 +114,7 @@
<path value="$PROJECT_DIR$/vendor/almasaeed2010/adminlte" />
<path value="$PROJECT_DIR$/vendor/laravel/ui" />
<path value="$PROJECT_DIR$/vendor/jeroennoten/laravel-adminlte" />
<path value="$PROJECT_DIR$/vendor/uxweb/sweet-alert" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.3" />
......
......@@ -20,8 +20,37 @@
</component>
<component name="ChangeListManager">
<list default="true" id="493d567d-53f3-4e20-a1ed-b21775166d2f" name="Default Changelist" comment="Atualizacao final README.md">
<change beforePath="$PROJECT_DIR$/.idea/laravel.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/laravel.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/php.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/ProdutoController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/ProdutoController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/CategoriaController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/CategoriaController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/Categoria.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/Categoria.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bootstrap/app.php" beforeDir="false" afterPath="$PROJECT_DIR$/bootstrap/app.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bootstrap/cache/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/bootstrap/cache/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/composer.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/adminlte.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/adminlte.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/app.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/app.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2020_09_29_124220_create_categorias_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2020_09_29_124220_create_categorias_table.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2020_10_06_140010_create_produtos_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2020_10_06_140010_create_produtos_table.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docker-compose.yml" beforeDir="false" afterPath="$PROJECT_DIR$/docker-compose.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/js/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/public/js/app.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/js/bootstrap.js" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/bootstrap.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/produto/index.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/produto/index.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/vendor/adminlte/master.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/vendor/adminlte/master.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/web.php" beforeDir="false" afterPath="$PROJECT_DIR$/routes/web.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/app/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/app/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/app/public/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/app/public/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/framework/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/framework/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/framework/cache/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/framework/cache/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/framework/cache/data/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/framework/cache/data/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/framework/sessions/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/framework/sessions/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/framework/testing/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/framework/testing/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/framework/views/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/framework/views/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/logs/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/logs/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/uema/BaseModel.php" beforeDir="false" afterPath="$PROJECT_DIR$/uema/BaseModel.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -149,6 +178,7 @@
<path value="$PROJECT_DIR$/vendor/almasaeed2010/adminlte" />
<path value="$PROJECT_DIR$/vendor/laravel/ui" />
<path value="$PROJECT_DIR$/vendor/jeroennoten/laravel-adminlte" />
<path value="$PROJECT_DIR$/vendor/uxweb/sweet-alert" />
</include_path>
</component>
<component name="ProjectId" id="1iHELaEE2R6sN6qt7YfpUiOQiLb" />
......@@ -162,7 +192,7 @@
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/resources/views" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
......@@ -200,6 +230,7 @@
<workItem from="1601987693392" duration="7404000" />
<workItem from="1602077915136" duration="39000" />
<workItem from="1602077975731" duration="6077000" />
<workItem from="1602593962487" duration="5442000" />
</task>
<task id="LOCAL-00001" summary="Atualizacao final README.md">
<created>1601565098636</created>
......@@ -231,14 +262,14 @@
<option name="LAST_COMMIT_MESSAGE" value="Atualizacao final README.md" />
</component>
<component name="WindowStateProjectService">
<state x="698" y="302" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1602165591180">
<state x="698" y="302" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1602597455171">
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="698" y="302" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1602165591180" />
<state x="469" y="179" key="SettingsEditor" timestamp="1602164584994">
<state x="698" y="302" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1602597455171" />
<state x="469" y="179" key="SettingsEditor" timestamp="1602594072370">
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="469" y="179" key="SettingsEditor/0.0.1920.1080@0.0.1920.1080" timestamp="1602164584994" />
<state x="469" y="179" key="SettingsEditor/0.0.1920.1080@0.0.1920.1080" timestamp="1602594072370" />
<state x="560" y="280" key="Vcs.Push.Dialog.v2" timestamp="1601565102812">
<screen x="0" y="0" width="1920" height="1080" />
</state>
......
......@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Repositories\CategoriaRepository;
use App\Models\Categoria;
use App\Http\Requests\CategoriaRequest;
use UxWeb\SweetAlert\SweetAlert;
class CategoriaController extends Controller
{
......@@ -30,6 +31,7 @@ class CategoriaController extends Controller
$categorias = $this->categoriaRepository->create($request->all());
if($categorias) {
SweetAlert::info('Salvo com sucesso');
return redirect()->route('categoria.index');
}
......
......@@ -12,4 +12,5 @@ class Categoria extends BaseModel
public function produtos() {
return $this->hasMany('App\Models\Produto', 'categoria_id', 'id');
}
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
......@@ -83,7 +83,7 @@ return [
|
*/
'layout_topnav' => true,
'layout_topnav' => false,
'layout_boxed' => null,
'layout_fixed_sidebar' => null,
'layout_fixed_navbar' => null,
......@@ -328,11 +328,11 @@ return [
],
],
'Sweetalert2' => [
'active' => false,
'active' => true,
'files' => [
[
'type' => 'js',
'asset' => false,
'asset' => true,
'location' => '//cdn.jsdelivr.net/npm/sweetalert2@8',
],
],
......
......@@ -175,6 +175,7 @@ return [
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
UxWeb\SweetAlert\SweetAlertServiceProvider::class,
],
/*
......@@ -189,7 +190,6 @@ return [
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
......@@ -229,7 +229,6 @@ return [
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'Input' => Illuminate\Support\Facades\Input::class,
'Alert' => UxWeb\SweetAlert\SweetAlert::class,
],
];
......@@ -14,8 +14,8 @@ class CreateCategoriasTable extends Migration
public function up()
{
Schema::create('categorias', function (Blueprint $table) {
$table->id();
$table->uuid('id')->unique();
$table->string('nome', 60);
$table->longtext('descricao')->nullable();
$table->boolean('ativo')->default(1);
......
......@@ -9,10 +9,10 @@ class CreateProdutosTable extends Migration
public function up()
{
Schema::create('produtos', function (Blueprint $table) {
$table->id();
$table->uuid('id')->unique();
$table->string('nome', 60);
$table->integer('categoria_id')->unsigned();
$table->uuid('categoria_id');
$table->foreign('categoria_id')->references('id')->on('categorias');
$table->integer('quantidade');
......
......@@ -109,9 +109,5 @@ networks:
#Volumes
volumes:
dbdata:
driver: local
redis:
driver: local
postgres:
pgadmin:
......@@ -3454,6 +3454,12 @@
"is-symbol": "^1.0.2"
}
},
"es6-object-assign": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz",
"integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=",
"dev": true
},
"es6-templates": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/es6-templates/-/es6-templates-0.2.3.tgz",
......@@ -7183,6 +7189,12 @@
"integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=",
"dev": true
},
"promise-polyfill": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-6.1.0.tgz",
"integrity": "sha1-36lpQ+qcEh/KTem1hoyznTRy4Fc=",
"dev": true
},
"proxy-addr": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
......@@ -8604,6 +8616,16 @@
"util.promisify": "~1.0.0"
}
},
"sweetalert": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/sweetalert/-/sweetalert-2.1.2.tgz",
"integrity": "sha512-iWx7X4anRBNDa/a+AdTmvAzQtkN1+s4j/JJRWlHpYE8Qimkohs8/XnFcWeYHH2lMA8LRCa5tj2d244If3S/hzA==",
"dev": true,
"requires": {
"es6-object-assign": "^1.1.0",
"promise-polyfill": "^6.0.2"
}
},
"tapable": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz",
......
This diff is collapsed.
......@@ -6,6 +6,9 @@ window._ = require('lodash');
* code may be modified to fit the specific needs of your application.
*/
require("sweetalert");
try {
window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
......
......@@ -24,7 +24,7 @@
<td>{{$produto->quantidade}}</td>
<td>
<a class="btn btn-warning" href="/produto/edit/{{$produto->id}}">Edit</a>
<a class="btn btn-danger" href="/produto/delete/{{$produto->id}}">Delete</a>
<a class="btn btn-danger btnDelete" href="/produto/delete/{{$produto->id}}">Delete</a>
</td>
</tr>
@endforeach
......
......@@ -104,6 +104,38 @@
{{-- Custom Scripts --}}
@yield('adminlte_js')
<script>
$(document).on('click', '.btnDelete', function(event){
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'You will not be able to recover this imaginary file!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes, delete it!',
cancelButtonText: 'No, keep it'
}).then((result) => {
if (result.value) {
Swal.fire(
'Deleted!',
'Your imaginary file has been deleted.',
'success'
)
// For more information about handling dismissals please visit
// https://sweetalert2.github.io/#handling-dismissals
} else if (result.dismiss === Swal.DismissReason.cancel) {
Swal.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
})
//var button = $(this);
});
</script>
</body>
</html>
......@@ -7,7 +7,7 @@ Route::get('/', function () { return view('welcome'); });
Auth::routes();
Route::group(['middleware' => 'auth'], function() {
Route::group(['prefix' => 'categoria', 'middleware' => 'ehAdmin'], function () {
Route::group(['prefix' => 'categoria'], function () {
Route::get('/', 'CategoriaController@getIndex')->name('categoria.index');
Route::get('/create', 'CategoriaController@getCreate')->name('categoria.create');
Route::post('/create', 'CategoriaController@postCreate')->name('categoria.create');
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -3,8 +3,17 @@
namespace Uema;
use Illuminate\Database\Eloquent\Model;
use Ramsey\Uuid\Uuid;
class BaseModel extends Model
{
protected $keyType = 'string';
public static function boot() {
parent::boot();
static::creating(function ($model) {
$model->{$model->primaryKey} = Uuid::uuid4();
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment