<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/', function () {
    return view('auth.login');
});

Auth::routes();

Route::resource('bienes', App\Http\Controllers\BieneController::class)->middleware('auth');
Route::resource('categorias', App\Http\Controllers\CategoriaController::class)->middleware('auth');
Route::resource('empleados', App\Http\Controllers\EmpleadoController::class)->middleware('auth');
Route::resource('centro-trabajos', App\Http\Controllers\CentroTrabajoController::class)->middleware('auth');
Route::resource('dependencias', App\Http\Controllers\DependenciaController::class)->middleware('auth');
Route::resource('proveedores', App\Http\Controllers\ProveedoreController::class)->middleware('auth');
Route::resource('facturas', App\Http\Controllers\FacturaController::class)->middleware('auth');
// Route::resource('empleados', App\Http\Controllers\EmpleadoController::class);
Route::get('/empleados/{id}/pdf', [App\Http\Controllers\EmpleadoController::class, 'generarPDF'])->name('empleados.pdf');
Route::get('/bien/{id}/pdf',  [App\Http\Controllers\EmpleadoController::class, 'generarPDFBienIndividual'])->name('bien.generarPDF');
// Route::get('/bien/{id}/pdf', [App\Http\Controllers\EmpleadoController::class, 'generarPDFBienIndividual'])->name('bien.generarPDF');
Route::get('/bienes/{id}/etiqueta', [App\Http\Controllers\BieneController::class, 'generarEtiqueta'])->name('bienes.etiqueta');
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
// Route::post('/bienes/{id}/asignar', [App\Http\Controllers\BieneController::class, 'asignarBien'])->name('bienes.asignar.store');
Route::get('/bienes/{id}/asignar', [App\Http\Controllers\BieneController::class, 'mostrarAsignacion'])->name('bienes.asignar');
Route::get('/bienes/disponibles', [App\Http\Controllers\BieneController::class, 'disponibles'])->name('biene.disponible');
Route::get('/bienes/{id}/asignar', [App\Http\Controllers\BieneController::class, 'mostrarAsignacion'])->name('bienes.asignacion.mostrar');
Route::post('/bienes/{bienId}/asignar', [App\Http\Controllers\BieneController::class, 'asignarBien'])->name('bienes.asignar');
Route::get('/disponibles', [App\Http\Controllers\BieneController::class, 'showAvailableItems'])->name('disponible');
Route::get('/bienes/disponibles', [App\Http\Controllers\BieneController::class, 'showAvailableItems'])->name('bienes.disponibles');
Route::post('/bienes/{id}/asignar', [App\Http\Controllers\BieneController::class, 'asignarBien'])->name('bienes.asignar.submit');

Route::post('/bienes/{bienId}/transferir', [App\Http\Controllers\BieneController::class, 'transferirBien'])->name('bienes.transferir');

Route::post('/bienes/{id}/duplicate', [App\Http\Controllers\BieneController::class, 'duplicate'])->name('bienes.duplicate');

Route::get('/bienes/buscar', [App\Http\Controllers\BieneController::class, 'buscarBienes'])->name('bienes.buscar');

Route::get('/export-excel',  [App\Http\Controllers\BieneController::class, 'exportExcel'])->name('export.excel');
Route::get('centroTrabajo/{id}',  [App\Http\Controllers\CentroTrabajoController::class, 'show'])->name('centroTrabajo.show');

Route::get('/register', [App\Http\Controllers\Auth\RegisterController::class, 'showRegistrationForm'])->name('register');
Route::middleware(['auth'])->group(function () {
    Route::get('/users', [App\Http\Controllers\UserController::class, 'index'])->name('users.index');
    Route::get('/users/{user}/edit', [App\Http\Controllers\UserController::class, 'edit'])->name('users.edit');
    Route::put('/users/{user}', [App\Http\Controllers\UserController::class, 'update'])->name('users.update');
});
Route::put('/users/{user}/change-password', [App\Http\Controllers\UserController::class, 'changePassword'])->name('users.change-password');