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') +
| + + | ++ 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 | +
|---|