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/KJPPExport.php b/app/Exports/KJPPExport.php index 86f3473..3b0cb13 100644 --- a/app/Exports/KJPPExport.php +++ b/app/Exports/KJPPExport.php @@ -53,7 +53,7 @@ class KJPPExport implements WithColumnFormatting, WithHeadings, FromCollection, 'ID', 'Code', 'Name', - 'Jenis Kantor / Cabang', + 'Jenis Kantor', 'Nomor Ijin Usaha', 'Province Code', 'City Code', 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/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/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/KJPPController.php b/app/Http/Controllers/KJPPController.php index f1f613b..99a0c2f 100644 --- a/app/Http/Controllers/KJPPController.php +++ b/app/Http/Controllers/KJPPController.php @@ -40,7 +40,15 @@ class KJPPController extends Controller $jenis_aset = JenisJaminan::all(); $provinces = Province::all(); - return view('lpj::kjpp.create', compact('branch', 'ijin_usaha', 'jenis_aset', 'provinces')); + // Generate KJPP Number + $lastKjpp = KJPP::orderBy('code', 'desc')->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')); } /** @@ -62,6 +70,9 @@ class KJPPController extends Controller 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; @@ -127,7 +138,10 @@ class KJPPController extends Controller if ($file !== null) { // Jika ada file dari database maka hapus file yang lama ke file yang baru $kjpp = KJPP::find($id); - // Storage::delete('public/uploads_pdf/' . $kjpp->attachment); + // 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; diff --git a/app/Http/Controllers/TenderController.php b/app/Http/Controllers/TenderController.php index d23fd30..0ac29a0 100644 --- a/app/Http/Controllers/TenderController.php +++ b/app/Http/Controllers/TenderController.php @@ -2,14 +2,24 @@ namespace Modules\Lpj\Http\Controllers; -use App\Http\Controllers\Controller; -use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; use Modules\Lpj\Models\Penawaran; +use App\Http\Controllers\Controller; +use Maatwebsite\Excel\Facades\Excel; +use Modules\Lpj\Models\PenawaranTender; +use Modules\Lpj\Exports\PenawaranTenderExport; +use Modules\Lpj\Http\Requests\TenderPenawaranRequest; +use Modules\Lpj\Models\JenisLaporan; +use Modules\Lpj\Models\KJPP; +use Modules\Lpj\Models\Permohonan; +use Modules\Lpj\Models\StatusPermohonan; +use Modules\Lpj\Models\TujuanPenilaianKJPP; class TenderController extends Controller { + public $user; + /** * Display a listing of the resource. */ @@ -21,33 +31,41 @@ class TenderController extends Controller /** * Show the form for creating a new resource. */ - public function penawaran_create() + public function penawaran_create($id) { - return view('lpj::penawaran/create'); + $status = StatusPermohonan::all(); + $tujuan_penilaian_kjpp = TujuanPenilaianKJPP::all(); + $jenis_laporan = JenisLaporan::all(); + $kjpp = KJPP::all(); + $permohonan = Permohonan::find($id); + $permohonanId = $permohonan->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(Request $request): RedirectResponse + public function penawaran_store(TenderPenawaranRequest $request, $id) { - // $validated = $request->validate([ - // 'nama_kjpp_sebelumnya' => 'required|string', - // 'biaya_kjpp_sebelumnya' => 'required|numeric', - // 'tgl_penilaian_sebelumnya' => 'required|date', - // 'nama_kjpp_1' => 'required|exists:kjpps,id', - // 'nama_kjpp_2' => 'required|exists:kjpps,id', - // 'nama_kjpp_3' => 'required|exists:kjpps,id', - // 'data_jaminan_legalitas' => 'required|string', - // 'tujuan_penilaian' => 'required|in:Penjaminan Hutang,Lelang,Revaluasi Aset', - // 'jenis_laporan' => 'required|in:Short report,Full report', - // 'batas_waktu' => 'required|date', - // 'catatan' => 'nullable|string' - // ]); + $validated = $request->validated(); - // Penawaran::create($validated); + if ($validated) { + $validated['nomor_registrasi'] = $request->nomor_registrasi; - // return redirect()->back()->with('success', 'Data berhasil disimpan!'); + $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'); + } } /** @@ -69,7 +87,7 @@ class TenderController extends Controller /** * Update the specified resource in storage. */ - public function update(Request $request, $id): RedirectResponse + public function update(Request $request, $id) { // } @@ -82,6 +100,73 @@ class TenderController extends Controller // } + 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'); 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/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/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/KJPPRequest.php b/app/Http/Requests/KJPPRequest.php index 3b5c637..e3e6fe4 100644 --- a/app/Http/Requests/KJPPRequest.php +++ b/app/Http/Requests/KJPPRequest.php @@ -32,8 +32,10 @@ class KJPPRequest extends FormRequest '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' => 'nullable', - 'jenis_aset_id' => 'nullable', + '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' ]; @@ -54,14 +56,6 @@ class KJPPRequest extends FormRequest return true; } - public function prepareForValidation(): void - { - $this->merge([ - 'ijin_usaha_id' => json_encode($this->ijin_usaha_id), - 'jenis_aset_id' => json_encode($this->jenis_aset_id) - ]); - } - public function messages(): array { return [ @@ -106,6 +100,10 @@ class KJPPRequest extends FormRequest '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/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/JenisLaporan.php b/app/Models/JenisLaporan.php new file mode 100644 index 0000000..13e248e --- /dev/null +++ b/app/Models/JenisLaporan.php @@ -0,0 +1,22 @@ +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_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_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 3d11d99..3416237 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": { diff --git a/resources/views/jenis_laporan/create.blade.php b/resources/views/jenis_laporan/create.blade.php new file mode 100644 index 0000000..64d0bb4 --- /dev/null +++ b/resources/views/jenis_laporan/create.blade.php @@ -0,0 +1,77 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection + +@section('content') +
+ @if (isset($jenisLaporan->id)) +
+ + @method('PUT') + @else + + @endif + @csrf +
+
+

