update approval rekening

This commit is contained in:
daengdeni 2024-01-17 11:41:49 +07:00
parent 670f1738da
commit c13704cacc
2 changed files with 19 additions and 6 deletions

View File

@ -95,6 +95,7 @@
'Parameter Jenis Fasilitas' => 'FacilityType',
'Parameter Jenis Pinjaman' => 'LoanType',
'Parameter Debitur' => 'Debitur',
'Parameter Rekening' => 'Rekening',
];
try {
$approval = Approval::findOrFail($id);
@ -149,8 +150,9 @@
'message' => 'Approval ' . $approval->description . ' successfully . '
]);
} 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

@ -33,7 +33,7 @@
protected $listeners = [
'delete' => 'delete',
'update' => 'update',
'reload' => 'reload',
'reload' => 'reload',
];
public function render()
@ -75,6 +75,9 @@
// Emit a success event with a message
$rekening = Rekening::find($this->id);
$data['updated_by'] = auth()->user()->id;
$data['updated_at'] = now();
$approval = [
'method' => 'update',
'menu' => 'Parameter Rekening',
@ -99,6 +102,9 @@
$this->dispatch('success', 'Data Berhasil Di Update, Menunggu Approval');
}
} else {
$data['created_by'] = auth()->user()->id;
$data['created_at'] = now();
// Emit a success event with a message
$approval = [
'method' => 'create',
@ -150,14 +156,19 @@
public function delete($id)
{
$rekening = Rekening::find($id);
$rekening->delete_by = auth()->user()->id;
$old = Rekening::find($id);
unset($old->deleted_at);
unset($old->delete_by);
$rekening = Rekening::find($id);
$rekening->delete_by = auth()->user()->id;
$rekening->deleted_at = now();
$approval = [
'method' => 'delete',
'menu' => 'Parameter Rekening',
'old_request' => json_encode($rekening),
'old_request' => json_encode($old),
'new_request' => json_encode($rekening),
'description' => 'Delete Parameter Rekening',
'status' => '0',
'ref' => $rekening->nomor_rekening