diff --git a/DataTables/DetailPenagihanDataTable.php b/DataTables/DetailPenagihanDataTable.php new file mode 100644 index 0000000..ce09968 --- /dev/null +++ b/DataTables/DetailPenagihanDataTable.php @@ -0,0 +1,92 @@ +filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + $query->where('nomor_pinjaman', 'like', "%" . $search['value'] . "%"); + } + })->addIndexColumn()->editColumn('tanggal_penagihan', function ($row) { + $date = Carbon::create($row->tanggal_penagihan); + return $date->locale('id')->translatedFormat('d F Y'); + })->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(DetailPenagihan $model) + : QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html() + : HtmlBuilder + { + return $this->builder() + ->setTableId('detail-penagihan-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => false, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5') + ->drawCallback("function() {" . file_get_contents(Module::getModulePath('writeoff').'Resources/views/pencatatan/detail_penagihan/_draw-scripts.js') . "}"); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns() + : array + { + return [ + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('tanggal_penagihan')->title('Tanggal Penagihan'), + Column::make('pic_penagihan')->title('PIC Penagihan'), + Column::make('tindakan')->title('Tindakan'), + Column::make('informasi_lku')->title('Informasi LKU'), + Column::make('prose_hukum')->title('Proses Hukum'), + Column::make('komitmen_debitur')->title('Komitmen Debitur') + ]; + } + + /** + * Get the filename for export. + */ + protected function filename() + : string + { + return 'Detail_Penagihan_' . date('YmdHis'); + } + } diff --git a/Database/Migrations/2023_12_18_140550_create_detail_penagihan_table.php b/Database/Migrations/2023_12_18_140550_create_detail_penagihan_table.php new file mode 100644 index 0000000..2e9f781 --- /dev/null +++ b/Database/Migrations/2023_12_18_140550_create_detail_penagihan_table.php @@ -0,0 +1,43 @@ +id(); + $table->string('nomor_pinjaman'); + $table->string('kode_penagihan'); + $table->date('tanggal_penagihan'); + $table->string('tindakan')->nullable(); + $table->string('informasi_lku')->nullable(); + $table->string('pic_penagihan')->nullable(); + $table->string('prose_hukum')->nullable(); + $table->string('komitmen_debitur')->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_penagihan'); + } +}; diff --git a/Database/Migrations/2023_12_18_145244_create_detail_subrogasi_jamkrindo_table.php b/Database/Migrations/2023_12_18_145244_create_detail_subrogasi_jamkrindo_table.php new file mode 100644 index 0000000..4359f39 --- /dev/null +++ b/Database/Migrations/2023_12_18_145244_create_detail_subrogasi_jamkrindo_table.php @@ -0,0 +1,42 @@ +id(); + $table->string('nomor_pinjaman'); + $table->string('kode_pembayaran'); + $table->date('tanggal_pembayaran'); + $table->double('pembayaran_debitur', 20, 2); + $table->double('subrogasi_jamkrindo', 20, 2); + $table->double('pendapatan_bank', 20, 2); + $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_subrogasi_jamkrindo'); + } +}; diff --git a/Entities/DetailPenagihan.php b/Entities/DetailPenagihan.php new file mode 100644 index 0000000..10044fc --- /dev/null +++ b/Entities/DetailPenagihan.php @@ -0,0 +1,23 @@ +middleware(function ($request, $next) { + $this->user = Auth::guard('web')->user(); + return $next($request); + }); + } + + public function index() + { + return view('writeoff::pencatatan.detail_penagihan.index'); + } + + public function store(Request $request) + { + $hapusbuku = HapusBuku::where('nomor_pinjaman', $request->nomor_pinjaman)->first(); + if ($hapusbuku) { + + echo json_encode(['status' => 'success', + 'message' => 'Nomor Pinjaman ditemukan.', + 'redirect' => route('pencatatan.detail_penagihan.show', ['nomor_pinjaman' => $request->nomor_pinjaman]) + ]); + } else { + echo json_encode(['status' => 'error', 'message' => 'Nomor Pinjaman tidak ditemukan.']); + } + } + + public function show(DetailPenagihanDataTable $dataTable, $nomor_pinjaman) + { + if (is_null($this->user) || !$this->user->can('master.read')) { + abort(403, 'Sorry !! You are Unauthorized to view any master data !'); + } + + session_start(); + $_SESSION['nomor_pinjaman']= $nomor_pinjaman; + + $hapusbuku = HapusBuku::where('nomor_pinjaman', $nomor_pinjaman)->first(); + if ($hapusbuku) { + $cabang = Branch::where('kode', $hapusbuku->kode_cabang)->first(); + return $dataTable->render('writeoff::pencatatan.detail_penagihan.show', compact('hapusbuku', 'cabang')); + } else { + return redirect() + ->route('pencatatan.detail_penagihan.index') + ->with('error', 'Nomor Pinjaman tidak ditemukan.'); + } + } + + } diff --git a/Http/Requests/DetailPenagihan/StoreDetailPenagihanRequest.php b/Http/Requests/DetailPenagihan/StoreDetailPenagihanRequest.php new file mode 100644 index 0000000..93f7b14 --- /dev/null +++ b/Http/Requests/DetailPenagihan/StoreDetailPenagihanRequest.php @@ -0,0 +1,51 @@ + + */ + public function rules() + : array + { + return [ + 'nomor_pinjaman' => 'nullable|string', + 'kode_penagihan' => 'nullable|string', + 'tanggal_penagihan' => 'nullable|date', + 'tindakan' => 'nullable|string', + 'informasi_lku' => 'nullable|string', + 'pic_penagihan' => 'nullable|string', + 'prose_hukum' => 'nullable|string', + 'komitmen_debitur' => 'nullable|string', + 'status' => 'nullable', + ]; + } + + public function ignored() + : string + { + return $this->id; + } + + protected function prepareForValidation() + { + $this->merge([ + 'nomor_pinjaman' => $_SESSION['nomor_pinjaman'], + ]); + } + } diff --git a/Livewire/DetailPembayaran/DetailPembayaranModal.php b/Livewire/DetailPembayaran/DetailPembayaranModal.php index d4ee60b..4b5d57b 100644 --- a/Livewire/DetailPembayaran/DetailPembayaranModal.php +++ b/Livewire/DetailPembayaran/DetailPembayaranModal.php @@ -5,7 +5,7 @@ use Illuminate\Support\Facades\DB; use Livewire\Component; use Modules\Writeoff\Entities\DetailPembayaran; - use Modules\Writeoff\Http\Requests\DetailPembayaran\StoreDetailPembayaranRequest; + use Modules\Writeoff\Http\Requests\DetailPembayaran\StoreDetailPenagihanRequest; use Request; class DetailPembayaranModal extends Component @@ -59,7 +59,7 @@ protected function rules() { - $request = new StoreDetailPembayaranRequest(); + $request = new StoreDetailPenagihanRequest(); return $request->rules(); } diff --git a/Livewire/DetailPenagihan/DetailPenagihanModal.php b/Livewire/DetailPenagihan/DetailPenagihanModal.php new file mode 100644 index 0000000..c77f78e --- /dev/null +++ b/Livewire/DetailPenagihan/DetailPenagihanModal.php @@ -0,0 +1,73 @@ +pinjaman = request()->segment(3); + $this->nomor_pinjaman = $this->pinjaman; + return view('writeoff::livewire.detail-penagihan.detail-penagihan-modal'); + } + + public function submit() + { + $this->validate(); + session_start(); + // Validate the form input data + DB::transaction(function () { + // Prepare the data for creating a new user + $data = [ + 'nomor_pinjaman' => $_SESSION['nomor_pinjaman'], + 'kode_penagihan' => round(microtime(true) * 100), + 'tanggal_penagihan' => $this->tanggal_penagihan, + 'tindakan' => $this->tindakan, + 'informasi_lku' => $this->informasi_lku, + 'pic_penagihan' => $this->pic_penagihan, + 'prose_hukum' => $this->prose_hukum, + 'komitmen_debitur' => $this->komitmen_debitur, + 'status' => $this->status, + ]; + + DetailPenagihan::create($data); + $this->dispatch('success', __('Data Detail Penagihan berhasil ditambahkan')); + }); + + // Reset the form fields after successful submission + $this->reset(); + $this->nomor_pinjaman = request()->segment(3); + } + + + public function hydrate() + { + $this->resetErrorBag(); + $this->resetValidation(); + } + + protected function rules() + { + $request = new StoreDetailPenagihanRequest(); + + return $request->rules(); + } + } + diff --git a/Resources/views/livewire/detail-penagihan/detail-penagihan-modal.blade.php b/Resources/views/livewire/detail-penagihan/detail-penagihan-modal.blade.php new file mode 100644 index 0000000..86154ae --- /dev/null +++ b/Resources/views/livewire/detail-penagihan/detail-penagihan-modal.blade.php @@ -0,0 +1,138 @@ + diff --git a/Resources/views/partials/menu/_app.blade.php b/Resources/views/partials/menu/_app.blade.php index 47de48a..304eebc 100644 --- a/Resources/views/partials/menu/_app.blade.php +++ b/Resources/views/partials/menu/_app.blade.php @@ -117,7 +117,7 @@ -