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 Fasilitas' => 'FacilityType',
'Parameter Jenis Pinjaman' => 'LoanType', 'Parameter Jenis Pinjaman' => 'LoanType',
'Parameter Debitur' => 'Debitur', 'Parameter Debitur' => 'Debitur',
'Parameter Rekening' => 'Rekening',
]; ];
try { try {
$approval = Approval::findOrFail($id); $approval = Approval::findOrFail($id);
@ -149,7 +150,8 @@
'message' => 'Approval ' . $approval->description . ' successfully . ' 'message' => 'Approval ' . $approval->description . ' successfully . '
]); ]);
} catch (Exception $e) { } catch (Exception $e) {
echo json_encode(['status' => 'error', echo json_encode([
'status' => 'error',
'message' => 'Approval ' . $approval->description . ' failed . ' 'message' => 'Approval ' . $approval->description . ' failed . '
]); ]);
} }

View File

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