import React, { useEffect, useState } from 'react'
import { router } from '@inertiajs/react'
import { usePrevious } from 'react-use'
import { Head } 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 SearchInput from '@/Components/SearchInput'
import { hasPermission } from '@/utils'
export default function Index(props) {
const {
query: { links, data },
auth,
} = props
const confirmModal = useModalState()
const formModal = useModalState()
const toggleFormModal = (location = null) => {
formModal.setData(location)
formModal.toggle()
}
const handleDeleteClick = (location) => {
confirmModal.setData(location)
confirmModal.toggle()
}
const onDelete = () => {
if (confirmModal.data !== null) {
router.delete(route('location.destroy', confirmModal.data.id))
}
}
const canCreate = hasPermission(auth, 'create-location')
const canUpdate = hasPermission(auth, 'update-location')
const canDelete = hasPermission(auth, 'delete-location')
return (
Name | Description | |
---|---|---|
{location.name} | {location.description} |
Ubah
Hapus
|