diff --git a/app/Http/Controllers/DokumenJaminanController.php b/app/Http/Controllers/DokumenJaminanController.php index cdfaa22..04feb22 100644 --- a/app/Http/Controllers/DokumenJaminanController.php +++ b/app/Http/Controllers/DokumenJaminanController.php @@ -4,6 +4,7 @@ use App\Http\Controllers\Controller; use Exception; + use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; @@ -572,4 +573,40 @@ $combinedLegalitas = array_merge($existingLegalitas, $newLegalitas); return response()->json($combinedLegalitas); } + + public function clearDetail(Request $request) + { + try { + DB::beginTransaction(); + + $detailId = $request->input('detail_id'); + $detail = DetailDokumenJaminan::findOrFail($detailId); + + // Delete associated files + if ($detail->dokumen_jaminan) { + $dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan)) + ? json_decode($detail->dokumen_jaminan) + : [$detail->dokumen_jaminan]; + + foreach ($dokumen_jaminan as $dokumen) { + if (Storage::exists($dokumen)) { + Storage::delete($dokumen); + } + } + } + + // Delete the detail record + $detail->delete(); + + DB::commit(); + + return response()->json(['success' => true, 'message' => 'Detail berhasil dihapus']); + } catch (\Exception $e) { + DB::rollBack(); + return response()->json([ + 'success' => false, + 'message' => 'Gagal menghapus detail: ' . $e->getMessage() + ], 500); + } + } } diff --git a/app/Http/Controllers/LaporanExternalController.php b/app/Http/Controllers/LaporanExternalController.php new file mode 100644 index 0000000..ea6cec1 --- /dev/null +++ b/app/Http/Controllers/LaporanExternalController.php @@ -0,0 +1,173 @@ +paginate(10); + return view('lpj::laporan_external.index', compact('laporanExternals')); + } + + /** + * Show the form for creating a new resource. + */ + public function create() + { + return view('lpj::laporan_external.create'); + } + + /** + * Store a newly created resource in storage. + */ + public function store(LaporanExternalRequest $request) + { + $validatedData = $request->validated(); + + if ($request->hasFile('file_resume')) { + $validatedData['file_resume'] = $request->file('file_resume')->store('laporan_external/resume', 'public'); + } + + if ($request->hasFile('file_laporan')) { + $validatedData['file_laporan'] = $request->file('file_laporan')->store('laporan_external/laporan', 'public'); + } + + LaporanExternal::create($validatedData); + + return redirect()->route('laporan-external.index')->with('success', 'Laporan External berhasil ditambahkan.'); + } + + /** + * Show the specified resource. + */ + public function show(LaporanExternal $laporanExternal) + { + return view('lpj::laporan_external.show', compact('laporanExternal')); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit(LaporanExternal $laporanExternal) + { + $permohonan = Permohonan::find($laporanExternal->permohonan_id); + return view('lpj::laporan_external.create', compact('laporanExternal','permohonan')); + } + + /** + * Update the specified resource in storage. + */ + public function update(LaporanExternalRequest $request, LaporanExternal $laporanExternal) + { + $validatedData = $request->validated(); + + if ($request->hasFile('file_resume')) { + $validatedData['file_resume'] = $request->file('file_resume')->store('laporan_external/resume', 'public'); + } + + if ($request->hasFile('file_laporan')) { + $validatedData['file_laporan'] = $request->file('file_laporan')->store('laporan_external/laporan', 'public'); + } + + $laporanExternal->update($validatedData); + + return redirect()->route('laporan-external.index')->with('success', 'Laporan External berhasil diperbarui.'); + } + + /** + * Remove the specified resource from storage. + */ + public function destroy(LaporanExternal $laporanExternal) + { + $laporanExternal->delete(); + + return redirect()->route('laporan-external.index')->with('success', 'Laporan External berhasil dihapus.'); + } + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('jenis_aset.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Retrieve data from the database + $query = LaporanExternal::query(); + + // Apply search filter if provided + if ($request->has('search') && !empty($request->get('search'))) { + $search = $request->get('search'); + $query->where(function ($q) use ($search) { + $q->where('nomor_laporan', 'LIKE', "%$search%") + ->orWhere('tanggal_laporan', 'LIKE', "%$search%") + ->orWhereHas('permohonan', function($q) use ($search) { + $q->where('nomor_permohonan', 'LIKE', "%$search%"); + }) + ->orWhere('tgl_final_laporan', 'LIKE', "%$search%") + ->orWhere('nilai_pasar', 'LIKE', "%$search%") + ->orWhere('indikasi_nilai_likuidasi', 'LIKE', "%$search%") + ->orWhere('indikasi_nilai_pasar_tanah', 'LIKE', "%$search%") + ->orWhere('estimasi_harga_tanah', 'LIKE', "%$search%") + ->orWhere('estimasi_harga_bangunan', 'LIKE', "%$search%") + ->orWhere('indikasi_nilai_pasar_bangunan', 'LIKE', "%$search%") + ->orWhere('indikasi_nilai_pasar_sarana_pelengkap', 'LIKE', "%$search%") + ->orWhere('indikasi_nilai_pasar_mesin', 'LIKE', "%$search%") + ->orWhere('indikasi_nilai_pasar_kendaraan_alat_berat', 'LIKE', "%$search%") + ->orWhere('file_resume', 'LIKE', "%$search%") + ->orWhere('file_laporan', 'LIKE', "%$search%"); + }); + } + + // Apply sorting if provided + if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } + + // Get the total count of records + $totalRecords = $query->count(); + + // Apply pagination if provided + if ($request->has('page') && $request->has('size')) { + $page = $request->get('page'); + $size = $request->get('size'); + $offset = ($page - 1) * $size; // Calculate the offset + + $query->skip($offset)->take($size); + } + + // Get the filtered count of records + $filteredRecords = $query->count(); + + // Get the data for the current page + $data = $query->get(); + + // Calculate the page count + $pageCount = ceil($totalRecords / $request->get('size')); + + // Calculate the current page number + $currentPage = 0 + 1; + + // Return the response data as a JSON object + return response()->json([ + 'draw' => $request->get('draw'), + 'recordsTotal' => $totalRecords, + 'recordsFiltered' => $filteredRecords, + 'pageCount' => $pageCount, + 'page' => $currentPage, + 'totalCount' => $totalRecords, + 'data' => $data, + ]); + } +} diff --git a/app/Http/Controllers/OtorisasiPenawaranController.php b/app/Http/Controllers/OtorisasiPenawaranController.php index 4adee4e..49deb5e 100644 --- a/app/Http/Controllers/OtorisasiPenawaranController.php +++ b/app/Http/Controllers/OtorisasiPenawaranController.php @@ -336,8 +336,9 @@ public function show($id) { - $prosespenawaran = PenawaranTender::find($id); - return view('lpj::otorisasipenawaran.show', compact('id','prosespenawaran')); + $prosespenawaran = PenawaranTender::with(['permohonan','tujuanPenilaianKjpp'])->find($id); + $permohonan = $prosespenawaran->permohonan; + return view('lpj::otorisasipenawaran.show', compact('id','prosespenawaran','permohonan')); } public function penawaranulang(Request $request, $id): JsonResponse diff --git a/app/Http/Controllers/PembayaranController.php b/app/Http/Controllers/PembayaranController.php index f6fe6de..806a411 100644 --- a/app/Http/Controllers/PembayaranController.php +++ b/app/Http/Controllers/PembayaranController.php @@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; use Maatwebsite\Excel\Facades\Excel; use Modules\Lpj\Http\Requests\PersetujuanPenawaranRequest; +use Modules\Lpj\Models\LaporanExternal; use Modules\Lpj\Models\PenawaranTender; use Modules\Lpj\Models\Permohonan; use Modules\Lpj\Models\PersetujuanPenawaran; @@ -235,6 +236,13 @@ class PembayaranController extends Controller 'updated_by' => Auth::id(), 'updated_at' => now(), ]); + + LaporanExternal::create([ + 'permohonan_id' => $permohonan->id, + 'nomor_laporan' => $permohonan->nomor_registrasi, + 'tanggal_laporan' => now(), + 'created_by' => Auth::id(), + ]); } } diff --git a/app/Http/Controllers/RegistrasiController.php b/app/Http/Controllers/RegistrasiController.php index 42efcea..4695cbd 100644 --- a/app/Http/Controllers/RegistrasiController.php +++ b/app/Http/Controllers/RegistrasiController.php @@ -153,7 +153,6 @@ class RegistrasiController extends Controller if ($tindakan == 0) { $dataku['jenis_penilaian_id'] = $request->jenis_penilaian; $dataku['region_id'] = $request->region; - $dataku['sla'] = $request->sla; $dataku['status'] = 'registered'; if ($request->catatan2) { $dataku['registrasi_catatan'] = $request->catatan2; @@ -209,11 +208,7 @@ class RegistrasiController extends Controller if (1 == $jenis_penilaian) { $validateIt['region'] = ['required']; $messageIt ['region.required'] = 'Silahkan pilih Region'; - } else { - $validateIt['sla'] = ['required']; - $messageIt ['sla.required'] = 'Silahkan isi SLA'; } - } elseif ($tindakan == 1) { $validateIt['catatan'] = ['required']; $messageIt ['catatan.required'] = 'Silahkan isi Catatan'; diff --git a/app/Http/Controllers/SpkController.php b/app/Http/Controllers/SpkController.php index 770944c..f5de6aa 100644 --- a/app/Http/Controllers/SpkController.php +++ b/app/Http/Controllers/SpkController.php @@ -158,7 +158,7 @@ use Illuminate\Support\Facades\Auth; $penawaran->jenis_laporan_name = $penawaran->jenisLaporan->name; $penawaran->jenis_laporan_code = $penawaran->jenisLaporan->code; $penawaran->tujuan_penilaian_kjpp_name = $penawaran->tujuanPenilaianKjpp->name; - $penawaran->penilaian_waktu_penilain = $penawaran->penilaian->waktu_penilaian; + $penawaran->penilaian_waktu_penilain = $penawaran->penilaian->waktu_penilaian ?? ""; $permohonan = Permohonan::where('nomor_registrasi','=',$penawaran->nomor_registrasi) ->leftJoin('dokumen_jaminan', 'dokumen_jaminan.permohonan_id','=','permohonan.id') @@ -244,7 +244,7 @@ use Illuminate\Support\Facades\Auth; $penawaran->jenis_laporan_name = $penawaran->jenisLaporan->name; $penawaran->jenis_laporan_code = $penawaran->jenisLaporan->code; $penawaran->tujuan_penilaian_kjpp_name = $penawaran->tujuanPenilaianKjpp->name; - $penawaran->penilaian_waktu_penilain = $penawaran->penilaian->waktu_penilaian; + $penawaran->penilaian_waktu_penilain = $penawaran->penilaian->waktu_penilaian ?? ""; $permohonan = Permohonan::where('nomor_registrasi','=',$penawaran->nomor_registrasi) ->leftJoin('dokumen_jaminan', 'dokumen_jaminan.permohonan_id','=','permohonan.id') diff --git a/app/Http/Requests/LaporanExternalRequest.php b/app/Http/Requests/LaporanExternalRequest.php new file mode 100644 index 0000000..1e2a4f4 --- /dev/null +++ b/app/Http/Requests/LaporanExternalRequest.php @@ -0,0 +1,41 @@ + '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', + ]; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize() + : bool + { + return true; + } + } diff --git a/app/Models/LaporanExternal.php b/app/Models/LaporanExternal.php new file mode 100644 index 0000000..77a63e3 --- /dev/null +++ b/app/Models/LaporanExternal.php @@ -0,0 +1,32 @@ +belongsTo(Permohonan::class); + } +} 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 new file mode 100644 index 0000000..032cbbc --- /dev/null +++ b/database/migrations/2025_03_06_012851_create_laporan_externals_table.php @@ -0,0 +1,47 @@ +id(); + $table->foreignIdFor(Permohonan::class)->constrained('permohonan')->onDelete('cascade'); + $table->string('nomor_laporan'); + $table->date('tgl_final_laporan')->nullable(); + $table->decimal('nilai_pasar', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_likuidasi', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_tanah', 15, 2)->nullable(); + $table->decimal('estimasi_harga_tanah', 15, 2)->nullable(); + $table->decimal('estimasi_harga_bangunan', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_bangunan', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_sarana_pelengkap', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_mesin', 15, 2)->nullable(); + $table->decimal('indikasi_nilai_pasar_kendaraan_alat_berat', 15, 2)->nullable(); + $table->string('file_resume')->nullable(); // New field for resume file + $table->string('file_laporan')->nullable(); // New field for report file + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('laporan_externals'); + } +}; 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/component/detail-jaminan.blade.php b/resources/views/component/detail-jaminan.blade.php index 3d996ed..55b618a 100644 --- a/resources/views/component/detail-jaminan.blade.php +++ b/resources/views/component/detail-jaminan.blade.php @@ -50,6 +50,26 @@ + @if(isset($penawaran)) +
| + + | ++ 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 | +
|---|