dev
Aji Kamaludin 1 year ago
parent 0315d4c727
commit 177edeb8bd
No known key found for this signature in database
GPG Key ID: 19058F67F0083AD3

@ -1,5 +1,11 @@
#nprogress { #nprogress {
pointer-events: none; pointer-events: auto !important;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 100 !important;
} }
#nprogress .bar { #nprogress .bar {
@ -32,7 +38,7 @@
#nprogress .spinner { #nprogress .spinner {
display: flex !important; display: flex !important;
position: fixed; position: fixed;
z-index: 1031; z-index: 1031 !important;
top: 0px !important; top: 0px !important;
right: 0px !important; right: 0px !important;
width: 100% !important; width: 100% !important;
@ -48,6 +54,7 @@
width: 140px !important; width: 140px !important;
height: 60px !important; height: 60px !important;
padding: 0.5rem; padding: 0.5rem;
z-index: 1031 !important;
background-color: white; background-color: white;
display: flex; display: flex;
flex-direction: row; flex-direction: row;

@ -60,6 +60,9 @@ export default function Index(props) {
return ( return (
<CustomerLayout> <CustomerLayout>
{/* for test */}
{/* <div id="nprogress"></div> */}
<Head title="Home" /> <Head title="Home" />
<div className="flex flex-col min-h-[calc(95dvh)]"> <div className="flex flex-col min-h-[calc(95dvh)]">
{/* guest or user banner */} {/* guest or user banner */}

@ -109,7 +109,7 @@ export default function AllVoucher() {
<div className="w-full flex flex-row overflow-y-scroll space-x-2 px-4 mt-2"> <div className="w-full flex flex-row overflow-y-scroll space-x-2 px-4 mt-2">
{sLocations.map((location, index) => ( {sLocations.map((location, index) => (
<div <div
className="flex flex-row items-center gap-1 px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200" className="flex flex-row items-center gap-1 px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200 hover:bg-blue-500"
key={location.id} key={location.id}
onClick={() => handleRemoveLocation(index)} onClick={() => handleRemoveLocation(index)}
> >

@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { router, usePage } from '@inertiajs/react' import { router, usePage, useForm } from '@inertiajs/react'
import { HiOutlineStar } from 'react-icons/hi2' import { HiOutlineStar } from 'react-icons/hi2'
import VoucherCard from '../Partials/VoucherCard' import VoucherCard from '../Partials/VoucherCard'
@ -33,20 +33,20 @@ export default function FavoriteVoucher() {
_flocations, _flocations,
}, },
} = usePage() } = usePage()
const { post, processing } = useForm({})
const nextPageUrl = next_page_url === undefined ? null : next_page_url const nextPageUrl = next_page_url === undefined ? null : next_page_url
const [items, setItems] = useState(data === undefined ? [] : data) const [items, setItems] = useState(data === undefined ? [] : data)
const handleRemoveLocation = (location) => { const handleRemoveLocation = (location) => {
router.post( if (processing) {
route('customer.location.favorite', location), return
{}, }
{ post(route('customer.location.favorite', location), {
onSuccess: () => { onSuccess: () => {
router.visit(route(route().current())) router.visit(route(route().current()))
}, },
} })
)
} }
const handleNextPage = () => { const handleNextPage = () => {
@ -75,7 +75,7 @@ export default function FavoriteVoucher() {
<div className="w-full flex flex-row overflow-y-scroll space-x-2 px-4 mt-2"> <div className="w-full flex flex-row overflow-y-scroll space-x-2 px-4 mt-2">
{_flocations.map((location) => ( {_flocations.map((location) => (
<div <div
className="flex flex-row items-center gap-1 px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200" className="flex flex-row items-center gap-1 px-2 py-1 rounded-2xl bg-blue-100 border border-blue-200 hover:bg-blue-500"
key={location.id} key={location.id}
onClick={() => handleRemoveLocation(location)} onClick={() => handleRemoveLocation(location)}
> >

@ -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

Loading…
Cancel
Save