From 180f0002eb4b0aeb27aa3bc7b4a35fe1db64a6e9 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 20:57:44 -0600 Subject: [PATCH 01/23] Controlador resource de los usuarios --- app/Http/Controllers/UserController.php | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 app/Http/Controllers/UserController.php diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php new file mode 100644 index 0000000..1d61788 --- /dev/null +++ b/app/Http/Controllers/UserController.php @@ -0,0 +1,66 @@ +get(); + return view('adminGen.usuarios.index', ['usuarios' => $usuarios]); + } + + /** + * Show the form for creating a new resource. + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + */ + public function show(string $id) + { + // + } + + /** + * Show the form for editing the specified resource. + */ + public function edit(string $id) + { + // + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, string $id) + { + // + } + + /** + * Remove the specified resource from storage. + */ + public function destroy(string $id) + { + // + } +} -- GitLab From 3660c24b32006e3884177f7575ea0f3d69f8f72d Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 20:58:03 -0600 Subject: [PATCH 02/23] Relacion inversa de uno a muchos en el modelo de usuarios --- app/Models/User.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Models/User.php b/app/Models/User.php index 5867318..3e26199 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -4,6 +4,7 @@ // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Fortify\TwoFactorAuthenticatable; @@ -66,4 +67,9 @@ protected function casts(): array 'password' => 'hashed', ]; } + + public function dependencia(): BelongsTo + { + return $this->belongsTo(Dependencia::class); + } } -- GitLab From d0a659e0ea1dee76b21a078faef8f5138ea9b1db Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 20:58:17 -0600 Subject: [PATCH 03/23] Vista principal de los usuarios --- .../views/adminGen/usuarios/index.blade.php | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 resources/views/adminGen/usuarios/index.blade.php diff --git a/resources/views/adminGen/usuarios/index.blade.php b/resources/views/adminGen/usuarios/index.blade.php new file mode 100644 index 0000000..bf48bb5 --- /dev/null +++ b/resources/views/adminGen/usuarios/index.blade.php @@ -0,0 +1,160 @@ + + + + + +
+
    +
  • + Dashboard +
  • +
  • + Administración +
  • +
  • + Usuarios +
  • +
+
+
+ +
+ + + + + + + + + +
IdNombreAcciones
+ +
+
+ + + + + +
\ No newline at end of file -- GitLab From 312c46e6963224c2031ae245bc8baa037bb0e4f4 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 20:58:32 -0600 Subject: [PATCH 04/23] Grupo de rutas para los usuarios --- routes/web.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routes/web.php b/routes/web.php index dd0beda..f6c2a5a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,6 +5,7 @@ use App\Http\Middleware\CheckBanned; //Controllers use App\Http\Controllers\DependenciaController; +use App\Http\Controllers\UserController; Route::get('/', function () { return view('welcome'); @@ -29,3 +30,7 @@ Route::delete('/catalogos/dependencias/{id}', [DependenciaController::class, 'destroy'])->name('dependencias.destroy'); }); +Route::name('usuarios.')->group(function () { + Route::get('/administracion/usuarios', [UserController::class, 'index'])->name('index'); +}); + -- GitLab From b9934c355bdc4d71cc84550add86debceefedda1 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 21:09:13 -0600 Subject: [PATCH 05/23] Funcion de eliminar usuarios --- app/Http/Controllers/UserController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 1d61788..c5d74d7 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -61,6 +61,12 @@ public function update(Request $request, string $id) */ public function destroy(string $id) { - // + try{ + $usuario = User::findOrFail($id); + $usuario->delete(); + return redirect()->route('usuarios.get')->with('success', 'Usuario eliminado correctamente.'); + }catch(\Exception $e){ + return redirect()->route('usuarios.get')->withErrors('Error al eliminar el usuario:' . $e->getMessage()); + } } } -- GitLab From eac1db1dc6904fc10bc3aab8f81486637cfafd4b Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 21:09:26 -0600 Subject: [PATCH 06/23] Ruta para eliminar usuarios --- routes/web.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index f6c2a5a..53feb84 100644 --- a/routes/web.php +++ b/routes/web.php @@ -31,6 +31,7 @@ }); Route::name('usuarios.')->group(function () { - Route::get('/administracion/usuarios', [UserController::class, 'index'])->name('index'); + Route::get('/administracion/usuarios', [UserController::class, 'index'])->name('get'); + Route::delete('/administracion/usuarios/{id}', [UserController::class, 'destroy'])->name('destroy'); }); -- GitLab From a7304770cd5759b98cf43fb5b07c00868a28e005 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 21:09:45 -0600 Subject: [PATCH 07/23] Cambio en la ruta para eliminar el usuario --- resources/views/adminGen/usuarios/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/adminGen/usuarios/index.blade.php b/resources/views/adminGen/usuarios/index.blade.php index bf48bb5..e02af3c 100644 --- a/resources/views/adminGen/usuarios/index.blade.php +++ b/resources/views/adminGen/usuarios/index.blade.php @@ -50,7 +50,7 @@ function renderActions(id, nombre) { return `
-
+ @csrf @method('DELETE') -- GitLab From 8e7d36ec5cf4ae2263ab23b9f446b3c878123459 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 23:53:51 -0600 Subject: [PATCH 08/23] Ruta de crear usuario --- routes/web.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routes/web.php b/routes/web.php index 53feb84..4a6ecaf 100644 --- a/routes/web.php +++ b/routes/web.php @@ -32,6 +32,8 @@ Route::name('usuarios.')->group(function () { Route::get('/administracion/usuarios', [UserController::class, 'index'])->name('get'); + Route::get('/administracion/usuarios/crear', [UserController::class, 'create'])->name('create'); + Route::post('/administracion/usuarios/crear', [UserController::class, 'store'])->name('store'); Route::delete('/administracion/usuarios/{id}', [UserController::class, 'destroy'])->name('destroy'); }); -- GitLab From 67f3d99f0c543d3947b74c56c1a48ad7cb5f587f Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 23:54:31 -0600 Subject: [PATCH 09/23] metodos para ver formulario de usuario y crear usuario --- app/Http/Controllers/UserController.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index c5d74d7..0b7d679 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -2,8 +2,11 @@ namespace App\Http\Controllers; +use App\Http\Requests\StoreUserRequest; +use App\Models\Dependencia; use App\Models\User; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Hash; class UserController extends Controller { @@ -21,15 +24,29 @@ public function index() */ public function create() { - // + $dependencias = Dependencia::get(); + return view('adminGen.usuarios.create', ['dependencias' => $dependencias]); } /** * Store a newly created resource in storage. */ - public function store(Request $request) + public function store(StoreUserRequest $request) { - // + //TODO Agregar Rol del usuario + $request->validated(); + $user = new User; + $user->name = $request->name; + $user->username = $request->username; + $user->password = Hash::make($request->password); + $user->dependencia_id = $request->dependencia_id; + if($request->active == "on"){ + $user->active = 1; + }else{ + $user->active = 0; + } + $user->save(); + return redirect()->route('usuarios.get')->with('success', 'Usuario creado correctamente.'); } /** -- GitLab From 457af72f5398bad58caca8911f7a7042899d4324 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 23:54:57 -0600 Subject: [PATCH 10/23] Validar request para crear el usuario --- app/Http/Requests/StoreUserRequest.php | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 app/Http/Requests/StoreUserRequest.php diff --git a/app/Http/Requests/StoreUserRequest.php b/app/Http/Requests/StoreUserRequest.php new file mode 100644 index 0000000..01cea2f --- /dev/null +++ b/app/Http/Requests/StoreUserRequest.php @@ -0,0 +1,31 @@ +|string> + */ + public function rules(): array + { + return [ + 'name' => 'required|regex:/\w*$/|string|min:1|max:255', + 'username' => 'required|string|regex:/\w*$/|max:255|unique:users,username', + 'password' => 'required|regex:/\w*$/|string|min:8|max:255|confirmed', + 'dependencia_id' => 'required|min:1|integer', + ]; + } +} -- GitLab From 929cd9286543bf86a690e3ac221be715eb5f4d96 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 23:55:19 -0600 Subject: [PATCH 11/23] Se agrego el campo dependencia_id al modelo del usuario --- app/Models/User.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Models/User.php b/app/Models/User.php index 3e26199..a02b9c0 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -32,6 +32,7 @@ class User extends Authenticatable 'username', 'active', 'password', + 'dependencia_id' ]; /** -- GitLab From 0405dfc294f09b6d9fc6d723062265557d693be6 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 23:55:54 -0600 Subject: [PATCH 12/23] Cambio de ruta para crear usuario y eliminar elementos obsoletos --- resources/views/adminGen/usuarios/index.blade.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/resources/views/adminGen/usuarios/index.blade.php b/resources/views/adminGen/usuarios/index.blade.php index e02af3c..a26e66d 100644 --- a/resources/views/adminGen/usuarios/index.blade.php +++ b/resources/views/adminGen/usuarios/index.blade.php @@ -17,23 +17,17 @@
- - - - - - - +
IdNombreAcciones
-- GitLab From 12d004d6b3c1fbf266f852ea1ecdab85cc807514 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Wed, 12 Jun 2024 23:56:06 -0600 Subject: [PATCH 13/23] Formulario de crear usuario --- .../views/adminGen/usuarios/create.blade.php | 189 ++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 resources/views/adminGen/usuarios/create.blade.php diff --git a/resources/views/adminGen/usuarios/create.blade.php b/resources/views/adminGen/usuarios/create.blade.php new file mode 100644 index 0000000..a9cd7ca --- /dev/null +++ b/resources/views/adminGen/usuarios/create.blade.php @@ -0,0 +1,189 @@ + + + + +
+ +
+
+
Crear nuevo usuario
+
+
+ + @csrf +
+
+ + +
+
+ +
+
+ @
+ +
+
+
+ + +
+
+ + +
+
+ +
+
+ ¿Activar usuario? + +
+
+ + +
+
+
+ + + + + + + +
\ No newline at end of file -- GitLab From 069cad153963e92c96cebfa998ce2e241809b46e Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Thu, 13 Jun 2024 08:25:33 -0600 Subject: [PATCH 14/23] Cambio de color del boton --- resources/views/adminGen/usuarios/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/adminGen/usuarios/index.blade.php b/resources/views/adminGen/usuarios/index.blade.php index a26e66d..f057f8b 100644 --- a/resources/views/adminGen/usuarios/index.blade.php +++ b/resources/views/adminGen/usuarios/index.blade.php @@ -17,7 +17,7 @@
- + -- GitLab From a722eff897295d59db21abd07c17da8f94ab6948 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Thu, 13 Jun 2024 10:13:41 -0600 Subject: [PATCH 15/23] =?UTF-8?q?Asignaci=C3=B3n=20de=20rol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/UserController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 0b7d679..5c0ab7d 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -7,6 +7,7 @@ use App\Models\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; +use Spatie\Permission\Models\Role; class UserController extends Controller { @@ -25,7 +26,8 @@ public function index() public function create() { $dependencias = Dependencia::get(); - return view('adminGen.usuarios.create', ['dependencias' => $dependencias]); + $roles = Role::get(); + return view('adminGen.usuarios.create', ['dependencias' => $dependencias, 'roles' => $roles]); } /** @@ -33,13 +35,13 @@ public function create() */ public function store(StoreUserRequest $request) { - //TODO Agregar Rol del usuario $request->validated(); $user = new User; $user->name = $request->name; $user->username = $request->username; $user->password = Hash::make($request->password); $user->dependencia_id = $request->dependencia_id; + $user->assignRole($request->role); if($request->active == "on"){ $user->active = 1; }else{ -- GitLab From a7b79fe6aa40293be1cbe54050d683eb5287236d Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Thu, 13 Jun 2024 10:14:18 -0600 Subject: [PATCH 16/23] Validacion del rol --- app/Http/Requests/StoreUserRequest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Requests/StoreUserRequest.php b/app/Http/Requests/StoreUserRequest.php index 01cea2f..d63927a 100644 --- a/app/Http/Requests/StoreUserRequest.php +++ b/app/Http/Requests/StoreUserRequest.php @@ -26,6 +26,7 @@ public function rules(): array 'username' => 'required|string|regex:/\w*$/|max:255|unique:users,username', 'password' => 'required|regex:/\w*$/|string|min:8|max:255|confirmed', 'dependencia_id' => 'required|min:1|integer', + 'role' => 'required|string|min:1' ]; } } -- GitLab From abf87a87d1e0cfbfb3297a96384163a3ff145e37 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Thu, 13 Jun 2024 10:14:42 -0600 Subject: [PATCH 17/23] Integracion de jQuery toast --- public/assets/css/jquery.toast.css | 133 +++++++ public/assets/images/toast/error_circle.png | Bin 0 -> 785 bytes .../assets/images/toast/icon_check_circle.png | Bin 0 -> 848 bytes public/assets/images/toast/infocircle.png | Bin 0 -> 835 bytes public/assets/images/toast/warning2.png | Bin 0 -> 706 bytes public/assets/js/jquery.toast.js | 359 ++++++++++++++++++ 6 files changed, 492 insertions(+) create mode 100644 public/assets/css/jquery.toast.css create mode 100644 public/assets/images/toast/error_circle.png create mode 100644 public/assets/images/toast/icon_check_circle.png create mode 100644 public/assets/images/toast/infocircle.png create mode 100644 public/assets/images/toast/warning2.png create mode 100644 public/assets/js/jquery.toast.js diff --git a/public/assets/css/jquery.toast.css b/public/assets/css/jquery.toast.css new file mode 100644 index 0000000..9a41bc2 --- /dev/null +++ b/public/assets/css/jquery.toast.css @@ -0,0 +1,133 @@ +/** + * jQuery toast plugin created by Kamran Ahmed copyright MIT license 2014 + */ +.jq-toast-wrap { + display: block; + position: fixed; + width: 250px; + pointer-events: none !important; + margin: 0; + padding: 0; + letter-spacing: normal; + z-index: 9000 !important; +} +.jq-toast-wrap * { + margin: 0; + padding: 0; +} + +.jq-toast-wrap.bottom-left { + bottom: 20px; + left: 20px; +} +.jq-toast-wrap.bottom-right { + bottom: 20px; + right: 40px; +} +.jq-toast-wrap.top-left { + top: 20px; + left: 20px; +} +.jq-toast-wrap.top-right { + top: 20px; + right: 80px; +} + +.jq-toast-single { + display: block; + width: 100%; + padding: 10px; + margin: 0px 0px 5px; + border-radius: 4px; + font-size: 13px; + font-family: arial, sans-serif; + line-height: 17px; + position: relative; + pointer-events: all !important; + background-color: #444444; + color: white; +} + +.jq-toast-single h2 { + font-family: arial, sans-serif; + font-size: 14px; + margin: 0px 0px 7px; + background: none; + + color: inherit; + line-height: inherit; + letter-spacing: normal; +} +.jq-toast-single a { + color: #eee; + text-decoration: none; + font-weight: bold; + border-bottom: 1px solid white; + padding-bottom: 3px; + font-size: 12px; +} + +.jq-toast-single ul { + margin: 0px 0px 0px 15px; + background: none; + padding:0px; +} +.jq-toast-single ul li { + list-style-type: disc !important; + line-height: 17px; + background: none; + margin: 0; + padding: 0; + letter-spacing: normal; +} + +.close-jq-toast-single { + position: absolute; + top: 3px; + right: 7px; + font-size: 14px; + cursor: pointer; +} + +.jq-toast-loader { + display: block; + position: absolute; + top: -2px; + height: 5px; + width: 0%; + left: 0; + border-radius: 5px; + background: #D1EDD6; +} +.jq-toast-loaded { + width: 100%; +} +.jq-has-icon { + padding: 10px 10px 10px 50px; + background-repeat: no-repeat; + background-position: 10px; +} +.jq-icon-info { + background-image: url(/assets/images/toast/infocircle.png); + background-color: #F1F7FA; + color: #d9edf7; + border-color: #bce8f1; +} +.jq-icon-warning { + background-image: url(/assets/images/toast/warning2.png); + background-color: #FAF0E4; + color: #fcf8e3; + border-color: #faebcc; +} +.jq-icon-error { + background-image: url(/assets/images/toast/error_circle.png); + background-color: #F8E2E1; + color: #676767; + border-color: #676767; +} +.jq-icon-success { + background-image: url(/assets/images/toast/icon_check_circle.png); + background-color: #F1FAF3; + color: #676767; + border-color: #F1FAF3; +} \ No newline at end of file diff --git a/public/assets/images/toast/error_circle.png b/public/assets/images/toast/error_circle.png new file mode 100644 index 0000000000000000000000000000000000000000..f5727de72e25cc01dcd97c0b40f1a3a172849ba4 GIT binary patch literal 785 zcmV+s1Md8ZP);280tNJwc3=He%-` zs_l8aH*wPZIY|`@sh{M(@tgO}oA);W{|RCnp@HjKPYTH)f+!<`r6&pq1z>-_dHHJ_ z9czh3u3Jh>bV#Z~pH_xg2nsq9;zse?_upB%WY&+{dd*1+IM5^rKB9ONMdIl}vnBZA zcOIjac1TM_Ni(=Pt)0QP7V$Ri74QcF*hJt(u{eL}c_FO9=%ZUw37*lM3KQQ&qPjT8 zT%0r^k$`UTqTPZmu>aW$=ust$0u-WAFpx>AvodpA$EGuhKx`D7t4aQRI6fq~qgDT& zU$oD8fxMNx^(%?k@w^&(^?3qhAWEc1a&FdtULbFuLeaQAdG}(8NExUdDfi+A>uTSCG4{JAG7RYIL21~V6i{pM3R1b7X_Y!SjLv5 zBplL}#hSVD%)mV-R-9=Dhf6Lq9O*jn-ZX(-ghh~2wbw(_i#j|2YzD`YvP000>X1^@s6#OZ}&00009a7bBm000Gv z000Gv0c~iV`Tzg`0drDELIAGL9O(c600d`2O+f$vv5yP@7(IY;0>};E1mJrr=!%`m z3v^l4Fus8>Foe{CZn|sgS65g4YJ@f7_UfreJ1VD%Yy`*>Ldt9qbO5mfWVOqgSKn9J zz^IM)gU|aKw95(yGtCkI_L0m83}!P>YKjL9prjiGwiKi~YvaSf!zHH!xF5#Y18#L;iG`+dSiEheZaUm;>Wb<8& zO3&}sL0kYH97LQ8wXtXFjBLf_YAb}T0HTTzgdw;{72H!|0Dwe@%OYh77m*T5xGUA4 zevXUFxxJx6xPs#VgheqxpY(DNNPtw*kuX7!J(~bXacia-g+yIBQtbzm-GY>#<(sC0 zSy_NK0WkK2rMVrb+iUnX^;+eYDW5aN1VFGsh#+Cu8KmDBTB!~iEy*%w&%G$ttq%R1 zcov7(W;E3@1)g>ahJ_UNvc=w8u*WV<4BOeYreKCA>FJUw0SvKK}mlVxsjCAQdGkqWV$f zYh{)pk_gUBb0lFfb2f;=60_Hecs~KEyh|6_%WOr0gu$d8$h%8TYsCO+4bsoMQfKQP a8~*@3ooUT?k&cT10000bq7tv zM8eD*&$)FtWK_Ta2N72A&gH#! zZ4Kp;cNt>~T|lhlR4}Y}d%KX;B5@Ptm)`M=#h)!!xYw#a9YF%@L$(|ic7dqEpDtcq zR$Du>|Ky@Sg(O5|cedBtkO8f&CqsTz>xaD|$FWKIyFyZ(mYH!K3+|3dpqZ6q8lA1R zJyK|kE5-HGa}(E%1J5x*blO|1)i`DKgOAU&(%R$WIGM&l?}U@2?2#&k2{N&W@`eti zw}4GZ0D^MlN|d?E>4kEF*x}fe>(CNwy3gZNR4)jyB3F`3YiDJ|D{@%4BFUvm<@WN; z*#q!=6TRzWNI|Eznkpj*a)zrs-&vR`NUV9}y>-`v{DUcvX13eGMcf8QLrJKMn z*CAq2Dmq6evjjOS5V-IO24P*^ zbOu6)ALaT{Zv*}k<2HpwLTrU&6Cz!RVwDfh_Uk{7mGn$)4JW~LanE#b1TXASZX6k} z(&a70olnAhS;6?sJF@BJu{^6g0%=FwI{K_~=mkbOX?u=ZqDg>VroifKuDwqr(quGzyfm_BS71MCD=+Cz0)0(C4Hb5Gvh4kOHoFCACr> zYeEMXzwN|r`>Dq*Aq;|r4OC=tag@TA!oeDWq5<&&)Z%43?OgHy;U^3`FzD4pPImwR N002ovPDHLkV1ntYd?^3` literal 0 HcmV?d00001 diff --git a/public/assets/images/toast/warning2.png b/public/assets/images/toast/warning2.png new file mode 100644 index 0000000000000000000000000000000000000000..4ab9a944d3a1f4cdf252b04c6172716b8a9f3649 GIT binary patch literal 706 zcmV;z0zLhSP)ksohD`lEh`|XX`kB_U{;U|NC;ui zaE^^duJ$AWA))?K;>;!U&zbq=cz}N(!Up=%J$SA`HbHw2YnLCfrq(hY_9`~%-~*f4 zah+ykO}V|I(;u0RV_^+h2%2K32#1RN$BO7BfeM!T@dkfGU(d=<#@(_W_sY%bdMQi2 zEV=1e#*z9&7rdC>t}}Qo<=8|a+u>dE0_c|MSVpFk?z1CVRtBII8!G7ju(w~5z2y1^ ze<~bx-DJE}Q-OyKT12?msa?IB`+GsYcWRgKHPC0OTHL>|wP_4bE>Ml6epwA^XQ+Z^ z`j`olD53Q+h}!pGU4KsM``~17EB!#aA<$t{Q_}vqz>^PxHVmYY5y(b9p}mo51P@9A zPg<0*!URER2~?Br!Hcy_1qKx!0qrfqlPo?`9f3+gwO2v4)YMXbUEs+pUBL#*fH+#R zE%HL~9SVxiCGa)<5%VbNQUNH43bBizvvSFZK`r=Dhb^U{Y`)gGauRk=uAI1jhF)!D9lnl~_;9;?4Z-#bW4cjR?sTDc oUc+9wf
', { + class : 'jq-toast-single' + }); + + // For the loader on top + _toastContent += ''; + + if ( this.options.allowToastClose ) { + _toastContent += '×'; + }; + + if ( this.options.text instanceof Array ) { + + if ( this.options.heading ) { + _toastContent +='

' + this.options.heading + '

'; + }; + + _toastContent += '
    '; + for (var i = 0; i < this.options.text.length; i++) { + _toastContent += '
  • ' + this.options.text[i] + '
  • '; + } + _toastContent += '
'; + + } else { + if ( this.options.heading ) { + _toastContent +='

' + this.options.heading + '

'; + }; + _toastContent += this.options.text; + } + + this._toastEl.html( _toastContent ); + + if ( this.options.bgColor !== false ) { + this._toastEl.css("background-color", this.options.bgColor); + }; + + if ( this.options.textColor !== false ) { + this._toastEl.css("color", this.options.textColor); + }; + + if ( this.options.textAlign ) { + this._toastEl.css('text-align', this.options.textAlign); + } + + if ( this.options.icon !== false ) { + this._toastEl.addClass('jq-has-icon'); + + if ( $.inArray(this.options.icon, this._defaultIcons) !== -1 ) { + this._toastEl.addClass('jq-icon-' + this.options.icon); + }; + }; + + if ( this.options.class !== false ){ + this._toastEl.addClass(this.options.class) + } + }, + + position: function () { + if ( ( typeof this.options.position === 'string' ) && ( $.inArray( this.options.position, this._positionClasses) !== -1 ) ) { + + if ( this.options.position === 'bottom-center' ) { + this._container.css({ + left: ( $(window).outerWidth() / 2 ) - this._container.outerWidth()/2, + bottom: 20 + }); + } else if ( this.options.position === 'top-center' ) { + this._container.css({ + left: ( $(window).outerWidth() / 2 ) - this._container.outerWidth()/2, + top: 20 + }); + } else if ( this.options.position === 'mid-center' ) { + this._container.css({ + left: ( $(window).outerWidth() / 2 ) - this._container.outerWidth()/2, + top: ( $(window).outerHeight() / 2 ) - this._container.outerHeight()/2 + }); + } else { + this._container.addClass( this.options.position ); + } + + } else if ( typeof this.options.position === 'object' ) { + this._container.css({ + top : this.options.position.top ? this.options.position.top : 'auto', + bottom : this.options.position.bottom ? this.options.position.bottom : 'auto', + left : this.options.position.left ? this.options.position.left : 'auto', + right : this.options.position.right ? this.options.position.right : 'auto' + }); + } else { + this._container.addClass( 'bottom-left' ); + } + }, + + bindToast: function () { + + var that = this; + + this._toastEl.on('afterShown', function () { + that.processLoader(); + }); + + this._toastEl.find('.close-jq-toast-single').on('click', function ( e ) { + + e.preventDefault(); + + if( that.options.showHideTransition === 'fade') { + that._toastEl.trigger('beforeHide'); + that._toastEl.fadeOut(function () { + that._toastEl.trigger('afterHidden'); + }); + } else if ( that.options.showHideTransition === 'slide' ) { + that._toastEl.trigger('beforeHide'); + that._toastEl.slideUp(function () { + that._toastEl.trigger('afterHidden'); + }); + } else { + that._toastEl.trigger('beforeHide'); + that._toastEl.hide(function () { + that._toastEl.trigger('afterHidden'); + }); + } + }); + + if ( typeof this.options.beforeShow == 'function' ) { + this._toastEl.on('beforeShow', function () { + that.options.beforeShow(); + }); + }; + + if ( typeof this.options.afterShown == 'function' ) { + this._toastEl.on('afterShown', function () { + that.options.afterShown(); + }); + }; + + if ( typeof this.options.beforeHide == 'function' ) { + this._toastEl.on('beforeHide', function () { + that.options.beforeHide(); + }); + }; + + if ( typeof this.options.afterHidden == 'function' ) { + this._toastEl.on('afterHidden', function () { + that.options.afterHidden(); + }); + }; + }, + + addToDom: function () { + + var _container = $('.jq-toast-wrap'); + + if ( _container.length === 0 ) { + + _container = $('
',{ + class: "jq-toast-wrap", + role: "alert", + "aria-live": "polite" + }); + + $('body').append( _container ); + + } else if ( !this.options.stack || isNaN( parseInt(this.options.stack, 10) ) ) { + _container.empty(); + } + + _container.find('.jq-toast-single:hidden').remove(); + + _container.append( this._toastEl ); + + if ( this.options.stack && !isNaN( parseInt( this.options.stack ), 10 ) ) { + + var _prevToastCount = _container.find('.jq-toast-single').length, + _extToastCount = _prevToastCount - this.options.stack; + + if ( _extToastCount > 0 ) { + $('.jq-toast-wrap').find('.jq-toast-single').slice(0, _extToastCount).remove(); + }; + + } + + this._container = _container; + }, + + canAutoHide: function () { + return ( this.options.hideAfter !== false ) && !isNaN( parseInt( this.options.hideAfter, 10 ) ); + }, + + processLoader: function () { + // Show the loader only, if auto-hide is on and loader is demanded + if (!this.canAutoHide() || this.options.loader === false) { + return false; + } + + var loader = this._toastEl.find('.jq-toast-loader'); + + // 400 is the default time that jquery uses for fade/slide + // Divide by 1000 for milliseconds to seconds conversion + var transitionTime = (this.options.hideAfter - 400) / 1000 + 's'; + var loaderBg = this.options.loaderBg; + + var style = loader.attr('style') || ''; + style = style.substring(0, style.indexOf('-webkit-transition')); // Remove the last transition definition + + style += '-webkit-transition: width ' + transitionTime + ' ease-in; \ + -o-transition: width ' + transitionTime + ' ease-in; \ + transition: width ' + transitionTime + ' ease-in; \ + background-color: ' + loaderBg + ';'; + + + loader.attr('style', style).addClass('jq-toast-loaded'); + }, + + animate: function () { + + var that = this; + + this._toastEl.hide(); + + this._toastEl.trigger('beforeShow'); + + if ( this.options.showHideTransition.toLowerCase() === 'fade' ) { + this._toastEl.fadeIn(function ( ){ + that._toastEl.trigger('afterShown'); + }); + } else if ( this.options.showHideTransition.toLowerCase() === 'slide' ) { + this._toastEl.slideDown(function ( ){ + that._toastEl.trigger('afterShown'); + }); + } else { + this._toastEl.show(function ( ){ + that._toastEl.trigger('afterShown'); + }); + } + + if (this.canAutoHide()) { + + var that = this; + + window.setTimeout(function(){ + + if ( that.options.showHideTransition.toLowerCase() === 'fade' ) { + that._toastEl.trigger('beforeHide'); + that._toastEl.fadeOut(function () { + that._toastEl.trigger('afterHidden'); + }); + } else if ( that.options.showHideTransition.toLowerCase() === 'slide' ) { + that._toastEl.trigger('beforeHide'); + that._toastEl.slideUp(function () { + that._toastEl.trigger('afterHidden'); + }); + } else { + that._toastEl.trigger('beforeHide'); + that._toastEl.hide(function () { + that._toastEl.trigger('afterHidden'); + }); + } + + }, this.options.hideAfter); + }; + }, + + reset: function ( resetWhat ) { + + if ( resetWhat === 'all' ) { + $('.jq-toast-wrap').remove(); + } else { + this._toastEl.remove(); + } + + }, + + update: function(options) { + this.prepareOptions(options, this.options); + this.setup(); + this.bindToast(); + } + }; + + $.toast = function(options) { + var toast = Object.create(Toast); + toast.init(options, this); + + return { + + reset: function ( what ) { + toast.reset( what ); + }, + + update: function( options ) { + toast.update( options ); + } + } + }; + + $.toast.options = { + text: '', + heading: '', + showHideTransition: 'fade', + allowToastClose: true, + hideAfter: 3000, + loader: true, + loaderBg: '#9EC600', + stack: 5, + position: 'bottom-left', + bgColor: false, + textColor: false, + textAlign: 'left', + icon: false, + beforeShow: function () {}, + afterShown: function () {}, + beforeHide: function () {}, + afterHidden: function () {} + }; + +})( jQuery, window, document ); -- GitLab From f9f1d4d0888e7de557e127d97ed8c8388fe70875 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Thu, 13 Jun 2024 10:15:14 -0600 Subject: [PATCH 18/23] =?UTF-8?q?Integraci=C3=B3n=20de=20jQuery=20Tosat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adminGen/catalogos/dependencias.blade.php | 64 +++-------- .../views/adminGen/usuarios/create.blade.php | 103 +++++++----------- .../views/adminGen/usuarios/index.blade.php | 70 ++++-------- 3 files changed, 74 insertions(+), 163 deletions(-) diff --git a/resources/views/adminGen/catalogos/dependencias.blade.php b/resources/views/adminGen/catalogos/dependencias.blade.php index 8892cf7..d3cb85f 100644 --- a/resources/views/adminGen/catalogos/dependencias.blade.php +++ b/resources/views/adminGen/catalogos/dependencias.blade.php @@ -213,63 +213,29 @@ function editItem(id, nombre) { })); }); - showMessage = (msg = 'Example notification text.', position = 'top-end', showCloseButton = true, closeButtonHtml = '', duration = 3000, type = 'success') => { - const toast = window.Swal.mixin({ - toast: true, - position: position || 'top-end', - showConfirmButton: false, - timer: duration, - showCloseButton: showCloseButton, - customClass: { - container: 'custom-swal-container', - popup: 'custom-swal-popup', - title: 'custom-swal-title', - } - }); - - // Define el color y el icono según el tipo de mensaje - let color; - let icon; - if (type === 'success') { - color = '#4caf50'; // Color verde para éxito - icon = 'success'; // Icono de éxito - } else if (type === 'error') { - color = '#f44336'; // Color rojo para error - icon = 'error'; // Icono de error - } - - // Aplica el estilo al mensaje - toast.fire({ - title: msg, + function showToast(message, heading, icon) { + $.toast({ + heading: heading, + text: message, + showHideTransition: 'slide', icon: icon, - showClass: { - popup: 'swal2-noanimation', - }, - hideClass: { - popup: '', - }, - customClass: { - title: 'swal2-title', - popup: 'swal2-popup', - icon: 'swal2-icon', - }, - timerProgressBar: true, - timerProgressBarColor: color, - timerProgressBarHeight: 3, - background: color, - iconColor: 'white', + position: 'top-right', + loader: false, + hideAfter: 10000, + allowToastClose: true, + textColor: '#676767', }); - }; + } document.addEventListener('DOMContentLoaded', function() { @if(session('success')) // Muestra el mensaje de éxito utilizando showMessage - showMessage("{{ session('success') }}", 'top-end', true, '', 3000, 'success'); + showToast("{{ session('success') }}", 'Exito.', 'success') @endif - @if($errors -> any()) - @foreach($errors -> all() as $error) - showMessage("{{$error}}", 'top-end', true, '', 3000, 'error'); + @if($errors->any()) + @foreach($errors->all() as $error) + showToast(`{{ $error }}`, 'Error.', 'error'); @endforeach @endif }); diff --git a/resources/views/adminGen/usuarios/create.blade.php b/resources/views/adminGen/usuarios/create.blade.php index a9cd7ca..76fd255 100644 --- a/resources/views/adminGen/usuarios/create.blade.php +++ b/resources/views/adminGen/usuarios/create.blade.php @@ -27,30 +27,42 @@
- +
@
- +
- +
- +
+
+
+
+ + +
+
- + +
¿Activar usuario? @@ -70,6 +82,9 @@ + + + diff --git a/resources/views/adminGen/usuarios/index.blade.php b/resources/views/adminGen/usuarios/index.blade.php index f057f8b..04bc94e 100644 --- a/resources/views/adminGen/usuarios/index.blade.php +++ b/resources/views/adminGen/usuarios/index.blade.php @@ -37,6 +37,10 @@ + + + + + + + + + + + + \ No newline at end of file -- GitLab From a5f250afb4e05edf8a858480f01b622a25236cd3 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Thu, 13 Jun 2024 12:42:04 -0600 Subject: [PATCH 22/23] Boton para editar el usuario --- resources/views/adminGen/usuarios/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/adminGen/usuarios/index.blade.php b/resources/views/adminGen/usuarios/index.blade.php index 04bc94e..b93f4be 100644 --- a/resources/views/adminGen/usuarios/index.blade.php +++ b/resources/views/adminGen/usuarios/index.blade.php @@ -53,7 +53,7 @@ function renderActions(id, nombre) { @method('DELETE') - + Editar
`; } -- GitLab From 15865af69ccb57d17bb7f5eb4af32d278cf8c636 Mon Sep 17 00:00:00 2001 From: Alfonso Rafael Solis Rangel Date: Thu, 13 Jun 2024 12:42:16 -0600 Subject: [PATCH 23/23] Rutar para la edicion del usuario --- routes/web.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routes/web.php b/routes/web.php index 4a6ecaf..b7735e7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -34,6 +34,8 @@ Route::get('/administracion/usuarios', [UserController::class, 'index'])->name('get'); Route::get('/administracion/usuarios/crear', [UserController::class, 'create'])->name('create'); Route::post('/administracion/usuarios/crear', [UserController::class, 'store'])->name('store'); + Route::get('/administracion/usuarios/{id}/editar', [UserController::class, 'edit'])->name('edit'); + Route::put('/administracion/usuarios/{id}/editar', [UserController::class, 'update'])->name('update'); Route::delete('/administracion/usuarios/{id}', [UserController::class, 'destroy'])->name('destroy'); }); -- GitLab