|
|
@ -1,5 +1,5 @@
|
|
|
|
import { useEffect, useState } from 'react'
|
|
|
|
import { useEffect, useState } from 'react'
|
|
|
|
import { router, usePage } from '@inertiajs/react'
|
|
|
|
import { router, useForm, usePage } from '@inertiajs/react'
|
|
|
|
import { HiArrowLeft, HiOutlineStar } from 'react-icons/hi2'
|
|
|
|
import { HiArrowLeft, HiOutlineStar } from 'react-icons/hi2'
|
|
|
|
|
|
|
|
|
|
|
|
import { useAutoFocus } from '@/hooks'
|
|
|
|
import { useAutoFocus } from '@/hooks'
|
|
|
@ -15,6 +15,8 @@ export default function LocationModal(props) {
|
|
|
|
} = usePage()
|
|
|
|
} = usePage()
|
|
|
|
const { state, locations, onItemSelected } = props
|
|
|
|
const { state, locations, onItemSelected } = props
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { post, processing } = useForm({})
|
|
|
|
|
|
|
|
|
|
|
|
const [search, setSearch] = useState('')
|
|
|
|
const [search, setSearch] = useState('')
|
|
|
|
const locationFocus = useAutoFocus()
|
|
|
|
const locationFocus = useAutoFocus()
|
|
|
|
const [filter_locations, setFilterLocations] = useState(locations)
|
|
|
|
const [filter_locations, setFilterLocations] = useState(locations)
|
|
|
@ -40,7 +42,10 @@ export default function LocationModal(props) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleFavorite = (location) => {
|
|
|
|
const handleFavorite = (location) => {
|
|
|
|
router.post(route('customer.location.favorite', location))
|
|
|
|
if (processing) {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
post(route('customer.location.favorite', location))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
@ -67,7 +72,7 @@ export default function LocationModal(props) {
|
|
|
|
<div className="flex flex-col overflow-y-auto max-h-[80vh] bg-white">
|
|
|
|
<div className="flex flex-col overflow-y-auto max-h-[80vh] bg-white">
|
|
|
|
{filter_locations.map((location) => (
|
|
|
|
{filter_locations.map((location) => (
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
className="flex flex-row justify-between items-center"
|
|
|
|
className="flex flex-row justify-between items-center hover:bg-gray-200"
|
|
|
|
key={location.id}
|
|
|
|
key={location.id}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|