From c1543263c48b8b05d25fc96939d253ea232e9db0 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Thu, 5 Oct 2023 23:01:45 +0700 Subject: [PATCH] Fix Parameter Cabang --- Livewire/Branch/BranchModal.php | 7 ------- Resources/views/parameter/branches/_draw-scripts.js | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Livewire/Branch/BranchModal.php b/Livewire/Branch/BranchModal.php index b53d69a..b8ad1b1 100644 --- a/Livewire/Branch/BranchModal.php +++ b/Livewire/Branch/BranchModal.php @@ -59,13 +59,6 @@ public function deleteBranch($id) { - // Prevent deletion of current user - if ($id == Auth::id()) { - $this->dispatch('error', 'Branch cannot be deleted'); - return; - } - - // Delete the user record with the specified ID Branch::destroy($id); // Emit a success event with a message diff --git a/Resources/views/parameter/branches/_draw-scripts.js b/Resources/views/parameter/branches/_draw-scripts.js index 30c605e..0087f89 100644 --- a/Resources/views/parameter/branches/_draw-scripts.js +++ b/Resources/views/parameter/branches/_draw-scripts.js @@ -17,7 +17,7 @@ document.querySelectorAll('[data-kt-action="delete_row"]').forEach(function (ele } }).then((result) => { if (result.isConfirmed) { - Livewire.dispatch('delete_branch', this.getAttribute('data-kt-branch-id')); + Livewire.dispatch('delete_branch', { id : this.getAttribute('data-kt-branch-id') }); } }); }); @@ -26,7 +26,7 @@ document.querySelectorAll('[data-kt-action="delete_row"]').forEach(function (ele // Add click event listener to update buttons document.querySelectorAll('[data-kt-action="update_row"]').forEach(function (element) { element.addEventListener('click', function () { - Livewire.dispatch('update_branch', this.getAttribute('data-kt-branch-id')); + Livewire.dispatch('update_branch', { id : this.getAttribute('data-kt-branch-id') }); }); });