<?php

    use Illuminate\Support\Facades\Route;
    use Modules\Lpj\Http\Controllers\ActivityController;
    use Modules\Lpj\Http\Controllers\ArahMataAnginController;
    use Modules\Lpj\Http\Controllers\BankDataController;
    use Modules\Lpj\Http\Controllers\BucokController;
    use Modules\Lpj\Http\Controllers\CategoryDaftarPustakaController;
    use Modules\Lpj\Http\Controllers\CustomFieldController;
    use Modules\Lpj\Http\Controllers\DaftarPustakaController;
    use Modules\Lpj\Http\Controllers\DebitureController;
    use Modules\Lpj\Http\Controllers\DokumenJaminanController;
    use Modules\Lpj\Http\Controllers\HubunganPemilikJaminanController;
    use Modules\Lpj\Http\Controllers\HubunganPenghuniJaminanController;
    use Modules\Lpj\Http\Controllers\IjinUsahaController;
    use Modules\Lpj\Http\Controllers\JenisDokumenController;
    use Modules\Lpj\Http\Controllers\JenisFasilitasKreditController;
    use Modules\Lpj\Http\Controllers\JenisJaminanController;
    use Modules\Lpj\Http\Controllers\JenisLampiranController;
    use Modules\Lpj\Http\Controllers\JenisLaporanController;
    use Modules\Lpj\Http\Controllers\JenisLegalitasJaminanController;
    use Modules\Lpj\Http\Controllers\JenisPenilaianController;
    use Modules\Lpj\Http\Controllers\KJPPController;
    use Modules\Lpj\Http\Controllers\LampiranDokumenController;
    use Modules\Lpj\Http\Controllers\LaporanAdminKreditController;
    use Modules\Lpj\Http\Controllers\LaporanBiayaInternalExternalController;
    use Modules\Lpj\Http\Controllers\LaporanController;
    use Modules\Lpj\Http\Controllers\LaporanDebitureController;
    use Modules\Lpj\Http\Controllers\LaporanExternalController;
    use Modules\Lpj\Http\Controllers\LaporanHasilPenilaianJaminanInternalExternalController;
    use Modules\Lpj\Http\Controllers\LaporanMonitoringSoController;
    use Modules\Lpj\Http\Controllers\LaporanPembatalanController;
    use Modules\Lpj\Http\Controllers\LaporanPenilaiJaminanController;
    use Modules\Lpj\Http\Controllers\LaporanPenilaianJaminanController;
    use Modules\Lpj\Http\Controllers\LaporanPermohonanController;
    use Modules\Lpj\Http\Controllers\LaporanSLAPenilaiController;
    use Modules\Lpj\Http\Controllers\LaporanSlikController;
    use Modules\Lpj\Http\Controllers\LaporanUserController;
    use Modules\Lpj\Http\Controllers\MemoController;
    use Modules\Lpj\Http\Controllers\NilaiPlafondController;
    use Modules\Lpj\Http\Controllers\NocController;
    use Modules\Lpj\Http\Controllers\PembatalanController;
    use Modules\Lpj\Http\Controllers\PemilikJaminanController;
    use Modules\Lpj\Http\Controllers\PenilaiController;
    use Modules\Lpj\Http\Controllers\PenilaianController;
    use Modules\Lpj\Http\Controllers\PermohonanController;
    use Modules\Lpj\Http\Controllers\PersetujuanPenawaranController;
    use Modules\Lpj\Http\Controllers\RekapHarianSoController;
    use Modules\Lpj\Http\Controllers\RegionController;
    use Modules\Lpj\Http\Controllers\ResumeController;
    use Modules\Lpj\Http\Controllers\SLAController;
    use Modules\Lpj\Http\Controllers\SlikController;
    use Modules\Lpj\Http\Controllers\StatusPermohonanController;
    use Modules\Lpj\Http\Controllers\SurveyorController;
    use Modules\Lpj\Http\Controllers\TeamsController;
    use Modules\Lpj\Http\Controllers\TenderController;
    use Modules\Lpj\Http\Controllers\TujuanPenilaianController;
    use Modules\Lpj\Http\Controllers\TujuanPenilaianKJPPController;

    /*
    |--------------------------------------------------------------------------
    | 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::middleware(['auth'])->group(function () {
        Route::get('api/check-penawaran/{nomor_registrasi}', [TenderController::class, 'checkPenawaranExistence']);

        Route::name('basicdata.')->prefix('basic-data')->group(function () {

            Route::name('jenis-lampiran.')->prefix('jenis-lampiran')->group(function () {
                Route::get('datatables', [JenisLampiranController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [JenisLampiranController::class, 'export'])->name('export');
            });
            Route::resource('jenis-lampiran', JenisLampiranController::class);

            Route::name('custom-field.')->prefix('custom-field')->group(function () {
                Route::get('restore/{id}', [CustomFieldController::class, 'restore'])->name('restore');
                Route::get('datatables', [CustomFieldController::class, 'dataForDatatables'])->name(
                    'datatables',
                );
                Route::get('export', [CustomFieldController::class, 'export'])->name('export');
            });
            Route::resource('custom-field', CustomFieldController::class);

            Route::name('jenis-fasilitas-kredit.')->prefix('jenis-fasilitas-kredit')->group(function () {
                Route::get('restore/{id}', [JenisFasilitasKreditController::class, 'restore'])->name('restore');
                Route::get('datatables', [JenisFasilitasKreditController::class, 'dataForDatatables'])->name(
                    'datatables',
                );
                Route::get('export', [JenisFasilitasKreditController::class, 'export'])->name('export');
            });
            Route::resource('jenis-fasilitas-kredit', JenisFasilitasKreditController::class);

            Route::name('jenis-legalitas-jaminan.')->prefix('jenis-legalitas-jaminan')->group(function () {
                Route::get('restore/{id}', [JenisLegalitasJaminanController::class, 'restore'])->name('restore');
                Route::get('datatables', [JenisLegalitasJaminanController::class, 'dataForDatatables'])->name(
                    'datatables',
                );
                Route::get('export', [JenisLegalitasJaminanController::class, 'export'])->name('export');
            });
            Route::resource('jenis-legalitas-jaminan', JenisLegalitasJaminanController::class);

            Route::name('jenis-jaminan.')->prefix('jenis-jaminan')->group(function () {
                Route::get('custom-fields/{id}', [JenisLegalitasJaminanController::class, 'getCustomFields'])->name('ustom-fields');
                Route::get('legalitas/{id}/{jenisJaminanId}', [DokumenJaminanController::class, 'getLegalitasJaminan'])
                    ->name('legalitas');
                Route::get('restore/{id}', [JenisJaminanController::class, 'restore'])->name('restore');
                Route::get('datatables', [JenisJaminanController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [JenisJaminanController::class, 'export'])->name('export');
            });
            Route::resource('jenis-jaminan', JenisJaminanController::class);

            Route::name('tujuan-penilaian.')->prefix('tujuan-penilaian')->group(function () {
                Route::get('restore/{id}', [TujuanPenilaianController::class, 'restore'])->name('restore');
                Route::get('datatables', [TujuanPenilaianController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [TujuanPenilaianController::class, 'export'])->name('export');
            });
            Route::resource('tujuan-penilaian', TujuanPenilaianController::class);

            Route::name('tujuan_penilaian_kjpp.')->prefix('tujuan_penilaian_kjpp')->group(function () {
                Route::get('datatables', [TujuanPenilaianKJPPController::class, 'dataForDatatables'])->name(
                    'datatables',
                );
                Route::get('export', [TujuanPenilaianKJPPController::class, 'export'])->name('export');
            });
            Route::resource('tujuan_penilaian_kjpp', TujuanPenilaianKJPPController::class);

            Route::name('jenis-dokumen.')->prefix('jenis-dokumen')->group(function () {
                Route::get('restore/{id}', [JenisDokumenController::class, 'restore'])->name('restore');
                Route::get('datatables', [JenisDokumenController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [JenisDokumenController::class, 'export'])->name('export');
            });
            Route::resource('jenis-dokumen', JenisDokumenController::class);


            Route::name('nilai-plafond.')->prefix('nilai-plafond')->group(function () {
                Route::get('restore/{id}', [NilaiPlafondController::class, 'restore'])->name('restore');
                Route::get('datatables', [NilaiPlafondController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [NilaiPlafondController::class, 'export'])->name('export');
            });
            Route::resource('nilai-plafond', NilaiPlafondController::class);

            Route::name('hubungan-pemilik-jaminan.')->prefix('hubungan-pemilik-jaminan')->group(function () {
                Route::get('restore/{id}', [HubunganPemilikJaminanController::class, 'restore'])->name('restore');
                Route::get('datatables', [HubunganPemilikJaminanController::class, 'dataForDatatables'])->name(
                    'datatables',
                );
                Route::get('export', [HubunganPemilikJaminanController::class, 'export'])->name('export');
            });
            Route::resource('hubungan-pemilik-jaminan', HubunganPemilikJaminanController::class);

            Route::name('hubungan-penghuni-jaminan.')->prefix('hubungan-penghuni-jaminan')->group(function () {
                Route::get('restore/{id}', [HubunganPenghuniJaminanController::class, 'restore'])->name('restore');
                Route::get('datatables', [HubunganPenghuniJaminanController::class, 'dataForDatatables'])->name(
                    'datatables',
                );
                Route::get('export', [HubunganPenghuniJaminanController::class, 'export'])->name('export');
            });
            Route::resource('hubungan-penghuni-jaminan', HubunganPenghuniJaminanController::class);

            Route::name('arah-mata-angin.')->prefix('arah-mata-angin')->group(function () {
                Route::get('restore/{id}', [ArahMataAnginController::class, 'restore'])->name('restore');
                Route::get('datatables', [ArahMataAnginController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [ArahMataAnginController::class, 'export'])->name('export');
            });
            Route::resource('arah-mata-angin', ArahMataAnginController::class);


            Route::name('status-permohonan.')->prefix('status-permohonan')->group(function () {
                Route::get('restore/{id}', [StatusPermohonanController::class, 'restore'])->name('restore');
                Route::get('datatables', [StatusPermohonanController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [StatusPermohonanController::class, 'export'])->name('export');
            });
            Route::resource('status-permohonan', StatusPermohonanController::class);

            Route::name('region.')->prefix('region')->group(function () {
                Route::get('restore/{id}', [RegionController::class, 'restore'])->name('restore');
                Route::get('datatables', [RegionController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [RegionController::class, 'export'])->name('export');
            });

            Route::resource('region', RegionController::class, [
                'names' => [
                    'index'   => 'region.index',
                    'show'    => 'region.show',
                    'create'  => 'region.create',
                    'store'   => 'region.store',
                    'edit'    => 'region.edit',
                    'update'  => 'region.update',
                    'destroy' => 'region.destroy',
                ],
            ]);

            Route::resource('region', RegionController::class);

            Route::name('teams.')->prefix('teams')->group(function () {
                Route::get('restore/{id}', [TeamsController::class, 'restore'])->name('restore');
                Route::get('datatables', [TeamsController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [TeamsController::class, 'export'])->name('export');
            });

            Route::resource('teams', TeamsController::class, [
                'names' => [
                    'index'   => 'teams.index',
                    'show'    => 'teams.show',
                    'create'  => 'teams.create',
                    'store'   => 'teams.store',
                    'edit'    => 'teams.edit',
                    'update'  => 'teams.update',
                    'destroy' => 'teams.destroy',
                ],
            ]);

            Route::name('jenis-penilaian.')->prefix('jenis-penilaian')->group(function () {
                Route::get('restore/{id}', [JenisPenilaianController::class, 'restore'])->name('restore');
                Route::get('datatables', [JenisPenilaianController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [JenisPenilaianController::class, 'export'])->name('export');
            });

            Route::resource('jenis-penilaian', JenisPenilaianController::class, [
                'names' => [
                    'index'   => 'jenis-penilaian.index',
                    'show'    => 'jenis-penilaian.show',
                    'create'  => 'jenis-penilaian.create',
                    'store'   => 'jenis-penilaian.store',
                    'edit'    => 'jenis-penilaian.edit',
                    'update'  => 'jenis-penilaian.update',
                    'destroy' => 'jenis-penilaian.destroy',
                ],
            ]);

            Route::name('nilai-plafond.')->prefix('nilai-plafond')->group(function () {
                Route::get('restore/{id}', [NilaiPlafondController::class, 'restore'])->name('restore');
                Route::get('datatables', [NilaiPlafondController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [NilaiPlafondController::class, 'export'])->name('export');
            });
            Route::resource('nilai-plafond', NilaiPlafondController::class);

            Route::name('hubungan-pemilik-jaminan.')->prefix('hubungan-pemilik-jaminan')->group(function () {
                Route::get('restore/{id}', [HubunganPemilikJaminanController::class, 'restore'])->name('restore');
                Route::get('datatables', [HubunganPemilikJaminanController::class, 'dataForDatatables'])->name(
                    'datatables',
                );
                Route::get('export', [HubunganPemilikJaminanController::class, 'export'])->name('export');
            });
            Route::resource('hubungan-pemilik-jaminan', HubunganPemilikJaminanController::class);

            Route::name('hubungan-penghuni-jaminan.')->prefix('hubungan-penghuni-jaminan')->group(function () {
                Route::get('restore/{id}', [HubunganPenghuniJaminanController::class, 'restore'])->name('restore');
                Route::get('datatables', [HubunganPenghuniJaminanController::class, 'dataForDatatables'])->name(
                    'datatables',
                );
                Route::get('export', [HubunganPenghuniJaminanController::class, 'export'])->name('export');
            });
            Route::resource('hubungan-penghuni-jaminan', HubunganPenghuniJaminanController::class);

            Route::name('arah-mata-angin.')->prefix('arah-mata-angin')->group(function () {
                Route::get('restore/{id}', [ArahMataAnginController::class, 'restore'])->name('restore');
                Route::get('datatables', [ArahMataAnginController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [ArahMataAnginController::class, 'export'])->name('export');
            });
            Route::resource('arah-mata-angin', ArahMataAnginController::class);

            Route::name('status-permohonan.')->prefix('status-permohonan')->group(function () {
                Route::get('restore/{id}', [StatusPermohonanController::class, 'restore'])->name('restore');
                Route::get('datatables', [StatusPermohonanController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [StatusPermohonanController::class, 'export'])->name('export');
            });
            Route::resource('status-permohonan', StatusPermohonanController::class);

            // Start Activity KJPP route
            Route::name('kjpp.')->prefix('kjpp')->group(function () {
                Route::get('datatables', [KJPPController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [KJPPController::class, 'export'])->name('export');
            });

            Route::resource('kjpp', KJPPController::class);
            // End Activity KJPP route

            // Start Activity Ijin Usaha route
            Route::name('ijin_usaha.')->prefix('ijin_usaha')->group(function () {
                Route::get('datatables', [IjinUsahaController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [IjinUsahaController::class, 'export'])->name('export');
            });

            Route::resource('ijin_usaha', IjinUsahaController::class);
            // End Activity Ijin Usaha route

            // Start Activity Jenis Laporan route
            Route::name('jenis_laporan.')->prefix('jenis_laporan')->group(function () {
                Route::get('datatables', [JenisLaporanController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [JenisLaporanController::class, 'export'])->name('export');
            });

            Route::resource('jenis_laporan', JenisLaporanController::class);
            // End Activity Jenis Laporan route

            // basic data surveyor
            Route::get('datatablesSurveyory/{type}', [SurveyorController::class, 'dataForDatatablesData'])->name(
                'datatablesSurveyory',
            );
            Route::get('createData/{type}', [SurveyorController::class, 'createData'])->name('createData');
            Route::get('/{type}/{id}', [SurveyorController::class, 'editData'])->name('editData');
            Route::post('storeData/{type}', [SurveyorController::class, 'storeData'])->name('storeData');
            Route::put('updateData/{type}/{id}', [SurveyorController::class, 'updateData'])->name('updateData');
            Route::delete('deleteData/{id}/{type}', [SurveyorController::class, 'destroy'])->name('deleteData');

            // Start Activity SLA route
            Route::name('sla.')->prefix('sla')->group(function () {
                Route::get('/', [SLAController::class, 'index'])->name('index');
            });
            // End Activity SLA route

            $headers = [
                'bentuk-tanah'           => 'Bentuk Tanah',
                'kontur-tanah'           => 'Kontur Tanah',
                'posisi-kavling'         => 'Posisi Kavling',
                'ketinggian-tanah'       => 'Ketinggian Tanah',
                'kondisi-fisik-tanah'    => 'Kondisi Fisik Tanah',
                'jenis-bangunan'         => 'Jenis Bangunan',
                'kondisi-bangunan'       => 'Kondisi Bangunan',
                'sifat-bangunan'         => 'Sifat Bangunan',
                'spek-bangunan'          => 'Speksifikasi Bangunan',
                'spek-kategori-bangunan' => 'Speksifikasi Kategori Bangunan',
                'sarana-pelengkap'       => 'Sarana Pelengkap',
                'lalu-lintas-lokasi'     => 'Lalu Lintas',
                'tingkat-keramaian'      => 'Tingkat Keramaian',
                'gol-mas-sekitar'        => 'Golongan Masyarakat Sekitar',
                'lantai-unit'            => 'Lantai Unit',
                'view-unit'              => 'View Unit',
                'bentuk-unit'            => 'Bentuk unit',
                'perkerasan-jalan'       => 'Perkerasan jalan',
                'jenis-pesawat'          => 'Jenis pesawat',
                'model-alat-berat'       => 'Model Alat Berat',
                'jenis-kapal'            => 'Jenis kapal',
                'jenis-kendaraan'        => 'Jenis kendaraan',
                'jenis-unit'             => 'Jenis unit',
                'terletak-area'          => 'Terletak di Area',
                'merupakan-daerah'       => 'Merupakan Daerah',
                'posisi-unit'            => 'Posisi unit',
                'bentuk-unit'            => 'Bentuk unit',
                'fasilitas-objek'        => 'Fasilitas Umum Dekat Objek',
                'foto-objek-jaminan'     => 'Foto Objek Jaminan',
                'perizinan'              => 'Perizinan'

            ];

            foreach ($headers as $type => $header) {
                Route::get($type, [SurveyorController::class, 'data'])->name($type . '.index')->defaults('type', $type);
            }

            Route::get('export/{type}', [SurveyorController::class, 'export'])->name('export');
        });

        Route::name('debitur.')->prefix('debitur')->group(function () {
            Route::get('restore/{id}', [DebitureController::class, 'restore'])->name('restore');
            Route::get('datatables', [DebitureController::class, 'dataForDatatables'])->name('datatables');
            Route::get('export', [DebitureController::class, 'export'])->name('export');

            Route::name('jaminan.')->prefix('{id}/jaminan')->group(function () {
                Route::get('download', [DokumenJaminanController::class, 'download'])->name('download');
                Route::get('bulk-download', [DokumenJaminanController::class, 'bulkDownload'])->name('bulk.download');
                Route::get('/', [DokumenJaminanController::class, 'index'])->name('index');
                Route::get('create', [DokumenJaminanController::class, 'create'])->name('create');
                Route::get('{jaminan}/edit', [DokumenJaminanController::class, 'edit'])->name('edit');
                Route::put('{jaminan}', [DokumenJaminanController::class, 'update'])->name('update');
                Route::post('store', [DokumenJaminanController::class, 'store'])->name('store');
                Route::delete('{jaminan}', [DokumenJaminanController::class, 'destroy'])->name('destroy');

                Route::post('clear-detail', [DokumenJaminanController::class, 'clearDetail'])->name('clearDetail');
            });

            Route::name('pemilik.')->prefix('{id}/pemilik')->group(function () {
                Route::get('/', [PemilikJaminanController::class, 'index'])->name('index');
                Route::get('create', [PemilikJaminanController::class, 'create'])->name('create');
                Route::get('{pemilik}/edit', [PemilikJaminanController::class, 'edit'])->name('edit');
                Route::put('{pemilik}', [PemilikJaminanController::class, 'update'])->name('update');
                Route::post('store', [PemilikJaminanController::class, 'store'])->name('store');
                Route::delete('{pemilik}', [PemilikJaminanController::class, 'destroy'])->name('destroy');
            });
        });

        Route::resource('debitur', DebitureController::class);

        Route::name('laporan.')->prefix('laporan')->group(function () {
            Route::get('datatables', [LaporanController::class, 'dataForDatatables'])->name('datatables');
        });
        Route::resource('laporan', LaporanController::class);

        Route::group(['prefix' => 'memo'], function () {
            Route::get('datatables', [MemoController::class, 'dataForDatatables'])->name('memo.datatables');
            Route::get('create-bulk', [MemoController::class, 'create'])->name('memo.create.bulk');
            Route::post('total-biaya-pj', [MemoController::class, 'getTotalBiayaPJ'])->name('memo.total-biaya-pj');
            Route::post('preview', [MemoController::class, 'preview'])->name('memo.preview');
            Route::post('generate-pdf', [MemoController::class, 'generatePdf'])->name('memo.generate-pdf');
            // Route untuk download PDF memo penyelesaian
            Route::get('/memo/download-pdf/{id}', [MemoController::class, 'downloadPdf'])
            ->name('memo.download-pdf');
        });
        Route::resource('memo', MemoController::class);

        Route::name('resume.')->prefix('resume')->group(function () {
            Route::get('/', [ResumeController::class, 'index'])->name('index');
            Route::get('{id}/show', [ResumeController::class, 'show'])->name('show');
            Route::post('store', [ResumeController::class, 'store'])->name('store');
            Route::get('datatables', [ResumeController::class, 'dataForDatatables'])->name('datatables');
        });

        Route::name('permohonan.')->prefix('permohonan')->group(function () {
            Route::get('{id}/create', [PermohonanController::class, 'createPermohonan'])->name('create.debitur');
            Route::get('restore/{id}', [PermohonanController::class, 'restore'])->name('restore');
            Route::get('datatables', [PermohonanController::class, 'dataForDatatables'])->name('datatables');
            Route::get('export', [PermohonanController::class, 'export'])->name('export');
            Route::get('print/{id}', [PermohonanController::class, 'print'])->name('print');
            Route::put('store-approved/{id}', [PermohonanController::class, 'storeAproved'])->name('storeAproved');
            Route::put('store-reschedule-survey/{id}', [PermohonanController::class, 'storeRescheduleSurvey'])->name('storeRescheduleSurvey');
        });

        Route::get('authorization', [PermohonanController::class, 'authorization'])->name('authorization.index');
        Route::get('permohonan/{id}/pembatalan', [PermohonanController::class, 'showPembatalan'])->name('permohonan.show-pembatalan');
        Route::post('permohonan/pembatalan', [PermohonanController::class, 'pembatalan'])->name('permohonan.pembatalan');

        Route::resource('permohonan', PermohonanController::class);

        Route::name('pembatalan.')->prefix('pembatalan')->group(function () {
            Route::get('datatables', [PembatalanController::class, 'dataForDatatables'])->name('datatables');
        });
        Route::resource('pembatalan', PembatalanController::class);

        Route::get('authorization', [PermohonanController::class, 'authorization'])->name('authorization.index');
        Route::get('authorization/datatables', [PermohonanController::class, 'dataForAuthorization'])->name(
            'authorization.datatables',
        );
        Route::get('authorization/{id}/edit', [PermohonanController::class, 'showAuthorization'])->name(
            'authorization.show',
        );
        Route::put('authorization/{id}', [PermohonanController::class, 'updateAuthorization'])->name(
            'authorization.update',
        );

        Route::name('tender.')->prefix('tender')->group(function () {
            // Penawaran
            Route::get('penawaran', [TenderController::class, 'penawaran_index'])->name('penawaran.index');
            Route::get('penawaran/{noreg}/show', [TenderController::class, 'penawaran_show'])->name('penawaran.show');
            Route::get('penawaran/{noreg}/create', [TenderController::class, 'penawaran_create'])->name(
                'penawaran.createPenawaran',
            );
            Route::post('penawaran/{noreg}/store', [TenderController::class, 'penawaran_store'])->name(
                'penawaran.storePenawaran',
            );
            Route::get('penawaran/{noreg}/edit', [TenderController::class, 'penawaran_edit'])->name(
                'penawaran.editPenawaran',
            );
            Route::put('penawaran/{noreg}/update', [TenderController::class, 'penawaran_update'])->name(
                'penawaran.updatePenawaran',
            );
            Route::get('penawaran/exportPenawaran', [TenderController::class, 'exportPenawaran'])->name(
                'penawaran.exportPenawaran',
            );
            Route::get('penawaran/datatables', [TenderController::class, 'datatablesPenawaran'])->name(
                'penawaran.datatables',
            );
            Route::get('penawaran/{noreg}/suratTender', [TenderController::class, 'showSuratTender'])->name(
                'penawaran.showSuratTender',
            );
            Route::get('penawaran/{noreg}/suratTender/downloadpdf', [TenderController::class, 'downloadSuratTender'])
                ->name('penawaran.downloadSuratTender');
            // Kirim Email Penawaran
            Route::get('penawaran/{noreg}/showKirimEmail', [TenderController::class, 'showKirimEmail'])->name(
                'penawaran.showKirimEmail',
            );
            Route::get('penawaran/{noreg}/kirimEmailAll', [TenderController::class, 'kirimEmailAll'])->name(
                'penawaran.kirimEmailAll',
            );
            Route::get('penawaran/{noreg}/suratTenderKJPP/{id}', [TenderController::class, 'suratTenderKJPP'])->name(
                'penawaran.suratTenderKJPP',
            );
            Route::get(
                'penawaran/{noreg}/suratTenderKJPP/{id}/kirimEmailKJPP',
                [TenderController::class, 'kirimEmailKJPP'],
            )->name('penawaran.kirimEmailKJPP');
            Route::get(
                'penawaran/suratTenderShow/{noreg}/datatables',
                [TenderController::class, 'dataTablesShowKirimSurat'],
            )->name('penawaran.showKirimSurat.datatables');
            // Download Surat Tender KJPP
            Route::get(
                'penawaran/{noreg}/suratTenderKJPP/{id}/downloadSuratTenderKJPP',
                [TenderController::class, 'downloadSuratTenderKJPP'],
            )->name('penawaran.downloadSuratTenderKJPP');

            // Penawaran Ulang
            Route::get('penawaran/ulang', [TenderController::class, 'penawaran_ulang_index'])->name(
                'penawaran.ulang.index',
            );
            Route::get('penawaran/ulang/datatables', [TenderController::class, 'datatablesPenawaranUlang'])->name(
                'penawaran.ulang.datatables',
            );
        });

        Route::name('penilaian.')->prefix('penilaian')->group(function () {
            Route::get('restore/{id}', [PenilaianController::class, 'restore'])->name('restore');
            Route::get('datatables', [PenilaianController::class, 'dataForDatatables'])->name('datatables');
            Route::get('export', [PenilaianController::class, 'export'])->name('export');
            Route::get('/getUserTeams/{id}', [PenilaianController::class, 'getUserTeams']);

            Route::get('/', [PenilaianController::class, 'index'])->name('index');
            Route::get('{id}/assignment', [PenilaianController::class, 'assignment'])->name('assignment');
            Route::put('{id}', [PenilaianController::class, 'update'])->name('update');
            Route::put('revisi/{nomor_registrasi}', [PenilaianController::class, 'revisi'])->name('revisi');
            Route::post('create', [PenilaianController::class, 'create'])->name('create');
            Route::post('store', [PenilaianController::class, 'store'])->name('store');
            Route::post('storePenilaiLaporan', [PenilaianController::class, 'storePenilaiLaporan'])->name('storePenilaiLaporan');
        });

        /**
         * Route start activity
         */

        Route::name('activity.')->prefix('activity')->group(function () {
            Route::get('restore/{id}', [ActivityController::class, 'restore'])->name('restore');
            Route::get('datatables', [ActivityController::class, 'dataForDatatables'])->name('datatables');
            Route::get('export', [ActivityController::class, 'export'])->name('export');

            Route::get('/', [ActivityController::class, 'index'])->name('index');
            Route::put('update-team', [ActivityController::class, 'updateTeamAssingment'])->name('update-team');
            Route::get('/{id}/show', [ActivityController::class, 'show'])->name('show');
            Route::get('download/{id}', [ActivityController::class, 'download'])->name('download');
            Route::get('senior', [ActivityController::class, 'senior'])->name('senior');

            Route::name('progres.')->prefix('progres')->group(function () {
                Route::get('/', [ActivityController::class, 'progres_activity'])->name('index');
                Route::get('/datatables/{id}', [ActivityController::class, 'dataTablesForActivity'])->name(
                    'datatables',
                );
            });

            Route::get('/teams/{regionId}', [ActivityController::class, 'dataTablesForActivity']);
        });

        /**
         * Route end activity
         */


        Route::name('otorisator.')->prefix('otorisator')->group(function () {
            Route::get('pelaporan', [PenilaianController::class, 'otorisator'])->name('pelaporan.index')->defaults(
                'type',
                'pelaporan',
            );

            Route::get('view-laporan', [PenilaianController::class, 'view_laporan'])->name('view-laporan');

            Route::get('pembayaran', [PenilaianController::class, 'otorisator'])->name('pembayaran.index')->defaults(
                'type',
                'pembayaran',
            );

            Route::post('otorisator/{id}/{context}', [PenilaianController::class, 'otorisatorUpdate'])->name('otorisator.update');
            Route::post('revisi-laporan/{id}', [PenilaianController::class, 'revisiLaporan'])->name('otorisator.revisi');

            Route::get('pembatalan', [PenilaianController::class, 'otorisator'])->name('pembatalan.index')->defaults(
                'type',
                'pembatalan',
            );

            Route::get('sla', [PenilaianController::class, 'otorisator'])->name('sla.index')->defaults('type', 'sla');

            Route::get('paparan', [PenilaianController::class, 'otorisator'])->name('paparan.index')->defaults('type', 'paparan');
            Route::get('/datatables/sla', [SLAController::class, 'dataForDatatables'])->name(
                'sla.datatables',
            );
            Route::get('/datatables/{otorisator}', [PenilaianController::class, 'dataForAuthorization'])->name(
                'datatables',
            );
            Route::get('show/{id}/{type}', [PenilaianController::class, 'show'])->name('show');
        });


        Route::name('surveyor.')->prefix('surveyor')->group(function () {
            Route::get('/', [SurveyorController::class, 'index'])->name('index');
            Route::get('{id}/show', [SurveyorController::class, 'show'])->name('show');
            Route::post('store', [SurveyorController::class, 'store'])->name('store');
            Route::post('storeDenah', [SurveyorController::class, 'storeDenah'])->name('storeDenah');
            Route::post('store-jadwal/{id}', [SurveyorController::class, 'storeJadwal'])->name('storeJadwal');

            Route::post('storeFreeze/{id}', [SurveyorController::class, 'storeFreeze'])->name('storeFreeze');
            Route::post('storeFoto', [SurveyorController::class, 'storeFoto'])->name('storeFoto');
            Route::put('updateFoto', [SurveyorController::class, 'updateFoto'])->name('updateFoto');
            Route::delete('/surveyor/hapus-foto', [SurveyorController::class, 'hapusFoto'])->name('hapusFoto');

            Route::delete('/hapus-lantai', [SurveyorController::class, 'hapusLantai'])->name('hapusLantai');
            Route::get('/surveyor/get-foto/', [SurveyorController::class, 'getFoto'])->name('getFoto');
            Route::post('storeDataPembanding', [SurveyorController::class, 'storeDataPembanding'])->name('storeDataPembanding');
            Route::get('checkButtonStatus/{id}', [SurveyorController::class, 'checkButtonStatus'])->name('checkButtonStatus');

            Route::get('datatables', [SurveyorController::class, 'dataForDatatables'])->name('datatables');
            Route::get('inspeksi/{id}/create', [SurveyorController::class, 'formInspeksi'])->name('inspeksi');
            Route::get('denah/{id}/create', [SurveyorController::class, 'denah'])->name('denah');
            Route::get('foto/{id}/create', [SurveyorController::class, 'foto'])->name('foto');
            Route::get('data-pembanding/{id}/create', [SurveyorController::class, 'dataPembanding'])->name('data-pembanding');
            Route::post('submitSurveyor/{id}', [SurveyorController::class, 'submitSurveyor'])->name('submitSurveyor');
            Route::post('update_analisa/{id}', [SurveyorController::class, 'update_analisa'])->name('update_analisa');

            Route::get('/signatures', [SurveyorController::class, 'signatures'])->name('signatures');
            Route::post('/signatures', [SurveyorController::class, 'signatureStore'])->name('signatureStore');
            Route::get('/signatures/{type}', [SurveyorController::class, 'signatureShow'])->name('signatureShow');
            Route::delete('/signatures/{type}', [SurveyorController::class, 'signatureDestroy'])->name('signatureDestroy');

            Route::get('/print-out-inspeksi/{permohonan_id}/{dokument_id}/{jenis_jaminan_id}', [SurveyorController::class, 'print_out_inspeksi'])->name('print_out_inspeksi');

            // resedule
            Route::put('store-approve-reschedule/{id}', [SurveyorController::class, 'approveReschedule'])->name('approveReschedule');
            Route::put('store-rejected-reschedule/{id}', [SurveyorController::class, 'rejectReschedule'])->name('rejectReschedule');
            Route::put('store-proses-survey/{id}', [SurveyorController::class, 'storeProsesSurvey'])->name('storeProsesSurvey');
            Route::post('save-edited-image/', [SurveyorController::class, 'saveEditedImage'])->name('saveEditedImage');

            Route::post('upload-file-foto/{url}', [SurveyorController::class, 'uploadFileFoto'])->name('uploadFileFoto');

        });

        Route::name('penilai.')->prefix('penilai')->group(function () {
            Route::get('/', [PenilaiController::class, 'index'])->name('index');
            Route::get('/{id}/edit', [PenilaiController::class, 'edit'])->name('edit');
            Route::get('/{id}/show', [PenilaiController::class, 'show'])->name('show');
            Route::get('datatables', [PenilaiController::class, 'dataForDatatables'])->name('dataForTables');

            Route::get('lampiran', [PenilaiController::class, 'lampiran'])->name('lampiran');
            Route::get('export/kertas-kerja', [PenilaiController::class, 'export_kertas_kerja'])->name('export.kertas-kerja');
            Route::get('print-out', [PenilaiController::class, 'print_out'])->name('print-out');
            Route::get('print-out-laporan/{permohonan_id}/{dokument_id}/{jenis_jaminan_id}', [PenilaiController::class, 'print_out_laporan'])->name('print-out-laporan');
            Route::get('show-laporan-inspeksi/{permohonan_id}/{dokument_id}/{jenis_jaminan_id}', [PenilaiController::class, 'showLaporanInspeksi'])->name('show-laporan-inspeksi');

            Route::post('import/kertas-kerja', [PenilaiController::class, 'import_kertas_kerja'])->name('import.kertas-kerja');

            Route::get('sederhana/{id}', [PenilaiController::class, 'sederhana'])->name('sederhana');
            Route::get('standar/{id}', [PenilaiController::class, 'standar'])->name('standar');
            Route::get('resume', [PenilaiController::class, 'resume'])->name('resume');
            Route::get('memo', [PenilaiController::class, 'memo'])->name('memo');
            Route::get('paparan', [PenilaiController::class, 'paparan'])->name('paparan');
            Route::get('call-report', [PenilaiController::class, 'call_report'])->name('call-report');
            Route::post('storeCallReport', [PenilaiController::class, 'storeCallReport'])->name('storeCallReport');
            Route::post('storePaparan/{id}', [PenilaiController::class, 'storePaparan'])->name('storePaparan');
            Route::get('rap', [PenilaiController::class, 'rap'])->name('rap');
            Route::get('/check-status-lpj', [PenilaiController::class, 'checkStatusLpj'])->name('check.status.lpj');
            Route::get('/check-laporan', [PenilaiController::class, 'checkPrintOutLaporan'])->name('check-laporan');
            Route::post('/save-status-lpj', [PenilaiController::class, 'saveStatusLpj'])->name('save.status.lpj');
            Route::post('/preoses-laporan/{id}', [PenilaiController::class, 'storePenilaian'])->name('proses.laporan');

            Route::post('storeResume', [PenilaiController::class, 'storeResume'])->name('storeResume');

            Route::post('storeMemo', [PenilaiController::class, 'storeMemo'])->name('storeMemo');
            Route::post('store-memo-with-photos', [PenilaiController::class, 'storeMemoWithPhotos'])->name('storeMemoWithPhotos');
            Route::post('upload-temp-photo', [PenilaiController::class, 'uploadTempPhoto'])->name('uploadTempPhoto');
            Route::delete('delete-temp-photo', [PenilaiController::class, 'deleteTempPhoto'])->name('deleteTempPhoto');

            Route::post('storeRap', [PenilaiController::class, 'storeRap'])->name('storeRap');
            Route::post('storeLpjSederhanadanStandard', [PenilaiController::class, 'storeLpjSederhanadanStandard'])->name('storeLpjSederhanadanStandard');
            Route::put('revisi-surveyor/{id}', [PenilaiController::class, 'revisiSurveyor'])->name('revisiSurveyor');
            Route::get('show-data-pembanding/{id}/edit', [SurveyorController::class, 'dataPembanding'])->name('showDataPembanding');

        });

        Route::get('persetujuan-penawaran/datatables', [PersetujuanPenawaranController::class, 'dataForDatatables'])
            ->name('persetujuan-penawaran.datatables');

        Route::resource('persetujuan-penawaran', PersetujuanPenawaranController::class);

        Route::get('noc/datatables', [NocController::class, 'dataForDatatables'])
            ->name('noc.datatables');
        Route::get('noc/datatables/pembayaran', [NocController::class, 'dataForDatatablesPembayaran'])
            ->name('noc.datatables.pembayaran');
        Route::get('noc/datatables/penyelesaian', [NocController::class, 'dataForDatatablesPenyelesaian'])
            ->name('noc.datatables.penyelesaian');

        Route::get('noc/pembayaran', [NocController::class, 'pembayaran'])->name('noc.pembayaran.index');
        Route::get('noc/penyelesaian', [NocController::class, 'penyelesaian'])->name('noc.penyelesaian.index');
        Route::post('noc/penyelesaian', [NocController::class, 'penyelesaian'])->name('noc.store.penyelesaian');

        Route::resource('noc', NocController::class);

        Route::name('laporan-external.')->prefix('laporan-external')->group(function () {
            Route::get('datatables', [LaporanExternalController::class, 'dataForDatatables'])->name('datatables');
            Route::get('export', [LaporanExternalController::class, 'export'])->name('export');
        });
        Route::resource('laporan-external', LaporanExternalController::class);

        Route::get('/lampiran/download/{id}', [LampiranDokumenController::class, 'download'])->name('lampiran.download');
        Route::post('lampiran/upload', [LampiranDokumenController::class, 'upload'])->name('lampiran.upload');
        Route::delete('lampiran/{lampiran}', [LampiranDokumenController::class, 'delete'])->name('lampiran.delete');

        Route::name('bank-data.')->prefix('bank-data')->group(function () {
            Route::get('datatables', [BankDataController::class, 'dataForDatatables'])->name('datatables');
        });

        Route::resource('bank-data', BankDataController::class);

        Route::name('laporan-penilai-jaminan.')->prefix('laporan-penilai-jaminan')->group(function () {
            Route::get('/', [LaporanPenilaiJaminanController::class, 'index'])->name('index');
            Route::get('datatables', [LaporanPenilaiJaminanController::class, 'dataForDatatables'])->name('datatables');
            Route::get('export', [LaporanPenilaiJaminanController::class, 'export'])->name('export');
            Route::get('show/{permohonan_id}/{dokumen_id}/{jaminan_id}/', [LaporanPenilaiJaminanController::class,'show'])->name('show');
        });

        Route::prefix('laporan-permohonan')->name('laporan-permohonan.')->group(function () {
            Route::get('datatables', [LaporanPermohonanController::class, 'dataForDatatables'])->name('data');
            Route::get('export', [LaporanPermohonanController::class, 'export'])->name('export');
            Route::get('/', [LaporanPermohonanController::class, 'index'])->name('index');
        });

        // Laporan Pembatalan routes
        Route::prefix('laporan-pembatalan')->name('laporan-pembatalan.')->group(function () {
            Route::get('/', [LaporanPembatalanController::class, 'index'])->name('index');
            Route::get('/data', [LaporanPembatalanController::class, 'dataForDatatables'])->name('data');
            Route::get('/export', [LaporanPembatalanController::class, 'export'])->name('export');
        });

        Route::prefix('laporan-penilaian-jaminan')->name('laporan-penilaian-jaminan.')->group(function () {
            Route::get('datatables', [LaporanPenilaianJaminanController::class, 'dataForDatatables'])->name('data');
            Route::get('export', [LaporanPenilaianJaminanController::class, 'export'])->name('export');
            Route::get('/', [LaporanPenilaianJaminanController::class, 'index'])->name('index');
        });

        Route::prefix('laporan-hasil-penilaian-jaminan-internal-external')->name('laporan-hasil-penilaian-jaminan-internal-external.')->group(function () {
            Route::get('datatables', [LaporanHasilPenilaianJaminanInternalExternalController::class, 'dataForDatatables'])->name('data');
            Route::get('export', [LaporanHasilPenilaianJaminanInternalExternalController::class, 'export'])->name('export');
            Route::get('/', [LaporanHasilPenilaianJaminanInternalExternalController::class, 'index'])->name('index');
        });

        // rekap harian so
        Route::resource('rekap-harian-so', RekapHarianSoController::class);

        // laporan biaya
        Route::prefix('laporan-biaya')->name('laporan-biaya.')->group(function () {
        Route::get('internal', [LaporanBiayaInternalExternalController::class, 'showLaporanBiayaInternal'])->name('internal.index');
        Route::get('external', [LaporanBiayaInternalExternalController::class, 'showLaporanBiayaExternal'])->name('external.index');
        });

        // laporan user
        Route::prefix('laporan-user')->name('laporan-user.')->group(function () {
            Route::get('/', [LaporanUserController::class, 'index'])->name('index');
            Route::get('export', [LaporanUserController::class, 'export'])->name('export');
            Route::get('api/user-pemohon', [LaporanUserController::class, 'searchUserPemohon'])->name('api.user-pemohon');
            Route::get('datatables', [LaporanUserController::class, 'dataTableForUserPemohon'])->name('datatables');
        });

        // laporan monitoring
        Route::prefix('laporan-monitoring')->name('laporan-monitoring.')->group(function () {
            Route::get('/', [LaporanMonitoringSoController::class, 'index'])->name('index');
            Route::get('/{id}/detail', [LaporanMonitoringSoController::class, 'show'])->name('show');
            Route::get('datatables/{id}', [LaporanMonitoringSoController::class, 'dataForDatatablePenilai'])->name('datatables');
        });

        // laporan debiture
        Route::prefix('laporan-debiture')->name('laporan-debiture.')->group(function () {
            Route::get('/', [LaporanDebitureController::class, 'index'])->name('index');
            Route::get('datatables', [LaporanDebitureController::class, 'dataTableForDebiture'])->name('datatables');
        });

        // laporan sla
        Route::prefix('laporan-sla-penilai')->name('laporan-sla-penilai.')->group(function () {
            Route::get('/', [LaporanSLAPenilaiController::class, 'index'])->name('index');
            Route::get('datatables', [LaporanSLAPenilaiController::class, 'dataForDatatableSLaPenilai'])->name('datatables');
        });

        // daftar pustaka
        Route::resource('daftar-pustaka', DaftarPustakaController::class);

        // category daftar pustaka
        Route::prefix('category-daftar-pustaka')->name('category-daftar-pustaka.')->group(function () {
            Route::get('datatables', [CategoryDaftarPustakaController::class, 'dataForDatatables'])->name('datatables');
        });

        Route::resource('category-daftar-pustaka', CategoryDaftarPustakaController::class);

        // Route untuk Bucok
        Route::prefix('bucok')->name('bucok.')->group(function () {
            Route::get('/', [BucokController::class, 'index'])->name('index');
            Route::get('/datatables', [BucokController::class, 'dataForDatatables'])->name('datatables');
            Route::get('/{id}', [BucokController::class, 'show'])->name('show');
            Route::post('/import', [BucokController::class, 'import'])->name('import');
            Route::get('/export', [BucokController::class, 'export'])->name('export');
        });

        Route::prefix('admin-kredit')->name('admin-kredit.')->group(function () {
            // Route SLIK
            Route::prefix('slik')->name('slik.')->group(function () {
                Route::get('/', [SlikController::class, 'index'])->name('index');
                Route::get('datatables', [SlikController::class, 'dataForDatatables'])->name('datatables');
                Route::get('{id}', [SlikController::class, 'show'])->name('show');
                Route::get('import', [SlikController::class, 'importForm'])->name('import-form');
                Route::post('import', [SlikController::class, 'import'])->name('import');
                Route::get('download-template', [SlikController::class, 'downloadTemplate'])->name('download-template');
                Route::get('export', [SlikController::class, 'export'])->name('export');
                Route::delete('truncate', [SlikController::class, 'truncate'])->name('truncate');
            });

            // Route Laporan SLIK
            Route::prefix('laporan-slik')->name('laporan-slik.')->group(function () {
                Route::get('/', [LaporanSlikController::class, 'index'])->name('index');
                Route::get('datatables', [LaporanSlikController::class, 'dataForDatatables'])->name('datatables');
                Route::get('{id}', [LaporanSlikController::class, 'show'])->name('show');
                Route::post('store', [LaporanSlikController::class, 'store'])->name('store');
                Route::get('export', [LaporanSlikController::class, 'export'])->name('export');
            });

            // Laporan Routes
            Route::prefix('laporan')->name('laporan.')->group(function () {
                Route::get('/', [LaporanAdminKreditController::class, 'index'])->name('index');
                Route::get('datatables', [LaporanAdminKreditController::class, 'dataForDatatables'])->name('datatables');
                Route::get('export', [LaporanAdminKreditController::class, 'export'])->name('export');
                Route::get('{id}/edit', [LaporanAdminKreditController::class,'edit'])->name('edit');
                Route::put('{id}', [LaporanAdminKreditController::class,'update'])->name('update');
            });
        });
    });

    require __DIR__ . '/registrasi.php';
