diff --git a/app/Http/Controllers/LaporanExternalController.php b/app/Http/Controllers/LaporanExternalController.php index 44cc89f..ea6cec1 100644 --- a/app/Http/Controllers/LaporanExternalController.php +++ b/app/Http/Controllers/LaporanExternalController.php @@ -6,9 +6,11 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; use Modules\Lpj\Models\LaporanExternal; use Modules\Lpj\Http\Requests\LaporanExternalRequest; +use Modules\Lpj\Models\Permohonan; class LaporanExternalController extends Controller { + public $user; /** * Display a listing of the resource. */ @@ -43,7 +45,7 @@ class LaporanExternalController extends Controller LaporanExternal::create($validatedData); - return redirect()->route('lpj.laporan_external.index')->with('success', 'Laporan External berhasil ditambahkan.'); + return redirect()->route('laporan-external.index')->with('success', 'Laporan External berhasil ditambahkan.'); } /** @@ -59,7 +61,8 @@ class LaporanExternalController extends Controller */ public function edit(LaporanExternal $laporanExternal) { - return view('lpj::laporan_external.edit', compact('laporanExternal')); + $permohonan = Permohonan::find($laporanExternal->permohonan_id); + return view('lpj::laporan_external.create', compact('laporanExternal','permohonan')); } /** @@ -79,7 +82,7 @@ class LaporanExternalController extends Controller $laporanExternal->update($validatedData); - return redirect()->route('lpj.laporan_external.index')->with('success', 'Laporan External berhasil diperbarui.'); + return redirect()->route('laporan-external.index')->with('success', 'Laporan External berhasil diperbarui.'); } /** @@ -89,7 +92,7 @@ class LaporanExternalController extends Controller { $laporanExternal->delete(); - return redirect()->route('lpj.laporan_external.index')->with('success', 'Laporan External berhasil dihapus.'); + return redirect()->route('laporan-external.index')->with('success', 'Laporan External berhasil dihapus.'); } public function dataForDatatables(Request $request) @@ -122,7 +125,6 @@ class LaporanExternalController extends Controller ->orWhere('indikasi_nilai_pasar_kendaraan_alat_berat', 'LIKE', "%$search%") ->orWhere('file_resume', 'LIKE', "%$search%") ->orWhere('file_laporan', 'LIKE', "%$search%"); - ->orWhere('tanggal_laporan', 'LIKE', "%$search%"); }); } diff --git a/app/Http/Requests/LaporanExternalRequest.php b/app/Http/Requests/LaporanExternalRequest.php index 8b2b5a0..1e2a4f4 100644 --- a/app/Http/Requests/LaporanExternalRequest.php +++ b/app/Http/Requests/LaporanExternalRequest.php @@ -13,18 +13,18 @@ : array { return [ - 'permohonan_id' => 'required|exists:permohonans,id', - 'nomor_laporan' => 'required|string|max:255', - 'tgl_final_laporan' => 'required|date', - 'nilai_pasar' => 'required|numeric', - 'indikasi_nilai_likuidasi' => 'required|numeric', - 'indikasi_nilai_pasar_tanah' => 'required|numeric', - 'estimasi_harga_tanah' => 'required|numeric', - 'estimasi_harga_bangunan' => 'required|numeric', - 'indikasi_nilai_pasar_bangunan' => 'required|numeric', - 'indikasi_nilai_pasar_sarana_pelengkap' => 'required|numeric', - 'indikasi_nilai_pasar_mesin' => 'required|numeric', - 'indikasi_nilai_pasar_kendaraan_alat_berat' => 'required|numeric', + 'permohonan_id' => 'required|exists:permohonan,id', + 'nomor_laporan' => 'nullable|string|max:255', + 'tgl_final_laporan' => 'nullable|date', + 'nilai_pasar' => 'nullable|numeric', + 'indikasi_nilai_likuidasi' => 'nullable|numeric', + 'indikasi_nilai_pasar_tanah' => 'nullable|numeric', + 'estimasi_harga_tanah' => 'nullable|numeric', + 'estimasi_harga_bangunan' => 'nullable|numeric', + 'indikasi_nilai_pasar_bangunan' => 'nullable|numeric', + 'indikasi_nilai_pasar_sarana_pelengkap' => 'nullable|numeric', + 'indikasi_nilai_pasar_mesin' => 'nullable|numeric', + 'indikasi_nilai_pasar_kendaraan_alat_berat' => 'nullable|numeric', 'file_resume' => 'nullable|file|mimes:pdf|max:10240', // 10MB max 'file_laporan' => 'nullable|file|mimes:pdf|max:10240', ]; diff --git a/database/migrations/2025_03_06_012851_create_laporan_externals_table.php b/database/migrations/2025_03_06_012851_create_laporan_externals_table.php index 727abcf..c721a93 100644 --- a/database/migrations/2025_03_06_012851_create_laporan_externals_table.php +++ b/database/migrations/2025_03_06_012851_create_laporan_externals_table.php @@ -3,8 +3,9 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; + use Modules\Lpj\Models\Permohonan; -return new class extends Migration + return new class extends Migration { /** * Run the migrations. @@ -13,7 +14,7 @@ return new class extends Migration { Schema::create('laporan_externals', function (Blueprint $table) { $table->id(); - $table->foreignId('permohonan_id')->constrained('permohonans')->onDelete('cascade'); + $table->foreignIdFor(Permohonan::class)->constrained('permohonan')->onDelete('cascade'); $table->string('nomor_laporan'); $table->date('tgl_final_laporan'); $table->decimal('nilai_pasar', 15, 2); diff --git a/module.json b/module.json index d656031..74efc94 100644 --- a/module.json +++ b/module.json @@ -218,6 +218,18 @@ "admin" ] }, + { + "title": "Laporan External", + "path": "laporan-external", + "icon": "ki-filled ki-document text-lg text-primary", + "classes": "", + "attributes": [], + "permission": "", + "roles": [ + "administrator", + "admin" + ] + }, { "title": "Registrasi Final", "path": "registrasifinal", diff --git a/resources/views/laporan_external/create.blade.php b/resources/views/laporan_external/create.blade.php new file mode 100644 index 0000000..72a9c8d --- /dev/null +++ b/resources/views/laporan_external/create.blade.php @@ -0,0 +1,167 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection + +@section('content') +
+
+ @csrf + @if(isset($laporanExternal)) + @method('PUT') + @endif +
+
+

+ {{ isset($laporanExternal) ? 'Edit' : 'Tambah' }} Laporan External +

+
+ Back +
+
+
+
+ + +
+ {{ $permohonan->nomor_registrasi }} +
+
+
+ +
+ + @error('nomor_laporan') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('tgl_final_laporan') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('nilai_pasar') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('indikasi_nilai_likuidasi') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('indikasi_nilai_pasar_tanah') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('estimasi_harga_tanah') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('estimasi_harga_bangunan') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('indikasi_nilai_pasar_bangunan') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('indikasi_nilai_pasar_sarana_pelengkap') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('indikasi_nilai_pasar_mesin') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('indikasi_nilai_pasar_kendaraan_alat_berat') + {{ $message }} + @enderror +
+
+
+ +
+ + @if(isset($laporanExternal) && $laporanExternal->file_resume) +

File saat ini:

File saat ini: + {{ basename($laporanExternal->file_resume) }} +

+ @endif + @error('file_resume') + {{ $message }} + @enderror +
+
+
+ +
+ + @if(isset($laporanExternal) && $laporanExternal->file_laporan) +

File saat ini: + {{ basename($laporanExternal->file_laporan) }} +

+ @endif + @error('file_laporan') + {{ $message }} + @enderror +
+
+ +
+ +
+
+
+@endsection diff --git a/resources/views/laporan_external/index.blade.php b/resources/views/laporan_external/index.blade.php new file mode 100644 index 0000000..e04b544 --- /dev/null +++ b/resources/views/laporan_external/index.blade.php @@ -0,0 +1,223 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render('laporan-external') }} +@endsection + +@section('content') +
+
+
+

+ Daftar Laporan External +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ + + Nomor Laporan + + + Tanggal Final Laporan + + + Nilai Pasar + + + Indikasi Nilai Likuidasi + + + Indikasi Nilai Pasar Tanah + + + Estimasi Harga Bangunan + + + Indikasi Nilai Pasar Bangunan + + + Indikasi Nilai Pasar Sarana Pelengkap + + + Indikasi Nilai Pasar Mesin + + + Indikasi Nilai Pasar Kendaraan/Alat Berat + + + File Resume + + + File Laporan + + Action
+
+ +
+
+
+@endsection + +@push('scripts') + + +@endpush diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index 743708f..f4271d8 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -673,5 +673,26 @@ $trail->push('Proses NOC'); }); + Breadcrumbs::for('laporan-external', function (BreadcrumbTrail $trail) { + $trail->push('Laporan External', route('laporan-external.index')); + }); + + Breadcrumbs::for('laporan-external.show', function (BreadcrumbTrail $trail) { + $trail->parent('laporan-external'); + $trail->push('Show Laporan External'); + }); + + + Breadcrumbs::for('laporan-external.create', function (BreadcrumbTrail $trail) { + $trail->parent('laporan-external'); + $trail->push('Tambah Laporan External', route('laporan-external.create')); + }); + + + Breadcrumbs::for('laporan-external.edit', function (BreadcrumbTrail $trail) { + $trail->parent('laporan-external'); + $trail->push('Data Laporan External'); + }); + // add andy require __DIR__ . '/breadcrumbs_registrasi.php'; diff --git a/routes/web.php b/routes/web.php index ad15ecf..d922846 100644 --- a/routes/web.php +++ b/routes/web.php @@ -17,7 +17,8 @@ use Modules\Lpj\Http\Controllers\JenisLegalitasJaminanController; use Modules\Lpj\Http\Controllers\JenisPenilaianController; use Modules\Lpj\Http\Controllers\KJPPController; use Modules\Lpj\Http\Controllers\LaporanController; -use Modules\Lpj\Http\Controllers\NilaiPlafondController; + use Modules\Lpj\Http\Controllers\LaporanExternalController; + use Modules\Lpj\Http\Controllers\NilaiPlafondController; use Modules\Lpj\Http\Controllers\NocController; use Modules\Lpj\Http\Controllers\PembatalanController; use Modules\Lpj\Http\Controllers\PemilikJaminanController; @@ -242,7 +243,6 @@ Route::middleware(['auth'])->group(function () { Route::get('export', [ArahMataAnginController::class, 'export'])->name('export'); }); Route::resource('arah-mata-angin', ArahMataAnginController::class); - 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'); @@ -630,6 +630,14 @@ Route::middleware(['auth'])->group(function () { ->name('noc.datatables'); 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); + + }); require __DIR__ . '/registrasi.php';