query($sql); // Handle delete operation - only for admin role if (isset($_GET['delete_id'])) { if (hasPermission('delete', $userRole)) { $id = $_GET['delete_id']; $sql = "DELETE FROM barang_kasir WHERE kode_barang = '$id'"; if ($conn->query($sql) === TRUE) { header("Location: /ayula-store/views/barang-kasir/?success=1"); exit(); } else { header("Location: /ayula-store/views/barang-kasir/?success=0"); exit(); } } else { // If user tries to delete without permission, redirect with error header("Location: /ayula-store/views/barang-kasir/?error=Anda tidak memiliki izin untuk menghapus barang"); exit(); } } ?> Dreams Pos admin template
img
num_rows > 0) { while ($row = $result->fetch_assoc()) { echo ""; } } else { echo ""; } ?>
Kode Barang Nama Barang Jenis Stok Harga Aksi
{$row['kode_barang']} {$row['nama_barang']} {$row['nama_jenis']} {$row['stok']} Rp " . number_format($row['harga'], 0, ',', '.') . " "; // View button - visible to all users if (hasPermission('view', $userRole)) { echo " Lihat Detail "; } // Edit button - visible only to admin if (hasPermission('edit', $userRole)) { echo " Edit "; } // Delete button - visible only to admin if (hasPermission('delete', $userRole)) { echo " Hapus "; } echo "
Tidak ada data barang kasir