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 Info(props) { const { query: { links, data }, auth, } = props const confirmModal = useModalState() const handleDeleteClick = (info) => { confirmModal.setData(info) confirmModal.toggle() } const onDelete = () => { if (confirmModal.data !== null) { router.delete(route('info.destroy', confirmModal.data.id)) } } const canCreate = hasPermission(auth, 'create-info') const canUpdate = hasPermission(auth, 'update-info') const canDelete = hasPermission(auth, 'delete-info') return (
{canCreate && ( )}
{data.map((info) => ( ))}
Info Publish
{info.title} {info.is_publish === 1 ? 'Yes' : 'No'} {canUpdate && (
Ubah
)} {canDelete && ( handleDeleteClick( info ) } >
Hapus
)}
) }