diff --git a/app/Http/Controllers/ProfesionController.php b/app/Http/Controllers/ProfesionController.php new file mode 100644 index 0000000000000000000000000000000000000000..60f0675e929641043194de0d4a62ca9c2d5b4d59 --- /dev/null +++ b/app/Http/Controllers/ProfesionController.php @@ -0,0 +1,48 @@ +validate([ + 'nombre' => 'required|string|max:255', + 'abreviatura' => 'required|string|max:10', + ]); + + Profesion::create($validated); + + return redirect()->route('catalogos.profesion.get'); + } + + public function update(Request $request, $id) + { + $validated = $request->validate([ + 'nombre' => 'required|string|max:255', + 'abreviatura' => 'required|string|max:10', + ]); + + $profesion = Profesion::findOrFail($id); + $profesion->update($validated); + + return redirect()->route('catalogos.profesion.get'); + } + + public function destroy($id) + { + $profesion = Profesion::findOrFail($id); + $profesion->delete(); + + return redirect()->route('catalogos.profesion.get'); + } +} diff --git a/app/Http/Controllers/profesionController.php b/app/Http/Controllers/profesionController.php deleted file mode 100644 index b4cacfef56a2918de3de45a35ca5035e7bb1eba9..0000000000000000000000000000000000000000 --- a/app/Http/Controllers/profesionController.php +++ /dev/null @@ -1,10 +0,0 @@ -hasMany(User::class); + } +} diff --git a/app/Models/profesion.php b/app/Models/profesion.php deleted file mode 100644 index cfc60d424bb207ecb05b3b0907b9a7f3a83d8bb9..0000000000000000000000000000000000000000 --- a/app/Models/profesion.php +++ /dev/null @@ -1,11 +0,0 @@ -id(); - $table->string('profesion'); + $table->string('nombre'); $table->string('abreviatura'); $table->timestamps(); }); diff --git a/database/migrations/2024_06_03_183943_create_cargos_table.php b/database/migrations/2024_06_03_183943_create_cargos_table.php index a040eb2318ca231024a2ae82c27cd6c4a03dea54..7014a185d3f267b116b17f9ca8a07b8dd2abfd21 100644 --- a/database/migrations/2024_06_03_183943_create_cargos_table.php +++ b/database/migrations/2024_06_03_183943_create_cargos_table.php @@ -14,6 +14,7 @@ public function up(): void Schema::create('cargos', function (Blueprint $table) { $table->id(); $table->string('nombre'); + $table->timestamps(); }); } diff --git a/database/migrations/2024_06_03_184326_create_caracteristicas_table.php b/database/migrations/2024_06_03_184326_create_caracteristicas_table.php index 7eb0ce5ab5cbe5e8a1e1dc14bb441ab69bac1f4a..f1b57e27af80779e64f8e23fc5a8ea0324ebfb19 100644 --- a/database/migrations/2024_06_03_184326_create_caracteristicas_table.php +++ b/database/migrations/2024_06_03_184326_create_caracteristicas_table.php @@ -14,6 +14,7 @@ public function up(): void Schema::create('caracteristicas', function (Blueprint $table) { $table->id(); $table->string('nombre'); + $table->timestamps(); }); } diff --git a/database/migrations/2024_06_10_194301_add_updated_at_to_cargos_table.php b/database/migrations/2024_06_10_194301_add_updated_at_to_cargos_table.php deleted file mode 100644 index 568bc06ff09fe19d5c191642216364bfb85898ea..0000000000000000000000000000000000000000 --- a/database/migrations/2024_06_10_194301_add_updated_at_to_cargos_table.php +++ /dev/null @@ -1,32 +0,0 @@ -timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('cargos', function (Blueprint $table) { - $table->dropTimestamps(); - }); - } -} diff --git a/database/migrations/2024_06_12_202929_add_timestamps_to_caracteristicas_table.php b/database/migrations/2024_06_12_202929_add_timestamps_to_caracteristicas_table.php deleted file mode 100644 index bdeb1b326a8d33751f880673a2446d26b56ca190..0000000000000000000000000000000000000000 --- a/database/migrations/2024_06_12_202929_add_timestamps_to_caracteristicas_table.php +++ /dev/null @@ -1,23 +0,0 @@ -timestamps(); - }); - } - - public function down() - { - Schema::table('caracteristicas', function (Blueprint $table) { - $table->dropTimestamps(); - }); - } -} - diff --git a/resources/views/adminGen/catalagos/caracteristicas.blade.php b/resources/views/adminGen/catalagos/caracteristicas.blade.php index aea6bec27abbbce915871916a38b76d718f81c98..7e20327aa6fd120b18388c4947b37eedcde1da72 100644 --- a/resources/views/adminGen/catalagos/caracteristicas.blade.php +++ b/resources/views/adminGen/catalagos/caracteristicas.blade.php @@ -37,14 +37,15 @@
- - - - - - - - + + + + + + + + +
@@ -61,14 +62,15 @@
@@ -91,14 +93,15 @@
- - - - - - - - + + + + + + + + +
@@ -154,10 +157,10 @@ function editItem(id, nombre) { const modal = document.querySelector('#editModal'); const nombreInput = modal.querySelector('#nombreEditar'); - // Asigna el nombre actual del cargo al input del modal + // Asigna el nombre actual de la caracteristica al input del modal nombreInput.value = nombre; - // Agrega el ID del cargo al botón de guardar del modal + // Agrega el ID de la caracteristica al botón de guardar del modal const idInput = modal.querySelector('#idEditar'); idInput.value = id; diff --git a/resources/views/adminGen/catalagos/cargos.blade.php b/resources/views/adminGen/catalagos/cargos.blade.php index ed4ad79c4963a6f844ba16b54b3c79e4615d27c2..40f9e319928edf40c13404eff8e37299dd27f978 100644 --- a/resources/views/adminGen/catalagos/cargos.blade.php +++ b/resources/views/adminGen/catalagos/cargos.blade.php @@ -37,15 +37,11 @@
- - - - - - - - - + + + + +
@@ -62,14 +58,11 @@
@@ -92,14 +85,11 @@
- - - - - - - - + + + + +
diff --git a/resources/views/adminGen/catalagos/grupos.blade.php b/resources/views/adminGen/catalagos/grupos.blade.php index 2f4121ff812aeded22f244cf7caa93184cb04052..ed13ea581d933473dfec7f7f3adad12f1422ad42 100644 --- a/resources/views/adminGen/catalagos/grupos.blade.php +++ b/resources/views/adminGen/catalagos/grupos.blade.php @@ -37,14 +37,13 @@
- - - - - - - - + + + + + + +
@@ -61,21 +60,20 @@