diff --git a/app/Exports/IjinUsahaExport.php b/app/Exports/IjinUsahaExport.php new file mode 100644 index 0000000..a7d02e4 --- /dev/null +++ b/app/Exports/IjinUsahaExport.php @@ -0,0 +1,47 @@ +id, + $row->code, + $row->name, + $row->created_at + ]; + } + + public function headings(): array + { + return [ + 'ID', + 'Code', + 'Name', + 'Created At' + ]; + } + + public function columnFormats(): array + { + return [ + 'A' => NumberFormat::FORMAT_NUMBER, + 'B' => NumberFormat::FORMAT_NUMBER, + 'E' => NumberFormat::FORMAT_DATE_DATETIME + ]; + } +} diff --git a/app/Exports/JenisLaporanExport.php b/app/Exports/JenisLaporanExport.php new file mode 100644 index 0000000..c647ee6 --- /dev/null +++ b/app/Exports/JenisLaporanExport.php @@ -0,0 +1,46 @@ +id, + $row->code, + $row->name, + $row->created_at + ]; + } + + public function headings(): array + { + return [ + 'ID', + 'Code', + 'Name', + 'Created At' + ]; + } + + public function columnFormats(): array + { + return [ + 'A' => NumberFormat::FORMAT_NUMBER, + 'D' => NumberFormat::FORMAT_DATE_DATETIME + ]; + } +} diff --git a/app/Exports/JenisPenilaianExport.php b/app/Exports/JenisPenilaianExport.php new file mode 100644 index 0000000..7d633eb --- /dev/null +++ b/app/Exports/JenisPenilaianExport.php @@ -0,0 +1,46 @@ +id, + $row->code, + $row->name, + $row->created_at + ]; + } + + public function headings(): array + { + return [ + 'ID', + 'Code', + 'Jenis Penilaian', + 'Created At' + ]; + } + + public function columnFormats(): array + { + return [ + 'A' => NumberFormat::FORMAT_NUMBER, + 'D' => NumberFormat::FORMAT_DATE_DATETIME + ]; + } +} diff --git a/app/Exports/KJPPExport.php b/app/Exports/KJPPExport.php new file mode 100644 index 0000000..3b0cb13 --- /dev/null +++ b/app/Exports/KJPPExport.php @@ -0,0 +1,89 @@ +id, + $row->code, + $row->name, + $row->jenis_kantor, + $row->nomor_ijin_usaha, + $row->province_code, + $row->city_code, + $row->district_code, + $row->village_code, + $row->address, + $row->postal_code, + $row->nomor_telepon_kantor, + $row->email_kantor, + $row->nama_pimpinan, + $row->nomor_hp_pimpinan, + $row->nama_pic_reviewer, + $row->nomor_hp_pic_reviewer, + $row->nama_pic_admin, + $row->nomor_hp_pic_admin, + $row->nama_pic_marketing, + $row->nomor_hp_pic_marketing, + $row->ijin_usaha_id, + $row->jenis_aset_id, + $row->attachment, + $row->created_at + ]; + } + + public function headings(): array + { + return [ + 'ID', + 'Code', + 'Name', + 'Jenis Kantor', + 'Nomor Ijin Usaha', + 'Province Code', + 'City Code', + 'District Code', + 'Village Code', + 'Address', + 'Postal Code', + 'Nomor Telepon Kantor', + 'Email Kantor', + 'Nama Pimpinan', + 'Nomor HP Pimpinan', + 'Nama PIC Reviewer', + 'Nomor HP PIC Reviewer', + 'Nama PIC Admin', + 'Nomor HP PIC Admin', + 'Nama PIC Marketing', + 'Nomor HP PIC Marketing', + 'Ijin Usaha ID', + 'Jenis Aset ID', + 'Attachment', + 'Created At' + ]; + } + + public function columnFormats(): array + { + return [ + 'A' => NumberFormat::FORMAT_NUMBER, + 'B' => NumberFormat::FORMAT_NUMBER, + 'E' => NumberFormat::FORMAT_DATE_DATETIME + ]; + } +} diff --git a/app/Exports/PenawaranTenderExport.php b/app/Exports/PenawaranTenderExport.php new file mode 100644 index 0000000..ba00879 --- /dev/null +++ b/app/Exports/PenawaranTenderExport.php @@ -0,0 +1,63 @@ +id, + $row->code, + $row->nama_kjpp_sebelumnya, + $row->biaya_kjpp_sebelumnya, + $row->tanggal_penilaian_sebelumnya, + $row->nomor_registrasi, + $row->tujuan_penilaian_kjpp_id, + $row->jenis_laporan_id, + $row->start_date, + $row->end_date, + $row->catatan, + $row->created_at + ]; + } + + public function headings(): array + { + return [ + 'ID', + 'Nomor Penawaran', + 'Nama KJPP Sebelumnya', + 'Biaya KJPP Sebelumnya', + 'Tanggal Penilaian Sebelumnya', + 'Nomor Registrasi', + 'Tujuan Penilaian KJPP ID', + 'Jenis Laporan ID', + 'Start Date', + 'End Date', + 'Catatan', + 'Created At' + ]; + } + + public function columnFormats(): array + { + return [ + 'A' => NumberFormat::FORMAT_NUMBER, + 'B' => NumberFormat::FORMAT_NUMBER, + 'E' => NumberFormat::FORMAT_DATE_DATETIME + ]; + } +} diff --git a/app/Exports/PermohonanExport.php b/app/Exports/PermohonanExport.php index 07b83fe..c6ce0a2 100644 --- a/app/Exports/PermohonanExport.php +++ b/app/Exports/PermohonanExport.php @@ -28,6 +28,8 @@ $row->branch->name, $row->tujuanPenilaian->name, $row->debiture->name, + $row->fasilitasKredit->name, + $row->plafond->name, $row->status, $row->authorized_at, $row->authorized_status, @@ -47,7 +49,9 @@ 'Branch Pemohon', 'Tujuan Penilaian', 'Debitur', - 'Status', + 'Jenis Fasilitas Kredit', + 'Nilai Plafond', + 'Status Permohonan', 'Tanggal Pengesahan', 'Status Pengesahan', 'Pengesah', @@ -61,7 +65,8 @@ return [ 'A' => NumberFormat::FORMAT_NUMBER, 'C' => NumberFormat::FORMAT_DATE_DATETIME, - 'L' => NumberFormat::FORMAT_DATE_DATETIME + 'K' => NumberFormat::FORMAT_DATE_DATETIME, + 'N' => NumberFormat::FORMAT_DATE_DATETIME ]; } } diff --git a/app/Exports/RegionExport.php b/app/Exports/RegionExport.php new file mode 100644 index 0000000..a7b2b51 --- /dev/null +++ b/app/Exports/RegionExport.php @@ -0,0 +1,49 @@ +id, + $row->code, + $row->name, + $row->created_at + ]; + } + + public function headings() + : array + { + return [ + 'ID', + 'Code', + 'Name', + 'Created At' + ]; + } + + public function columnFormats() + : array + { + return [ + 'A' => NumberFormat::FORMAT_NUMBER, + 'D' => NumberFormat::FORMAT_DATE_DATETIME + ]; + } + } diff --git a/app/Exports/TeamPenilaianExport.php b/app/Exports/TeamPenilaianExport.php new file mode 100644 index 0000000..3fdc1f7 --- /dev/null +++ b/app/Exports/TeamPenilaianExport.php @@ -0,0 +1,57 @@ +join('regions', 'teams.regions_id', '=', 'regions.id') + ->leftJoin('teams_users', 'teams.id', '=', 'teams_users.teams_id') + ->leftJoin('users', 'teams_users.user_id', '=', 'users.id') + ->groupBy('teams.id', 'teams.name', 'regions.name') + ->get(); + } + + public function map($row): array + { + return [ + $row->team_name, + $row->region_name, + $row->team_group, + ]; + } + + public function headings(): array + { + return [ + 'Name', + 'Region', + 'Anggota Team', + ]; + } + + public function columnFormats(): array + { + return [ + 'A' => NumberFormat::FORMAT_TEXT, + 'B' => NumberFormat::FORMAT_TEXT, + 'C' => NumberFormat::FORMAT_TEXT, + ]; + } +} diff --git a/app/Exports/TujuanPenilaianKJPPExport.php b/app/Exports/TujuanPenilaianKJPPExport.php new file mode 100644 index 0000000..073db3a --- /dev/null +++ b/app/Exports/TujuanPenilaianKJPPExport.php @@ -0,0 +1,46 @@ +id, + $row->code, + $row->name, + $row->created_at + ]; + } + + public function headings(): array + { + return [ + 'ID', + 'Code', + 'Name', + 'Created At' + ]; + } + + public function columnFormats(): array + { + return [ + 'A' => NumberFormat::FORMAT_NUMBER, + 'D' => NumberFormat::FORMAT_DATE_DATETIME + ]; + } +} diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php new file mode 100644 index 0000000..c24eee2 --- /dev/null +++ b/app/Http/Controllers/ActivityController.php @@ -0,0 +1,152 @@ +get(); + + $permohonan = Permohonan::with( + [ + 'user', + 'debiture.province', + 'debiture.city', + 'debiture.district', + 'debiture.village', + 'branch', + 'tujuanPenilaian', + 'penilaian' + ], + )->findOrFail($id); + + return view('lpj::activity.activitydetail', compact('id', 'status_permohonan', 'permohonan')); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + return view('lpj::edit'); + } + + /** + * Update the specified resource in storage. + */ + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('debitur.view')) { + // abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Retrieve data from the database + $query = Permohonan::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_registrasi', 'LIKE', '%' . $search . '%'); + $q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('debiture', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhere('status', 'LIKE', '%' . $search . '%'); + }); + } + + // Apply status filter if provided + if ($request->has('status') && !empty($request->get('status'))) { + $status = $request->get('status'); + $query->where('status', '=', $status); + } + + // Default sorting if no sort provided + if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } else { + $query->orderBy('nomor_registrasi', 'asc'); // Default order by nomor_registrasi + } + + // Get the total count of records before paginating + $totalRecords = $query->count(); + + // Apply pagination if provided + if ($request->has('page') && $request->has('size')) { + $page = (int) $request->get('page', 1); // Default page is 1 + $size = (int) $request->get('size', 10); // Default size is 10 + $offset = ($page - 1) * $size; // Calculate the offset + + // Limit results based on pagination + $query->skip($offset)->take($size); + } + + // Get the filtered count of records (after search & filters applied) + $filteredRecords = $query->count(); + + // Get the data for the current page + $data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->get(); + + // Calculate the total number of pages + $pageCount = ceil($totalRecords / $request->get('size', 10)); + + // Return the response data as a JSON object + return response()->json([ + 'draw' => $request->get('draw'), + 'recordsTotal' => $totalRecords, + 'recordsFiltered' => $filteredRecords, + 'pageCount' => $pageCount, + 'page' => $request->get('page', 1), + 'totalCount' => $totalRecords, + 'data' => $data, + ]); + } + + + /** + * Download the specified resource from storage. + */ + public function download($id) + { + $document = Permohonan::find($id); + return response()->download(storage_path('app/public/' . $document->dokumen)); + } +} diff --git a/app/Http/Controllers/DebitureController.php b/app/Http/Controllers/DebitureController.php index 7929578..b429265 100644 --- a/app/Http/Controllers/DebitureController.php +++ b/app/Http/Controllers/DebitureController.php @@ -71,6 +71,7 @@ public function update(DebitureRequest $request, $id) { + //print_r($request->all());exit; $validate = $request->validated(); if ($validate) { @@ -174,10 +175,4 @@ { return Excel::download(new DebitureExport, 'debitur.xlsx'); } - - public function download($id) - { - $document = DokumenJaminan::find($id); - return response()->download(storage_path('app/public/' . $document->dokumen_jaminan)); - } } diff --git a/app/Http/Controllers/DokumenJaminanController.php b/app/Http/Controllers/DokumenJaminanController.php index 1907fbf..dca91a5 100644 --- a/app/Http/Controllers/DokumenJaminanController.php +++ b/app/Http/Controllers/DokumenJaminanController.php @@ -4,12 +4,15 @@ use App\Http\Controllers\Controller; use Exception; + use Illuminate\Support\Facades\DB; + use Illuminate\Support\Facades\Storage; use Modules\Location\Models\City; use Modules\Location\Models\District; use Modules\Location\Models\Province; use Modules\Location\Models\Village; use Modules\Lpj\Http\Requests\DokumenJaminanRequest; use Modules\Lpj\Models\Debiture; + use Modules\Lpj\Models\DetailDokumenJaminan; use Modules\Lpj\Models\DokumenJaminan; use Modules\Lpj\Models\JenisJaminan; use Modules\Lpj\Models\JenisLegalitasJaminan; @@ -23,7 +26,7 @@ public function index($id) { $debitur = Debiture::find($id); - $documents = DokumenJaminan::with('pemilik')->where('debiture_id', $id)->get(); + $documents = DokumenJaminan::with('pemilik', 'detail')->where('debiture_id', $id)->get(); return view( 'lpj::debitur.edit', @@ -36,8 +39,10 @@ $debitur = Debiture::find($id); $validate = $request->validated(); + if ($validate) { try { + DB::beginTransaction(); $validate['debiture_id'] = $id; if ($validate['pemilik_jaminan_id'] == 0) { @@ -61,22 +66,53 @@ $validate['pemilik_jaminan_id'] = $pemilikJaminan->id; } - if ($request->hasFile('dokumen_jaminan')) { - $file = $request->file('dokumen_jaminan'); - $file_name = $file->getClientOriginalName(); - $file->storeAs('public/jaminan/' . $debitur->id, $file_name); - $validate['dokumen_jaminan'] = 'jaminan/' . $debitur->id . '/' . $file_name; + $document = DokumenJaminan::create($validate); + + try { + foreach ($request->dokumen_jaminan as $key => $value) { + $file_name = $value->getClientOriginalName(); + + if ($file_name) { + try { + $file_name = $value->getClientOriginalName(); + $value->storeAs( + 'public/jaminan/' . $debitur->id . '/' . $document->id . '/', + $file_name, + ); + + $detail = [ + 'dokumen_jaminan_id' => $document->id, + 'jenis_legalitas_jaminan_id' => $request->jenis_legalitas_jaminan_id[$key], + 'dokumen_jaminan' => 'jaminan/' . $debitur->id . '/' . $document->id . '/' . $file_name, + 'name' => $request->name[$key], + 'keterangan' => $request->keterangan[$key], + ]; + DetailDokumenJaminan::create($detail); + } catch (Exception $e) { + DB::rollBack(); + return redirect()->route('debitur.jaminan.index', $id)->with( + 'error', + 'Gagal upload file dokumen jaminan ' . $key . ': ' . $e->getMessage(), + ); + } + } + } + DB::commit(); + } catch (Exception $e) { + DB::rollBack(); + return redirect()->route('debitur.jaminan.index', $id)->with( + 'error', + 'gg' . $e->getMessage(), + ); } - - DokumenJaminan::create($validate); - return redirect()->route('debitur.jaminan.index', $id)->with( 'success', 'Dokumen Jaminan berhasil ditambahkan', ); } catch (Exception $e) { - return redirect()->route('debitur.jaminan.index', $id)->with('error', $e->getMessage()); + DB::rollBack(); + return redirect()->route('debitur.jaminan.index', $id)->with('error', 'ggl' . $e->getMessage()); } } } @@ -102,6 +138,7 @@ $validate = $request->validated(); if ($validate) { try { + DB::beginTransaction(); $validate['debiture_id'] = $id; if ($validate['pemilik_jaminan_id'] == 0) { @@ -124,29 +161,77 @@ ], $pemilik_jaminan); } - if ($request->hasFile('dokumen_jaminan')) { - $file = $request->file('dokumen_jaminan'); - $file_name = $file->getClientOriginalName(); - $file->storeAs('public/jaminan/' . $debitur->id, $file_name); - $validate['dokumen_jaminan'] = 'jaminan/' . $debitur->id . '/' . $file_name; - } - $document = DokumenJaminan::find($jaminan); $document->update($validate); + if ($request->detail_dokumen_jaminan_id) { + foreach ($request->detail_dokumen_jaminan_id as $key => $value) { + if (isset($request->dokumen_jaminan[$key])) { + $file = $request->dokumen_jaminan[$key]; + if ($file) { + $file_name = $file->getClientOriginalName(); + } + + if (isset($file_name)) { + $file->storeAs( + 'public/jaminan/' . $debitur->id . '/' . $document->id . '/', + $file_name, + ); + + $detail = [ + 'dokumen_jaminan_id' => $document->id, + 'jenis_legalitas_jaminan_id' => $request->jenis_legalitas_jaminan_id[$key], + 'dokumen_jaminan' => 'jaminan/' . $debitur->id . '/' . $document->id . '/' . $file_name, + 'name' => $request->name[$key], + 'keterangan' => $request->keterangan[$key], + ]; + if (isset($request->detail_dokumen_jaminan_id[$key])) { + $detailDocument = DetailDokumenJaminan::find( + $request->detail_dokumen_jaminan_id[$key], + ); + + $detailDocument->update($detail); + $detailDocument->save(); + } + } + } else { + $detail = [ + 'dokumen_jaminan_id' => $document->id, + 'jenis_legalitas_jaminan_id' => $request->jenis_legalitas_jaminan_id[$key], + 'name' => $request->name[$key], + 'keterangan' => $request->keterangan[$key], + ]; + + if (isset($request->detail_dokumen_jaminan_id[$key])) { + $detailDocument = DetailDokumenJaminan::find( + $request->detail_dokumen_jaminan_id[$key], + ); + $detailDocument->update($detail); + } + } + } + } + + DB::commit(); return redirect()->route('debitur.jaminan.index', $id)->with( 'success', 'Dokumen Jaminan berhasil diubah', ); - } catch (Exception $e) { + } catch + (Exception $e) { + DB::rollBack(); return redirect()->route('debitur.jaminan.index', $id)->with('error', $e->getMessage()); } } } - public function edit($id, $jaminan) - { + public + function edit( + $id, + $jaminan, + ) { $document = DokumenJaminan::find($jaminan); + $details = DetailDokumenJaminan::where('dokumen_jaminan_id', $document->id)->get(); $debitur = Debiture::find($document->debiture_id); $provinces = Province::all(); $cities = City::where('province_code', $document->province_code)->get(); @@ -164,6 +249,7 @@ 'jenisJaminan', 'jenisLegalitasJaminan', 'document', + 'details', 'cities', 'districts', 'villages', @@ -172,14 +258,30 @@ ); } - public function destroy($id, $jaminan_id) - { + public + function destroy( + $id, + $jaminan_id, + ) { try { $jaminan = DokumenJaminan::find($jaminan_id); + $details = DetailDokumenJaminan::where('dokumen_jaminan_id',$jaminan->id)->get(); + foreach ($details as $detail){ + Storage::delete('public/'. $detail->dokumen_jaminan); + $detail->delete(); + } $jaminan->delete(); echo json_encode(['success' => true, 'message' => 'Dokumen Jaminan deleted successfully']); } catch (Exception $e) { echo json_encode(['success' => false, 'message' => 'Failed to delete Dokumen Jaminan']); } } + + public + function download( + $id, + ) { + $document = DetailDokumenJaminan::find($id); + return response()->download(storage_path('app/public/' . $document->dokumen_jaminan)); + } } diff --git a/app/Http/Controllers/IjinUsahaController.php b/app/Http/Controllers/IjinUsahaController.php new file mode 100644 index 0000000..360d223 --- /dev/null +++ b/app/Http/Controllers/IjinUsahaController.php @@ -0,0 +1,174 @@ +validated(); + + if ($validate) { + try { + IjinUsaha::create($validate); + return redirect() + ->route('basicdata.ijin_usaha.index') + ->with('success', 'Ijin Usaha created successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.ijin_usaha.create') + ->with('error', 'Failed to create ijin Usaha'); + } + } + } + + /** + * Show the specified resource. + */ + public function show($id) + { + // return view('lpj::show'); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + $ijin_usaha = IjinUsaha::find($id); + return view('lpj::Ijin_usaha.create', compact('ijin_usaha')); + } + + /** + * Update the specified resource in storage. + */ + public function update(IjinUsahaRequest $request, $id) + { + $validate = $request->validated(); + + if ($validate) { + try { + // Update in database + $ijin_usaha = IjinUsaha::find($id); + $ijin_usaha->update($validate); + return redirect() + ->route('basicdata.ijin_usaha.index') + ->with('success', 'Ijin Usaha updated successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.ijin_usaha.edit', $id) + ->with('error', 'Failed to update ijin$ijin_usaha'); + } + } + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + try { + $ijin_usaha = IjinUsaha::find($id); + $ijin_usaha->delete(); + + echo json_encode(['success' => true, 'message' => 'Ijin Usaha deleted successfully']); + } catch (Exception $e) { + echo json_encode(['success' => false, 'message' => 'Failed to delete Ijin Usaha']); + } + } + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('Ijin_usaha.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Retrieve data from the database + $query = IjinUsaha::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('code', 'LIKE', "%$search%"); + $q->orWhere('name', '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, + ]); + } + + public function export() + { + return Excel::download(new IjinUsahaExport, 'ijin_usaha.xlsx'); + } +} diff --git a/app/Http/Controllers/JenisJaminanController.php b/app/Http/Controllers/JenisJaminanController.php index f9736d2..e1cbe82 100644 --- a/app/Http/Controllers/JenisJaminanController.php +++ b/app/Http/Controllers/JenisJaminanController.php @@ -9,6 +9,7 @@ use Modules\Lpj\Exports\JenisJaminanExport; use Modules\Lpj\Http\Requests\JenisJaminanRequest; use Modules\Lpj\Models\JenisJaminan; + use Modules\Lpj\Models\JenisLegalitasJaminan; class JenisJaminanController extends Controller { @@ -40,13 +41,15 @@ public function create() { - return view('lpj::jenis_jaminan.create'); + $jenisLegalitasJaminan = JenisLegalitasJaminan::all(); + return view('lpj::jenis_jaminan.create', compact('jenisLegalitasJaminan')); } public function edit($id) { - $jenisJaminan = JenisJaminan::find($id); - return view('lpj::jenis_jaminan.create', compact('jenisJaminan')); + $jenisJaminan = JenisJaminan::find($id); + $jenisLegalitasJaminan = JenisLegalitasJaminan::all(); + return view('lpj::jenis_jaminan.create', compact('jenisJaminan', 'jenisLegalitasJaminan')); } public function update(JenisJaminanRequest $request, $id) @@ -147,4 +150,13 @@ { return Excel::download(new JenisJaminanExport, 'jenis_jaminan.xlsx'); } + + public function legalitasJaminan($id) + { + $jenisJaminan = JenisJaminan::find($id); + $legalitasJaminan = $jenisJaminan->jenis_legalitas_jaminan_id; + + $legalitas = JenisLegalitasJaminan::whereIn('code', json_decode($legalitasJaminan, true))->get(); + echo json_encode($legalitas); + } } diff --git a/app/Http/Controllers/JenisLaporanController.php b/app/Http/Controllers/JenisLaporanController.php new file mode 100644 index 0000000..ed93164 --- /dev/null +++ b/app/Http/Controllers/JenisLaporanController.php @@ -0,0 +1,174 @@ +validated(); + + if ($validate) { + try { + JenisLaporan::create($validate); + return redirect() + ->route('basicdata.jenis_laporan.index') + ->with('success', 'Jenis Laporan created successfully'); + } catch (Throwable $e) { + return redirect() + ->route('basicdata.jenis_laporan.create') + ->with('success', 'Failed to create Jenis Laporan: ' . $e); + } + } + } + + /** + * Show the specified resource. + */ + public function show($id) + { + // return view('lpj::show'); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + $jenisLaporan = JenisLaporan::find($id); + return view('lpj::jenis_laporan.create', compact('jenisLaporan')); + } + + /** + * Update the specified resource in storage. + */ + public function update(JenisLaporanRequest $request, $id) + { + $validate = $request->validated(); + + if ($validate) { + try { + $jenisLaporan = JenisLaporan::find($id); + $jenisLaporan->update($validate); + return redirect() + ->route('basicdata.jenis_laporan.index') + ->with('success', 'Jenis Laporan updated successfully'); + } catch (Throwable $e) { + return redirect() + ->route('basicdata.jenis_laporan.edit', $id) + ->with('success', 'Failed to update Jenis Laporan: ' . $e); + } + } + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + try { + // Delete from database + $jenisLaporan = JenisLaporan::find($id); + $jenisLaporan->delete(); + + echo json_encode(['success' => true, 'message' => 'Jenis Laporan deleted successfully']); + } catch (Throwable $e) { + echo json_encode(['success' => false, 'message' => 'Failed to delete jenis Laporan']); + } + } + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('jenis_jaminan.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Retrieve data from the database + $query = JenisLaporan::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('code', 'LIKE', "%$search%"); + $q->orWhere('name', '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, + ]); + } + + public function export() + { + return Excel::download(new JenisLaporanExport, 'jenis_laporan.xlsx'); + } +} diff --git a/app/Http/Controllers/JenisPenilaianController.php b/app/Http/Controllers/JenisPenilaianController.php new file mode 100644 index 0000000..e70fcdb --- /dev/null +++ b/app/Http/Controllers/JenisPenilaianController.php @@ -0,0 +1,156 @@ +validated(); + + try { + JenisPenilaian::create($validate); + return redirect()->route('basicdata.jenis-penilaian.index')->with('success', 'Jenis Penilaian created successfully'); + } catch (Exception $e) { + return redirect()->route('basicdata.jenis-penilaian.create')->with('error', $e->getMessage()); + } + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + $jenisPenilaian = JenisPenilaian::find($id); + return view('lpj::jenis_penilaian.form', compact('jenisPenilaian')); + } + + /** + * Update the specified resource in storage. + */ + public function update(JenisPenilaianRequest $request, $id) + { + + $validated = $request->validated(); + + + if ($validated) { + try { + $jenisPenilaian = JenisPenilaian::find($id); + $jenisPenilaian->update($validated); + return redirect()->route('basicdata.jenis-penilaian.index')->with('success', 'Jenis Penilaian updated successfully'); + } catch (Exception $e) { + return redirect()->route('basicdata.jenis-penilaian.edit', $id)->with('error', $e->getMessage()); + } + } + + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + try { + $jenisPenilaian = JenisPenilaian::find($id); + $jenisPenilaian->delete(); + echo json_encode(['success' => true, 'message' => 'Jenis Penilaian deleted successfully']); + + } catch (Exception $e) { + echo json_encode(['success' => false, 'message' => 'Failed to delete Jenis Penilaian']); + } + } + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('jenis_penilaian.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + $query = JenisPenilaian::query(); + + if ($request->has('search') && !empty($request->get('search'))) { + $search = $request->get('search'); + $query->where(function ($q) use ($search) { + $q->where('code', 'LIKE', "%$search%"); + $q->orWhere('name', 'LIKE', "%$search%"); + }); + } + + if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } + + $totalRecords = $query->count(); + + + $size = $request->get('size'); + $pageCount = 1; + + if ($size > 0) { + if ($request->has('page') && $request->has('size')) { + $page = $request->get('page'); + $offset = ($page - 1) * $size; + $query->skip($offset)->take($size); + $filteredRecords = $query->count(); + $pageCount = ceil($totalRecords / $size); + } + + $data = $query->get(); + } else { + $filteredRecords = $totalRecords; + $data = $query->get(); + } + + $currentPage = $request->get('page') ?? 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 + ]); + } + + + public function export() + { + return Excel::download(new JenisPenilaianExport(), 'jenis-penilaian.xlsx'); + } +} diff --git a/app/Http/Controllers/KJPPController.php b/app/Http/Controllers/KJPPController.php new file mode 100644 index 0000000..99a0c2f --- /dev/null +++ b/app/Http/Controllers/KJPPController.php @@ -0,0 +1,255 @@ +first(); + $nextNumber = $lastKjpp ? intval(substr($lastKjpp->code, 1, 6)) + 1 : 1; + $kjppNumber = 'K' . str_pad($nextNumber, 6, '0', STR_PAD_LEFT); + + // Combine KJPP number with branch code + $fullKjppNumber = $kjppNumber; + + return view('lpj::kjpp.create', compact('branch', 'ijin_usaha', 'jenis_aset', 'provinces', 'fullKjppNumber')); + } + + /** + * Store a newly created resource in storage. + */ + public function store(KJPPRequest $request) + { + $validated = $request->validated(); + + if ($validated) { + $file = $request->file('attachment'); + $filename = $file ? time() . '.' . $file->getClientOriginalExtension() : 'default.pdf'; + + if ($file) { + // Simpan file yang diunggah + $file->storeAs('public/uploads_pdf', $filename); + } else { + // Salin file default ke lokasi yang diinginkan + Storage::copy('public/test/default.pdf', 'public/uploads_pdf/' . $filename); + } + + $validated['ijin_usaha_id'] = json_encode($request->input('ijin_usaha_id')); + $validated['jenis_aset_id'] = json_encode($request->input('jenis_aset_id')); + + // Tambahkan nama file ke data yang divalidasi + $validated['attachment'] = $filename; + + // Simpan data ke database + KJPP::create($validated); + + return redirect() + ->route('basicdata.kjpp.index') + ->with('success', 'KJPP created successfully'); + } else { + return redirect() + ->route('basicdata.kjpp.create') + ->with('error', 'Validation failed'); + } + } + + /** + * Show the specified resource. + */ + public function show($id) + { + $kjpp = KJPP::find($id); + $ijin_usaha = IjinUsaha::where('code', $kjpp->nomor_ijin_usaha)->get(); + $ijin_usahas = IjinUsaha::all(); + $jenis_jaminan = JenisJaminan::all(); + $branches = Branch::where('name', $kjpp->jenis_kantor)->get(); + $provinces = Province::where('code', $kjpp->province_code)->get(); + $cities = City::where('code', $kjpp->city_code)->get(); + $districts = District::where('code', $kjpp->district_code)->get(); + $villages = Village::where('code', $kjpp->village_code)->get(); + // dd($branches); + return view('lpj::kjpp.show', compact('jenis_jaminan', 'ijin_usahas', 'ijin_usaha', 'branches', 'kjpp', 'provinces', 'cities', 'districts', 'villages')); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + $kjpp = KJPP::find($id); + $branch = Branch::all(); + $ijin_usaha = IjinUsaha::all(); + $jenis_aset = JenisJaminan::all(); + $provinces = Province::all(); + $cities = City::where('province_code', $kjpp->province_code)->get(); + $districts = District::where('city_code', $kjpp->city_code)->get(); + $villages = Village::where('district_code', $kjpp->district_code)->get(); + + return view('lpj::kjpp.create', compact('kjpp', 'branch', 'ijin_usaha', 'jenis_aset', 'provinces', 'cities', 'districts', 'villages')); + } + + /** + * Update the specified resource in storage. + */ + public function update(KJPPRequest $request, $id) + { + $validated = $request->validated(); + + if ($validated) { + $file = $request->file('attachment'); + $filename = $file ? time() . '.' . $file->getClientOriginalExtension() : null; + + if ($file !== null) { + // Jika ada file dari database maka hapus file yang lama ke file yang baru + $kjpp = KJPP::find($id); + // Jika filenya ada default.pdf jangan dihapus + if ($kjpp->attachment !== 'default.pdf') { + Storage::delete('public/uploads_pdf/' . $kjpp->attachment); + } + // Simpan file yang diunggah + $file->storeAs('public/uploads_pdf', $filename); + $validated['attachment'] = $filename; + } else { + // Jika tidak ada file yang diunggah, gunakan file yang sudah ada atau file default + $kjpp = KJPP::find($id); + $validated['attachment'] = $kjpp->attachment ?? 'default.pdf'; + } + + // Perbarui data di database + KJPP::where('id', $id)->update($validated); + + return redirect() + ->route('basicdata.kjpp.index') + ->with('success', 'KJPP updated successfully'); + } else { + return redirect() + ->route('basicdata.kjpp.edit', $id) + ->with('error', 'Validation failed'); + } + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + try { + $kjpp = KJPP::find($id); + + // Jangan hapus file default.pdf + if ($kjpp->attachment && $kjpp->attachment !== 'default.pdf') { + Storage::delete('public/uploads_pdf/' . $kjpp->attachment); + } + + // Hapus data dari database + $kjpp->delete(); + + echo json_encode(['success' => true, 'message' => 'KJPP deleted successfully']); + } catch (Throwable $e) { + echo json_encode(['success' => false, 'message' => 'Failed to delete branch: ' . $e]); + } + } + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('kjpp.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Retrieve data from the database + $query = KJPP::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('code', 'LIKE', "%$search%"); + $q->orWhere('name', 'LIKE', "%$search%"); + $q->orWhere('jenis_kantor', '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, + ]); + } + + public function export() + { + return Excel::download(new KJPPExport, 'kjpp.xlsx'); + } +} diff --git a/app/Http/Controllers/PenilaianController.php b/app/Http/Controllers/PenilaianController.php new file mode 100644 index 0000000..0576671 --- /dev/null +++ b/app/Http/Controllers/PenilaianController.php @@ -0,0 +1,225 @@ +all());exit; + $validatedData = $request->validated(); + if ($validatedData) { + try { + $penilaian = Penilaian::create($validatedData); + + $permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi); + $permohonan->update([ + 'status' => 'assign', + ]); + + return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil disimpan'); + } catch (Exception $e) { + + return redirect()->route('penilaian.index')->with('error', $e->getMessage()); + } + } + } + + /** + * Show the form for creating a new resource. + */ + public function create($id) + { + return view('lpj::penilaian.form'); + } + + /** + * Update the specified resource in storage. + */ + public function update(PenilaianRequest $request, $id) + { + $validate = $request->validated(); + if ($validate) { + try { + $penilaian = Penilaian::where('nomor_registrasi', $request->nomor_registrasi)->firstOrFail(); + $penilaian->update($validate); + $permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi); + $permohonan->update([ + 'status' => 'assign', + ]); + + return redirect()->route('penilaian.index', $id)->with('success', 'Penilaian berhasil diubah'); + } catch (Exception $e) { + return redirect()->route('penilaian.index', $id)->with('error', $e->getMessage()); + } + } + } + + /** + * Show the form for editing the specified resource. + */ + public function assignment($id) + { + $permohonan = Permohonan::with( + [ + 'user', + 'debiture.province', + 'debiture.city', + 'debiture.district', + 'debiture.village', + 'branch', + 'tujuanPenilaian', + ], + )->findOrFail($id); + + $jenisPenilaian = JenisPenilaian::all(); + $teamPenilai = Teams::with(['regions', 'teamsUsers'])->get(); + + $penilaian = Penilaian::where('nomor_registrasi', $permohonan->nomor_registrasi)->first(); + + return view('lpj::penilaian.form', compact('permohonan', 'teamPenilai', 'jenisPenilaian', 'penilaian')); + } + + /** + * Remove the specified resource from storage. + */ + + public function revisi(PenilaianRequest $request, $nomor_registrasi) + { + $validatedData = $request->validated(); + if ($validatedData) { + + try { + + if (isset($validatedData['dokumen']) && $request->hasFile('dokumen')) { + $file_name = $validatedData['dokumen']->getClientOriginalName(); + $validatedData['dokumen']->storeAs('public/dokumen_revisi', $file_name); + } + + $dataToUpdate = [ + 'keterangan' => $validatedData['keterangan'], + 'dokumen' => 'dokumen_revisi/' . $file_name, + 'status' => 'revisi', + ]; + + // dump($dataToUpdate); + + $permohonan = Permohonan::where('nomor_registrasi', $nomor_registrasi)->first(); + + $permohonan->update($dataToUpdate); + return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil direvisi'); + } catch (Exception $e) { + dump($e->getMessage()); + // return redirect()->route('penilaian.index')->with('error', $e->getMessage()); + } + } + } + + + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('debitur.view')) { + // abort(403, 'Sorry! You are not allowed to view users.'); + } + + $query = Permohonan::query(); + + if ($request->has('search') && !empty($request->get('search'))) { + $search = $request->get('search'); + $query->where(function ($q) use ($search) { + $q->where('nomor_registrasi', 'LIKE', '%' . $search . '%'); + $q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('debiture', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhere('status', 'LIKE', '%' . $search . '%'); + }); + } + + $query->whereRaw('LOWER(status) = ?', ['register']); + + if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } + + $totalRecords = $query->count(); + + $size = $request->get('size', 10); + if ($size == 0) { + $size = 10; + } + + if ($request->has('page') && $request->has('size')) { + $page = $request->get('page', 1); + $offset = ($page - 1) * $size; + + $query->skip($offset)->take($size); + } + + $filteredRecords = $query->count(); + $data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->get(); + + $pageCount = ceil($totalRecords / $size); + + $currentPage = max(1, $request->get('page', 1)); + return response()->json([ + 'draw' => $request->get('draw'), + 'recordsTotal' => $totalRecords, + 'recordsFiltered' => $filteredRecords, + 'pageCount' => $pageCount, + 'page' => $currentPage, + 'totalCount' => $totalRecords, + 'data' => $data, + ]); + } + + + + public function getUserTeams($id) + { + $teamsUser = TeamsUsers::where('teams_id', $id)->get(); + $userIds = $teamsUser->pluck('user_id'); + $users = User::whereIn('id', $userIds) + ->with('roles') + ->get(); + + + if ($users->isNotEmpty()) { + return response()->json($users, 200); + } + + return response()->json([], 200); + } + + +} diff --git a/app/Http/Controllers/PermohonanController.php b/app/Http/Controllers/PermohonanController.php index d45c873..2cd35d0 100644 --- a/app/Http/Controllers/PermohonanController.php +++ b/app/Http/Controllers/PermohonanController.php @@ -6,11 +6,19 @@ use Exception; use Illuminate\Http\Request; use Maatwebsite\Excel\Facades\Excel; + use Modules\Location\Models\City; + use Modules\Location\Models\District; + use Modules\Location\Models\Province; + use Modules\Location\Models\Village; use Modules\Lpj\Exports\PermohonanExport; use Modules\Lpj\Http\Requests\PermohonanRequest; use Modules\Lpj\Models\Branch; use Modules\Lpj\Models\Debiture; + use Modules\Lpj\Models\DokumenJaminan; + use Modules\Lpj\Models\JenisFasilitasKredit; + use Modules\Lpj\Models\NilaiPlafond; use Modules\Lpj\Models\Permohonan; + use Modules\Lpj\Models\StatusPermohonan; use Modules\Lpj\Models\TujuanPenilaian; class PermohonanController extends Controller @@ -26,7 +34,6 @@ { $validate = $request->validated(); - if ($validate) { try { // Save to database @@ -37,7 +44,7 @@ } catch (Exception $e) { return redirect() ->route('permohonan.create') - ->with('error', 'Failed to create permohonan'. $e->getMessage()); + ->with('error', 'Failed to create permohonan' . $e->getMessage()); } } else { return redirect() @@ -49,49 +56,56 @@ public function create() { - $branches = Branch::all(); - $debitures = Debiture::all(); - $tujuanPenilaian = TujuanPenilaian::all(); - $status = [ - 'order' => 'Order', - 'revisi' => 'Revisi', - 'register' => 'Register', - 'assign' => 'Assign', - 'survey' => 'Survey', - 'finalisasi' => 'Proses Laporan', - 'approved' => 'Diterima', - 'rejected' => 'Ditolak', - 'cancel' => 'Dibatalkan', - 'finished' => 'Selesai', - 'not_started' => 'Belum dimulai', - ]; + return view('lpj::permohonan.create'); + } - return view('lpj::permohonan.form', compact('branches', 'debitures', 'tujuanPenilaian','status')); + public function createPermohonan($debitur) + { + $branches = Branch::all(); + $debitur = Debiture::find($debitur); + $tujuanPenilaian = TujuanPenilaian::all(); + $status = StatusPermohonan::all(); + $fasilitasKredit = JenisFasilitasKredit::all(); + $plafond = NilaiPlafond::all(); + + return view( + 'lpj::permohonan.form', + compact('branches', 'debitur', 'tujuanPenilaian', 'status', 'fasilitasKredit', 'plafond'), + ); } public function edit($id) { $permohonan = Permohonan::find($id); $branches = Branch::all(); - $debitures = Debiture::all(); + $debitur = Debiture::find($permohonan->debiture_id); $tujuanPenilaian = TujuanPenilaian::all(); - $status = [ - 'order' => 'Order', - 'revisi' => 'Revisi', - 'register' => 'Register', - 'assign' => 'Assign', - 'survey' => 'Survey', - 'finalisasi' => 'Proses Laporan', - 'approved' => 'Diterima', - 'rejected' => 'Ditolak', - 'cancel' => 'Dibatalkan', - 'finished' => 'Selesai', - 'not_started' => 'Belum dimulai', - ]; + $status = StatusPermohonan::all(); + $provinces = Province::all(); + $cities = City::where('province_code', $debitur->province_code)->get(); + $districts = District::where('city_code', $debitur->city_code)->get(); + $villages = Village::where('district_code', $debitur->district_code)->get(); + $documents = DokumenJaminan::with('pemilik', 'detail')->where('debiture_id', $id)->get(); + + $fasilitasKredit = JenisFasilitasKredit::all(); + $plafond = NilaiPlafond::all(); return view( 'lpj::permohonan.form', - compact('permohonan', 'branches', 'debitures', 'tujuanPenilaian','status'), + compact( + 'permohonan', + 'branches', + 'debitur', + 'tujuanPenilaian', + 'status', + 'provinces', + 'cities', + 'districts', + 'villages', + 'documents', + 'fasilitasKredit', + 'plafond', + ), ); } @@ -198,4 +212,96 @@ { return Excel::download(new PermohonanExport, 'permohonan.xlsx'); } + + public function authorization() + { + return view('lpj::permohonan.authorization.index'); + } + + public function dataForAuthorization(Request $request) + { + if (is_null($this->user) || !$this->user->can('debitur.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Retrieve data from the database + $query = Permohonan::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_registrasi', 'LIKE', '%' . $search . '%'); + $q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('debiture', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%'); + $q->orWhere('status', '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->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->where('status', '=', 'order')->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, + ]); + } + + public function showAuthorization($id) + { + $permohonan = Permohonan::find($id); + return view('lpj::permohonan.authorization.show', compact('permohonan')); + } + + public function updateAuthorization(Request $request, $id) + { + try { + $permohonan = Permohonan::find($id); + $permohonan->status = $request->status; + $permohonan->keterangan = $request->keterangan; + $permohonan->save(); + } catch (Exception $e) { + return redirect()->route('authorization.show', $id)->with('error', 'Failed to update permohonan'); + } + + return redirect()->route('authorization.index')->with('success', 'Permohonan updated successfully'); + } } diff --git a/app/Http/Controllers/RegionController.php b/app/Http/Controllers/RegionController.php new file mode 100644 index 0000000..e6aa981 --- /dev/null +++ b/app/Http/Controllers/RegionController.php @@ -0,0 +1,164 @@ +validated(); + + if ($validate) { + try { + // Save to database + Regions::create($validate); + return redirect() + ->route('basicdata.region.index') + ->with('success', 'region created successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.region.create') + ->with('error', 'Failed to create region'); + } + } + } + + + public function edit($id) + { + $region = Regions::find($id); + return view('lpj::region.create', compact('region')); + + } + + /** + * Update the specified resource in storage. + */ + public function update(RegionRequest $request, $id) + { + $validate = $request->validated(); + + if ($validate) { + try { + // Update in database + $region = Regions::find($id); + $region->update($validate); + return redirect() + ->route('basicdata.region.index') + ->with('success', 'Region updated successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.region.edit', $id) + ->with('error', 'Failed to update region'); + } + } + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + try { + // Delete from database + $region = Regions::find($id); + $region->delete(); + + echo json_encode(['success' => true, 'message' => 'Region deleted successfully']); + } catch (Exception $e) { + echo json_encode(['success' => false, 'message' => 'Failed to delete region']); + } + } + + public function dataForDatatables(Request $request) + { + + + if (is_null($this->user) || !$this->user->can('region.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + $query = Regions::query(); + + if ($request->has('search') && !empty($request->get('search'))) { + $search = $request->get('search'); + $query->where(function ($q) use ($search) { + $q->where('code', 'LIKE', "%$search%"); + $q->orWhere('name', 'LIKE', "%$search%"); + }); + } + + if($request->has('sortOrder') && !empty($request->get('sortOrder'))){ + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } + + $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; + + // dump($data); + + // 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 + ]); + } + + public function export() + { + return Excel::download(new RegionExport, 'region.xlsx'); + } +} diff --git a/app/Http/Controllers/TeamsController.php b/app/Http/Controllers/TeamsController.php new file mode 100644 index 0000000..bf0a39b --- /dev/null +++ b/app/Http/Controllers/TeamsController.php @@ -0,0 +1,260 @@ +toArray(); + $region = Regions::whereNotIn('id', $regionTeam)->get(); + + // cek user apakah sudah ada di tabel teams_users + $userTeam = TeamsUsers::pluck('user_id')->toArray(); + $user = User::whereNotIn('id', $userTeam) + ->with('roles') + ->get(); + + return view('lpj::teams.form', compact('region', 'user')); + } + + /** + * Store a newly created resource in storage. + */ + public function store(TeamsRequest $request) + { + $validate = $request->validated(); + + DB::beginTransaction(); + try { + $teams = Teams::create($validate); + + $users = $request->input('user', []); + + // loop untuk insert data users ke tabel teams_users + foreach ($users as $user) { + TeamsUsers::create([ + 'teams_id' => $teams->id, + 'user_id' => $user + ]); + } + + DB::commit(); + + return redirect() + ->route('basicdata.teams.index') + ->with('success', 'Data saved successfully. '); + } catch (Exception $e) { + + DB::rollBack(); + + return redirect() + ->route('basicdata.teams.create') + ->with('error', 'Failed to save data. '); + } + } + + /** + * Show the specified resource. + */ + public function show($id) + { + return view('lpj::show'); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + $teams = Teams::find($id); + + + $region = Regions::all(); + $usedUsers = TeamsUsers::where('teams_id', '!=', $id)->pluck('user_id')->toArray(); + $user = User::whereNotIn('id', $usedUsers) + ->with('roles') + ->get(); + // Ambil user yang sudah ada di tim ini + $selectedUsers = $teams->teamsUsers->pluck('user_id')->toArray(); + + return view('lpj::teams.form', compact('teams', 'region', 'user', 'selectedUsers')); + } + + /** + * Update the specified resource in storage. + */ + public function update(TeamsRequest $request, $id) + { + $validate = $request->validated(); + + DB::beginTransaction(); + try { + $teams = Teams::findOrFail($id); + + // Update data tim + $teams->update($validate); + $userIds = $request->input('user', []); + + $teams->teamsUsers()->delete(); + + + foreach ($userIds as $userId) { + TeamsUsers::create([ + 'teams_id' => $teams->id, + 'user_id' => $userId + ]); + } + + DB::commit(); + + return redirect() + ->route('basicdata.teams.index') + ->with('success', 'Data updated successfully. '); + } catch (Exception $e) { + + DB::rollBack(); + + return redirect() + ->route('basicdata.teams.create') + ->with('error', 'Failed to update data. '); + } + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + DB::beginTransaction(); + try { + + $teams = Teams::findOrFail($id); + $teams->teamsUsers()->delete(); + + // Hapus tim + $teams->delete(); + + DB::commit(); + + echo json_encode(['success' => true, 'message' => 'Team has been deleted successfully']); + + } catch (Exception $e) { + DB::rollBack(); + echo json_encode(['success' => false, 'message' => 'Failed to delete Team']); + } + } + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('teams.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Inisialisasi query + $query = Teams::select('teams.id as id', 'teams.name as team_name', 'regions.name as region_name') + ->join('regions', 'teams.regions_id', '=', 'regions.id') + ->leftJoin('teams_users', 'teams.id', '=', 'teams_users.teams_id') + ->leftJoin('users', 'teams_users.user_id', '=', 'users.id') + ->addSelect('users.id as user_id', 'users.name as user_name'); + + // Filter pencarian + if ($request->has('search') && !empty($request->get('search'))) { + $search = $request->get('search'); + $query->where(function ($q) use ($search) { + $q->where('teams.name', 'LIKE', "%$search%") + ->orWhere('regions.name', 'LIKE', "%$search%") + ->orWhere('users.name', 'LIKE', "%$search%"); + }); + } + + // Sorting + if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } + + // Hitung total records + $totalRecords = $query->count(); + + // Pagination + $size = $request->get('size', 10); + $page = $request->get('page', 1); + $offset = ($page - 1) * $size; + + // Ambil data dengan pagination + $data = $query->skip($offset)->take($size)->get(); + $filteredRecords = $data->count(); + $pageCount = ceil($totalRecords / $size); + + // Ambil ID pengguna dari hasil query + $userIds = $data->pluck('user_id')->unique(); + + // Ambil data pengguna dengan peran mereka + $users = User::whereIn('id', $userIds) + ->with('roles') + ->get() + ->keyBy('id'); + + // Format data + $formattedData = $data->groupBy('id')->map(function ($group) use ($users) { + $team = $group->first(); + $team->user_team = $group->map(function ($item) use ($users) { + $user = $users->get($item->user_id); + return [ + 'nama' => $item->user_name, + 'roles' => $user ? $user->roles->pluck('name')->toArray() : [], + ]; + })->toArray(); + return $team; + })->values(); + + return response()->json([ + 'draw' => $request->get('draw'), + 'recordsTotal' => $totalRecords, + 'recordsFiltered' => $filteredRecords, + 'pageCount' => $pageCount, + 'page' => $page, + 'totalCount' => $totalRecords, + 'data' => $formattedData + ]); + } + + + + + public function export() + { + return Excel::download(new TeamPenilaianExport(), 'team-penilai.xlsx'); + } + + +} diff --git a/app/Http/Controllers/TenderController.php b/app/Http/Controllers/TenderController.php new file mode 100644 index 0000000..0ac29a0 --- /dev/null +++ b/app/Http/Controllers/TenderController.php @@ -0,0 +1,179 @@ +id; + $permohonanNomorRegistrasi = $permohonan->nomor_registrasi; + + return view('lpj::penawaran/create', compact('status', 'tujuan_penilaian_kjpp', 'jenis_laporan', 'kjpp', 'permohonanId', 'permohonanNomorRegistrasi')); + } + + /** + * Store a newly created resource in storage. + */ + public function penawaran_store(TenderPenawaranRequest $request, $id) + { + $validated = $request->validated(); + + if ($validated) { + $validated['nomor_registrasi'] = $request->nomor_registrasi; + + $validated['nama_kjpp_sebelumnya'] = json_encode($request->input('nama_kjpp_sebelumnya')); + + PenawaranTender::create($validated); + + return redirect() + ->route('tender.penawaran.index') + ->with('success', 'Data Penawaran created successfully'); + } else { + return redirect() + ->route('tender.penawaran.createPenawaran', $id) + ->with('error', 'Validation failed'); + } + } + + /** + * Show the specified resource. + */ + public function penawaran_show($id) + { + return view('lpj::show'); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + return view('lpj::edit'); + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, $id) + { + // + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + // + } + + public function datatablesPenawaran(Request $request) + { + if (is_null($this->user) || !$this->user->can('penawaran.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Retrieve data from the database + $query = PenawaranTender::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('code', 'LIKE', "%$search%"); + $q->orWhere('nama_kjpp_sebelumnya', 'LIKE', "%$search%"); + $q->orWhere('tanggal_penilaian_sebelumnya', '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, + ]); + } + + public function exportPenawaran() + { + return Excel::download(new PenawaranTenderExport, 'kjpp.xlsx'); + } + + public function proses_penawaran_index() + { + return view('lpj::proses_penawaran/index'); + } + + public function penawaran_ulang_index() + { + return view('lpj::penawaran_ulang/index'); + } +} diff --git a/app/Http/Controllers/TujuanPenilaianKJPPController.php b/app/Http/Controllers/TujuanPenilaianKJPPController.php new file mode 100644 index 0000000..1ee7c9c --- /dev/null +++ b/app/Http/Controllers/TujuanPenilaianKJPPController.php @@ -0,0 +1,174 @@ +validated(); + + if ($validate) { + try { + TujuanPenilaianKJPP::create($validate); + return redirect() + ->route('basicdata.tujuan_penilaian_kjpp.index') + ->with('success', 'Tujuan Penilaian KJPP created successfully'); + } catch (Throwable $e) { + return redirect() + ->route('basicdata.tujuan_penilaian_kjpp.create') + ->with('success', 'Failed to create Tujuan Penilaian KJPP: ' . $e); + } + } + } + + /** + * Show the specified resource. + */ + public function show($id) + { + return view('lpj::show'); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + $tujuanPenilaianKJPP = TujuanPenilaianKJPP::find($id); + return view('lpj::tujuan_penilaian_kjpp.create', compact('tujuanPenilaianKJPP')); + } + + /** + * Update the specified resource in storage. + */ + public function update(JenisPenilaianKJPPRequest $request, $id) + { + $validate = $request->validated(); + + if ($validate) { + try { + $tujuanPenilaianKJPP = TujuanPenilaianKJPP::find($id); + $tujuanPenilaianKJPP->update($validate); + return redirect() + ->route('basicdata.tujuan_penilaian_kjpp.index') + ->with('success', 'Tujuan Penilaian KJPP updated successfully'); + } catch (Throwable $e) { + return redirect() + ->route('basicdata.tujuan_penilaian_kjpp.edit', $id) + ->with('success', 'Failed to update Tujuan Penilaian KJPP: ' . $e); + } + } + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + try { + // Delete from database + $tujuanPenilaianKJPP = TujuanPenilaianKJPP::find($id); + $tujuanPenilaianKJPP->delete(); + + echo json_encode(['success' => true, 'message' => 'Tujuan Penilaian deleted successfully']); + } catch (Throwable $e) { + echo json_encode(['success' => false, 'message' => 'Failed to delete deleted']); + } + } + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('jenis_jaminan.view')) { + //abort(403, 'Sorry! You are not allowed to view users.'); + } + + // Retrieve data from the database + $query = TujuanPenilaianKJPP::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('code', 'LIKE', "%$search%"); + $q->orWhere('name', '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, + ]); + } + + public function export() + { + return Excel::download(new TujuanPenilaianKJPPExport, 'jenis_laporan.xlsx'); + } +} diff --git a/app/Http/Requests/DebitureRequest.php b/app/Http/Requests/DebitureRequest.php index ff87263..7f83fbb 100644 --- a/app/Http/Requests/DebitureRequest.php +++ b/app/Http/Requests/DebitureRequest.php @@ -3,6 +3,7 @@ namespace Modules\Lpj\Http\Requests; use Illuminate\Foundation\Http\FormRequest; + use Modules\Lpj\Rules\UniqueCifExceptZero; class DebitureRequest extends FormRequest { @@ -21,7 +22,7 @@ 'nomor_rekening' => 'nullable|string|max:50', 'name' => 'required', 'registered_at' => 'nullable|date', - 'npwp' => 'nullable|string|max:16', + 'npwp' => 'nullable|string|min:15|max:16', 'email' => 'nullable|email', 'phone' => 'nullable|string|max:15', 'address' => 'nullable|string', @@ -29,10 +30,10 @@ 'status' => 'nullable|boolean' ]; - if ($this->method() == 'PUT') { - $rules['cif'] = 'nullable|unique:debitures,cif,' . $this->id; - } else { - $rules['cif'] = 'nullable|unique:debitures,cif'; + if($this->method() == 'PUT'){ + $rules['cif'] = ['required', new UniqueCifExceptZero($this->id)]; + }else{ + $rules['cif'] = ['required', new UniqueCifExceptZero(null)]; } return $rules; diff --git a/app/Http/Requests/DetailDokumenJaminanRequest.php b/app/Http/Requests/DetailDokumenJaminanRequest.php new file mode 100644 index 0000000..4cb22ce --- /dev/null +++ b/app/Http/Requests/DetailDokumenJaminanRequest.php @@ -0,0 +1,43 @@ + 'required|exists:debitures,id', + 'pemilik_jaminan_id' => 'required', + 'jenis_jaminan_id' => 'required', + 'jenis_legalitas_jaminan_id' => 'required', + 'dokumen_jaminan' => 'nullable|file|mimes:pdf', + 'keterangan' => 'nullable|string|max:255', + 'province_code' => 'nullable|exists:provinces,code', + 'city_code' => 'nullable|exists:cities,code', + 'district_code' => 'nullable|exists:districts,code', + 'village_code' => 'nullable|exists:villages,code', + 'name' => 'required', + 'address' => 'nullable|string', + 'postal_code' => 'nullable|string|max:10', + 'status' => 'nullable|boolean', + ]; + + return $rules; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize() + : bool + { + return true; + } + } diff --git a/app/Http/Requests/DokumenJaminanRequest.php b/app/Http/Requests/DokumenJaminanRequest.php index 4cb22ce..bc5cad4 100644 --- a/app/Http/Requests/DokumenJaminanRequest.php +++ b/app/Http/Requests/DokumenJaminanRequest.php @@ -16,14 +16,10 @@ 'debiture_id' => 'required|exists:debitures,id', 'pemilik_jaminan_id' => 'required', 'jenis_jaminan_id' => 'required', - 'jenis_legalitas_jaminan_id' => 'required', - 'dokumen_jaminan' => 'nullable|file|mimes:pdf', - 'keterangan' => 'nullable|string|max:255', 'province_code' => 'nullable|exists:provinces,code', 'city_code' => 'nullable|exists:cities,code', 'district_code' => 'nullable|exists:districts,code', 'village_code' => 'nullable|exists:villages,code', - 'name' => 'required', 'address' => 'nullable|string', 'postal_code' => 'nullable|string|max:10', 'status' => 'nullable|boolean', diff --git a/app/Http/Requests/IjinUsahaRequest.php b/app/Http/Requests/IjinUsahaRequest.php new file mode 100644 index 0000000..6f5cd80 --- /dev/null +++ b/app/Http/Requests/IjinUsahaRequest.php @@ -0,0 +1,46 @@ + 'required|string|not_regex:/^\d+$/|max:255' + ]; + + if ($this->method() == 'PUT') { + $rules['code'] = 'required|max:50|unique:ijin_usaha,code,' . $this->id; + } else { + $rules['code'] = 'required|max:50|unique:ijin_usaha,code'; + } + + return $rules; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } + + public function messages(): array + { + return [ + 'code.required' => 'Kode Ijin Usaha harus diisi!', + 'code.max' => 'Kode Ijin Usaha maksimal 255 huruf!', + 'code.unique' => 'Kode Ijin Usaha tidak boleh sama!', + 'name.required' => 'Nama Ijin Usaha harus diisi!', + 'name.not_regex' => 'Nama Ijin Usaha harus berupa huruf!', + 'name.max' => 'Nama Ijin Usaha maksimal 255 huruf!' + ]; + } +} diff --git a/app/Http/Requests/JenisJaminanRequest.php b/app/Http/Requests/JenisJaminanRequest.php index 4e2da8f..6f0325c 100644 --- a/app/Http/Requests/JenisJaminanRequest.php +++ b/app/Http/Requests/JenisJaminanRequest.php @@ -2,7 +2,9 @@ namespace Modules\Lpj\Http\Requests; + use daengdeni\LaravelIdGenerator\IdGenerator; use Illuminate\Foundation\Http\FormRequest; + use Illuminate\Support\Str; class JenisJaminanRequest extends FormRequest { @@ -12,16 +14,12 @@ public function rules() : array { - $rules = [ - 'name' => 'required|max:255', + return [ + 'code' => 'required|max:5', + 'name' => 'required|max:255', + 'slug' => 'required|max:255', + 'jenis_legalitas_jaminan_id' => 'nullable', ]; - - if ($this->method() == 'PUT') { - $rules['code'] = 'required|max:50|unique:jenis_jaminan,code,' . $this->id; - } else { - $rules['code'] = 'required|max:50|unique:jenis_jaminan,code'; - } - return $rules; } /** @@ -32,4 +30,21 @@ { return true; } + + public function prepareForValidation() + : void + { + if ($this->method() == 'POST') { + $this->merge([ + 'code' => IdGenerator::generate( + ['table' => 'jenis_jaminan', 'length' => 5, 'prefix' => 'JJ', 'field' => 'code'], + ) + ]); + } + + $this->merge([ + 'jenis_legalitas_jaminan_id' => json_encode($this->jenis_legalitas_jaminan_id), + 'slug' => Str::slug($this->name), + ]); + } } diff --git a/app/Http/Requests/JenisLaporanRequest.php b/app/Http/Requests/JenisLaporanRequest.php new file mode 100644 index 0000000..76babb0 --- /dev/null +++ b/app/Http/Requests/JenisLaporanRequest.php @@ -0,0 +1,46 @@ + 'required|max:5', + 'name' => 'required|max:255', + ]; + + if ($this->method() == 'PUT') { + $rules['code'] = 'required|max:5|unique:jenis_laporan,code,' . $this->id; + } else { + $rules['code'] = 'required|max:5|unique:jenis_laporan,code'; + } + + return $rules; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } + + public function messages(): array + { + return [ + 'code.required' => 'Kode Jenis Laporan Wajib diisi!', + 'code.max' => 'Kode Jenis Laporan maksimum 5 huruf!', + 'code.unique' => 'Kode Jenis Laporan tidak boleh sama!', + 'name.required' => 'Nama Jenis Laporan Wajib diisi!', + 'name.max' => 'Nama Jenis Laporan Wajib diisi!' + ]; + } +} diff --git a/app/Http/Requests/JenisLegalitasJaminanRequest.php b/app/Http/Requests/JenisLegalitasJaminanRequest.php index b319443..1d5d98c 100644 --- a/app/Http/Requests/JenisLegalitasJaminanRequest.php +++ b/app/Http/Requests/JenisLegalitasJaminanRequest.php @@ -2,7 +2,9 @@ namespace Modules\Lpj\Http\Requests; + use daengdeni\LaravelIdGenerator\IdGenerator; use Illuminate\Foundation\Http\FormRequest; + use Illuminate\Support\Str; class JenisLegalitasJaminanRequest extends FormRequest { @@ -12,16 +14,11 @@ public function rules() : array { - $rules = [ + return [ + 'code' => 'required|max:6', 'name' => 'required|max:255', + 'slug' => 'required|max:255', ]; - - if ($this->method() == 'PUT') { - $rules['code'] = 'required|max:50|unique:jenis_legalitas_jaminan,code,' . $this->id; - } else { - $rules['code'] = 'required|max:50|unique:jenis_legalitas_jaminan,code'; - } - return $rules; } /** @@ -32,4 +29,20 @@ { return true; } + + public function prepareForValidation() + { + if($this->method() == 'POST' && $this->code == null) { + $this->merge([ + 'code' => IdGenerator::generate( + ['table' => 'jenis_legalitas_jaminan', 'length' => 6, 'prefix' => 'JLJ', 'field' => 'code'], + ), + 'slug' => Str::slug($this->name), + ]); + } else { + $this->merge([ + 'slug' => Str::slug($this->name), + ]); + } + } } diff --git a/app/Http/Requests/JenisPenilaianKJPPRequest.php b/app/Http/Requests/JenisPenilaianKJPPRequest.php new file mode 100644 index 0000000..851b00c --- /dev/null +++ b/app/Http/Requests/JenisPenilaianKJPPRequest.php @@ -0,0 +1,45 @@ + 'required|max:5', + 'name' => 'required|max:255', + ]; + + if ($this->method() == 'PUT') { + $rules['code'] = 'required|max:5|unique:tujuan_penilaian_kjpp,code,' . $this->id; + } else { + $rules['code'] = 'required|max:5|unique:tujuan_penilaian_kjpp,code'; + } + + return $rules; + } + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } + + public function messages(): array + { + return [ + 'code.required' => 'Kode Tujuan Penilaian KJPP Wajib diisi!', + 'code.max' => 'Kode Tujuan Penilaian KJPP maksimum 5 huruf!', + 'code.unique' => 'Kode Tujuan Penilaian KJPP tidak boleh sama!', + 'name.required' => 'Nama Tujuan Penilaian KJPP Wajib diisi!', + 'name.max' => 'Nama Tujuan Penilaian KJPP Wajib diisi!' + ]; + } +} diff --git a/app/Http/Requests/JenisPenilaianRequest.php b/app/Http/Requests/JenisPenilaianRequest.php new file mode 100644 index 0000000..f8479f0 --- /dev/null +++ b/app/Http/Requests/JenisPenilaianRequest.php @@ -0,0 +1,41 @@ + 'required|string|max:255', + 'status' => 'nullable|boolean', + 'authorized_at' => 'nullable|datetime', + 'authorized_status' => 'nullable|string|max:1', + 'authorized_by' => 'nullable|exists:users,id', + ]; + + if ($this->method() == 'PUT') { + + $rules['code'] = 'required|string|max:3|unique:jenis_penilaian,code,' . $this->id; + + } else { + $rules['code'] = 'required|string|max:3|unique:jenis_penilaian,code'; + } + + return $rules; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/KJPPRequest.php b/app/Http/Requests/KJPPRequest.php new file mode 100644 index 0000000..e3e6fe4 --- /dev/null +++ b/app/Http/Requests/KJPPRequest.php @@ -0,0 +1,111 @@ + 'required|string|not_regex:/^\d+$/|max:255', + 'jenis_kantor' => 'required', + 'nomor_ijin_usaha' => 'required', + 'province_code' => 'required', + 'city_code' => 'required', + 'district_code' => 'required', + 'village_code' => 'required', + 'address' => 'required', + 'postal_code' => 'required|numeric', + 'nomor_telepon_kantor' => 'required|numeric|digits_between:8,15', + 'email_kantor' => 'required|email', + 'nama_pimpinan' => 'required|string|not_regex:/^\d+$/|max:255', + 'nomor_hp_pimpinan' => 'required|numeric|digits_between:10,15', + 'nama_pic_reviewer' => 'required|string|not_regex:/^\d+$/|max:255', + 'nomor_hp_pic_reviewer' => 'required|numeric|digits_between:10,15', + 'nama_pic_admin' => 'required|string|not_regex:/^\d+$/|max:255', + 'nomor_hp_pic_admin' => 'required|numeric|digits_between:10,15', + 'nama_pic_marketing' => 'required|string|not_regex:/^\d+$/|max:255', + 'nomor_hp_pic_marketing' => 'required|numeric|digits_between:10,15', + 'ijin_usaha_id' => 'required|array', + 'ijin_usaha_id.*' => 'exists:ijin_usaha,code', + 'jenis_aset_id' => 'required|array', + 'jenis_aset_id.*' => 'exists:jenis_jaminan,code', + 'attachment' => 'nullable|mimes:pdf|max:1024' + ]; + + if ($this->method() == 'PUT') { + $rules['code'] = 'required|max:50|unique:kjpp,code,' . $this->id; + } else { + $rules['code'] = 'required|max:50|unique:kjpp,code'; + } + + return $rules; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } + + public function messages(): array + { + return [ + 'code.required' => 'Kode KJPP Wajib diisi!', + 'code.max' => 'Kode KJPP maksimal 255 huruf!', + 'code.unique' => 'Kode KJPP tidak boleh sama!', + 'name.required' => 'Nama KJPP Wajib diisi!', + 'name.not_regex' => 'Nama KJPP harus berupa huruf!', + 'name.max' => 'Nama KJPP maksimal 255 huruf!', + 'jenis_kantor.required' => 'Jenis Kantor Wajib diisi!', + 'nomor_ijin_usaha.required' => 'Nomor Ijin Usaha Wajib diisi!', + 'nomor_ijin_usaha.max' => 'Nomor Ijin Usaha maksimal 255 huruf!', + 'province_code.required' => 'Provinsi Wajib diisi!', + 'city_code.required' => 'Kota / Kabupaten Wajib diisi!', + 'district_code.required' => 'Kecamatan Wajib diisi!', + 'village_code.required' => 'Kelurahan Wajib diisi!', + 'postal_code.required' => 'Kode Pos Wajib diisi!', + 'postal_code.numeric' => 'Kode Pos harus berupa angka!', + 'address.required' => 'Alamat Kantor Wajib diisi!', + 'nomor_telepon_kantor.required' => 'Nomor Telepon Kantor Wajib diisi!', + 'nomor_telepon_kantor.numeric' => 'Nomor Telepon Kantor harus berupa angka!', + 'nomor_telepon_kantor.digits_between' => 'Nomor Telepon Kantor minimum 8 digit dan maksimum 15 digit!', + 'email_kantor.required' => 'Email Kantor Wajib diisi!', + 'email_kantor.email' => 'Email Kantor tidak valid!', + 'nama_pimpinan.required' => 'Nama Pimpinan Wajib diisi!', + 'nama_pimpinan.not_regex' => 'Nama Pimpinan harus berupa huruf!', + 'nomor_hp_pimpinan.required' => 'Nomor HP Pimpinan Wajib diisi!', + 'nomor_hp_pimpinan.numeric' => 'Nomor HP Pimpinan harus berupa angka!', + 'nomor_hp_pimpinan.digits_between' => 'Nomor HP Pimpinan minimum 10 digit dan maksimum 15 digit!', + 'nama_pic_reviewer.required' => 'Nama PIC Reviewer Wajib diisi!', + 'nama_pic_reviewer.not_regex' => 'Nama PIC Reviewer harus berupa huruf!', + 'nomor_hp_pic_reviewer.required' => 'Nomor HP PIC Reviewer Wajib diisi!', + 'nomor_hp_pic_reviewer.numeric' => 'Nomor HP PIC Reviewer harus berupa angka!', + 'nomor_hp_pic_reviewer.digits_between' => 'Nomor HP PIC Reviewer minimum 10 digit dan maksimum 15 digit!', + 'nama_pic_admin.required' => 'Nama PIC Admin Wajib diisi!', + 'nama_pic_admin.not_regex' => 'Nama PIC Admin harus berupa huruf!', + 'nomor_hp_pic_admin.required' => 'Nomor HP PIC Admin Wajib diisi!', + 'nomor_hp_pic_admin.numeric' => 'Nomor HP PIC Admin harus berupa angka!', + 'nomor_hp_pic_admin.digits_between' => 'Nomor HP PIC Admin minimum 10 digit dan maksimum 15 digit!', + 'nama_pic_marketing.required' => 'Nama PIC Marketing Wajib diisi!', + 'nama_pic_marketing.not_regex' => 'Nama PIC Marketing harus berupa huruf!', + 'nomor_hp_pic_marketing.required' => 'Nomor HP PIC Marketing Wajib diisi!', + 'nomor_hp_pic_marketing.numeric' => 'Nomor HP PIC Marketing harus berupa angka!', + 'nomor_hp_pic_marketing.digits_between' => 'Nomor HP PIC Marketing minimum 10 digit dan maksimum 15 digit!', + 'ijin_usaha_id.required' => 'Ijin Usaha Wajib diisi!', + 'ijin_usaha_id.min' => 'Ijin Usaha Wajib diisi minimal satu atau lebih!', + 'jenis_aset_id.required' => 'Jenis Aset Wajib diisi!', + 'jenis_aset_id.min' => 'Jenis Aset Wajib diisi minimal satu atau lebih!', + 'attachment.mimes' => 'Attachment harus berformat pdf!', + 'attachment.max' => 'Attachment berukuran maksimum 1 MB!', + ]; + } +} diff --git a/app/Http/Requests/PemilikJaminanRequest.php b/app/Http/Requests/PemilikJaminanRequest.php index dd4a11d..b6e267d 100644 --- a/app/Http/Requests/PemilikJaminanRequest.php +++ b/app/Http/Requests/PemilikJaminanRequest.php @@ -28,8 +28,8 @@ 'status' => 'nullable|boolean', ]; - $rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,nomor_id,debiture_id,' . $this->debiture_id; - + //$rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,nomor_id,debiture_id,' . $this->debiture_id; + $rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,debiture_id,' . $this->debiture_id; return $rules; } diff --git a/app/Http/Requests/PenilaianRequest.php b/app/Http/Requests/PenilaianRequest.php new file mode 100644 index 0000000..0d9c1bf --- /dev/null +++ b/app/Http/Requests/PenilaianRequest.php @@ -0,0 +1,59 @@ +input('action'); + + if ($action === 'revisi') { + return [ + 'dokumen' => 'required|file|mimes:pdf', + 'keterangan' => 'required|string', + ]; + } + + + + return [ + 'jenis_penilaian_id' => 'required|max:255', + 'teams_id' => 'required|max:255', + 'tanggal_kunjungan' => 'required|max:255', + 'status' => 'required|string', + 'nomor_registrasi' => 'required|string', + 'surveyor_id' => 'nullable|required_without:penilai_surveyor_id', + 'penilaian_id' => 'nullable|required_without:penilai_surveyor_id', + 'penilai_surveyor_id' => 'nullable|required_without_all:surveyor_id,penilaian_id', + 'keterangan' => 'nullable', + ]; + } + + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } + + protected function prepareForValidation() + { + // Menetapkan nilai default untuk 'status' jika tidak ada dalam request + $this->merge([ + 'status' => $this->status ?? 'assign', + ]); + } +} diff --git a/app/Http/Requests/PermohonanRequest.php b/app/Http/Requests/PermohonanRequest.php index 5a576dd..8d6ef20 100644 --- a/app/Http/Requests/PermohonanRequest.php +++ b/app/Http/Requests/PermohonanRequest.php @@ -14,13 +14,17 @@ : array { $rules = [ - 'nomor_registrasi' => 'nullable|string|max:10', - 'tanggal_permohonan' => 'nullable|date', - 'user_id' => 'nullable|exists:users,id', - 'branch_id' => 'required|exists:branches,id', - 'tujuan_penilaian_id' => 'required|exists:tujuan_penilaian,id', - 'debiture_id' => 'required|exists:debitures,id', - 'status' => 'required|string', + 'nomor_registrasi' => 'nullable|string|max:10', + 'tanggal_permohonan' => 'nullable|date', + 'user_id' => 'nullable|exists:users,id', + 'branch_id' => 'required|exists:branches,id', + 'tujuan_penilaian_id' => 'required|exists:tujuan_penilaian,id', + 'debiture_id' => 'required|exists:debitures,id', + 'status' => 'required|string', + 'jenis_fasilitas_kredit_id' => 'required|exists:jenis_fasilitas_kredit,id', + 'nilai_plafond_id' => 'required|exists:nilai_plafond,id', + 'status_bayar' => 'required|string', + 'nilai_njop' => 'nullable|numeric' ]; return $rules; @@ -40,10 +44,11 @@ if (!$this->id) { $this->merge([ 'nomor_registrasi' => IdGenerator::generate( - ['table' => 'permohonan', 'length' => 10, 'prefix'=>'REG', 'field' => 'nomor_registrasi'], + ['table' => 'permohonan', 'length' => 10, 'prefix' => 'REG', 'field' => 'nomor_registrasi'], ), 'tanggal_permohonan' => date('Y-m-d'), 'user_id' => auth()->user()->id, + 'branch_id' => auth()->user()->branch_id, ]); } } diff --git a/app/Http/Requests/RegionRequest.php b/app/Http/Requests/RegionRequest.php new file mode 100644 index 0000000..fd9ab1d --- /dev/null +++ b/app/Http/Requests/RegionRequest.php @@ -0,0 +1,38 @@ + 'required|string|max:255', + 'status' => 'nullable|boolean', + 'authorized_at' => 'nullable|datetime', + 'authorized_status' => 'nullable|string|max:1', + 'authorized_by' => 'nullable|exists:users,id', + ]; + + if ($this->method() == 'PUT') { + $rules['code'] = 'required|string|max:3|unique:regions,code,' . $this->id; + } else { + $rules['code'] = 'required|string|max:3|unique:regions,code'; + } + + return $rules; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/StatusPermohonanRequest.php b/app/Http/Requests/StatusPermohonanRequest.php index 21bd8e5..d0a9ac6 100644 --- a/app/Http/Requests/StatusPermohonanRequest.php +++ b/app/Http/Requests/StatusPermohonanRequest.php @@ -16,6 +16,7 @@ $rules = [ 'description' => 'nullable|max:255', 'status' => 'required|boolean', + 'slug' => 'nullable|max:255', ]; if ($this->method() == 'PUT') { @@ -37,9 +38,9 @@ public function prepareForValidation() { - $this->merge([ + return $this->merge([ 'status' => isset($this->status) ? 1 : 0, - 'slug'=> Str::slug($this->name) + 'slug' => Str::slug($this->name), ]); } } diff --git a/app/Http/Requests/TeamsRequest.php b/app/Http/Requests/TeamsRequest.php new file mode 100644 index 0000000..c77f4a5 --- /dev/null +++ b/app/Http/Requests/TeamsRequest.php @@ -0,0 +1,41 @@ + 'required|string|max:255', + 'status' => 'nullable|boolean', + 'regions_id' => 'required|nullable|exists:regions,id', + 'user.*' => 'nullable|exists:users,id', + 'authorized_at' => 'nullable|datetime', + 'authorized_status' => 'nullable|string|max:1', + 'authorized_by' => 'nullable|exists:users,id', + + ]; + + if ($this->method() == 'PUT') { + $rules['code'] = 'required|string|max:3|unique:teams,code,' . $this->id; + } else { + $rules['code'] = 'required|string|max:3|unique:teams,code'; + } + + return $rules; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Requests/TenderPenawaranRequest.php b/app/Http/Requests/TenderPenawaranRequest.php new file mode 100644 index 0000000..16ed5bc --- /dev/null +++ b/app/Http/Requests/TenderPenawaranRequest.php @@ -0,0 +1,75 @@ + 'required|array', + 'nama_kjpp_sebelumnya.*' => 'exists:kjpp,name', + 'biaya_kjpp_sebelumnya' => 'required|numeric', + 'tanggal_penilaian_sebelumnya' => 'required', + 'nomor_registrasi' => 'required', + 'tujuan_penilaian_kjpp_id' => 'required', + 'jenis_laporan_id' => 'required', + 'start_date' => 'required', + 'end_date' => 'required', + 'catatan' => 'nullable', + 'status' => 'required' + ]; + + if ($this->method() == 'PUT') { + $rules['code'] = 'required|max:50|unique:penawaran,code,' . $this->id; + } else { + $rules['code'] = 'required|max:50|unique:penawaran,code'; + } + + return $rules; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } + + public function messages(): array + { + return [ + 'code.required' => 'Kode Penawaran Wajib diisi!', + 'code.max' => 'Kode Penawaran maksimal 255 huruf!', + 'code.unique' => 'Kode Penawaran tidak boleh sama!', + 'nama_kjpp_sebelumnya.required' => 'Nama KJPP Sebelumnya Wajib diisi!', + 'biaya_kjpp_sebelumnya.required' => 'Biaya KJPP Sebelumnya Wajib diisi!', + 'biaya_kjpp_sebelumnya.numeric' => 'Biaya KJPP Sebelumnya harus berupa angka!', + 'tanggal_penilaian_sebelumnya.required' => 'Tanggal Penilaian Sebelumnya Wajib diisi!', + 'nomor_registrasi.required' => 'Nomor Registrasi Wajib diisi!', + 'tujuan_penilaian_kjpp_id.required' => 'Tujuan Penilaian KJPP Wajib diisi!', + 'jenis_laporan_id.required' => 'Jenis Laporan Wajib diisi!', + 'start_date.required' => 'Tanggal Awal Wajib diisi!', + 'end_date.required' => 'Tanggal Akhir Wajib diisi!', + 'status.required' => 'Status Wajib diisi!' + ]; + } + + public function withValidator($validator) + { + $validator->after(function ($validator) { + $startDate = strtotime($this->input('start_date')); + $endDate = strtotime($this->input('end_date')); + + if ($endDate < $startDate) { + $validator->errors()->add('end_date', 'Tanggal Akhir tidak boleh lebih awal dari Tanggal Awal.'); + } + }); + } +} diff --git a/app/Models/Branch.php b/app/Models/Branch.php index 836cca5..834b5cc 100644 --- a/app/Models/Branch.php +++ b/app/Models/Branch.php @@ -1,16 +1,16 @@ hasMany(Debiture::class, 'branch_id', 'id'); - } + return $this->hasMany(Debiture::class, 'branch_id', 'id'); } +} diff --git a/app/Models/Debiture.php b/app/Models/Debiture.php index df5b9d2..8980513 100644 --- a/app/Models/Debiture.php +++ b/app/Models/Debiture.php @@ -56,4 +56,8 @@ return $this->belongsTo(Village::class, 'village_code', 'code'); } + public function documents(){ + return $this->hasMany(DokumenJaminan::class); + } + } diff --git a/app/Models/DetailDokumenJaminan.php b/app/Models/DetailDokumenJaminan.php new file mode 100644 index 0000000..e164ea5 --- /dev/null +++ b/app/Models/DetailDokumenJaminan.php @@ -0,0 +1,34 @@ +belongsTo(JenisLegalitasJaminan::class, 'jenis_legalitas_jaminan_id', 'id'); + } + + public function dokumenJaminan(){ + return $this->belongsTo(DokumenJaminan::class, 'dokumen_jaminan_id', 'id'); + } + } diff --git a/app/Models/DokumenJaminan.php b/app/Models/DokumenJaminan.php index 83886f6..3454dc9 100644 --- a/app/Models/DokumenJaminan.php +++ b/app/Models/DokumenJaminan.php @@ -16,10 +16,6 @@ 'permohonan_id', 'pemilik_jaminan_id', 'jenis_jaminan_id', - 'jenis_legalitas_jaminan_id', - 'name', - 'dokumen_jaminan', - 'keterangan', 'province_code', 'city_code', 'district_code', @@ -64,11 +60,11 @@ return $this->belongsTo(JenisJaminan::class, 'jenis_jaminan_id', 'id'); } - public function jenisLegalitasJaminan(){ - return $this->belongsTo(JenisLegalitasJaminan::class, 'jenis_legalitas_jaminan_id', 'id'); - } - public function permohonan(){ return $this->belongsTo(Permohonan::class, 'permohonan_id', 'id'); } + + public function detail(){ + return $this->hasMany(DetailDokumenJaminan::class, 'dokumen_jaminan_id', 'id'); + } } diff --git a/app/Models/IjinUsaha.php b/app/Models/IjinUsaha.php new file mode 100644 index 0000000..e2e464a --- /dev/null +++ b/app/Models/IjinUsaha.php @@ -0,0 +1,18 @@ +hasMany(Penilaian::class , 'jenis_penilaian_id', 'id'); + } + +} diff --git a/app/Models/KJPP.php b/app/Models/KJPP.php new file mode 100644 index 0000000..426d940 --- /dev/null +++ b/app/Models/KJPP.php @@ -0,0 +1,46 @@ +belongsTo(JenisPenilaian::class, 'jenis_penilaian_id', 'id'); + } + + public function teams(){ + return $this->belongsTo(Teams::class, 'teams_id', 'id'); + } + + public function users(){ + return $this->belongsTo(User::class, 'user_id', 'id'); + } + + public function userPenilai(){ + return $this->belongsTo(User::class, 'penilaian_id', 'id'); + } + + public function userSurveyor(){ + return $this->belongsTo(User::class, 'surveyor_id', 'id'); + } + + public function userPenilaiSurveyor(){ + return $this->belongsTo(User::class, 'penilai_surveyor_id', 'id'); + } + + public function permohonan(){ + return $this->belongsTo(Permohonan::class, 'nomor_registrasi', 'nomor_registrasi'); + } + + +} diff --git a/app/Models/Permohonan.php b/app/Models/Permohonan.php index 7b3329f..46ae5a3 100644 --- a/app/Models/Permohonan.php +++ b/app/Models/Permohonan.php @@ -6,6 +6,8 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; use Modules\Lpj\Database\Factories\PermohonanFactory; use Modules\Usermanagement\Models\User; +use Modules\Lpj\Models\TujuanPenilaian; +use Modules\Lpj\Models\JenisFasilitasKredit; class Permohonan extends Base { @@ -17,6 +19,10 @@ class Permohonan extends Base 'branch_id', 'tujuan_penilaian_id', 'debiture_id', + 'keterangan', + 'dokumen', + 'jenis_fasilitas_kredit_id', + 'nilai_plafond_id', 'status', 'authorized_at', 'authorized_status', @@ -26,7 +32,10 @@ class Permohonan extends Base 'registrasi_by', 'registrasi_at', 'jenis_penilaian_id', - 'region_id' + 'region_id', + // andy add + 'status_bayar', + 'nilai_njop' ]; public function user(){ @@ -48,4 +57,16 @@ class Permohonan extends Base public function documents(){ return $this->hasMany(DokumenJaminan::class); } + + public function nilaiPlafond(){ + return $this->belongsTo(NilaiPlafond::class); + } + + public function jenisFasilitasKredit(){ + return $this->belongsTo(JenisFasilitasKredit::class); + } + + public function penilaian(){ + return $this->belongsTo(Penilaian::class, 'nomor_registrasi', 'nomor_registrasi'); + } } diff --git a/app/Models/Regions.php b/app/Models/Regions.php new file mode 100644 index 0000000..28836b5 --- /dev/null +++ b/app/Models/Regions.php @@ -0,0 +1,26 @@ +hasMany(Teams::class, 'regions_id', 'id'); + } +} diff --git a/app/Models/Teams.php b/app/Models/Teams.php new file mode 100644 index 0000000..0fd48a8 --- /dev/null +++ b/app/Models/Teams.php @@ -0,0 +1,40 @@ +belongsTo(Regions::class, 'regions_id', 'id'); + } + + public function teamsUsers(){ + return $this->hasMany(TeamsUsers::class, 'teams_id', 'id'); + } + + public function penilaian(){ + return $this->hasMany(Penilaian::class, 'teams_id', 'id'); + } + + + +} + diff --git a/app/Models/TeamsUsers.php b/app/Models/TeamsUsers.php new file mode 100644 index 0000000..a47cae9 --- /dev/null +++ b/app/Models/TeamsUsers.php @@ -0,0 +1,33 @@ +belongsTo(Teams::class, 'teams_id', 'id'); + } + + + public function user() + { + return $this->belongsTo(User::class, 'user_id', 'id'); + } +} diff --git a/app/Models/TujuanPenilaianKJPP.php b/app/Models/TujuanPenilaianKJPP.php new file mode 100644 index 0000000..40adbea --- /dev/null +++ b/app/Models/TujuanPenilaianKJPP.php @@ -0,0 +1,19 @@ +id = $id; + } + + public function validate($attribute, $value, $fail): void + { + if (Debiture::where($attribute, $value) + ->where('id', '!=', $this->id) + ->where($attribute, '!=', '000000') + ->exists()) { + $fail('The :attribute field must be uniquse.'.$this->id); + } + } +} diff --git a/database/migrations/2024_08_23_073834_create_permohonan_jaminan_table.php b/database/migrations/2024_08_23_073834_create_permohonan_jaminan_table.php new file mode 100644 index 0000000..ad46f00 --- /dev/null +++ b/database/migrations/2024_08_23_073834_create_permohonan_jaminan_table.php @@ -0,0 +1,38 @@ +id(); + $table->foreignIdFor(Permohonan::class)->constrained('permohonan'); + $table->foreignIdFor(DokumenJaminan::class)->constrained('dokumen_jaminan'); + $table->boolean('status')->default(true)->nullable(); + $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('permohonan_jaminan'); + } + }; diff --git a/database/migrations/2024_09_04_082053_update_jenis_legalitas_jaminan_table.php b/database/migrations/2024_09_04_082053_update_jenis_legalitas_jaminan_table.php new file mode 100644 index 0000000..f10bd3a --- /dev/null +++ b/database/migrations/2024_09_04_082053_update_jenis_legalitas_jaminan_table.php @@ -0,0 +1,28 @@ +string('slug')->nullable()->after('name'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('jenis_legalitas_jaminan', function (Blueprint $table) { + $table->dropColumn('slug'); + }); + } +}; diff --git a/database/migrations/2024_09_04_082059_update_jenis_jaminan_table.php b/database/migrations/2024_09_04_082059_update_jenis_jaminan_table.php new file mode 100644 index 0000000..f148718 --- /dev/null +++ b/database/migrations/2024_09_04_082059_update_jenis_jaminan_table.php @@ -0,0 +1,30 @@ +string('slug')->after('name'); + $table->string('jenis_legalitas_jaminan_id')->nullable()->after('slug'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('jenis_jaminan', function (Blueprint $table) { + $table->dropColumn('slug'); + $table->dropColumn('jenis_legalitas_jaminan_id'); + }); + } +}; diff --git a/database/migrations/2024_09_05_030302_create_regions_table.php b/database/migrations/2024_09_05_030302_create_regions_table.php new file mode 100644 index 0000000..3f942ff --- /dev/null +++ b/database/migrations/2024_09_05_030302_create_regions_table.php @@ -0,0 +1,36 @@ +id(); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->char('status')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $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('regions'); + } +}; diff --git a/database/migrations/2024_09_05_030338_create_jenis_penilaian_table.php b/database/migrations/2024_09_05_030338_create_jenis_penilaian_table.php new file mode 100644 index 0000000..bf31ab4 --- /dev/null +++ b/database/migrations/2024_09_05_030338_create_jenis_penilaian_table.php @@ -0,0 +1,37 @@ +id(); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->char('status')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $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('jenis_penilaian'); + } +}; diff --git a/database/migrations/2024_08_20_090400_create_dokumen_jaminan_table.php b/database/migrations/2024_09_05_030400_create_dokumen_jaminan_table.php similarity index 88% rename from database/migrations/2024_08_20_090400_create_dokumen_jaminan_table.php rename to database/migrations/2024_09_05_030400_create_dokumen_jaminan_table.php index 979d973..2e663c9 100644 --- a/database/migrations/2024_08_20_090400_create_dokumen_jaminan_table.php +++ b/database/migrations/2024_09_05_030400_create_dokumen_jaminan_table.php @@ -18,20 +18,16 @@ use Illuminate\Support\Facades\Schema; { Schema::create('dokumen_jaminan', function (Blueprint $table) { $table->id(); - $table->string('name'); $table->foreignIdFor(Debiture::class)->constrained('debitures')->onDelete('cascade'); $table->foreignIdFor(Permohonan::class)->nullable()->constrained('permohonan')->onDelete('cascade'); $table->foreignIdFor(JenisJaminan::class)->constrained('jenis_jaminan')->onDelete('cascade'); $table->foreignIdFor(PemilikJaminan::class)->constrained('pemilik_jaminan')->onDelete('cascade'); - $table->foreignIdFor(JenisLegalitasJaminan::class)->constrained('jenis_legalitas_jaminan')->onDelete('cascade'); $table->string('province_code')->nullable()->index(); $table->string('city_code')->nullable()->index(); $table->string('district_code')->nullable()->index(); $table->string('village_code')->nullable()->index(); $table->string('postal_code', 5)->nullable(); $table->text('address')->nullable(); - $table->string('dokumen_jaminan')->nullable(); - $table->string('keterangan')->nullable(); $table->boolean('status')->default(true)->nullable(); $table->timestamps(); diff --git a/database/migrations/2024_09_05_030405_create_teams_table.php b/database/migrations/2024_09_05_030405_create_teams_table.php new file mode 100644 index 0000000..8ecffde --- /dev/null +++ b/database/migrations/2024_09_05_030405_create_teams_table.php @@ -0,0 +1,41 @@ +id(); + $table->foreignIdFor(Regions::class)->constrained()->onDelete('cascade'); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->char('status')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $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('teams'); + } +}; diff --git a/database/migrations/2024_09_05_030417_create_teams_users_table.php b/database/migrations/2024_09_05_030417_create_teams_users_table.php new file mode 100644 index 0000000..32167ee --- /dev/null +++ b/database/migrations/2024_09_05_030417_create_teams_users_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignIdFor(Teams::class)->constrained()->onDelete('cascade'); + $table->unsignedBigInteger('user_id'); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $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('teams_users'); + } +}; diff --git a/database/migrations/2024_09_05_035110_create_detail_dokumen_jaminan_table.php b/database/migrations/2024_09_05_035110_create_detail_dokumen_jaminan_table.php new file mode 100644 index 0000000..cef5294 --- /dev/null +++ b/database/migrations/2024_09_05_035110_create_detail_dokumen_jaminan_table.php @@ -0,0 +1,44 @@ +id(); + $table->string('name'); + $table->foreignIdFor(DokumenJaminan::class)->constrained('dokumen_jaminan')->onDelete('cascade'); + $table->foreignIdFor(JenisLegalitasJaminan::class)->constrained('jenis_legalitas_jaminan')->onDelete('cascade'); + $table->string('dokumen_jaminan')->nullable(); + $table->string('keterangan')->nullable(); + + $table->boolean('status')->default(true)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('detail_dokumen_jaminan'); + } +}; diff --git a/database/migrations/2024_09_05_070712_create_penilaian_table.php b/database/migrations/2024_09_05_070712_create_penilaian_table.php new file mode 100644 index 0000000..93670c0 --- /dev/null +++ b/database/migrations/2024_09_05_070712_create_penilaian_table.php @@ -0,0 +1,43 @@ +id(); + $table->foreignIdFor(JenisPenilaian::class); + $table->foreignIdFor(Teams::class); + $table->datetime('tanggal_kunjungan'); + $table->text('keterangan')->nullable(); + $table->string('status')->nullable(); + $table->unsignedBigInteger('user_id'); + $table->timestamps(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->softDeletes(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('penilaian'); + } +}; diff --git a/database/migrations/2024_09_13_030119_update_permohonan_table.php b/database/migrations/2024_09_13_030119_update_permohonan_table.php new file mode 100644 index 0000000..1906224 --- /dev/null +++ b/database/migrations/2024_09_13_030119_update_permohonan_table.php @@ -0,0 +1,33 @@ +foreignIdFor(JenisFasilitasKredit::class)->nullable()->onDelete('cascade'); + $table->foreignIdFor(NilaiPlafond::class)->nullable()->onDelete('cascade'); + $table->string('status')->default('order')->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('permohonan', function (Blueprint $table) { + $table->dropForeign(['fasilitas_kredit_id']); + $table->dropForeign(['nilai_plafond_id']); + }); + } +}; diff --git a/database/migrations/2024_09_18_014746_create_ijin_usaha_table.php b/database/migrations/2024_09_18_014746_create_ijin_usaha_table.php new file mode 100644 index 0000000..af9e74f --- /dev/null +++ b/database/migrations/2024_09_18_014746_create_ijin_usaha_table.php @@ -0,0 +1,36 @@ +id(); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('ijin_usaha'); + } +}; diff --git a/database/migrations/2024_09_18_084905_create_kjpp_table.php b/database/migrations/2024_09_18_084905_create_kjpp_table.php new file mode 100644 index 0000000..387af1f --- /dev/null +++ b/database/migrations/2024_09_18_084905_create_kjpp_table.php @@ -0,0 +1,57 @@ +id(); + $table->string('code'); + $table->string('name'); + $table->string('jenis_kantor'); + $table->string('nomor_ijin_usaha'); + $table->string('province_code'); + $table->string('city_code'); + $table->string('district_code'); + $table->string('village_code'); + $table->string('address'); + $table->string('postal_code'); + $table->string('nomor_telepon_kantor'); + $table->string('email_kantor'); + $table->string('nama_pimpinan'); + $table->string('nomor_hp_pimpinan'); + $table->string('nama_pic_reviewer'); + $table->string('nomor_hp_pic_reviewer'); + $table->string('nama_pic_admin'); + $table->string('nomor_hp_pic_admin'); + $table->string('nama_pic_marketing'); + $table->string('nomor_hp_pic_marketing'); + $table->string('ijin_usaha_id')->nullable(); + $table->string('jenis_aset_id')->nullable(); + $table->string('attachment')->nullable(); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->softDeletes(); + + $table->unsignedBigInteger('deleted_by')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('kjpp'); + } +}; diff --git a/database/migrations/2024_09_19_075113_update_permohonan_table.php b/database/migrations/2024_09_19_075113_update_permohonan_table.php new file mode 100644 index 0000000..ec58aca --- /dev/null +++ b/database/migrations/2024_09_19_075113_update_permohonan_table.php @@ -0,0 +1,30 @@ +enum('status_bayar',['sudah_bayar','belum_bayar'])->default('sudah_bayar'); + $table->string('nilai_njop')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('permohonan', function (Blueprint $table) { + $table->dropColumn('status_bayar'); + $table->dropColumn('nilai_njop'); + }); + } +}; diff --git a/database/migrations/2024_09_24_014023_update_permohonan_table.php b/database/migrations/2024_09_24_014023_update_permohonan_table.php new file mode 100644 index 0000000..6103ce2 --- /dev/null +++ b/database/migrations/2024_09_24_014023_update_permohonan_table.php @@ -0,0 +1,29 @@ +string('dokumen')->nullable()->after('status'); + $table->string('keterangan')->nullable()->after('dokumen'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('permohonan', function (Blueprint $table) { + $table->dropColumn('dokumen'); + $table->dropColumn('keterangan'); + }); + } +}; diff --git a/database/migrations/2024_09_26_021850_update_penilaian_table.php b/database/migrations/2024_09_26_021850_update_penilaian_table.php new file mode 100644 index 0000000..91d680e --- /dev/null +++ b/database/migrations/2024_09_26_021850_update_penilaian_table.php @@ -0,0 +1,37 @@ +dropColumn('user_id'); + $table->string('nomor_registrasi')->references('nomor_registrasi')->on(Permohonan::class)->onDelete('cascade'); + $table->unsignedBigInteger('penilaian_id')->unsigned()->nullable(); + $table->unsignedBigInteger('surveyor_id')->unsigned()->nullable(); + $table->unsignedBigInteger('penilai_surveyor_id')->unsigned()->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('penilaian', function (Blueprint $table) { + $table->unsignedBigInteger('user_id')->unsigned(); + $table->dropColumn('nomor_registrasi'); + $table->dropColumn('penilaian_id'); + $table->dropColumn('surveyor_id'); + $table->dropColumn('penilai_surveyor_id'); + }); + } +}; diff --git a/database/migrations/2024_09_26_034446_create_tujuan_penilaian_kjpp_table.php b/database/migrations/2024_09_26_034446_create_tujuan_penilaian_kjpp_table.php new file mode 100644 index 0000000..7f300c6 --- /dev/null +++ b/database/migrations/2024_09_26_034446_create_tujuan_penilaian_kjpp_table.php @@ -0,0 +1,36 @@ +id(); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('tujuan_penilaian_kjpp'); + } +}; diff --git a/database/migrations/2024_09_26_041326_create_jenis_laporan_table.php b/database/migrations/2024_09_26_041326_create_jenis_laporan_table.php new file mode 100644 index 0000000..f47da7a --- /dev/null +++ b/database/migrations/2024_09_26_041326_create_jenis_laporan_table.php @@ -0,0 +1,36 @@ +id(); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('jenis_laporan'); + } +}; diff --git a/database/migrations/2024_09_26_043440_create_penawaran_table.php b/database/migrations/2024_09_26_043440_create_penawaran_table.php new file mode 100644 index 0000000..403faaf --- /dev/null +++ b/database/migrations/2024_09_26_043440_create_penawaran_table.php @@ -0,0 +1,44 @@ +id(); + $table->string('code'); + $table->string('nama_kjpp_sebelumnya'); + $table->string('biaya_kjpp_sebelumnya'); + $table->datetime('tanggal_penilaian_sebelumnya'); + $table->string('nomor_registrasi'); + $table->foreignId('tujuan_penilaian_kjpp_id')->constrained('tujuan_penilaian_kjpp'); + $table->foreignId('jenis_laporan_id')->constrained('jenis_laporan'); + $table->date('start_date'); + $table->date('end_date'); + $table->text('catatan'); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('penawaran'); + } +}; diff --git a/database/migrations/2024_09_26_043449_create_persetujuan_penawaran_table.php b/database/migrations/2024_09_26_043449_create_persetujuan_penawaran_table.php new file mode 100644 index 0000000..025fb96 --- /dev/null +++ b/database/migrations/2024_09_26_043449_create_persetujuan_penawaran_table.php @@ -0,0 +1,43 @@ +id(); + $table->foreignId('penawaran_id')->constrained('penawaran'); + $table->string('nomor_proposal_penawaran'); + $table->date('tanggal_proposal_penawaran'); + $table->string('biaya_final'); + $table->datetime('sls_resume'); + $table->datetime('sla_final'); + $table->string('catatan'); + $table->string('attachment'); + $table->foreignId('region_id')->constrained('regions'); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('persetujuan_penawaran'); + } +}; diff --git a/database/migrations/2024_09_26_043525_create_detail_penawaran_table.php b/database/migrations/2024_09_26_043525_create_detail_penawaran_table.php new file mode 100644 index 0000000..6a185db --- /dev/null +++ b/database/migrations/2024_09_26_043525_create_detail_penawaran_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignId('kjpp_rekanan_id')->constrained('kjpp'); + $table->foreignId('penawaran_id')->constrained('penawaran'); + $table->string('biaya_penawaran'); + $table->string('attachment'); + $table->string('dokumen_persetujuan'); + $table->boolean('status')->default(true)->nullable(); + $table->char('authorized_status', 1)->nullable(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('detail_penawaran'); + } +}; diff --git a/database/migrations/2024_09_30_021444_update_kjpp_table.php b/database/migrations/2024_09_30_021444_update_kjpp_table.php new file mode 100644 index 0000000..1ffb5a1 --- /dev/null +++ b/database/migrations/2024_09_30_021444_update_kjpp_table.php @@ -0,0 +1,30 @@ +string('ijin_usaha_id')->change(); + $table->string('jenis_aset_id')->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('kjpp', function (Blueprint $table) { + $table->string('ijin_usaha_id')->nullable()->change(); + $table->string('jenis_aset_id')->nullable()->change(); + }); + } +}; diff --git a/database/migrations/2024_10_01_070143_update_penawaran_table.php b/database/migrations/2024_10_01_070143_update_penawaran_table.php new file mode 100644 index 0000000..dc5cd40 --- /dev/null +++ b/database/migrations/2024_10_01_070143_update_penawaran_table.php @@ -0,0 +1,28 @@ +char('status')->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('penawaran', function (Blueprint $table) { + $table->boolean('status')->default(true)->nullable(); + }); + } +}; diff --git a/module.json b/module.json index a5d9986..4fa1aad 100644 --- a/module.json +++ b/module.json @@ -1,12 +1,94 @@ { - "name": "Lpj", - "alias": "lpj", - "database": "", - "description": "", - "keywords": [], - "priority": 0, - "providers": [ - "Modules\\Lpj\\Providers\\LpjServiceProvider" + "name": "Lpj", + "alias": "lpj", + "database": "", + "description": "", + "keywords": [], + "priority": 0, + "providers": ["Modules\\Lpj\\Providers\\LpjServiceProvider"], + "files": [], + "menu": { + "main": [ + { + "title": "Permohonan", + "path": "permohonan", + "icon": "ki-filled ki-questionnaire-tablet text-lg", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["administrator"] + }, + { + "title": "Tender", + "path": "tender", + "icon": "ki-filled ki-category text-lg", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["administrator"], + "sub": [ + { + "title": "Data Penawaran", + "path": "tender.penawaran", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + }, + { + "title": "Data Proses Penawaran", + "path": "tender.proses_penawaran", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + }, + { + "title": "Data Penawaran Ulang", + "path": "tender.penawaran_ulang", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + } + ] + }, + { + "title": "Pembatalan", + "path": "", + "icon": "ki-filled ki-file-deleted text-lg", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["administrator"] + }, + { + "title": "Data Debitur", + "path": "debitur", + "icon": "ki-filled ki-people text-lg", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["administrator"] + }, + { + "title": "Authorization", + "path": "authorization", + "icon": "ki-filled ki-some-files text-lg", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["administrator"] + }, + { + "title": "Laporan", + "path": "", + "icon": "ki-filled ki-some-files text-lg", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["administrator"] + } ], "files": [], "menu": { @@ -19,7 +101,44 @@ "attributes": [], "permission": "", "roles": [ - "Administrator" + "administrator" + ] + }, + { + "title": "Tender", + "path": "tender", + "icon": "ki-filled ki-category text-lg", + "classes": "", + "attributes": [], + "permission": "", + "roles": [ + "administrator" + ], + "sub": [ + { + "title": "Data Penawaran", + "path": "tender.penawaran", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + }, + { + "title": "Data Proses Penawaran", + "path": "tender.proses_penawaran", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + }, + { + "title": "Data Penawaran Ulang", + "path": "tender.penawaran_ulang", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + } ] }, { @@ -30,7 +149,7 @@ "attributes": [], "permission": "", "roles": [ - "Administrator" + "administrator" ] }, { @@ -53,13 +172,24 @@ "classes": "", "attributes": [], "permission": "", + "roles": [ + "administrator" + ] + }, + { + "title": "Assignment", + "path": "penilaian", + "icon": "ki-filled ki-badge", + "classes": "", + "attributes": [], + "permission": "", "roles": [ "Administrator" ] }, { - "title": "Authorization", - "path": "authorization", + "title": "Activity", + "path": "activity", "icon": "ki-filled ki-some-files text-lg", "classes": "", "attributes": [], @@ -76,7 +206,7 @@ "attributes": [], "permission": "", "roles": [ - "Administrator" + "administrator" ] } ], @@ -116,14 +246,6 @@ "permission": "", "roles": [] }, - { - "title": "Jenis Jaminan", - "path": "basicdata.jenis-jaminan", - "classes": "", - "attributes": [], - "permission": "", - "roles": [] - }, { "title": "Jenis Legalitas Jaminan", "path": "basicdata.jenis-legalitas-jaminan", @@ -134,7 +256,7 @@ }, { "title": "Jenis Aset", - "path": "basicdata.jenis-aset", + "path": "basicdata.jenis-jaminan", "classes": "", "attributes": [], "permission": "", @@ -195,6 +317,46 @@ "attributes": [], "permission": "", "roles": [] + }, + { + "title": "Region", + "path": "basicdata.region", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + }, + { + "title": "Staff Appraisal", + "path": "basicdata.teams", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + }, + { + "title": "Jenis Penilaian", + "path": "basicdata.jenis-penilaian", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + }, + { + "title": "KJPP", + "path": "basicdata.kjpp", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] + }, + { + "title": "Ijin Usaha", + "path": "basicdata.ijin_usaha", + "classes": "", + "attributes": [], + "permission": "", + "roles": [] } ] } @@ -202,3 +364,4 @@ "system": [] } } +} diff --git a/resources/views/Ijin_usaha/create.blade.php b/resources/views/Ijin_usaha/create.blade.php new file mode 100644 index 0000000..507268d --- /dev/null +++ b/resources/views/Ijin_usaha/create.blade.php @@ -0,0 +1,77 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection + +@section('content') +
| + + | ++ Kode Ijin Usaha + + | ++ Nama Ijin Usaha + + | +Action | +
|---|
+ {{ $permohonan->keterangan }} +
++ {{ $permohonan->keterangan }} +
+Penilai:
+ {{ $penilai }} +Surveyor:
+ {{ $surveyor }} +Penilai Surveyor:
+ {{ $penilaiSurveyor }} +| + + | ++ Nomor Registrasi + + + | ++ Tanggal Permohonan + + + | ++ User Pemohon + + + | ++ Cabang Pemohon + + + | ++ Debitur + + + | ++ Tujuan Penilaian + + + | ++ Status + + + | +Action | +
|---|