update hapus buku

This commit is contained in:
daengdeni 2023-12-05 18:17:27 +07:00
parent 7b781ad76d
commit 67605b866a
6 changed files with 300 additions and 12 deletions

View File

@ -10,6 +10,7 @@
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
use Illuminate\Support\Number;
class KlaimJamkrindoDataTable extends DataTable
{
@ -45,13 +46,13 @@
return $row->jumlah_debitur_surat.'/'.$row->jumlah_debitur_excel;
})
->editColumn('dana_hasil_klaim', function ($row) {
return $this->rupiah($row->dana_hasil_klaim);
return Number::currency($row->dana_hasil_klaim,'IDR','id_ID');
})
->editColumn('nilai_penyelesaian', function ($row) {
return $this->rupiah($row->nilai_penyelesaian).' / '.$row->jumlah_debitur_penyelesaian;
return Number::currency($row->nilai_penyelesaian,'IDR','id_ID').' / '.$row->jumlah_debitur_penyelesaian;
})
->editColumn('sisa_dana_ksl', function ($row) {
return $this->rupiah($row->sisa_dana_ksl).' / '.$row->jumlah_debitur_sisa_ksl;
return Number::currency($row->sisa_dana_ksl,'IDR','id_ID').' / '.$row->jumlah_debitur_sisa_ksl;
})
->editColumn('is_detail_debitur', function ($row) {
return $row->is_detail_debitur ? 'Ada' : 'Tidak Ada';
@ -62,11 +63,6 @@
return view('writeoff::pencatatan.klaim_jamkrindo._actions', compact('klaim_jamkrindo'));
})->setRowId('id');
}
private function rupiah($expression){
return "Rp. ".number_format($expression, 2, ',', '.');
}
/**
* Get the query source of dataTable.
*/

View File

