<?php

use App\Http\Controllers\MaintenanceUnitController;
use App\Http\Controllers\MasterUnitController;
use App\Http\Controllers\ProjectController;
use App\Models\MaintenanceDoc;
use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('dashboard');
});

// ROUTE PROJECT
Route::get('/project', [ProjectController::class, 'index']);
Route::resource('/project/project_form', ProjectController::class);
Route::post('/project/project_form/store', [ProjectController::class, 'store'])->name('project.store');
Route::get('/project/project_from/{project_code}', [ProjectController::class, 'show']);
Route::put('/project/project_form/update/{project_code}', [ProjectController::class, 'update'])->name('project.update');
Route::delete('/project/{project_code}', [ProjectController::class, 'destroy']);

// ROUTE MASTER UNIT
Route::get('/unit/master_unit', [MasterUnitController::class, 'index']);
Route::resource('/unit/master_unit', MasterUnitController::class);
Route::post('/unit/master_unit/unit_form/store', [MasterUnitController::class, 'store'])->name('master_unit.store');
Route::get('/unit/master_unit/unit_form/{unit_code}', [MasterUnitController::class, 'show']);
Route::put('/unit/master_unit/unit_form/update/{unit_code}', [MasterUnitController::class, 'update'])->name('master_unit.update');
Route::delete('/unit/master_unit/{unit_code}', [MasterUnitController::class, 'destroy']);

// ROUTE MAINTENANCE UNIT
Route::get('/unit/maintenance', [MaintenanceUnitController::class, 'index']);
Route::get('/unit/maintenance_list/{unit_code}', [MaintenanceUnitController::class, 'maintenanceList']);
Route::get('/unit/maintenance_list/{unit_code}/maintenance_form', [MaintenanceUnitController::class, 'create']);
Route::post('unit/maintenance_list/maintenance_form/store', [MaintenanceUnitController::class, 'store'])->name('maintenance.store');
Route::get('/unit/maintenance_list/maintenance_form/{mnt_code}', [MaintenanceUnitController::class, 'show']);
Route::delete('unit/maintenance_list/{mnt_code}', [MaintenanceUnitController::class, 'destroyMnt']);
Route::delete('unit/maintenance_list/maintenance_detail/{upl_num}', [MaintenanceUnitController::class, 'destroyDoc']);
Route::put('/unit/maintenance_list/maintenance_form/update/{mnt_code}', [MaintenanceUnitController::class, 'update'])->name('maintenance.update');