update approval debitur

This commit is contained in:
daengdeni 2024-01-17 11:40:34 +07:00
parent bfe89659e3
commit 670f1738da
2 changed files with 19 additions and 5 deletions

View File

@ -94,6 +94,7 @@
'Parameter Jenis Jaminan' => 'GuaranteeType', 'Parameter Jenis Jaminan' => 'GuaranteeType',
'Parameter Jenis Fasilitas' => 'FacilityType', 'Parameter Jenis Fasilitas' => 'FacilityType',
'Parameter Jenis Pinjaman' => 'LoanType', 'Parameter Jenis Pinjaman' => 'LoanType',
'Parameter Debitur' => 'Debitur',
]; ];
try { try {
$approval = Approval::findOrFail($id); $approval = Approval::findOrFail($id);
@ -148,7 +149,9 @@
'message' => 'Approval ' . $approval->description . ' successfully . ' 'message' => 'Approval ' . $approval->description . ' successfully . '
]); ]);
} catch (Exception $e) { } catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Approval ' . $approval->description . ' failed . ']); echo json_encode(['status' => 'error',
'message' => 'Approval ' . $approval->description . ' failed . '
]);
} }
} }

View File

@ -26,7 +26,7 @@
protected $listeners = [ protected $listeners = [
'delete' => 'delete', 'delete' => 'delete',
'update' => 'update', 'update' => 'update',
'reload' => 'reload', 'reload' => 'reload',
]; ];
public function render() public function render()
@ -56,6 +56,9 @@
// Emit a success event with a message // Emit a success event with a message
$debitur = Debitur::find($this->id); $debitur = Debitur::find($this->id);
$data['updated_by'] = auth()->user()->id;
$data['updated_at'] = now();
$approval = [ $approval = [
'method' => 'update', 'method' => 'update',
'menu' => 'Parameter Debitur', 'menu' => 'Parameter Debitur',
@ -81,6 +84,9 @@
} }
} else { } else {
// Emit a success event with a message // Emit a success event with a message
$data['created_by'] = auth()->user()->id;
$data['created_at'] = now();
$approval = [ $approval = [
'method' => 'create', 'method' => 'create',
'menu' => 'Parameter Debitur', 'menu' => 'Parameter Debitur',
@ -129,14 +135,19 @@
public function delete($id) public function delete($id)
{ {
$debitur = Debitur::find($id); $old = Debitur::find($id);
$debitur->delete_by = auth()->user()->id; unset($old->deleted_at);
unset($old->deleted_by);
$debitur = Debitur::find($id);
$debitur->delete_by = auth()->user()->id;
$debitur->deleted_at = now(); $debitur->deleted_at = now();
$approval = [ $approval = [
'method' => 'delete', 'method' => 'delete',
'menu' => 'Parameter Debitur', 'menu' => 'Parameter Debitur',
'old_request' => json_encode($debitur), 'old_request' => json_encode($old),
'new_request' => json_encode($debitur),
'description' => 'Delete Parameter Debitur', 'description' => 'Delete Parameter Debitur',
'status' => '0', 'status' => '0',
'ref' => $debitur->kode 'ref' => $debitur->kode