diff --git a/src/app/(dashboard)/consultation-reservations/page.jsx b/src/app/(dashboard)/consultation-reservations/page.jsx
index e80beab825db0fe9302cf0d2372f7dae0ecc86e6..3101bfd74070c4bb1e7f72c954034a1e98b9a70f 100644
--- a/src/app/(dashboard)/consultation-reservations/page.jsx
+++ b/src/app/(dashboard)/consultation-reservations/page.jsx
@@ -1,10 +1,10 @@
'use client'
-import React, {useEffect, useState, useRef} from 'react'
+import React, { useEffect, useState, useRef } from 'react'
import ZoneUI from './ZoneUI'
import fetchRequest from '@/app/lib/fetchRequest'
import Loader from '@/components/Loader/Loader'
-import {useNotification} from '@/context/NotificationContext'
+import { useNotification } from '@/context/NotificationContext'
import ArrowUturnLeft from "@/static/image/svg/arrow-uturn-left.svg";
import SearchIcon from "@/static/image/svg/search.svg";
import Select from "react-select";
@@ -14,8 +14,8 @@ export const ReservationContext = React.createContext()
const Reservation = () => {
const [isLoadingData, setIsLoadingData] = useState(false)
- const {toggleNotification} = useNotification()
- const [date, setDate] = useState({day: null, week: null})
+ const { toggleNotification } = useNotification()
+ const [date, setDate] = useState({ day: null, week: null })
const [isLoadingSelectsData, setIsLoadingSelectsData] = useState(true)
const [projectsData, setProjectsData] = useState([])
const [filteredProjectsData, setFilteredProjectsData] = useState([])
@@ -23,13 +23,13 @@ const Reservation = () => {
const [datesData, setDatesData] = useState(null)
const [bookedPlaces, setBookedPlaces] = useState([])
const [floors, setFloors] = useState([])
- const [selectedZone, setSelectedZone] = useState({floorId: null, zoneId: null})
+ const [selectedZone, setSelectedZone] = useState({ floorId: null, zoneId: null })
const [NameProjectFilter, setNameProjectFilter] = useState("")
useEffect(() => {
const getPlan = async () => {
try {
- const {isSuccess, errors, data} = await fetchRequest('/zoaning/etage-zone-table-place/')
+ const { isSuccess, errors, data } = await fetchRequest('/zoaning/etage-zone-table-place/')
setIsLoadingSelectsData(false)
if (isSuccess) {
setFloors(data)
@@ -63,7 +63,7 @@ const Reservation = () => {
floorId: data[0].zones[0].id_etage.id,
zoneId: data[0].zones[0].id
})
- else setSelectedZone({floorId: null, zoneId: null})
+ else setSelectedZone({ floorId: null, zoneId: null })
} else {
console.log(errors)
toggleNotification({
@@ -74,7 +74,7 @@ const Reservation = () => {
}
}
const getBookedPlaces = async () => {
- const {isSuccess, errors, data} = await fetchRequest(`/zoaning/reservations/date/${date.date}/`)
+ const { isSuccess, errors, data } = await fetchRequest(`/zoaning/reservations/date/${date.date}/`)
if (isSuccess) {
console.log("booked places : :", data)
setBookedPlaces(data.map((element) => ({
@@ -112,7 +112,7 @@ const Reservation = () => {
useEffect(() => {
const getCurrentDateData = async () => {
- const {isSuccess, errors, data} = await fetchRequest('/zoaning/current-date/');
+ const { isSuccess, errors, data } = await fetchRequest('/zoaning/current-date/');
if (isSuccess) {
setCurrentDateData(data)
} else {
@@ -124,7 +124,7 @@ const Reservation = () => {
}
}
const YearCalendar = async () => {
- const {isSuccess, errors, data} = await fetchRequest('/zoaning/dates/');
+ const { isSuccess, errors, data } = await fetchRequest('/zoaning/dates/');
if (isSuccess) {
console.log("dates data", data)
setDatesData(data)
@@ -148,11 +148,11 @@ const Reservation = () => {
const dateSelected = JSON.parse(event.target.value);
console.log("weekMonthly", dateSelected.weekMonthly);
console.log("day", dateSelected.day);
- setDate({day: dateSelected.day, week: dateSelected.weekMonthly, date: dateSelected.date})
+ setDate({ day: dateSelected.day, week: dateSelected.weekMonthly, date: dateSelected.date })
// setSelectedEtage(null)
// setSelectedZone({floorId: null, zoneId: null})
} else {
- setDate({day: null, week: null})
+ setDate({ day: null, week: null })
// setSelectedEtage(null)
}
}
@@ -170,7 +170,7 @@ const Reservation = () => {
useEffect(() => {
if (dateRef.current && currentDateData?.date) {
dateRef.current.value = JSON.stringify(currentDateData)
- setDate({day: currentDateData.day, week: currentDateData.weekMonthly, date: currentDateData.date})
+ setDate({ day: currentDateData.day, week: currentDateData.weekMonthly, date: currentDateData.date })
}
}, [dateRef.current, currentDateData?.date])
@@ -184,7 +184,7 @@ const Reservation = () => {
if (isLoadingSelectsData)
return
-
+
const currentMonth = new Date().getMonth() + 1
@@ -207,18 +207,18 @@ const Reservation = () => {
{floors.map((element, index) => {
- if (element.id !== selectedZone.floorId)
- return
setSelectedZone({floorId: element.id, zoneId: element.zones[0].id})}
- className='cursor-pointer px-3 pb-2 h-full flex items-center justify-center'>
-
Etage {element.numero}
-
+ if (element.id !== selectedZone.floorId)
return
setSelectedZone({floorId: element.id, zoneId: element.zones[0].id})}
- className='cursor-pointer px-3 pb-2 h-full relative flex items-center justify-center before:content-[""] before:absolute before:bottom-0 before:left-0 before:bg-sushi-500 before:w-full before:h-0.5'>
-
Etage {element.numero}
+ onClick={() => setSelectedZone({ floorId: element.id, zoneId: element.zones[0].id })}
+ className='cursor-pointer px-3 pb-2 h-full flex items-center justify-center'>
+
Etage {element.numero}
- }
+ return
setSelectedZone({ floorId: element.id, zoneId: element.zones[0].id })}
+ className='cursor-pointer px-3 pb-2 h-full relative flex items-center justify-center before:content-[""] before:absolute before:bottom-0 before:left-0 before:bg-sushi-500 before:w-full before:h-0.5'>
+
Etage {element.numero}
+
+ }
)}
@@ -287,7 +287,7 @@ const Reservation = () => {
value={(selectedZone.floorId) ? selectedZone.floorId : ""}
onChange={(event) => {
// event.target.value to int
- setSelectedZone({floorId: parseInt(event.target.value), zoneId: null})
+ setSelectedZone({ floorId: parseInt(event.target.value), zoneId: null })
}}
disabled={!(date.day && date.week) || isLoadingData}
name="etage"
@@ -329,16 +329,16 @@ const Reservation = () => {
@@ -350,7 +350,7 @@ const Reservation = () => {
réservations
{(filteredDatesData && filteredDatesData.length) &&