fix bug modal search location in home && send request after click on continue for update list clinics && change style on hover text of specialties and service in clinics page && add loading for list of clinics && fix bug page doctor item && link footer to clinic-pro
This commit is contained in:
@@ -2,8 +2,8 @@ import { Button } from "@mui/material";
|
||||
|
||||
// Icon
|
||||
import CloseModalD from "@/components/icons/CloseModalD";
|
||||
import AutoCompleteSelect from "@/app/component/element/AutoCompleteSelect";
|
||||
import ArrowLeftM from "@/components/icons/ArrowLeftM";
|
||||
import AutoComplete from "./AutoComplete";
|
||||
|
||||
function Content({
|
||||
state,
|
||||
@@ -14,6 +14,7 @@ function Content({
|
||||
filteredCities,
|
||||
handleSearch,
|
||||
}) {
|
||||
const citySelected = selected.city;
|
||||
const listboxProps = {
|
||||
style: {
|
||||
maxHeight: 200,
|
||||
@@ -38,19 +39,24 @@ function Content({
|
||||
شهر یا استان مورد نظر را انتخاب نمایید:
|
||||
</p>
|
||||
<div className="flex md:min-w-[344px] flex-col mt-[52px] md:mt-[44px] mb-14 justify-center items-center gap-10">
|
||||
<AutoComplete
|
||||
<AutoCompleteSelect
|
||||
value={selected.province}
|
||||
disabled={state}
|
||||
listboxProps={listboxProps}
|
||||
updateData={updateData}
|
||||
list={states}
|
||||
label="استان"
|
||||
name="province"
|
||||
disabled={state}
|
||||
updateData={updateData}
|
||||
value={selected.province}
|
||||
listboxProps={listboxProps}
|
||||
/>
|
||||
<AutoComplete
|
||||
<AutoCompleteSelect
|
||||
updateData={updateData}
|
||||
listboxProps={listboxProps}
|
||||
value={selected.city}
|
||||
value={
|
||||
selected &&
|
||||
citySelected &&
|
||||
filteredCities.find((item) => item.name === citySelected) &&
|
||||
citySelected
|
||||
}
|
||||
list={filteredCities}
|
||||
name="city"
|
||||
label="شهر"
|
||||
@@ -74,4 +80,4 @@ function Content({
|
||||
);
|
||||
}
|
||||
|
||||
export default Content;
|
||||
export default Content;
|
||||
@@ -3,12 +3,12 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { Modal, Box } from "@mui/material";
|
||||
import { styleDefault } from "@/mui";
|
||||
import { addLabelToList } from "@/helper";
|
||||
|
||||
// Data
|
||||
import states from "@/data/state.json";
|
||||
import cities from "@/data/city.json";
|
||||
import statesData from "@/data/state.json";
|
||||
import citiesData from "@/data/city.json";
|
||||
import Content from "./Content";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
function ModalSearchCity({
|
||||
open,
|
||||
@@ -16,11 +16,13 @@ function ModalSearchCity({
|
||||
setOpen,
|
||||
children,
|
||||
selected,
|
||||
setSelected,
|
||||
handleSearch,
|
||||
setSelected,
|
||||
}) {
|
||||
const provinceSelected = selected?.province?.name;
|
||||
const router = useRouter();
|
||||
const provinceSelected = selected.province;
|
||||
|
||||
const states = addLabelToList(statesData);
|
||||
const cities = addLabelToList(citiesData);
|
||||
const [filteredCities, setFilteredCities] = useState([]);
|
||||
|
||||
const handleClose = () => setOpen(false);
|
||||
@@ -28,7 +30,7 @@ function ModalSearchCity({
|
||||
useEffect(() => {
|
||||
if (provinceSelected) {
|
||||
const selectedState = states.find(
|
||||
(state) => state.name === provinceSelected
|
||||
(state) => state.label === provinceSelected
|
||||
);
|
||||
if (selectedState) {
|
||||
const stateId = selectedState.id;
|
||||
@@ -42,19 +44,12 @@ function ModalSearchCity({
|
||||
}
|
||||
}, [provinceSelected]);
|
||||
|
||||
const updateData = (name, event) => {
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
|
||||
const updateData = (event, name) => {
|
||||
if (name === "province") {
|
||||
setSelected({ ...selected, province: event, city: "" });
|
||||
searchParams.set("state", event?.name);
|
||||
searchParams.set("city", selected.city?.name);
|
||||
} else {
|
||||
setSelected({ ...selected, [name]: event });
|
||||
searchParams.set("city", event?.name);
|
||||
searchParams.set("state", selected.province?.name);
|
||||
}
|
||||
router.push(`?${searchParams.toString()}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user