@ -0,0 +1,65 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up()
: void
{
Schema::create('hapus_buku', function (Blueprint $table) {
$table->id();
$table->string('nomor_pinjaman', 20);
$table->integer('kode_jenis_pinjaman', false, true);
$table->integer('kode_debitur', false, true);
$table->text('alamat_debitur')->nullable();
$table->string('npwp_debitur', 16)->nullable();
$table->string('kode_cabang', 11);
$table->string('kode_mata_uang', 3);
$table->date('tanggal_hapus_buku');
$table->string('nomor_fasilitas', 50);
$table->integer('kode_jenis_fasilitas', false, true);
$table->double('nilai_plafond_awal', 15, 2);
$table->integer('suku_bunga', false, true);
$table->double('baki_debet', 15, 2);
$table->double('jumlah_bunga', 15, 2);
$table->double('jumlah_kewajiban_lain', 15, 2)->nullable();
$table->double('total_kewajiban', 15, 2)->nullable();
$table->double('total_bunga_extra', 15, 2);
$table->double('bunga_ekstra', 15, 2)->nullable();
$table->double('bunga_non_ekstra', 15, 2);
$table->double('denda', 15, 2)->nullable();
$table->double('tagihan_lain', 15, 2);
$table->double('biaya_lain', 15, 2);
$table->double('total_all_kewajiban', 15, 2)->nullable();
$table->string('memo_persetujuan', 100)->nullable();
$table->integer('lama_hari')->nullable();
$table->text('proses_hukum')->nullable();
$table->text('komitmen_debitur')->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('hapus_buku');
}
};

44
Entities/HapusBuku.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace Modules\Writeoff\Entities;
class HapusBuku extends BaseModel
{
protected $table = 'hapus_buku';
protected $fillable = [
'nomor_pinjaman',
'kode_jenis_pinjaman',
'kode_debitur',
'alamat_debitur',
'npwp_debitur',
'kode_cabang',
'kode_mata_uang',
'tanggal_hapus_buku',
'nomor_fasilitas',
'kode_jenis_fasilitas',
'nilai_plafond_awal',
'suku_bunga',
'baki_debet',
'jumlah_bunga',
'jumlah_kewajiban_lain',
'total_kewajiban',
'total_bunga_extra',
'bunga_ekstra',
'bunga_non_ekstra',
'denda',
'tagihan_lain',
'biaya_lain',
'total_all_kewajiban',
'memo_persetujuan',
'lama_hari',
'proses_hukum',
'komitmen_debitur',
'keterangan',
'status',
'registered_at',
'authorized_at',
'authorized_status',
'authorized_by',
];
}

View File

@ -0,0 +1,102 @@
<?php
namespace Modules\Writeoff\Http\Requests\HapusBuku;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\JsonResponse;
class StoreHapusBukuRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules()
: array
{
return [
'nomor_pinjaman' => 'required|integer',
'kode_jenis_pinjaman' => 'required|integer',
'kode_debitur' => 'required|integer',
'alamat_debitur' => 'nullable|string',
'npwp_debitur' => 'nullable|string',
'kode_cabang' => 'required|string',
'kode_mata_uang' => 'required|string',
'tanggal_hapus_buku' => 'required|date',
'nomor_fasilitas' => 'required|string',
'kode_jenis_fasilitas' => 'required|integer',
'nilai_plafond_awal' => 'required|numeric',
'suku_bunga' => 'required|integer',
'baki_debet' => 'required|numeric',
'jumlah_bunga' => 'required|numeric',
'jumlah_kewajiban_lain' => 'nullable|numeric',
'total_kewajiban' => 'nullable|numeric',
'total_bunga_extra' => 'required|numeric',
'bunga_ekstra' => 'nullable|numeric',
'bunga_non_ekstra' => 'required|numeric',
'denda' => 'nullable|numeric',
'tagihan_lain' => 'required|numeric',
'biaya_lain' => 'required|numeric',
'total_all_kewajiban' => 'nullable|numeric',
'memo_persetujuan' => 'nullable|string',
'lama_hari' => 'nullable|integer',
'proses_hukum' => 'nullable|string',
'komitmen_debitur' => 'nullable|string',
'keterangan' => 'nullable|string',
'status' => 'nullable|boolean',
];
}
public function ignored()
: string
{
return $this->id;
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator)
: void
{
$validator->after(function (Validator $validator) {
if ($validator->errors()->any()) {
$errors = json_decode($validator->errors()->toJson(), true);
foreach ($errors as $key => $value) {
flash($value[0]);
}
return redirect()
->route('pencatatan.hapus_buku.index')
->with('error', 'Hapus Buku created failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator)
: JsonResponse
{
$errors = (new ValidationException($validator))->errors();
throw new HttpResponseException(response()->json([
'success' => false,
'errors' => $errors,
'messages' => 'Hapus Buku created failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace Modules\Writeoff\Http\Requests\SubrogasiJamkrindo;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
class UpdateHapusBukuRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules()
: array
{
return [
'nomor_pinjaman' => 'required|integer',
'kode_debitur' => 'required|integer',
'nama_debitur' => 'required|string',
'kode_cabang' => 'required|string',
'nama_cabang' => 'required|string',
'nomor_rekening' => 'required|integer',
'nama_rekening' => 'required|string',
'plafond' => 'required|numeric',
'tenor' => 'required|integer',
'tanggal_pengajuan_klaim' => 'required|date',
'piutang_subrogasi' => 'required|numeric',
'total_bayar_subrogasi' => 'required|numeric',
'sisa_piutang_subrogasi' => 'required|numeric',
'is_lunas_subrogasi' => 'required|boolean',
'keterangan' => 'nullable|string',
'status' => 'nullable|boolean',
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator)
: void
{
$validator->after(function (Validator $validator) {
if ($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash($value[0]);
}
return redirect()
->route('pencatatan.subrogasi_jamkrindo.index')
->with('error', 'Subrogasi Jamkrindo updated failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator)
: JsonResponse
{
$errors = (new ValidationException($validator))->errors();
throw new HttpResponseException(response()->json([
'success' => false,
'errors' => $errors,
'messages' => 'Subrogasi Jamkrindo updated failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -9,8 +9,8 @@
use Modules\Writeoff\Entities\Debitur;
use Modules\Writeoff\Entities\Rekening;
use Modules\Writeoff\Entities\SubrogasiJamkrindo;
use Modules\Writeoff\Http\Requests\SubrogasiJamkrindo\StoreSubrogasiJamkrindoRequest;
use Modules\Writeoff\Http\Requests\SubrogasiJamkrindo\UpdateSubrogasiJamkrindoRequest;
use Modules\Writeoff\Http\Requests\SubrogasiJamkrindo\StoreHapusBukuRequest;
use Modules\Writeoff\Http\Requests\SubrogasiJamkrindo\UpdateHapusBukuRequest;
class SubrogasiJamkrindoModal extends Component
{
@ -166,9 +166,9 @@
{
if ($this->edit_mode) {
$request = new UpdateSubrogasiJamkrindoRequest();
$request = new UpdateHapusBukuRequest();
} else {
$request = new StoreSubrogasiJamkrindoRequest();
$request = new StoreHapusBukuRequest();
}