import React from 'react' import { Link, router } from '@inertiajs/react' import { Head } from '@inertiajs/react' import { Button, Dropdown } from 'flowbite-react' import { HiPencil, HiTrash } from 'react-icons/hi' import { useModalState } from '@/hooks' import { hasPermission } from '@/utils' import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout' import Pagination from '@/Components/Pagination' import ModalConfirm from '@/Components/ModalConfirm' export default function DespositLocation(props) { const { query: { links, data }, auth, } = props const confirmModal = useModalState() const handleDeleteClick = (location) => { confirmModal.setData(location) confirmModal.toggle() } const onDelete = () => { if (confirmModal.data !== null) { router.delete( route('deposit-location.destroy', confirmModal.data.id) ) } } const canCreate = hasPermission(auth, 'create-deposit-location') const canUpdate = hasPermission(auth, 'update-deposit-location') const canDelete = hasPermission(auth, 'delete-deposit-location') return (
{canCreate && ( )}
{data.map((location) => ( ))}
Nama Alamat Whatsapp Jam Operasional Aktif
{location.name} {location.address} {location.phone} {location.operational_hour} {+location.is_active === 1 ? 'Yes' : 'No'} {canUpdate && (
Ubah
)} {canDelete && ( handleDeleteClick( location ) } >
Hapus
)}
) }