diff --git a/app/Exports/ChoferesExport.php b/app/Exports/ChoferesExport.php new file mode 100644 index 0000000..cb9f25a --- /dev/null +++ b/app/Exports/ChoferesExport.php @@ -0,0 +1,24 @@ +get(); + } + + public function headings(): array + { + return [ + 'ID', + 'Nombre', + 'Tipo de Licencia', + ]; + } +} diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index fc8a88c..c96f45f 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -37,4 +37,11 @@ class LoginController extends Controller $this->middleware('guest')->except('logout'); $this->middleware('auth')->only('logout'); } + + protected function authenticated($request, $user) + { + if ($user->email === 'usuarios@usuariosgmail.com') { + return redirect('/user-dashboard'); + } + } } diff --git a/app/Http/Controllers/ChoferController.php b/app/Http/Controllers/ChoferController.php new file mode 100644 index 0000000..94fd693 --- /dev/null +++ b/app/Http/Controllers/ChoferController.php @@ -0,0 +1,97 @@ + null]); + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request) + { + $request->validate([ + 'nombre' => 'required|string|max:255', + 'tipo_licencia' => 'required|string|max:255', + ]); + + Chofer::create($request->all()); + return redirect()->route('choferes.index')->with('success', 'Chofer creado exitosamente.'); + } + + /** + * Display the specified resource. + */ + public function show(Chofer $chofer) + { + // + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + $chofer = Chofer::findOrFail($id); + return view('choferesCrearEditar', compact('chofer')); + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, $id) + { + $request->validate([ + 'nombre' => 'required|string|max:255', + 'tipo_licencia' => 'required|string|max:255', + ]); + + $chofer = Chofer::findOrFail($id); + $chofer->update($request->all()); + return redirect()->route('choferes.index')->with('success', 'Chofer actualizado exitosamente.'); + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + $chofer = Chofer::findOrFail($id); + $chofer->delete(); + return redirect()->route('choferes.index')->with('success', 'Chofer eliminado exitosamente.'); + } + + public function exportExcel() + { + return \Maatwebsite\Excel\Facades\Excel::download(new \App\Exports\ChoferesExport, 'choferes.xlsx'); + } + + public function exportPDF() + { + $choferes = \App\Models\Chofer::all(); + $pdf = \PDF::loadView('exports.choferes-pdf', ['choferes' => $choferes]); + return $pdf->download('choferes.pdf'); + } +} diff --git a/app/Http/Controllers/PrestamoController.php b/app/Http/Controllers/PrestamoController.php index 5490623..c06ebbf 100644 --- a/app/Http/Controllers/PrestamoController.php +++ b/app/Http/Controllers/PrestamoController.php @@ -40,7 +40,13 @@ class PrestamoController extends Controller */ public function create() { - return view('prestamosCrearEditar', ['prestamo' => null]); // No se necesita pasar préstamos + $vehiculos = \App\Models\tiposVeiculos::where('status', true)->get(); + $choferes = \App\Models\Chofer::all(); + return view('prestamosCrearEditar', [ + 'prestamo' => null, + 'vehiculos' => $vehiculos, + 'choferes' => $choferes + ]); } /** @@ -48,16 +54,27 @@ class PrestamoController extends Controller */ public function store(Request $request) { + // Validación de datos + $request->validate([ + 'nombre_solicitante' => 'required|string|max:255', + 'chofer_id' => 'required|exists:choferes,id', + 'destino' => 'required|string|max:255', + 'fecha_hora_salida' => 'required|date', + 'fecha_hora_llegada' => 'required|date', + 'motivo' => 'required|string|max:255', + 'domicilio' => 'required|string|max:255', + 'numero_personas' => 'required|integer', + 'vehiculo_id' => 'required|exists:tipos_veiculos,id' + ]); + // Preparar los datos $datos = $request->all(); - $datos['chofer'] = $request->has('chofer') ? 1 : 0; // Convertir 'on' a 1, o ausencia a 0 + $datos['chofer'] = $request->has('chofer') ? 1 : 0; $prestamo = new Prestamo($datos); - $prestamo->estado = 'pendiente'; // Estado inicial + $prestamo->estado = 'pendiente'; $prestamo->save(); - // Aquí puedes agregar notificaciones para los administradores - return redirect()->route('prestamos.index') ->with('success', 'Préstamo solicitado correctamente. Esperando aprobación.'); } @@ -68,7 +85,13 @@ class PrestamoController extends Controller public function edit($id) { $prestamo = Prestamo::findOrFail($id); // Busca el préstamo por ID - return view('prestamosCrearEditar', ['prestamo' => $prestamo]); // Pasa el préstamo a la vista + $vehiculos = \App\Models\tiposVeiculos::where('status', true)->get(); + $choferes = \App\Models\Chofer::all(); + return view('prestamosCrearEditar', [ + 'prestamo' => $prestamo, + 'vehiculos' => $vehiculos, + 'choferes' => $choferes + ]); // Pasa el préstamo a la vista } /** diff --git a/app/Http/Controllers/SolicitudVehiculoController.php b/app/Http/Controllers/SolicitudVehiculoController.php new file mode 100644 index 0000000..0e0111b --- /dev/null +++ b/app/Http/Controllers/SolicitudVehiculoController.php @@ -0,0 +1,49 @@ +middleware(['auth', 'profesor']); + } + + public function index() + { + $solicitudes = SolicitudVehiculo::where('user_id', auth()->id())->get(); + return view('profesor.solicitudes.index', compact('solicitudes')); + } + + public function create() + { + return view('profesor.solicitudes.create'); + } + + public function store(Request $request) + { + $request->validate([ + 'fecha_solicitud' => 'required|date', + 'hora_salida' => 'required', + 'hora_regreso' => 'required', + 'destino' => 'required|string', + 'motivo' => 'required|string', + ]); + + $solicitud = new SolicitudVehiculo(); + $solicitud->user_id = auth()->id(); + $solicitud->fecha_solicitud = $request->fecha_solicitud; + $solicitud->hora_salida = $request->hora_salida; + $solicitud->hora_regreso = $request->hora_regreso; + $solicitud->destino = $request->destino; + $solicitud->motivo = $request->motivo; + $solicitud->estado = 'pendiente'; + $solicitud->save(); + + return redirect()->route('profesor.solicitudes.index') + ->with('success', 'Solicitud creada exitosamente'); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/TiposLicenciasController.php b/app/Http/Controllers/TiposLicenciasController.php index a117ab5..8a14ce6 100644 --- a/app/Http/Controllers/TiposLicenciasController.php +++ b/app/Http/Controllers/TiposLicenciasController.php @@ -59,17 +59,6 @@ class TiposLicenciasController extends Controller */ public function store(Request $request) { - // Verificar si ya existe un tipo de licencia con el mismo nombre - $existe = tiposLicencias::where('tipoLicencia', $request->tipoLicencia) - ->where('eliminado', 1) - ->exists(); - - if ($existe) { - return redirect()->route('tiposLicencias.create') - ->with('error', 'Ya existe un tipo de licencia con el nombre "' . $request->tipoLicencia . '". Por favor, ingrese un nombre diferente.') - ->withInput(); - } - $tipoLicencia = new TiposLicencias(); $tipoLicencia->tipoLicencia = $request->tipoLicencia; $tipoLicencia->eliminado = 1; @@ -92,18 +81,6 @@ class TiposLicenciasController extends Controller */ public function update(Request $request, $id) { - // Verificar si ya existe otro tipo de licencia con el mismo nombre - $existe = tiposLicencias::where('tipoLicencia', $request->tipoLicencia) - ->where('id', '!=', $id) - ->where('eliminado', 1) - ->exists(); - - if ($existe) { - return redirect()->route('tiposLicencias.edit', $id) - ->with('error', 'Ya existe un tipo de licencia con el nombre "' . $request->tipoLicencia . '". Por favor, ingrese un nombre diferente.') - ->withInput(); - } - $tipoLicencia = TiposLicencias::findOrFail($id); $tipoLicencia->tipoLicencia = $request->tipoLicencia; if ($request->has('eliminado')) { diff --git a/app/Http/Controllers/UserDashboardController.php b/app/Http/Controllers/UserDashboardController.php new file mode 100644 index 0000000..e3a307e --- /dev/null +++ b/app/Http/Controllers/UserDashboardController.php @@ -0,0 +1,23 @@ +middleware('auth'); + } + + public function index() + { + // Verificar si el usuario tiene el correo específico + if (auth()->user()->email !== 'usuarios@usuariosgmail.com') { + return redirect('/')->with('error', 'No tienes permiso para acceder a esta sección'); + } + + return view('user-dashboard.index'); + } +} diff --git a/app/Http/Controllers/usuariosController.php b/app/Http/Controllers/usuariosController.php index 3921194..fd3ccfd 100644 --- a/app/Http/Controllers/usuariosController.php +++ b/app/Http/Controllers/usuariosController.php @@ -106,6 +106,12 @@ class usuariosController extends Controller $usuario->departamento_id = $request->departamento_id; $usuario->telefono = $request->telefono; $usuario->password = bcrypt($request->password); + // Asignar rol si viene en la petición y el usuario autenticado es admin o servicios + if (auth()->user()->rol === 'admin' && $request->has('rol')) { + $usuario->rol = $request->rol; + } elseif (auth()->user()->rol === 'servicios') { + $usuario->rol = 'usuario'; // Solo puede crear usuarios normales + } $usuario->save(); return redirect()->route('usuarios')->with('success', 'Usuario creado exitosamente.'); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 4e233af..d3bda25 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -60,9 +60,14 @@ class Kernel extends HttpKernel 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, + 'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, 'signed' => \App\Http\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, + 'profesor' => \App\Http\Middleware\CheckProfesorRole::class, + 'admin' => \App\Http\Middleware\CheckAdminRole::class, + 'servicios' => \App\Http\Middleware\CheckServiciosRole::class, + 'adminOrServicios' => \App\Http\Middleware\AdminOrServiciosRole::class, ]; protected $routeMiddleware = [ diff --git a/app/Http/Middleware/AdminOrServiciosRole.php b/app/Http/Middleware/AdminOrServiciosRole.php new file mode 100644 index 0000000..87c506f --- /dev/null +++ b/app/Http/Middleware/AdminOrServiciosRole.php @@ -0,0 +1,23 @@ +check() || !in_array(auth()->user()->rol, ['admin', 'servicios'])) { + return redirect()->route('dashboard')->with('error', 'No tienes permisos para acceder a esta sección.'); + } + return $next($request); +} +} \ No newline at end of file diff --git a/app/Http/Middleware/CheckAdminRole.php b/app/Http/Middleware/CheckAdminRole.php new file mode 100644 index 0000000..97c5764 --- /dev/null +++ b/app/Http/Middleware/CheckAdminRole.php @@ -0,0 +1,20 @@ +check() || auth()->user()->rol !== 'admin') { + return redirect()->route('dashboard') + ->with('error', 'No tienes permisos de administrador para acceder a esta sección.'); + } + + return $next($request); + } +} diff --git a/app/Http/Middleware/CheckProfesorRole.php b/app/Http/Middleware/CheckProfesorRole.php new file mode 100644 index 0000000..27bb597 --- /dev/null +++ b/app/Http/Middleware/CheckProfesorRole.php @@ -0,0 +1,19 @@ +check() || auth()->user()->rol !== 'profesor') { + return redirect('/')->with('error', 'No tienes permiso para acceder a esta sección.'); + } + + return $next($request); + } +} \ No newline at end of file diff --git a/app/Http/Middleware/CheckServiciosRole.php b/app/Http/Middleware/CheckServiciosRole.php new file mode 100644 index 0000000..87757aa --- /dev/null +++ b/app/Http/Middleware/CheckServiciosRole.php @@ -0,0 +1,19 @@ +check() || auth()->user()->rol !== 'servicios') { + return redirect('/')->with('error', 'No tienes permisos de servicios para acceder a esta sección.'); + } + + return $next($request); + } +} diff --git a/app/Models/Chofer.php b/app/Models/Chofer.php new file mode 100644 index 0000000..c185392 --- /dev/null +++ b/app/Models/Chofer.php @@ -0,0 +1,18 @@ +belongsTo(User::class); + } +} \ No newline at end of file diff --git a/app/Models/User.php b/app/Models/User.php index eafb383..b5525f7 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -28,6 +28,7 @@ class User extends Authenticatable 'departamento_id', 'telefono', 'password', + 'rol', ]; diff --git a/app/Models/prestamo.php b/app/Models/prestamo.php index 8cfde19..8156025 100644 --- a/app/Models/prestamo.php +++ b/app/Models/prestamo.php @@ -20,6 +20,12 @@ protected $fillable = [ 'numero_personas', 'chofer', 'estado', - 'eliminado' + 'eliminado', + 'vehiculo_id' ]; + +public function vehiculo() +{ + return $this->belongsTo(\App\Models\tiposVeiculos::class, 'vehiculo_id'); +} } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 5522aa2..eaca45b 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -4,6 +4,7 @@ namespace App\Providers; // use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Gate; class AuthServiceProvider extends ServiceProvider { @@ -20,9 +21,11 @@ class AuthServiceProvider extends ServiceProvider * Register any authentication / authorization services. */ public function boot(): void - { - $this->registerPolicies(); +{ + $this->registerPolicies(); - // - } + Gate::define('gestionar-prestamos', function ($user) { + return in_array($user->rol, ['admin', 'servicios']); + }); +} } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 82450c6..ec9f421 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -3,6 +3,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; +use Illuminate\Support\Facades\DB; return new class extends Migration { @@ -18,72 +19,25 @@ return new class extends Migration $table->timestamp('email_verified_at')->nullable(); $table->string('apellido')->nullable(); $table->unsignedBigInteger('puesto_id')->nullable(); - $table->unsignedBigInteger('tipos_id')->nullable(); + $table->unsignedBigInteger('departamento_id')->nullable(); $table->string('telefono')->nullable(); $table->string('password'); + $table->string('rol')->default('profesor'); $table->rememberToken(); $table->timestamps(); $table->foreign('puesto_id')->references('id')->on('puestos'); - $table->foreign('tipos_id')->references('id')->on('tipos'); + $table->foreign('departamento_id')->references('id')->on('despartamentos'); }); - - DB::table('users')->insert([ - 'name' => 'silva', - 'email' => 'silva@silva.com', - 'apellido' => 'anael', - 'tipos_id' => 2, // Asegúrate que este ID corresponde a "Usuario" en la tabla tipos - 'puesto_id' => 2, // Asegúrate que este ID corresponde a "docente" en la tabla puestos - 'departamento_id' => 2, // Asegúrate que este ID corresponde a "wfaf" en la tabla despartamentos - 'telefono' => '33652147821', - 'password' => bcrypt('12345678'), - 'email_verified_at' => now(), - 'created_at' => now(), - 'updated_at' => now(), - ]); DB::table('users')->insert([ - 'name' => 'monse', - 'email' => 'monse@monse.com', - 'apellido' => 'martinez', - 'tipos_id' => 1, - 'puesto_id' => 1, - 'departamento_id' => 3, - 'telefono' => null, - 'password' => bcrypt('12345678'), - 'email_verified_at' => now(), - 'created_at' => now(), - 'updated_at' => now(), + 'name'=> 'Administrador', + 'email'=> 'admin@admin.com', + 'password'=> bcrypt('12345678'), + 'rol' => 'admin' ]); - DB::table('users')->insert([ - 'name' => 'usuario_tipo3', - 'email' => 'tipo3@ejemplo.com', - 'apellido' => 'apellido3', - 'tipos_id' => 3, // Tercer tipo restante - 'puesto_id' => 1, // Puedes ajustar el puesto según corresponda - 'departamento_id' => 1, // Puedes ajustar el departamento según corresponda - 'telefono' => '3333333333', - 'password' => bcrypt('12345678'), - 'email_verified_at' => now(), - 'created_at' => now(), - 'updated_at' => now(), - ]); - DB::table('users')->insert([ - 'name' => 'usuario_tipo4', - 'email' => 'tipo4@ejemplo.com', - 'apellido' => 'apellido4', - 'tipos_id' => 4, // Cuarto tipo restante - 'puesto_id' => 1, // Puedes ajustar el puesto según corresponda - 'departamento_id' => 1, // Puedes ajustar el departamento según corresponda - 'telefono' => '4444444444', - 'password' => bcrypt('12345678'), - 'email_verified_at' => now(), - 'created_at' => now(), - 'updated_at' => now(), - ]); - } /** diff --git a/database/migrations/2024_03_19_create_user_dashboard_user.php b/database/migrations/2024_03_19_create_user_dashboard_user.php new file mode 100644 index 0000000..96358b7 --- /dev/null +++ b/database/migrations/2024_03_19_create_user_dashboard_user.php @@ -0,0 +1,31 @@ +where('email', 'usuarios@usuariosgmail.com')->first(); + + if (!$user) { + DB::table('users')->insert([ + 'name' => 'Usuario Dashboard', + 'email' => 'usuarios@usuariosgmail.com', + 'password' => Hash::make('usuario123'), + 'created_at' => now(), + 'updated_at' => now(), + ]); + } + } + + public function down() + { + DB::table('users')->where('email', 'usuarios@usuariosgmail.com')->delete(); + } +}; diff --git a/database/migrations/2024_03_27_000000_create_solicitud_vehiculos_table.php b/database/migrations/2024_03_27_000000_create_solicitud_vehiculos_table.php new file mode 100644 index 0000000..dd48ec7 --- /dev/null +++ b/database/migrations/2024_03_27_000000_create_solicitud_vehiculos_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('user_id')->constrained()->onDelete('cascade'); + $table->date('fecha_solicitud'); + $table->time('hora_salida'); + $table->time('hora_regreso'); + $table->string('destino'); + $table->text('motivo'); + $table->enum('estado', ['pendiente', 'aprobada', 'rechazada'])->default('pendiente'); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('solicitud_vehiculos'); + } +}; \ No newline at end of file diff --git a/database/migrations/2025_03_27_174121_create_prestamos_table.php b/database/migrations/2025_03_27_174121_create_prestamos_table.php index 2ceb81f..3ae0b9b 100644 --- a/database/migrations/2025_03_27_174121_create_prestamos_table.php +++ b/database/migrations/2025_03_27_174121_create_prestamos_table.php @@ -21,6 +21,7 @@ return new class extends Migration $table->string('domicilio'); $table->integer('numero_personas'); $table->boolean('chofer')->default(false); // Opción de sí (true) o no (false) + $table->foreignId('vehiculo_id')->constrained('tipos_veiculos')->onDelete('cascade'); $table->timestamps(); }); } diff --git a/database/migrations/2025_03_28_182126_add_estado_to_prestamos_table.php b/database/migrations/2025_03_28_182126_add_estado_to_prestamos_table.php deleted file mode 100644 index af9986e..0000000 --- a/database/migrations/2025_03_28_182126_add_estado_to_prestamos_table.php +++ /dev/null @@ -1,28 +0,0 @@ -string('estado')->default('pendiente'); // pendiente, aceptado, rechazado - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::table('prestamos', function (Blueprint $table) { - $table->dropColumn('estado'); - }); - } -}; diff --git a/database/migrations/2025_04_01_191325_add_estado_to_prestamos_table.php b/database/migrations/2025_04_01_191325_add_estado_to_prestamos_table.php index c5d3a01..1384d82 100644 --- a/database/migrations/2025_04_01_191325_add_estado_to_prestamos_table.php +++ b/database/migrations/2025_04_01_191325_add_estado_to_prestamos_table.php @@ -9,21 +9,22 @@ return new class extends Migration /** * Run the migrations. */ - public function up(): void + public function up() { Schema::table('prestamos', function (Blueprint $table) { - // $table->enum('estado', ['pendiente', 'aceptado', 'rechazado'])->default('pendiente')->after('chofer'); - // Línea comentada porque la columna ya existe + $table->string('estado')->default('pendiente'); }); } /** * Reverse the migrations. */ - public function down(): void - { - Schema::table('prestamos', function (Blueprint $table) { + public function down() +{ + Schema::table('prestamos', function (Blueprint $table) { + if (Schema::hasColumn('prestamos', 'estado')) { $table->dropColumn('estado'); - }); + } + }); } }; diff --git a/database/migrations/2025_05_20_032155_add_columneliminado_topuestos.php b/database/migrations/2025_05_20_032155_add_columneliminado_topuestos.php deleted file mode 100644 index 84ac675..0000000 --- a/database/migrations/2025_05_20_032155_add_columneliminado_topuestos.php +++ /dev/null @@ -1,28 +0,0 @@ -boolean('eliminado')->default(false); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::table('puestos', function (Blueprint $table) { - $table->dropColumn('eliminado'); - }); - } -}; diff --git a/database/migrations/2025_03_28_175646_add_estado_to_prestamos_table.php b/database/migrations/2025_05_22_205902_create_chofers_table.php similarity index 53% rename from database/migrations/2025_03_28_175646_add_estado_to_prestamos_table.php rename to database/migrations/2025_05_22_205902_create_chofers_table.php index af9986e..e81227b 100644 --- a/database/migrations/2025_03_28_175646_add_estado_to_prestamos_table.php +++ b/database/migrations/2025_05_22_205902_create_chofers_table.php @@ -9,20 +9,21 @@ return new class extends Migration /** * Run the migrations. */ - public function up(): void - { - Schema::table('prestamos', function (Blueprint $table) { - // - }); - } + public function up() +{ + Schema::create('choferes', function (Blueprint $table) { + $table->id(); + $table->string('nombre'); + $table->string('tipo_licencia'); + $table->timestamps(); + }); +} /** * Reverse the migrations. */ public function down(): void { - Schema::table('prestamos', function (Blueprint $table) { - // - }); + Schema::dropIfExists('choferes'); } }; diff --git a/database/migrations/2025_05_22_212123_add_chofer_id_to_prestamos_table.php b/database/migrations/2025_05_22_212123_add_chofer_id_to_prestamos_table.php new file mode 100644 index 0000000..c7a6195 --- /dev/null +++ b/database/migrations/2025_05_22_212123_add_chofer_id_to_prestamos_table.php @@ -0,0 +1,25 @@ +foreignId('chofer_id')->nullable()->constrained('choferes')->onDelete('set null'); + }); +} +public function down() +{ + Schema::table('prestamos', function (Blueprint $table) { + $table->dropForeign(['chofer_id']); + $table->dropColumn('chofer_id'); + }); +} +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index a9f4519..7688ecf 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -18,5 +18,10 @@ class DatabaseSeeder extends Seeder // 'name' => 'Test User', // 'email' => 'test@example.com', // ]); + + $this->call([ + ProfesorSeeder::class, + ServiciosSeeder::class, + ]); } } diff --git a/database/seeders/ProfesorSeeder.php b/database/seeders/ProfesorSeeder.php new file mode 100644 index 0000000..e178ed1 --- /dev/null +++ b/database/seeders/ProfesorSeeder.php @@ -0,0 +1,22 @@ + 'Profesor', + 'email' => 'profesor@profesor.com', + 'password' => Hash::make('12345678'), + 'rol' => 'profesor', + 'apellido' => 'Ejemplo', + 'telefono' => '1234567890', + ]); + } +} \ No newline at end of file diff --git a/database/seeders/ServiciosSeeder.php b/database/seeders/ServiciosSeeder.php new file mode 100644 index 0000000..5e37876 --- /dev/null +++ b/database/seeders/ServiciosSeeder.php @@ -0,0 +1,24 @@ + 'jorge@jorge.com' ], + [ + 'name' => 'Jorge', + 'apellido' => 'Servicios', + 'telefono' => '1234567890', + 'password' => Hash::make('servicios123'), + 'rol' => 'servicios', + ] + ); + } +} diff --git a/public/css/user-dashboard.css b/public/css/user-dashboard.css new file mode 100644 index 0000000..7dbb1fa --- /dev/null +++ b/public/css/user-dashboard.css @@ -0,0 +1,85 @@ +body.user-dashboard-bg { + background: linear-gradient(120deg, #4158D0 0%, #5068c8 46%, #70e7ff 100%); + min-height: 100vh; +} + +.user-dashboard-header { + font-size: 2.2rem; + font-weight: 900; + color: #fff; + letter-spacing: 1px; + margin-top: 32px; + margin-left: 60px; + margin-bottom: 30px; + text-shadow: 0 2px 8px rgba(65,88,208,0.15); + text-align: left; +} + +.user-dashboard-card { + background: #fff; + border-radius: 24px; + box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15); + padding: 48px 32px; + max-width: 480px; + margin: 60px auto; + text-align: center; +} + +.user-dashboard-title { + font-size: 2.5rem; + font-weight: 800; + color: #2d3748; + margin-bottom: 18px; +} + +.user-dashboard-desc { + color: #6b7280; + font-size: 1.2rem; + margin-bottom: 32px; +} + +.user-dashboard-btn { + background: #4158D0; + color: #fff; + border: none; + border-radius: 8px; + padding: 14px 36px; + font-size: 1.1rem; + font-weight: 600; + box-shadow: 0 2px 8px rgba(65,88,208,0.15); + transition: background 0.2s; + cursor: pointer; +} +.user-dashboard-btn:hover { + background: #C850C0; + color: #fff; +} + +.user-dashboard-logout { + position: absolute; + top: 32px; + right: 60px; + z-index: 10; +} +.user-dashboard-logout-btn { + background: #e53e3e; + color: #fff; + border: none; + border-radius: 8px; + padding: 10px 22px; + font-size: 1rem; + font-weight: 600; + display: flex; + align-items: center; + gap: 8px; + box-shadow: 0 2px 8px rgba(229,62,62,0.15); + transition: background 0.2s; + cursor: pointer; +} +.user-dashboard-logout-btn:hover { + background: #c53030; + color: #fff; +} +.user-dashboard-logout-btn i { + font-size: 1.2rem; +} diff --git a/resources/views/choferes.blade.php b/resources/views/choferes.blade.php new file mode 100644 index 0000000..43b0e83 --- /dev/null +++ b/resources/views/choferes.blade.php @@ -0,0 +1,95 @@ +@extends('layouts.dashboard') + +@section('content') +
Fecha de generación: {{ date('d/m/Y H:i:s') }}
+ID | +Nombre | +Tipo de Licencia | +Fecha de Creación | +
---|---|---|---|
{{ $chofer->id }} | +{{ $chofer->nombre }} | +{{ $chofer->tipo_licencia }} | +{{ $chofer->created_at->format('d/m/Y') }} | +
{{ $message }}
+ @enderror +Fecha | +Hora Salida | +Hora Regreso | +Destino | +Estado | +
---|---|---|---|---|
{{ $solicitud->fecha_solicitud }} | +{{ $solicitud->hora_salida }} | +{{ $solicitud->hora_regreso }} | +{{ $solicitud->destino }} | ++ + {{ ucfirst($solicitud->estado) }} + + | +
ID | -Tipo de Licencia | -Estado | -Acciones | -
---|---|---|---|
{{ $tipoLicencia->id }} | -- - {{ $tipoLicencia->tipoLicencia }} - | -- @if($tipoLicencia->eliminado == 1) - - Activo - - @else - - Inactivo - - @endif - | -- - | -
Gasolina (salida) | +Vehículo | +Gasolina (regreso) | +Fecha salida | +Fecha regreso | +Motivo | +Acciones | +
---|
Gestiona tus préstamos de manera fácil y rápida
+ Ir a la siguiente sección +