From c3242719b0275267251d29831fc59ee236b7ba28 Mon Sep 17 00:00:00 2001 From: arieeefajar Date: Tue, 4 Mar 2025 20:05:46 +0700 Subject: [PATCH] fix(master-user): bug fix delete function --- .../Controllers/MasterData/UserController.php | 1 - .../customJs/master-data/pengguna/index.js | 38 ++++--- .../master-data/pengguna/index.blade.php | 100 +++++++++++++----- 3 files changed, 92 insertions(+), 47 deletions(-) diff --git a/app/Http/Controllers/MasterData/UserController.php b/app/Http/Controllers/MasterData/UserController.php index 7f61e1c..644eb7a 100644 --- a/app/Http/Controllers/MasterData/UserController.php +++ b/app/Http/Controllers/MasterData/UserController.php @@ -3,7 +3,6 @@ namespace App\Http\Controllers\MasterData; use App\Http\Controllers\Controller; -use App\Mail\ActivationAccountMail; use App\Models\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; diff --git a/public/assets/js/pages/customJs/master-data/pengguna/index.js b/public/assets/js/pages/customJs/master-data/pengguna/index.js index da86c44..602f55e 100644 --- a/public/assets/js/pages/customJs/master-data/pengguna/index.js +++ b/public/assets/js/pages/customJs/master-data/pengguna/index.js @@ -19,6 +19,22 @@ function deleteData(id) { form.action = "/data-pengguna/" + id; } +var checkAll = document.getElementById("checkAll"); +checkAll && + (checkAll.onclick = function () { + for ( + var e = document.querySelectorAll( + '.form-check-all input[type="checkbox"]' + ), + t = 0; + t < e.length; + t++ + ) + (e[t].checked = this.checked), + e[t].checked + ? e[t].closest("tr").classList.add("table-active") + : e[t].closest("tr").classList.remove("table-active"); + }); var perPage = 10, options = { valueNames: ["id", "fullname", "email", "username", "role", "status"], @@ -121,7 +137,7 @@ refreshCallbacks(), .addEventListener("show.bs.modal", function (e) { e.relatedTarget.classList.contains("edit-item-btn") ? ((document.getElementById("exampleModalLabel").innerHTML = - "Edit Data Customer"), + "Edit Customer"), (document .getElementById("showModal") .querySelector(".modal-footer").style.display = "block"), @@ -129,7 +145,7 @@ refreshCallbacks(), (document.getElementById("edit-btn").style.display = "block")) : e.relatedTarget.classList.contains("add-btn") ? ((document.getElementById("exampleModalLabel").innerHTML = - "Tambah Data Pengguna"), + "Tambah Pengguna"), (document .getElementById("showModal") .querySelector(".modal-footer").style.display = "block"), @@ -313,24 +329,6 @@ document .querySelector(".active") .previousSibling.children[0].click()); }); -var attroptions = { - valueNames: [ - "name", - "born", - { data: ["id"] }, - { attr: "src", name: "image" }, - { attr: "href", name: "link" }, - { attr: "data-timestamp", name: "timestamp" }, - ], - }, - attrList = new List("users", attroptions); -attrList.add({ - name: "Leia", - born: "1954", - image: "assets/images/users/avatar-5.jpg", - id: 5, - timestamp: "67893", -}); var existOptionsList = { valueNames: ["contact-name", "contact-message"] }, existList = new List("contact-existing-list", existOptionsList), fuzzySearchList = new List("fuzzysearch-list", { valueNames: ["name"] }), diff --git a/resources/views/master-data/pengguna/index.blade.php b/resources/views/master-data/pengguna/index.blade.php index 0372404..239a962 100644 --- a/resources/views/master-data/pengguna/index.blade.php +++ b/resources/views/master-data/pengguna/index.blade.php @@ -3,7 +3,6 @@ @section('content')
-
@@ -12,11 +11,12 @@
-
@@ -27,7 +27,8 @@

Data Pengguna

-
+
+
@@ -35,14 +36,15 @@
+ id="create-btn" data-bs-target="#showModal"> + Tambah +
@@ -56,26 +58,32 @@ class="ri-add-line align-bottom me-1"> Tambah No - Nama Lengkap + + Nama Lengkap + Username Email - Role - Status + + Role + + + Status + Action @foreach ($users as $user) - - {{ $loop->iteration }} - - #VZ2101 + {{ $loop->iteration }} + + #VZ2101 + {{ $user->name }} {{ $user->username }} {{ $user->email }} - {{ $user->role }} + {{ $user->role }} @if ($user->is_active == 0) Tidak @@ -90,24 +98,58 @@ class="badge badge-soft-success text-uppercase">Aktif
+ onclick="updateData({{ $user }})"> + Edit +
+ onclick="deleteData({{ $user->id }})"> + Hapus +
@endforeach + {{-- + 1 + + #VZ2101 + + Mary Cousar + marycousar + marycousar@velzon.com + 06 Apr, 2021 + + Active + + +
+
+ +
+
+ +
+
+ + --}} +
+
@@ -135,6 +178,7 @@ class="badge badge-soft-success text-uppercase">Aktif + {{-- add modal --}} + @push('other-js')