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 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
Crear nueva caracteristica
@@ -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 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
Crear nuevo cargo
@@ -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 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
Crear nuevo grupo
-
Crear nueva caracteristica
+
Crear nuevo grupo
@@ -91,14 +89,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -154,10 +151,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 del grupo al input del modal
nombreInput.value = nombre;
- // Agrega el ID del cargo al botón de guardar del modal
+ // Agrega el ID del grupo al botón de guardar del modal
const idInput = modal.querySelector('#idEditar');
idInput.value = id;
diff --git a/resources/views/adminGen/catalagos/profesion.blade.php b/resources/views/adminGen/catalagos/profesion.blade.php
new file mode 100644
index 0000000000000000000000000000000000000000..15756f465f7421ba5ec5a6aa1c84a961a5ba7dc9
--- /dev/null
+++ b/resources/views/adminGen/catalagos/profesion.blade.php
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+ Dashboard
+
+
+ Catálogos
+
+
+ Profesiones
+
+
+
+
+
+
+
+
+
+
+
+ Crear nueva profesion
+
+
+
+
+
+
+ Crear una nueva profesion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Id
+ Nombre
+ Abreviatura
+ Acciones
+
+
+
+ @foreach($profesiones as $profesion)
+
+ {{ $profesion->id }}
+ {{ $profesion->nombre }}
+ {{ $profesion->abreviatura }}
+
+
+
+ id }}, '{{ $profesion->nombre }}', '{{ $profesion->abreviatura }}')">Editar
+
+
+
+ @endforeach
+
+
+
+
+
+
+
+
+ Editar profesión
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index edaef8356678ebfeb84d9859fdaa178a13886737..739b131cf57bf1cadd8e8e6b19435017b2138446 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -4,13 +4,15 @@
//Middlewares
use App\Http\Middleware\CheckBanned;
//Controllers
+use App\Http\Controllers\DependenciaController;
use App\Http\Controllers\CargoController;
+use App\Http\Controllers\ProfesionController;
use App\Http\Controllers\CaracteristicasController;
-use App\Http\Controllers\DependenciaController;
use App\Http\Controllers\GruposController;
use App\Http\Controllers\SubgrupoController;
use App\Http\Controllers\UserController;
+
Route::get('/', function () {
return view('welcome');
});
@@ -27,11 +29,16 @@
});
Route::prefix('catalogos')->name('catalogos.')->group(function () {
- Route::get('/cargos', [CargoController::class, 'index'])->name('cargos.get');
- Route::post('/cargos', [CargoController::class, 'store'])->name('cargos.store');
- Route::put('/cargos', [CargoController::class, 'update'])->name('cargos.update');
+ Route::get('/cargos', [CargoController::class, 'index'])->name('cargos.get');
+ Route::post('/cargos', [CargoController::class, 'store'])->name('cargos.store');
+ Route::put('/cargos', [CargoController::class, 'update'])->name('cargos.update');
Route::delete('/cargos/{id}', [CargoController::class, 'destroy'])->name('cargos.destroy');
+ Route::get('/profesion', [ProfesionController::class, 'index'])->name('profesion.get');
+ Route::post('/profesion', [ProfesionController::class, 'store'])->name('profesion.store');
+ Route::put('/profesion/{id}', [ProfesionController::class, 'update'])->name('profesion.update');
+ Route::delete('/profesion/{id}', [ProfesionController::class, 'destroy'])->name('profesion.destroy');
+
Route::get('/caracteristicas', [CaracteristicasController::class, 'index'])->name('caracteristicas.get');
Route::post('/caracteristicas', [CaracteristicasController::class, 'store'])->name('caracteristicas.store');
Route::put('/caracteristicas', [CaracteristicasController::class, 'update'])->name('caracteristicas.update');