+ {{ isset($jenisLaporan->id) ? 'Edit' : 'Tambah' }} Jenis Laporan +

+
+ Back +
+
+
+ @if (isset($jenisLaporan->id)) +
+ +
+ + @error('code') + {{ $message }} + @enderror +
+
+ @else +
+ +
+ + @error('code') + {{ $message }} + @enderror +
+
+ @endif +
+ +
+ + @error('name') + {{ $message }} + @enderror +
+
+
+ +
+
+
+
+
+@endsection diff --git a/resources/views/jenis_laporan/index.blade.php b/resources/views/jenis_laporan/index.blade.php new file mode 100644 index 0000000..fb1f6b8 --- /dev/null +++ b/resources/views/jenis_laporan/index.blade.php @@ -0,0 +1,153 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render('basicdata.jenis_laporan') }} +@endsection + +@section('content') +
+
+
+

+ Daftar Jenis Laporan +

+ +
+
+
+ + + + + + + + + +
+ + + Kode Laporan + + + Jenis Laporan + + Action
+
+ +
+
+
+@endsection + +@push('scripts') + + + +@endpush diff --git a/resources/views/kjpp/create.blade.php b/resources/views/kjpp/create.blade.php index 977fe3f..c03ab45 100644 --- a/resources/views/kjpp/create.blade.php +++ b/resources/views/kjpp/create.blade.php @@ -32,7 +32,7 @@
+ value="{{ isset($kjpp->id) ? $kjpp->code : (empty($kjpp->id) ? $fullKjppNumber : old('code')) }}"> @error('code') {{ $message }} @enderror @@ -49,11 +49,11 @@
- +
- @if (isset($ijin_usaha)) @@ -345,46 +346,42 @@ -
- @foreach ($ijin_usaha as $row) -
-
- @foreach ($jenis_aset as $row) -
diff --git a/resources/views/kjpp/index.blade.php b/resources/views/kjpp/index.blade.php index 20777a5..dccdacd 100644 --- a/resources/views/kjpp/index.blade.php +++ b/resources/views/kjpp/index.blade.php @@ -45,7 +45,7 @@ - Jenis Kantor / Cabang + Jenis Kantor Action @@ -130,7 +130,7 @@ title: 'Nama KJPP', }, jenis_kantor: { - title: 'Jenis Kantor / Cabang', + title: 'Jenis Kantor', }, actions: { title: 'Action', diff --git a/resources/views/kjpp/show.blade.php b/resources/views/kjpp/show.blade.php index 14e9ae3..35762c9 100644 --- a/resources/views/kjpp/show.blade.php +++ b/resources/views/kjpp/show.blade.php @@ -33,7 +33,7 @@
- +

@foreach ($branches as $branch) @@ -63,7 +63,7 @@ {{ $district->name }} @endforeach , @foreach ($cities as $city) - {{ $city->name }} + {{ ucwords(strtolower($city->name)) }} @endforeach , @foreach ($provinces as $province) {{ $province->name }} @@ -148,32 +148,50 @@ -

- @foreach ($ijin_usahas as $row) - - @endforeach +
+ @if (isset($kjpp->ijin_usaha_id)) +
+ @foreach (json_decode($kjpp->ijin_usaha_id, true) as $ijin_code) + @php + $ijin_usaha = $ijin_usahas->firstWhere('code', $ijin_code); + @endphp + @if ($ijin_usaha) +
+ {{ $ijin_usaha->name }} +
+ @endif + @endforeach +
+ @else +
No + business license + selected.
+ @endif
-
- @foreach ($jenis_jaminan as $row) - - @endforeach +
+ @if (isset($kjpp->jenis_aset_id)) + @foreach (json_decode($kjpp->jenis_aset_id, true) as $aset_code) + @php + $jenis_aset = $jenis_jaminan->firstWhere('code', $aset_code); + @endphp + @if ($jenis_aset) + + {{ $jenis_aset->name }} + + @endif + @endforeach + @else + + No asset type selected. + + @endif
diff --git a/resources/views/penawaran/create.blade.php b/resources/views/penawaran/create.blade.php index 08ec062..9a081ec 100644 --- a/resources/views/penawaran/create.blade.php +++ b/resources/views/penawaran/create.blade.php @@ -1,22 +1,193 @@ @extends('layouts.main') @section('breadcrumbs') - {{ Breadcrumbs::render('tender.penawaran') }} + {{ Breadcrumbs::render(request()->route()->getName(), request()->route('id')) }} @endsection @section('content')
+
+ @csrf -
-
-

- Tambah Data Penawaran -

- +
+
+

+ Tambah Data Penawaran +

+
+ + Back +
+
+
+
+ +
+ + @error('nomor_registrasi') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('code') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('nama_kjpp_sebelumnya') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('biaya_kjpp_sebelumnya') + {{ $message }} + @enderror +
+ +
+ + @error('tanggal_penilaian_sebelumnya') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('tujuan_penilaian_kjpp_id') + {{ $message }} + @enderror +
+ +
+ + @error('jenis_laporan_id') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('start_date') + {{ $message }} + @enderror +
+ +
+ + @error('end_date') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('catatan') + {{ $message }} + @enderror +
+
+
+ + +
+
+ +
+
-
- {{-- @include('lpj::debitur.form') --}} -
-
+
@endsection diff --git a/resources/views/penawaran/index.blade.php b/resources/views/penawaran/index.blade.php index 9158891..897f77e 100644 --- a/resources/views/penawaran/index.blade.php +++ b/resources/views/penawaran/index.blade.php @@ -7,15 +7,156 @@ @section('content')
-
+

Data Penawaran

+
+
+ +
+ +
+
+ + + + + + + + + + +
+ + + Nomor Penawaran + + + Nama KJPP Sebelumnya + + + Tanggal Penilaian Sebelumnya + + Action
+
+
@endsection + +@push('scripts') + + + +@endpush diff --git a/resources/views/permohonan/index.blade.php b/resources/views/permohonan/index.blade.php index 23b267b..c5c6014 100644 --- a/resources/views/permohonan/index.blade.php +++ b/resources/views/permohonan/index.blade.php @@ -7,7 +7,8 @@ @section('content')
-
+

Daftar Permohonan @@ -27,46 +28,48 @@

- +
- - - - - - - - - - - + + + + + + + + + + +
- - - Nomor Registrasi - - - Tanggal Permohonan - - - User Pemohon - - - Cabang Pemohon - - - Debitur - - - Tujuan Penilaian - - - Status - - Action
+ + + Nomor Registrasi + + + Tanggal Permohonan + + + User Pemohon + + + Cabang Pemohon + + + Debitur + + + Tujuan Penilaian + + + Status + + Action
-