import React from 'react' import { Head, Link, router } from '@inertiajs/react' import { Button, Dropdown } from 'flowbite-react' import { HiPencil, HiTrash } from 'react-icons/hi' import { useModalState } from '@/hooks' import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout' import Pagination from '@/Components/Pagination' import ModalConfirm from '@/Components/ModalConfirm' import FormModal from './FormModal' import { hasPermission } from '@/utils' export default function Account(props) { const { query: { links, data }, auth, } = props const confirmModal = useModalState() const formModal = useModalState() const toggleFormModal = (account = null) => { formModal.setData(account) formModal.toggle() } const handleDeleteClick = (account) => { confirmModal.setData(account) confirmModal.toggle() } const onDelete = () => { if (confirmModal.data !== null) { router.delete(route('account.destroy', confirmModal.data.id)) } } const canCreate = hasPermission(auth, 'create-account') const canUpdate = hasPermission(auth, 'update-account') const canDelete = hasPermission(auth, 'delete-account') return (
{canCreate && ( )}
{data.map((account) => ( ))}
Nama Atas Nama Rekening Nomor Rekening Logo
{account.name} {account.holder_name} {account.account_number} bank logo alt {canUpdate && (
Ubah
)} {canDelete && ( handleDeleteClick( account ) } >
Hapus
)}
) }