update module branch

This commit is contained in:
daengdeni 2024-01-10 10:57:27 +07:00
parent 0445253018
commit 3446107242
2 changed files with 15 additions and 2 deletions

View File

@ -21,6 +21,7 @@
protected $listeners = [
'delete' => 'delete',
'update' => 'update',
'reload' => 'reload',
];
public function render()
@ -112,17 +113,25 @@
$this->status = $branch->status ? true : false;
}
public function reload()
{
$this->edit_mode = false;
$this->reset();
}
public function delete($id)
{
$branch = Branch::find($id);
$old = $branch;
$branch->delete_by = auth()->user()->id;
$branch->deleted_at = now();
$approval = [
'method' => 'delete',
'menu' => 'Parameter Cabang',
'old_request' => json_encode($branch),
'old_request' => json_encode($old),
'new_request' => json_encode($branch),
'description' => 'Delete Parameter Cabang',
'status' => '0',
'ref' => $branch->kode

View File

@ -91,8 +91,12 @@
$('#kt_modal_add_branch').modal('hide');
LaravelDataTables['branch-table'].ajax.reload();
});
});
$('#kt_modal_add_branch').on('hidden.bs.modal', function () {
$(this).find('form').trigger('reset');
Livewire.dispatch('reload', false);
})
</script>
@endpush