<?php
use Modules\Laporan\Http\Controllers\LaporanController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::prefix('admin')->group(function(){
    Route::prefix('laporan')->name('laporan.')->middleware(['auth', 'checkRole:Superadmin'])->group(function() {
        Route::get('/', [LaporanController::class, 'index'])->name('index');
        Route::get('create', [LaporanController::class, 'create'])->name('create');
        Route::post('store', [LaporanController::class, 'store'])->name('store');
        Route::get('edit/{id}', [LaporanController::class, 'edit'])->name('edit');
        Route::post('update/{id}', [LaporanController::class, 'update'])->name('update');
        Route::delete('delete/{id}', [LaporanController::class, 'destroy'])->name('destroy');
        Route::post('datatable', [LaporanController::class, 'datatable'])->name('datatable');

        /* Report File */
        Route::post('store-file', [LaporanController::class, 'storeFile'])->name('storeFile');
        Route::post('get-report-file', [LaporanController::class, 'getReportFiles'])->name('getReportFiles');
        Route::post('delete-report-file', [LaporanController::class, 'deleteReportFile'])->name('deleteReportFile');

        /* Laporan Kategori */
        Route::post('datatable-laporan-kategori', [LaporanController::class, 'datatableLaporanKategori'])->name('datatableLaporanKategori');
        Route::get('kategori', [LaporanController::class, 'indexReportCategory'])->name('indexReportCategory');
        Route::get('create-laporan-kategori', [LaporanController::class, 'createReportCategory'])->name('createReportCategory');
        Route::post('store-laporan-kategori', [LaporanController::class, 'storeReportCategory'])->name('storeReportCategory');
        Route::get('edit-laporan-kategori/{id}', [LaporanController::class, 'editReportCategory'])->name('editReportCategory');
        Route::post('update-laporan-kategori/{id}', [LaporanController::class, 'updateReportCategory'])->name('updateReportCategory');
        Route::delete('delete-laporan-kategori/{id}', [LaporanController::class, 'destroyReportCategory'])->name('destroyReportCategory');
    });
});

