From 177edeb8bd78dc62b4b3460aa796ef321a11e5e9 Mon Sep 17 00:00:00 2001 From: Aji Kamaludin Date: Mon, 19 Jun 2023 02:02:01 +0700 Subject: [PATCH] bit fix --- resources/css/spinner.css | 11 ++++++++-- resources/js/Customer/Index/Index.jsx | 3 +++ .../Index/IndexPartials/AllVoucher.jsx | 2 +- .../Index/IndexPartials/FavoriteVoucher.jsx | 22 +++++++++---------- .../Customer/Index/Partials/LocationModal.jsx | 11 +++++++--- 5 files changed, 32 insertions(+), 17 deletions(-) diff --git a/resources/css/spinner.css b/resources/css/spinner.css index 5e5fd3f..62280e4 100644 --- a/resources/css/spinner.css +++ b/resources/css/spinner.css @@ -1,5 +1,11 @@ #nprogress { - pointer-events: none; + pointer-events: auto !important; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 100 !important; } #nprogress .bar { @@ -32,7 +38,7 @@ #nprogress .spinner { display: flex !important; position: fixed; - z-index: 1031; + z-index: 1031 !important; top: 0px !important; right: 0px !important; width: 100% !important; @@ -48,6 +54,7 @@ width: 140px !important; height: 60px !important; padding: 0.5rem; + z-index: 1031 !important; background-color: white; display: flex; flex-direction: row; diff --git a/resources/js/Customer/Index/Index.jsx b/resources/js/Customer/Index/Index.jsx index f47a856..0947172 100644 --- a/resources/js/Customer/Index/Index.jsx +++ b/resources/js/Customer/Index/Index.jsx @@ -60,6 +60,9 @@ export default function Index(props) { return ( + {/* for test */} + {/*
*/} +
{/* guest or user banner */} diff --git a/resources/js/Customer/Index/IndexPartials/AllVoucher.jsx b/resources/js/Customer/Index/IndexPartials/AllVoucher.jsx index b46a930..b932bb8 100644 --- a/resources/js/Customer/Index/IndexPartials/AllVoucher.jsx +++ b/resources/js/Customer/Index/IndexPartials/AllVoucher.jsx @@ -109,7 +109,7 @@ export default function AllVoucher() {
{sLocations.map((location, index) => (
handleRemoveLocation(index)} > diff --git a/resources/js/Customer/Index/IndexPartials/FavoriteVoucher.jsx b/resources/js/Customer/Index/IndexPartials/FavoriteVoucher.jsx index 85033b9..7d601a1 100644 --- a/resources/js/Customer/Index/IndexPartials/FavoriteVoucher.jsx +++ b/resources/js/Customer/Index/IndexPartials/FavoriteVoucher.jsx @@ -1,5 +1,5 @@ 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 VoucherCard from '../Partials/VoucherCard' @@ -33,20 +33,20 @@ export default function FavoriteVoucher() { _flocations, }, } = usePage() + const { post, processing } = useForm({}) const nextPageUrl = next_page_url === undefined ? null : next_page_url const [items, setItems] = useState(data === undefined ? [] : data) const handleRemoveLocation = (location) => { - router.post( - route('customer.location.favorite', location), - {}, - { - onSuccess: () => { - router.visit(route(route().current())) - }, - } - ) + if (processing) { + return + } + post(route('customer.location.favorite', location), { + onSuccess: () => { + router.visit(route(route().current())) + }, + }) } const handleNextPage = () => { @@ -75,7 +75,7 @@ export default function FavoriteVoucher() {
{_flocations.map((location) => (
handleRemoveLocation(location)} > diff --git a/resources/js/Customer/Index/Partials/LocationModal.jsx b/resources/js/Customer/Index/Partials/LocationModal.jsx index d384518..cd1fa23 100644 --- a/resources/js/Customer/Index/Partials/LocationModal.jsx +++ b/resources/js/Customer/Index/Partials/LocationModal.jsx @@ -1,5 +1,5 @@ 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 { useAutoFocus } from '@/hooks' @@ -15,6 +15,8 @@ export default function LocationModal(props) { } = usePage() const { state, locations, onItemSelected } = props + const { post, processing } = useForm({}) + const [search, setSearch] = useState('') const locationFocus = useAutoFocus() const [filter_locations, setFilterLocations] = useState(locations) @@ -40,7 +42,10 @@ export default function LocationModal(props) { } const handleFavorite = (location) => { - router.post(route('customer.location.favorite', location)) + if (processing) { + return + } + post(route('customer.location.favorite', location)) } useEffect(() => { @@ -67,7 +72,7 @@ export default function LocationModal(props) {
{filter_locations.map((location) => (