Merge remote-tracking branch 'origin/dev'
This commit is contained in:
+38
-5
@@ -1,19 +1,52 @@
|
|||||||
// app/clinics/page.js
|
import { fetchReq } from "@/lib/req";
|
||||||
import ClinicsPage from "@/components/clinics";
|
import ClinicsPage from "@/components/clinics";
|
||||||
import Layout from "@/components/layout/StLayout";
|
import Layout from "@/components/layout/StLayout";
|
||||||
import { fetchReq } from "@/lib/req";
|
|
||||||
import { getStateInfo } from "@/lib/getStateInfo";
|
import { getStateInfo } from "@/lib/getStateInfo";
|
||||||
|
import { buildClinicParams } from "@/helper";
|
||||||
|
|
||||||
export default async function Clinics() {
|
export default async function Clinics({ searchParams }) {
|
||||||
const { matchedCity, matchedState } = getStateInfo();
|
const { matchedCity, matchedState } = getStateInfo();
|
||||||
const API_URL = process.env.NEXT_PUBLIC_API_URL;
|
const API_URL = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
const stateParams = searchParams.state;
|
||||||
|
const cityParams = searchParams.city;
|
||||||
|
|
||||||
const clinics = await fetchReq(`${API_URL}/api/v1/clinics`);
|
let clinics;
|
||||||
|
try {
|
||||||
|
// Params
|
||||||
|
let newSearchParams = searchParams;
|
||||||
|
|
||||||
|
// Conditional State
|
||||||
|
if (stateParams) newSearchParams.state = stateParams;
|
||||||
|
else if (matchedState) newSearchParams.state = matchedState.name;
|
||||||
|
|
||||||
|
// Conditional City
|
||||||
|
if (cityParams) newSearchParams.city = cityParams;
|
||||||
|
else if (matchedCity && matchedCity.id !== "600")
|
||||||
|
newSearchParams.city = matchedCity.name;
|
||||||
|
|
||||||
|
console.log("newSearchParams");
|
||||||
|
console.log(newSearchParams);
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
...buildClinicParams(newSearchParams),
|
||||||
|
page: 1,
|
||||||
|
limit: 12,
|
||||||
|
};
|
||||||
|
console.log("params");
|
||||||
|
console.log(params);
|
||||||
|
|
||||||
|
// Req
|
||||||
|
clinics = await fetchReq(`${API_URL}/api/v1/clinics`, {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.log(`Error fetching doctors: ${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout name="/clinics">
|
<Layout name="/clinics">
|
||||||
<ClinicsPage
|
<ClinicsPage
|
||||||
clinics={clinics && clinics.data}
|
clinics={clinics}
|
||||||
matchedCity={matchedCity}
|
matchedCity={matchedCity}
|
||||||
matchedState={matchedState}
|
matchedState={matchedState}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function ItemDoctor({ doctor, doctors, setDoctors }) {
|
|||||||
height={72}
|
height={72}
|
||||||
alt="image-doctor"
|
alt="image-doctor"
|
||||||
src={doctor?.img[0]?.url}
|
src={doctor?.img[0]?.url}
|
||||||
className="object-contain w-[64px] md:w-[68px] lg:w-[72px] h-[64px] md:h-[68px] lg:h-[72px]"
|
className="object-contain rounded-full w-[64px] md:w-[68px] lg:w-[72px] h-[64px] md:h-[68px] lg:h-[72px]"
|
||||||
/>
|
/>
|
||||||
</CircularLoading>
|
</CircularLoading>
|
||||||
<div className="flex flex-col items-start justify-center gap-2">
|
<div className="flex flex-col items-start justify-center gap-2">
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { Pagination } from "@mui/material";
|
||||||
|
|
||||||
|
function PaginationContent({ page, pageDetail, changePage, limit = 12 }) {
|
||||||
|
const count = Math.ceil(pageDetail.totalRecords / limit);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Pagination
|
||||||
|
count={count}
|
||||||
|
page={page || 1}
|
||||||
|
onChange={changePage}
|
||||||
|
color="primary"
|
||||||
|
className={count < 2 && "!hidden"}
|
||||||
|
sx={{
|
||||||
|
"& .mui-8q7g72-MuiButtonBase-root-MuiPaginationItem-root": {
|
||||||
|
color: "#616161",
|
||||||
|
fontSize: "16px",
|
||||||
|
fontWeight: "500",
|
||||||
|
},
|
||||||
|
"& .mui-8q7g72-MuiButtonBase-root-MuiPaginationItem-root.Mui-selected":
|
||||||
|
{
|
||||||
|
color: "#F8F8FF",
|
||||||
|
},
|
||||||
|
"& .MuiSvgIcon-root": {
|
||||||
|
rotate: "180deg !important",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PaginationContent;
|
||||||
@@ -1,11 +1,19 @@
|
|||||||
import { numberToArStyle } from "@/helper";
|
import { numberToArStyle } from "@/helper";
|
||||||
import { LinearProgress } from "@mui/material";
|
import { LinearProgress } from "@mui/material";
|
||||||
|
|
||||||
function ProgressDetail({ data }) {
|
const label = [
|
||||||
|
"برخورد مناسب پزشک",
|
||||||
|
"تشخیص درست",
|
||||||
|
"زمان انتظار در مطب",
|
||||||
|
"مهارت پزشک",
|
||||||
|
"نظافت مطب",
|
||||||
|
];
|
||||||
|
|
||||||
|
function ProgressDetail({ data, idx }) {
|
||||||
return (
|
return (
|
||||||
<li className="flex items-center justify-start gap-2 w-full">
|
<li className="flex items-center justify-start gap-2 w-full">
|
||||||
<p className="text-[#525252] text-[14px] font-normal min-w-[120px] w-[118px]">
|
<p className="text-[#525252] text-[14px] font-normal min-w-[120px] w-[118px]">
|
||||||
{data.label}
|
{label[idx]}
|
||||||
</p>
|
</p>
|
||||||
<LinearProgress
|
<LinearProgress
|
||||||
value={data}
|
value={data}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ function ButtonFilter({ selected, setOpen }) {
|
|||||||
className="text-[#616161] text-[11px] md:text-[14px] leading-[17px] sm:leading-[19px]
|
className="text-[#616161] text-[11px] md:text-[14px] leading-[17px] sm:leading-[19px]
|
||||||
md:leading-[22px] lg:leading-[24px] font-medium ml-1 md:mx-1"
|
md:leading-[22px] lg:leading-[24px] font-medium ml-1 md:mx-1"
|
||||||
>
|
>
|
||||||
{selected.city || "شهر"}
|
{(selected.city?.name !== "نوبت 724" ? selected.city?.name : false) ||
|
||||||
|
"شهر"}
|
||||||
</p>
|
</p>
|
||||||
<div className="w-[16px] h-[16px] md:w-[18px] md:h-[18px] lg:w-[20px] lg:h-[20px] grid place-items-center">
|
<div className="w-[16px] h-[16px] md:w-[18px] md:h-[18px] lg:w-[20px] lg:h-[20px] grid place-items-center">
|
||||||
<ArrowBottomH />
|
<ArrowBottomH />
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ async function Doctors({ searchParams }) {
|
|||||||
|
|
||||||
// Conditional City
|
// Conditional City
|
||||||
if (cityParams) newSearchParams.city = cityParams;
|
if (cityParams) newSearchParams.city = cityParams;
|
||||||
else if (matchedCity && matchedCity.id !== "63")
|
else if (matchedCity && matchedCity.id !== "600")
|
||||||
newSearchParams.city = matchedCity.name;
|
newSearchParams.city = matchedCity.name;
|
||||||
|
|
||||||
const params = buildDoctorParams(newSearchParams);
|
const params = buildDoctorParams(newSearchParams);
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import { Autocomplete, TextField } from "@mui/material";
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
|
function AutoSearch({
|
||||||
|
data,
|
||||||
|
noneBg,
|
||||||
|
inputValue,
|
||||||
|
placeholder,
|
||||||
|
handleSearch,
|
||||||
|
setInputValue,
|
||||||
|
setSelectedOption,
|
||||||
|
debounce = 500,
|
||||||
|
}) {
|
||||||
|
const typingTimeoutRef = useRef(null);
|
||||||
|
const [localInput, setLocalInput] = useState(inputValue || "");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLocalInput(inputValue || "");
|
||||||
|
}, [inputValue]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const onInputChange = (_, newInputValue) => {
|
||||||
|
setLocalInput(newInputValue);
|
||||||
|
|
||||||
|
if (setInputValue) setInputValue(newInputValue);
|
||||||
|
|
||||||
|
if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);
|
||||||
|
typingTimeoutRef.current = setTimeout(() => {
|
||||||
|
handleSearch(newInputValue);
|
||||||
|
}, debounce);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onChange = (_, newValue) => {
|
||||||
|
if (typingTimeoutRef.current) {
|
||||||
|
clearTimeout(typingTimeoutRef.current);
|
||||||
|
typingTimeoutRef.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const val = newValue
|
||||||
|
? typeof newValue === "string"
|
||||||
|
? newValue
|
||||||
|
: newValue.name
|
||||||
|
: "";
|
||||||
|
setLocalInput(val);
|
||||||
|
setSelectedOption && setSelectedOption(newValue);
|
||||||
|
handleSearch(val);
|
||||||
|
if (setInputValue) setInputValue(val);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Autocomplete
|
||||||
|
freeSolo
|
||||||
|
options={data}
|
||||||
|
getOptionLabel={(option) =>
|
||||||
|
typeof option === "string" ? option : option.name
|
||||||
|
}
|
||||||
|
disableClearable
|
||||||
|
inputValue={localInput}
|
||||||
|
className="!w-full"
|
||||||
|
onInputChange={onInputChange}
|
||||||
|
onChange={onChange}
|
||||||
|
renderOption={(props, option) => (
|
||||||
|
<li {...props} key={option.id}>
|
||||||
|
{option.name}
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
sx={{
|
||||||
|
"& .MuiAutocomplete-input": {
|
||||||
|
background: noneBg ? "" : "#ffffff !important",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField
|
||||||
|
{...params}
|
||||||
|
variant="standard"
|
||||||
|
placeholder={placeholder}
|
||||||
|
dir="rtl"
|
||||||
|
InputProps={{
|
||||||
|
...params.InputProps,
|
||||||
|
disableUnderline: true,
|
||||||
|
style: { height: "100%" },
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
background: "transparent !important",
|
||||||
|
"& .MuiInputBase-input": {
|
||||||
|
background: "#FAFAFA",
|
||||||
|
color: "#6C757D",
|
||||||
|
padding: "0 16px",
|
||||||
|
fontSize: "14px",
|
||||||
|
fontFamily: "inherit",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
className="!shadow-none !w-full !px-5 !h-full !text-[14px] md:!text-[16px] !min-w-[50%] !rounded-0 !font-normal"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AutoSearch;
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import SearchD from "@/components/icons/SearchD";
|
||||||
|
import { QueryForClinicsFilter } from "@/helper";
|
||||||
|
import { request } from "@/services/response";
|
||||||
|
import { Button } from "@mui/material";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
function FilterButton({ selected, setFilteredClinics }) {
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
const filterData = () => {
|
||||||
|
setLoading(true);
|
||||||
|
const params = QueryForClinicsFilter(selected);
|
||||||
|
|
||||||
|
request
|
||||||
|
.getClinicList(params)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.data) setFilteredClinics(res.data);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setLoading(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
onClick={filterData}
|
||||||
|
loading={loading}
|
||||||
|
className="
|
||||||
|
!rounded-[4px] !gap-2.5 !p-2 md:!p-3 lg:!p-4 !grid !place-items-center
|
||||||
|
!w-[38px] sm:!w-[44px] md:!w-[50px] lg:!w-[56px]
|
||||||
|
!h-[38px] sm:!h-[44px] md:!h-[50px] lg:!h-[56px]
|
||||||
|
!min-w-[38px] sm:!min-w-[44px] md:!min-w-[50px] lg:!min-w-[56px]
|
||||||
|
!min-h-[38px] sm:!min-h-[44px] md:!min-h-[50px] lg:!min-h-[56px]
|
||||||
|
!max-w-[38px] sm:!max-w-[44px] md:!max-w-[50px] lg:!max-w-[56px]
|
||||||
|
!max-h-[38px] sm:!max-h-[44px] md:!max-h-[50px] lg:!max-h-[56px]
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<div className="w-[24px] h-[24px] min-w-[24px] min-h-[24px] grid place-items-center">
|
||||||
|
{!loading && <SearchD />}
|
||||||
|
</div>
|
||||||
|
<SearchD />
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default FilterButton;
|
||||||
@@ -1,18 +1,34 @@
|
|||||||
import { Button, ButtonGroup, TextField } from "@mui/material";
|
import { ButtonGroup } from "@mui/material";
|
||||||
import SearchD from "@/components/icons/SearchD";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ButtonFilter from "@/app/component/modalSearchCity/ButtonFilter";
|
import ButtonFilter from "@/app/component/modalSearchCity/ButtonFilter";
|
||||||
import AutoCompleteSearch from "@/components/searchHead/smSearch/AutoCompleteSearch";
|
|
||||||
import ModalSearchCity from "@/components/home/search/modal";
|
import ModalSearchCity from "@/components/home/search/modal";
|
||||||
|
import AutoSearch from "./AutoSearch";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import FilterButton from "./FilterButton";
|
||||||
|
|
||||||
function SearchBar({
|
function SearchBar({
|
||||||
selected,
|
|
||||||
setSelected,
|
|
||||||
specialties,
|
|
||||||
state,
|
state,
|
||||||
handleSearch,
|
selected,
|
||||||
|
specialties,
|
||||||
|
setSelected,
|
||||||
|
setFilteredClinics,
|
||||||
}) {
|
}) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const handleSearch = (e) => {
|
||||||
|
const specialty = specialties.find((item) => item.name === e);
|
||||||
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
|
if (specialty) {
|
||||||
|
searchParams.set("specialty", specialty.name);
|
||||||
|
setSelected({ ...selected, specialty: specialty.name });
|
||||||
|
} else {
|
||||||
|
e ? searchParams.set("specialty", e) : searchParams.delete("specialty");
|
||||||
|
setSelected({ ...selected, specialty: e });
|
||||||
|
}
|
||||||
|
router.push(`?${searchParams.toString()}`);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup
|
<ButtonGroup
|
||||||
@@ -28,29 +44,19 @@ function SearchBar({
|
|||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
selected={selected}
|
selected={selected}
|
||||||
setSelected={setSelected}
|
setSelected={setSelected}
|
||||||
// handleSearch={handleSearch}
|
|
||||||
>
|
>
|
||||||
<ButtonFilter setOpen={setOpen} selected={selected} />
|
<ButtonFilter setOpen={setOpen} selected={selected} />
|
||||||
</ModalSearchCity>
|
</ModalSearchCity>
|
||||||
<AutoCompleteSearch
|
<AutoSearch
|
||||||
data={specialties}
|
data={specialties}
|
||||||
|
inputValue={selected.specialty}
|
||||||
placeholder="جستجوی تخصص"
|
placeholder="جستجوی تخصص"
|
||||||
handleSearch={handleSearch}
|
handleSearch={handleSearch}
|
||||||
/>
|
/>
|
||||||
<Button
|
<FilterButton
|
||||||
onClick={handleSearch}
|
selected={selected}
|
||||||
className="
|
setFilteredClinics={setFilteredClinics}
|
||||||
!rounded-[4px] !gap-2.5 !p-2 md:!p-3 lg:!p-4
|
/>
|
||||||
!w-[38px] sm:!w-[44px] md:!w-[50px] lg:!w-[56px]
|
|
||||||
!h-[38px] sm:!h-[44px] md:!h-[50px] lg:!h-[56px]
|
|
||||||
!min-w-[38px] sm:!min-w-[44px] md:!min-w-[50px] lg:!min-w-[56px]
|
|
||||||
!min-h-[38px] sm:!min-h-[44px] md:!min-h-[50px] lg:!min-h-[56px]
|
|
||||||
!max-w-[38px] sm:!max-w-[44px] md:!max-w-[50px] lg:!max-w-[56px]
|
|
||||||
!max-h-[38px] sm:!max-h-[44px] md:!max-h-[50px] lg:!max-h-[56px]
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<SearchD />
|
|
||||||
</Button>
|
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-14
@@ -5,25 +5,31 @@ import { useState } from "react";
|
|||||||
import List from "./list";
|
import List from "./list";
|
||||||
import SearchBar from "./head/SearchBar";
|
import SearchBar from "./head/SearchBar";
|
||||||
import HeadPageList from "@/app/component/head";
|
import HeadPageList from "@/app/component/head";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import specialtiesData from "@/data/specialties.json";
|
import specialtiesData from "@/data/specialties.json";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
|
|
||||||
|
// Data
|
||||||
|
import states from "@/data/state.json";
|
||||||
|
import cities from "@/data/city.json";
|
||||||
|
|
||||||
function ClinicsPage({ clinics, matchedCity, matchedState }) {
|
function ClinicsPage({ clinics, matchedCity, matchedState }) {
|
||||||
const router = useRouter();
|
const searchParams = useSearchParams();
|
||||||
const [filteredClinics, setFilteredClinics] = useState(clinics);
|
const [filteredClinics, setFilteredClinics] = useState(clinics.data);
|
||||||
|
|
||||||
|
const selectedState = searchParams.get("state") || matchedState?.name;
|
||||||
|
const selectedCity =
|
||||||
|
searchParams.get("city") ||
|
||||||
|
(matchedCity?.name && matchedCity?.id !== "600"
|
||||||
|
? matchedCity?.name
|
||||||
|
: false);
|
||||||
|
|
||||||
const [selected, setSelected] = useState({
|
const [selected, setSelected] = useState({
|
||||||
province: matchedState?.name || "",
|
province:
|
||||||
city: matchedCity?.name || "",
|
selectedState && states.find((item) => item.name === selectedState),
|
||||||
|
city: selectedCity && cities.find((item) => item.name === selectedCity),
|
||||||
|
specialty: searchParams.get("specialty") || "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSearch = (value) => {
|
|
||||||
// const current = new URLSearchParams(window.location.search);
|
|
||||||
// current.set("search", value);
|
|
||||||
// const queryString = current.toString();
|
|
||||||
// router.push(`/clinics?${queryString}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<HeadPageList
|
<HeadPageList
|
||||||
@@ -34,11 +40,17 @@ function ClinicsPage({ clinics, matchedCity, matchedState }) {
|
|||||||
selected={selected}
|
selected={selected}
|
||||||
state={matchedState}
|
state={matchedState}
|
||||||
setSelected={setSelected}
|
setSelected={setSelected}
|
||||||
handleSearch={handleSearch}
|
|
||||||
specialties={specialtiesData}
|
specialties={specialtiesData}
|
||||||
|
setFilteredClinics={setFilteredClinics}
|
||||||
/>
|
/>
|
||||||
</HeadPageList>
|
</HeadPageList>
|
||||||
<List selected={selected} clinics={filteredClinics} />
|
<List
|
||||||
|
limit={12}
|
||||||
|
selected={selected}
|
||||||
|
pages={clinics.page}
|
||||||
|
clinics={filteredClinics}
|
||||||
|
setFilteredClinics={setFilteredClinics}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,25 +7,26 @@ import { Button } from "@mui/material";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
function ItemClinic({ data }) {
|
function ItemClinic({ data, loading }) {
|
||||||
return (
|
return (
|
||||||
<li className="p-4 relative bg-[#FFF] border border-solid border-[#EFEFEF] rounded-[8px]">
|
<li className="p-4 relative bg-[#FFF] border border-solid border-[#EFEFEF] rounded-[8px]">
|
||||||
<div className="flex items-center justify-start gap-2">
|
<div className="flex items-center justify-start gap-2">
|
||||||
<CircularLoading width={60} height={60}>
|
<CircularLoading loading={loading} width={60} height={60}>
|
||||||
<Image
|
<Image
|
||||||
width={60}
|
width={60}
|
||||||
height={60}
|
height={60}
|
||||||
|
className="object-cover rounded-full w-[64px] md:w-[68px] lg:w-[72px] h-[64px] md:h-[68px] lg:h-[72px]"
|
||||||
src={data.clinic_logo[0].url || ""}
|
src={data.clinic_logo[0].url || ""}
|
||||||
alt="img clinic"
|
alt="img clinic"
|
||||||
/>
|
/>
|
||||||
</CircularLoading>
|
</CircularLoading>
|
||||||
<div className="flex flex-col items-start justify-center gap-2">
|
<div className="flex flex-col items-start justify-center gap-2">
|
||||||
<TextLoading width={100} height={18}>
|
<TextLoading loading={loading} width={100} height={18}>
|
||||||
<h3 className="text-[#3B3B3B] text-[14px] font-bold">
|
<h3 className="text-[#3B3B3B] text-[14px] font-bold">
|
||||||
{data.title}
|
{data.title}
|
||||||
</h3>
|
</h3>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading width={60} height={18}>
|
<TextLoading loading={loading} width={60} height={18}>
|
||||||
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
||||||
{data.doctors} پزشک
|
{data.doctors} پزشک
|
||||||
</p>
|
</p>
|
||||||
@@ -35,7 +36,7 @@ function ItemClinic({ data }) {
|
|||||||
<div className="flex flex-col items-start mt-4 gap-4 mb-[14px]">
|
<div className="flex flex-col items-start mt-4 gap-4 mb-[14px]">
|
||||||
<div className="flex items-start justify-start gap-0.5">
|
<div className="flex items-start justify-start gap-0.5">
|
||||||
<LocationClinic />
|
<LocationClinic />
|
||||||
<TextLoading width={150} height={18}>
|
<TextLoading loading={loading} width={150} height={18}>
|
||||||
<p className="text-[#7E7E7E] text-[12px] font-normal">
|
<p className="text-[#7E7E7E] text-[12px] font-normal">
|
||||||
{data.location}
|
{data.location}
|
||||||
</p>
|
</p>
|
||||||
@@ -43,7 +44,7 @@ function ItemClinic({ data }) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-start justify-start gap-0.5 ml-[64px]">
|
<div className="flex items-start justify-start gap-0.5 ml-[64px]">
|
||||||
<ClockClinic />
|
<ClockClinic />
|
||||||
<TextLoading width={120} height={18}>
|
<TextLoading loading={loading} width={120} height={18}>
|
||||||
<p className="text-[#7E7E7E] text-[12px] font-normal">
|
<p className="text-[#7E7E7E] text-[12px] font-normal">
|
||||||
ساعت کاری: {data.hours_of_work}
|
ساعت کاری: {data.hours_of_work}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,9 +1,35 @@
|
|||||||
import Pageguide from "@/app/component/Pageguide";
|
import { useState } from "react";
|
||||||
import ItemClinic from "./ItemClinic";
|
import ItemClinic from "./ItemClinic";
|
||||||
import Pagination from "@/app/component/Pagination";
|
import { QueryForClinicsFilter } from "@/helper";
|
||||||
|
import Pageguide from "@/app/component/Pageguide";
|
||||||
|
import PaginationContent from "@/app/component/PaginationContent";
|
||||||
|
import { request } from "@/services/response";
|
||||||
|
|
||||||
function List({ selected, clinics }) {
|
function List({ limit, selected, clinics, pages, setFilteredClinics }) {
|
||||||
const listPage = ["کلینیک ها", selected?.city || ""];
|
const listPage = ["کلینیک ها", selected?.city?.name || ""];
|
||||||
|
const [page, setPage] = useState(pages?.currentPage);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
const changePage = (_, num) => {
|
||||||
|
setLoading(true);
|
||||||
|
|
||||||
|
setPage(num);
|
||||||
|
const params = {
|
||||||
|
...QueryForClinicsFilter(selected),
|
||||||
|
page: num,
|
||||||
|
limit,
|
||||||
|
};
|
||||||
|
|
||||||
|
request
|
||||||
|
.getClinicList(params)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.data) setFilteredClinics(res.data);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
})
|
||||||
|
.finally(() => setLoading(false));
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="padding-responsive pt-[20px]">
|
<div className="padding-responsive pt-[20px]">
|
||||||
@@ -14,7 +40,7 @@ function List({ selected, clinics }) {
|
|||||||
gap-y-[16px] sm:gap-y-[24px] md:gap-y-[32px] lg:gap-y-[40px] mt-6"
|
gap-y-[16px] sm:gap-y-[24px] md:gap-y-[32px] lg:gap-y-[40px] mt-6"
|
||||||
>
|
>
|
||||||
{clinics.map((item) => (
|
{clinics.map((item) => (
|
||||||
<ItemClinic data={item} key={item.id} />
|
<ItemClinic loading={loading} data={item} key={item.id} />
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
) : (
|
) : (
|
||||||
@@ -23,7 +49,15 @@ function List({ selected, clinics }) {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="mt-[48px] flex justify-center">
|
<div className="mt-[48px] flex justify-center">
|
||||||
<Pagination list={clinics} itemsPerPage={12} />
|
<PaginationContent
|
||||||
|
page={page}
|
||||||
|
limit={limit}
|
||||||
|
list={clinics}
|
||||||
|
itemsPerPage={12}
|
||||||
|
setPage={setPage}
|
||||||
|
pageDetail={pages}
|
||||||
|
changePage={changePage}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ function Chart({ comments, doctor }) {
|
|||||||
<ul className="flex w-full flex-col items-start justify-start gap-1.5 lg:w-fit">
|
<ul className="flex w-full flex-col items-start justify-start gap-1.5 lg:w-fit">
|
||||||
{Object.values(doctor?.average_rate?.averages).map((item, idx) => (
|
{Object.values(doctor?.average_rate?.averages).map((item, idx) => (
|
||||||
<TextLoading width="full" key={idx} height={20}>
|
<TextLoading width="full" key={idx} height={20}>
|
||||||
<ProgressDetail data={item} />
|
<ProgressDetail data={item} idx={idx} />
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ function Head({ matchedCity, matchedState, setDoctors }) {
|
|||||||
const selectedState = searchParams.get("state") || matchedState?.name;
|
const selectedState = searchParams.get("state") || matchedState?.name;
|
||||||
const selectedCity =
|
const selectedCity =
|
||||||
searchParams.get("city") ||
|
searchParams.get("city") ||
|
||||||
(matchedCity?.name && matchedCity?.id !== "63" ? matchedCity?.name : false);
|
(matchedCity?.name && matchedCity?.id !== "600"
|
||||||
|
? matchedCity?.name
|
||||||
|
: false);
|
||||||
|
|
||||||
const valCategory = isParent
|
const valCategory = isParent
|
||||||
? findItem("id", isParent)
|
? findItem("id", isParent)
|
||||||
|
|||||||
@@ -5,22 +5,20 @@ function AutoComplete({
|
|||||||
data,
|
data,
|
||||||
noneBg,
|
noneBg,
|
||||||
clearText,
|
clearText,
|
||||||
inputValue, // مقدار کنترلشده از والد (اختیاری)
|
inputValue,
|
||||||
placeholder,
|
placeholder,
|
||||||
handleSearch, // تابعی که باید با مقدار جستجو صدا زده بشه
|
handleSearch,
|
||||||
setInputValue, // اختیاری: اگه والد دوست داره همونوقت مقدار رو بگیره
|
setInputValue,
|
||||||
setSelectedOption,
|
setSelectedOption,
|
||||||
debounce = 500, // قابل تنظیم
|
debounce = 500,
|
||||||
}) {
|
}) {
|
||||||
const typingTimeoutRef = useRef(null);
|
const typingTimeoutRef = useRef(null);
|
||||||
const [localInput, setLocalInput] = useState(inputValue || "");
|
const [localInput, setLocalInput] = useState(inputValue || "");
|
||||||
|
|
||||||
// همگامسازی وقتی والد مقدار کنترلشده رو تغییر میده (مثلاً بعد از انتخاب گزینه)
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLocalInput(inputValue || "");
|
setLocalInput(inputValue || "");
|
||||||
}, [inputValue]);
|
}, [inputValue]);
|
||||||
|
|
||||||
// پاککردن تایمر هنگام unmount
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);
|
if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);
|
||||||
@@ -28,13 +26,10 @@ function AutoComplete({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onInputChange = (_, newInputValue) => {
|
const onInputChange = (_, newInputValue) => {
|
||||||
// نمایش آنی تایپ کاربر
|
|
||||||
setLocalInput(newInputValue);
|
setLocalInput(newInputValue);
|
||||||
|
|
||||||
// اختیاری: اگر والد خواست همونجا مقدار رو بگیره
|
|
||||||
if (setInputValue) setInputValue(newInputValue);
|
if (setInputValue) setInputValue(newInputValue);
|
||||||
|
|
||||||
// پاک کردن تایمر قبلی و ست کردن تایمر جدید برای debounce
|
|
||||||
if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);
|
if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);
|
||||||
typingTimeoutRef.current = setTimeout(() => {
|
typingTimeoutRef.current = setTimeout(() => {
|
||||||
handleSearch(newInputValue);
|
handleSearch(newInputValue);
|
||||||
@@ -42,7 +37,6 @@ function AutoComplete({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (_, newValue) => {
|
const onChange = (_, newValue) => {
|
||||||
// انتخاب از لیست — مقدار رو فوراً پردازش کن
|
|
||||||
if (typingTimeoutRef.current) {
|
if (typingTimeoutRef.current) {
|
||||||
clearTimeout(typingTimeoutRef.current);
|
clearTimeout(typingTimeoutRef.current);
|
||||||
typingTimeoutRef.current = null;
|
typingTimeoutRef.current = null;
|
||||||
@@ -55,7 +49,7 @@ function AutoComplete({
|
|||||||
: "";
|
: "";
|
||||||
setLocalInput(val);
|
setLocalInput(val);
|
||||||
setSelectedOption && setSelectedOption(newValue);
|
setSelectedOption && setSelectedOption(newValue);
|
||||||
handleSearch(val); // اجرای فوری روی انتخاب
|
handleSearch(val);
|
||||||
if (setInputValue) setInputValue(val);
|
if (setInputValue) setInputValue(val);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -67,7 +61,7 @@ function AutoComplete({
|
|||||||
typeof option === "string" ? option : option.name
|
typeof option === "string" ? option : option.name
|
||||||
}
|
}
|
||||||
disableClearable
|
disableClearable
|
||||||
inputValue={localInput} // ← نمایش آنی از local state
|
inputValue={localInput}
|
||||||
className="!w-full"
|
className="!w-full"
|
||||||
onInputChange={onInputChange}
|
onInputChange={onInputChange}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import specialties from "@/data/specialties.json";
|
import specialties from "@/data/specialties.json";
|
||||||
import AutoComplete from "./AutoComplete";
|
import AutoComplete from "./AutoComplete";
|
||||||
|
|
||||||
function SearchField({ filter, setFilter, updateData, setDataInURL }) {
|
function SearchField({ filter, setFilter, setDataInURL }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const clearText = () => {
|
const clearText = () => {
|
||||||
@@ -17,7 +17,6 @@ function SearchField({ filter, setFilter, updateData, setDataInURL }) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
setFilter(newFilter);
|
setFilter(newFilter);
|
||||||
// setDataInURL(newFilter);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearch = (e) => {
|
const handleSearch = (e) => {
|
||||||
@@ -34,7 +33,6 @@ function SearchField({ filter, setFilter, updateData, setDataInURL }) {
|
|||||||
dataUrl.specialty = findName.name;
|
dataUrl.specialty = findName.name;
|
||||||
newFilter.category = itemParent;
|
newFilter.category = itemParent;
|
||||||
newFilter.specialty = findName;
|
newFilter.specialty = findName;
|
||||||
// updateData("name", e);
|
|
||||||
} else {
|
} else {
|
||||||
dataUrl.specialty = findName.name;
|
dataUrl.specialty = findName.name;
|
||||||
newFilter.category = findName;
|
newFilter.category = findName;
|
||||||
@@ -50,8 +48,6 @@ function SearchField({ filter, setFilter, updateData, setDataInURL }) {
|
|||||||
router.push(`?${searchParams.toString()}`);
|
router.push(`?${searchParams.toString()}`);
|
||||||
newFilter.name = e;
|
newFilter.name = e;
|
||||||
setFilter(newFilter);
|
setFilter(newFilter);
|
||||||
// const newFilter = { ...filter, [name]: e };
|
|
||||||
// setFilter(newFilter);
|
|
||||||
} else {
|
} else {
|
||||||
let newFilter = filter;
|
let newFilter = filter;
|
||||||
|
|
||||||
@@ -65,20 +61,18 @@ function SearchField({ filter, setFilter, updateData, setDataInURL }) {
|
|||||||
router.push(`?${searchParams.toString()}`);
|
router.push(`?${searchParams.toString()}`);
|
||||||
}
|
}
|
||||||
newFilter.name = e;
|
newFilter.name = e;
|
||||||
// updateData("name", e);
|
|
||||||
setFilter(newFilter);
|
setFilter(newFilter);
|
||||||
setDataInURL(newFilter);
|
setDataInURL(newFilter);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="!min-w-[50%] !w-[524px]">
|
<div className="!min-w-[50%] !w-full">
|
||||||
<AutoComplete
|
<AutoComplete
|
||||||
data={specialties}
|
data={specialties}
|
||||||
clearText={clearText}
|
clearText={clearText}
|
||||||
inputValue={filter.name}
|
inputValue={filter.name}
|
||||||
handleSearch={handleSearch}
|
handleSearch={handleSearch}
|
||||||
// handleSearch={(e) => updateData("name", e)}
|
|
||||||
placeholder="جستجوی نام پزشک، تخصص، بیماری ..."
|
placeholder="جستجوی نام پزشک، تخصص، بیماری ..."
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ function SearchBar({ filter, sendReq, setFilter, updateData, setDataInURL }) {
|
|||||||
<SearchField
|
<SearchField
|
||||||
filter={filter}
|
filter={filter}
|
||||||
setFilter={setFilter}
|
setFilter={setFilter}
|
||||||
updateData={updateData}
|
|
||||||
setDataInURL={setDataInURL}
|
setDataInURL={setDataInURL}
|
||||||
/>
|
/>
|
||||||
<SendReq
|
<SendReq
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import BottomSelect from "@/components/icons/BottomSelect";
|
||||||
|
import { Autocomplete, Button, TextField } from "@mui/material";
|
||||||
|
import { styleTextSelectRight } from "@/mui";
|
||||||
|
|
||||||
|
function AutoComplete({
|
||||||
|
list,
|
||||||
|
value,
|
||||||
|
isError,
|
||||||
|
updateData,
|
||||||
|
label,
|
||||||
|
disabled,
|
||||||
|
listboxProps,
|
||||||
|
name,
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Autocomplete
|
||||||
|
disablePortal
|
||||||
|
options={list}
|
||||||
|
disabled={disabled}
|
||||||
|
ListboxProps={listboxProps}
|
||||||
|
value={value || null}
|
||||||
|
getOptionLabel={(option) => option?.name || ""}
|
||||||
|
className="!w-full !rounded-lg auto-complete-selector"
|
||||||
|
onChange={(_, value) => updateData(name, value)}
|
||||||
|
sx={{
|
||||||
|
...styleTextSelectRight,
|
||||||
|
// Hide Icon Number
|
||||||
|
"& input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button":
|
||||||
|
{
|
||||||
|
display: "none",
|
||||||
|
},
|
||||||
|
"& input[type=number]": {
|
||||||
|
MozAppearance: "textfield",
|
||||||
|
},
|
||||||
|
"& .MuiInputBase-input": { padding: "12.5px 14px !important" },
|
||||||
|
"& .MuiInputBase-root": {
|
||||||
|
borderRadius: 2,
|
||||||
|
padding: "0 !important",
|
||||||
|
height: {
|
||||||
|
xs: "43px !important",
|
||||||
|
sm: "43px !important",
|
||||||
|
md: "46px !important",
|
||||||
|
lg: "48px !important",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"& .MuiOutlinedInput-notchedOutline": {
|
||||||
|
border: "1px solid #D7D7D7",
|
||||||
|
},
|
||||||
|
"& .MuiInput-underline:hover:not(.Mui-disabled):before, .MuiOutlinedInput-notchedOutline":
|
||||||
|
{
|
||||||
|
borderColor: "#D7D7D7 !important",
|
||||||
|
},
|
||||||
|
"& .muirtl-1kiro5a-MuiInputBase-root-MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":
|
||||||
|
{
|
||||||
|
border: "1px solid #5559CE !important",
|
||||||
|
},
|
||||||
|
"& .MuiOutlinedInput-notchedOutline": {
|
||||||
|
border: isError ? "1px solid red !important" : "",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
renderOption={(props, option) => (
|
||||||
|
<Button
|
||||||
|
fullWidth
|
||||||
|
{...props}
|
||||||
|
key={props.id}
|
||||||
|
className="!flex !justify-start !p-[8px] !text-start !text-[#A1A1A1] hover:dark:!bg-[#35343D] !bg-[#FFF] dark:!bg-[#1F1D2B]"
|
||||||
|
>
|
||||||
|
{option.name}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField
|
||||||
|
fullWidth
|
||||||
|
{...params}
|
||||||
|
InputProps={{
|
||||||
|
...params.InputProps,
|
||||||
|
endAdornment: (
|
||||||
|
<div className="absolute left-4">
|
||||||
|
<BottomSelect />
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
placeholder={label}
|
||||||
|
sx={{
|
||||||
|
borderRadius: "8px",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AutoComplete;
|
||||||
@@ -2,8 +2,8 @@ import { Button } from "@mui/material";
|
|||||||
|
|
||||||
// Icon
|
// Icon
|
||||||
import CloseModalD from "@/components/icons/CloseModalD";
|
import CloseModalD from "@/components/icons/CloseModalD";
|
||||||
import AutoCompleteSelect from "@/app/component/element/AutoCompleteSelect";
|
|
||||||
import ArrowLeftM from "@/components/icons/ArrowLeftM";
|
import ArrowLeftM from "@/components/icons/ArrowLeftM";
|
||||||
|
import AutoComplete from "./AutoComplete";
|
||||||
|
|
||||||
function Content({
|
function Content({
|
||||||
state,
|
state,
|
||||||
@@ -14,7 +14,6 @@ function Content({
|
|||||||
filteredCities,
|
filteredCities,
|
||||||
handleSearch,
|
handleSearch,
|
||||||
}) {
|
}) {
|
||||||
const citySelected = selected.city;
|
|
||||||
const listboxProps = {
|
const listboxProps = {
|
||||||
style: {
|
style: {
|
||||||
maxHeight: 200,
|
maxHeight: 200,
|
||||||
@@ -39,24 +38,19 @@ function Content({
|
|||||||
شهر یا استان مورد نظر را انتخاب نمایید:
|
شهر یا استان مورد نظر را انتخاب نمایید:
|
||||||
</p>
|
</p>
|
||||||
<div className="flex md:min-w-[344px] flex-col mt-[52px] md:mt-[44px] mb-14 justify-center items-center gap-10">
|
<div className="flex md:min-w-[344px] flex-col mt-[52px] md:mt-[44px] mb-14 justify-center items-center gap-10">
|
||||||
<AutoCompleteSelect
|
<AutoComplete
|
||||||
value={selected.province}
|
|
||||||
disabled={state}
|
|
||||||
listboxProps={listboxProps}
|
|
||||||
updateData={updateData}
|
|
||||||
list={states}
|
list={states}
|
||||||
label="استان"
|
label="استان"
|
||||||
name="province"
|
name="province"
|
||||||
|
disabled={state}
|
||||||
|
updateData={updateData}
|
||||||
|
value={selected.province}
|
||||||
|
listboxProps={listboxProps}
|
||||||
/>
|
/>
|
||||||
<AutoCompleteSelect
|
<AutoComplete
|
||||||
updateData={updateData}
|
updateData={updateData}
|
||||||
listboxProps={listboxProps}
|
listboxProps={listboxProps}
|
||||||
value={
|
value={selected.city}
|
||||||
selected &&
|
|
||||||
citySelected &&
|
|
||||||
filteredCities.find((item) => item.name === citySelected) &&
|
|
||||||
citySelected
|
|
||||||
}
|
|
||||||
list={filteredCities}
|
list={filteredCities}
|
||||||
name="city"
|
name="city"
|
||||||
label="شهر"
|
label="شهر"
|
||||||
@@ -80,4 +74,4 @@ function Content({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Content;
|
export default Content;
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Modal, Box } from "@mui/material";
|
import { Modal, Box } from "@mui/material";
|
||||||
import { styleDefault } from "@/mui";
|
import { styleDefault } from "@/mui";
|
||||||
import { addLabelToList } from "@/helper";
|
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
import statesData from "@/data/state.json";
|
import states from "@/data/state.json";
|
||||||
import citiesData from "@/data/city.json";
|
import cities from "@/data/city.json";
|
||||||
import Content from "./Content";
|
import Content from "./Content";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
function ModalSearchCity({
|
function ModalSearchCity({
|
||||||
open,
|
open,
|
||||||
@@ -16,13 +16,11 @@ function ModalSearchCity({
|
|||||||
setOpen,
|
setOpen,
|
||||||
children,
|
children,
|
||||||
selected,
|
selected,
|
||||||
handleSearch,
|
|
||||||
setSelected,
|
setSelected,
|
||||||
|
handleSearch,
|
||||||
}) {
|
}) {
|
||||||
const provinceSelected = selected.province;
|
const provinceSelected = selected?.province?.name;
|
||||||
|
const router = useRouter();
|
||||||
const states = addLabelToList(statesData);
|
|
||||||
const cities = addLabelToList(citiesData);
|
|
||||||
const [filteredCities, setFilteredCities] = useState([]);
|
const [filteredCities, setFilteredCities] = useState([]);
|
||||||
|
|
||||||
const handleClose = () => setOpen(false);
|
const handleClose = () => setOpen(false);
|
||||||
@@ -30,7 +28,7 @@ function ModalSearchCity({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (provinceSelected) {
|
if (provinceSelected) {
|
||||||
const selectedState = states.find(
|
const selectedState = states.find(
|
||||||
(state) => state.label === provinceSelected
|
(state) => state.name === provinceSelected
|
||||||
);
|
);
|
||||||
if (selectedState) {
|
if (selectedState) {
|
||||||
const stateId = selectedState.id;
|
const stateId = selectedState.id;
|
||||||
@@ -44,12 +42,19 @@ function ModalSearchCity({
|
|||||||
}
|
}
|
||||||
}, [provinceSelected]);
|
}, [provinceSelected]);
|
||||||
|
|
||||||
const updateData = (event, name) => {
|
const updateData = (name, event) => {
|
||||||
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
if (name === "province") {
|
if (name === "province") {
|
||||||
setSelected({ ...selected, province: event, city: "" });
|
setSelected({ ...selected, province: event, city: "" });
|
||||||
|
searchParams.set("state", event?.name);
|
||||||
|
searchParams.set("city", selected.city?.name);
|
||||||
} else {
|
} else {
|
||||||
setSelected({ ...selected, [name]: event });
|
setSelected({ ...selected, [name]: event });
|
||||||
|
searchParams.set("city", event?.name);
|
||||||
|
searchParams.set("state", selected.province?.name);
|
||||||
}
|
}
|
||||||
|
router.push(`?${searchParams.toString()}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+35
-36
@@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": "32",
|
"id": "101",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "1",
|
"province_id": "1",
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به تبریز نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به تبریز نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "33",
|
"id": "102",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "2",
|
"province_id": "2",
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به ارومیه نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به ارومیه نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "34",
|
"id": "103",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "3",
|
"province_id": "3",
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به اردبیل نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به اردبیل نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "35",
|
"id": "104",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "4",
|
"province_id": "4",
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به اصفهان نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به اصفهان نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "36",
|
"id": "105",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "5",
|
"province_id": "5",
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به کرج نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به کرج نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "37",
|
"id": "106",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "6",
|
"province_id": "6",
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به ایلام نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به ایلام نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "38",
|
"id": "107",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "7",
|
"province_id": "7",
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به بوشهر نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به بوشهر نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "39",
|
"id": "108",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "8",
|
"province_id": "8",
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به تهران نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به تهران نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "40",
|
"id": "109",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "9",
|
"province_id": "9",
|
||||||
@@ -189,7 +189,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به شهرکرد نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به شهرکرد نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "41",
|
"id": "110",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "10",
|
"province_id": "10",
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به بیرجند نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به بیرجند نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "42",
|
"id": "111",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "11",
|
"province_id": "11",
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به مشهد نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به مشهد نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "43",
|
"id": "112",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "12",
|
"province_id": "12",
|
||||||
@@ -252,7 +252,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به بجنورد نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به بجنورد نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "44",
|
"id": "113",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "13",
|
"province_id": "13",
|
||||||
@@ -273,7 +273,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به اهواز نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به اهواز نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "45",
|
"id": "114",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "14",
|
"province_id": "14",
|
||||||
@@ -294,7 +294,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به زنجان نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به زنجان نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "46",
|
"id": "115",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "15",
|
"province_id": "15",
|
||||||
@@ -315,7 +315,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به سمنان نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به سمنان نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "47",
|
"id": "116",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "16",
|
"province_id": "16",
|
||||||
@@ -336,7 +336,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به زاهدان نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به زاهدان نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "48",
|
"id": "117",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "17",
|
"province_id": "17",
|
||||||
@@ -357,7 +357,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به شیراز نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به شیراز نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "49",
|
"id": "118",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "18",
|
"province_id": "18",
|
||||||
@@ -378,7 +378,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به قزوین نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به قزوین نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "50",
|
"id": "119",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "19",
|
"province_id": "19",
|
||||||
@@ -399,7 +399,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به قم نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به قم نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "51",
|
"id": "120",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "20",
|
"province_id": "20",
|
||||||
@@ -420,7 +420,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به سنندج نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به سنندج نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "52",
|
"id": "121",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "21",
|
"province_id": "21",
|
||||||
@@ -441,7 +441,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به کرمان نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به کرمان نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "53",
|
"id": "122",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "22",
|
"province_id": "22",
|
||||||
@@ -462,7 +462,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به کرمانشاه نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به کرمانشاه نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "54",
|
"id": "123",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "23",
|
"province_id": "23",
|
||||||
@@ -483,7 +483,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به یاسوج نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به یاسوج نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "64",
|
"id": "124",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "23",
|
"province_id": "23",
|
||||||
@@ -504,7 +504,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به یاسوج نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به یاسوج نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "55",
|
"id": "125",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "24",
|
"province_id": "24",
|
||||||
@@ -525,7 +525,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به گرگان نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به گرگان نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "56",
|
"id": "126",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "25",
|
"province_id": "25",
|
||||||
@@ -546,7 +546,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به رشت نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به رشت نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "57",
|
"id": "127",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "26",
|
"province_id": "26",
|
||||||
@@ -567,7 +567,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به خرمآباد نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به خرمآباد نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "58",
|
"id": "128",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "27",
|
"province_id": "27",
|
||||||
@@ -588,7 +588,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به ساری نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به ساری نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "59",
|
"id": "129",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "28",
|
"province_id": "28",
|
||||||
@@ -609,7 +609,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به اراک نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به اراک نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "60",
|
"id": "130",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "29",
|
"province_id": "29",
|
||||||
@@ -630,7 +630,7 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به بندرعباس نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به بندرعباس نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "61",
|
"id": "131",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "30",
|
"province_id": "30",
|
||||||
@@ -651,10 +651,10 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به همدان نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به همدان نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "62",
|
"id": "132",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "31",
|
"province_id": "100",
|
||||||
"name": "یزد",
|
"name": "یزد",
|
||||||
"site_name": "یزد نوبت",
|
"site_name": "یزد نوبت",
|
||||||
"slogan": "نوبتگیری آنلاین پزشکان یزد، در هر ساعت از روز",
|
"slogan": "نوبتگیری آنلاین پزشکان یزد، در هر ساعت از روز",
|
||||||
@@ -672,10 +672,9 @@
|
|||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به یزد نوبت میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به یزد نوبت میباشد."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "63",
|
"id": "600",
|
||||||
"email": "nobat724@gmail.com",
|
"email": "nobat724@gmail.com",
|
||||||
"type": "2",
|
"type": "2",
|
||||||
"province_id": "32",
|
|
||||||
"name": "نوبت 724",
|
"name": "نوبت 724",
|
||||||
"site_name": "نوبت 724",
|
"site_name": "نوبت 724",
|
||||||
"slogan": "دیگه نوبت گرفتن کار سختی نیست !",
|
"slogan": "دیگه نوبت گرفتن کار سختی نیست !",
|
||||||
@@ -692,4 +691,4 @@
|
|||||||
"footerDescription": "نوبت 724، سامانه جامع نوبتدهی پزشکی برای تمامی شهرها. رزرو نوبت از پزشکان و مراکز درمانی معتبر بدون نیاز به مراجعه حضوری.",
|
"footerDescription": "نوبت 724، سامانه جامع نوبتدهی پزشکی برای تمامی شهرها. رزرو نوبت از پزشکان و مراکز درمانی معتبر بدون نیاز به مراجعه حضوری.",
|
||||||
"footerDisclaimer": "تمامی حقوق این سایت متعلق به نوبت 724 میباشد."
|
"footerDisclaimer": "تمامی حقوق این سایت متعلق به نوبت 724 میباشد."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+106
-106
@@ -1,346 +1,346 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": "500",
|
"id": "601",
|
||||||
"name": "پزشکی عمومی",
|
"name": "پزشکی عمومی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "501",
|
"id": "602",
|
||||||
"name": "داخلی",
|
"name": "داخلی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "502",
|
"id": "603",
|
||||||
"name": "داخلی عمومی",
|
"name": "داخلی عمومی",
|
||||||
"parent": "501"
|
"parent": "602"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "503",
|
"id": "604",
|
||||||
"name": "قلب و عروق",
|
"name": "قلب و عروق",
|
||||||
"parent": "501"
|
"parent": "602"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "504",
|
"id": "605",
|
||||||
"name": "گوارش و کبد",
|
"name": "گوارش و کبد",
|
||||||
"parent": "501"
|
"parent": "602"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "505",
|
"id": "606",
|
||||||
"name": "غدد و متابولیسم",
|
"name": "غدد و متابولیسم",
|
||||||
"parent": "501"
|
"parent": "602"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "506",
|
"id": "607",
|
||||||
"name": "خون و انکولوژی",
|
"name": "خون و انکولوژی",
|
||||||
"parent": "501"
|
"parent": "602"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "507",
|
"id": "608",
|
||||||
"name": "ریه (پولمونولوژی)",
|
"name": "ریه (پولمونولوژی)",
|
||||||
"parent": "501"
|
"parent": "602"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "508",
|
"id": "609",
|
||||||
"name": "کلیه و مجاری ادراری (نفرولوژی)",
|
"name": "کلیه و مجاری ادراری (نفرولوژی)",
|
||||||
"parent": "501"
|
"parent": "602"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "509",
|
"id": "610",
|
||||||
"name": "روماتولوژی (بیماریهای مفاصل)",
|
"name": "روماتولوژی (بیماریهای مفاصل)",
|
||||||
"parent": "501"
|
"parent": "602"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "510",
|
"id": "611",
|
||||||
"name": "نورولوژی (عصبی)",
|
"name": "نورولوژی (عصبی)",
|
||||||
"parent": "501"
|
"parent": "602"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "511",
|
"id": "612",
|
||||||
"name": "جراحی",
|
"name": "جراحی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "512",
|
"id": "613",
|
||||||
"name": "جراحی عمومی",
|
"name": "جراحی عمومی",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "513",
|
"id": "614",
|
||||||
"name": "جراحی مغز و اعصاب",
|
"name": "جراحی مغز و اعصاب",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "514",
|
"id": "615",
|
||||||
"name": "جراحی قلب و عروق",
|
"name": "جراحی قلب و عروق",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "515",
|
"id": "616",
|
||||||
"name": "جراحی عروق",
|
"name": "جراحی عروق",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "516",
|
"id": "617",
|
||||||
"name": "جراحی ارتوپدی (استخوان و مفاصل)",
|
"name": "جراحی ارتوپدی (استخوان و مفاصل)",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "517",
|
"id": "618",
|
||||||
"name": "جراحی پلاستیک و ترمیمی",
|
"name": "جراحی پلاستیک و ترمیمی",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "518",
|
"id": "619",
|
||||||
"name": "جراحی چشم",
|
"name": "جراحی چشم",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "519",
|
"id": "620",
|
||||||
"name": "جراحی گوش، حلق و بینی (ENT)",
|
"name": "جراحی گوش، حلق و بینی (ENT)",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "520",
|
"id": "621",
|
||||||
"name": "جراحی کودکان",
|
"name": "جراحی کودکان",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "521",
|
"id": "622",
|
||||||
"name": "جراحی دستگاه گوارش",
|
"name": "جراحی دستگاه گوارش",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "522",
|
"id": "623",
|
||||||
"name": "جراحی توراکس (قفسه سینه)",
|
"name": "جراحی توراکس (قفسه سینه)",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "523",
|
"id": "624",
|
||||||
"name": "جراحی دست",
|
"name": "جراحی دست",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "524",
|
"id": "625",
|
||||||
"name": "جراحی فک و صورت",
|
"name": "جراحی فک و صورت",
|
||||||
"parent": "511"
|
"parent": "612"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "525",
|
"id": "626",
|
||||||
"name": "زنان و زایمان",
|
"name": "زنان و زایمان",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "526",
|
"id": "627",
|
||||||
"name": "اطفال (کودکان)",
|
"name": "اطفال (کودکان)",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "527",
|
"id": "628",
|
||||||
"name": "روانپزشکی",
|
"name": "روانپزشکی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "528",
|
"id": "629",
|
||||||
"name": "روانپزشکی عمومی",
|
"name": "روانپزشکی عمومی",
|
||||||
"parent": "527"
|
"parent": "628"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "529",
|
"id": "630",
|
||||||
"name": "روانپزشکی کودکان و نوجوانان",
|
"name": "روانپزشکی کودکان و نوجوانان",
|
||||||
"parent": "527"
|
"parent": "628"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "530",
|
"id": "631",
|
||||||
"name": "روانپزشکی سالمندان",
|
"name": "روانپزشکی سالمندان",
|
||||||
"parent": "527"
|
"parent": "628"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "531",
|
"id": "632",
|
||||||
"name": "پوست و مو (درماتولوژی)",
|
"name": "پوست و مو (درماتولوژی)",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "532",
|
"id": "633",
|
||||||
"name": "چشم پزشکی",
|
"name": "چشم پزشکی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "533",
|
"id": "634",
|
||||||
"name": "گوش، حلق و بینی",
|
"name": "گوش، حلق و بینی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "534",
|
"id": "635",
|
||||||
"name": "اورولوژی (مجاری ادراری و تناسلی)",
|
"name": "اورولوژی (مجاری ادراری و تناسلی)",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "535",
|
"id": "636",
|
||||||
"name": "رادیولوژی",
|
"name": "رادیولوژی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "536",
|
"id": "637",
|
||||||
"name": "رادیولوژی تشخیصی",
|
"name": "رادیولوژی تشخیصی",
|
||||||
"parent": "535"
|
"parent": "636"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "537",
|
"id": "638",
|
||||||
"name": "رادیولوژی مداخلهای",
|
"name": "رادیولوژی مداخلهای",
|
||||||
"parent": "535"
|
"parent": "636"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "538",
|
"id": "639",
|
||||||
"name": "نوار قلب و الکتروفیزیولوژی",
|
"name": "نوار قلب و الکتروفیزیولوژی",
|
||||||
"parent": "535"
|
"parent": "636"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "539",
|
"id": "640",
|
||||||
"name": "پاتولوژی (آسیبشناسی)",
|
"name": "پاتولوژی (آسیبشناسی)",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "540",
|
"id": "641",
|
||||||
"name": "انکولوژی (سرطانشناسی)",
|
"name": "انکولوژی (سرطانشناسی)",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "541",
|
"id": "642",
|
||||||
"name": "انکولوژی پزشکی",
|
"name": "انکولوژی پزشکی",
|
||||||
"parent": "540"
|
"parent": "641"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "542",
|
"id": "643",
|
||||||
"name": "انکولوژی رادیوتراپی",
|
"name": "انکولوژی رادیوتراپی",
|
||||||
"parent": "540"
|
"parent": "641"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "543",
|
"id": "644",
|
||||||
"name": "طب فیزیکی و توانبخشی",
|
"name": "طب فیزیکی و توانبخشی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "544",
|
"id": "645",
|
||||||
"name": "دندانپزشکی",
|
"name": "دندانپزشکی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "545",
|
"id": "646",
|
||||||
"name": "عمومی",
|
"name": "عمومی",
|
||||||
"parent": "544"
|
"parent": "645"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "546",
|
"id": "647",
|
||||||
"name": "ارتودنسی",
|
"name": "ارتودنسی",
|
||||||
"parent": "544"
|
"parent": "645"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "547",
|
"id": "648",
|
||||||
"name": "جراحی فک و صورت",
|
"name": "جراحی فک و صورت",
|
||||||
"parent": "544"
|
"parent": "645"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "548",
|
"id": "649",
|
||||||
"name": "پریودنتولوژی (بیماریهای لثه)",
|
"name": "پریودنتولوژی (بیماریهای لثه)",
|
||||||
"parent": "544"
|
"parent": "645"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "549",
|
"id": "650",
|
||||||
"name": "اندودنتولوژی (درمان ریشه)",
|
"name": "اندودنتولوژی (درمان ریشه)",
|
||||||
"parent": "544"
|
"parent": "645"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "550",
|
"id": "651",
|
||||||
"name": "پروتز دندان",
|
"name": "پروتز دندان",
|
||||||
"parent": "544"
|
"parent": "645"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "551",
|
"id": "652",
|
||||||
"name": "دندانپزشکی کودکان",
|
"name": "دندانپزشکی کودکان",
|
||||||
"parent": "544"
|
"parent": "645"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "552",
|
"id": "653",
|
||||||
"name": "طب اورژانس",
|
"name": "طب اورژانس",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "553",
|
"id": "654",
|
||||||
"name": "پزشکی خانواده",
|
"name": "پزشکی خانواده",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "554",
|
"id": "655",
|
||||||
"name": "طب ورزشی",
|
"name": "طب ورزشی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "555",
|
"id": "656",
|
||||||
"name": "پزشکی هستهای",
|
"name": "پزشکی هستهای",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "556",
|
"id": "657",
|
||||||
"name": "پزشکی قانونی",
|
"name": "پزشکی قانونی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "557",
|
"id": "658",
|
||||||
"name": "پزشکی اجتماعی",
|
"name": "پزشکی اجتماعی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "558",
|
"id": "659",
|
||||||
"name": "طب سالمندان",
|
"name": "طب سالمندان",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "559",
|
"id": "660",
|
||||||
"name": "نوروسرجری (جراحی مغز و اعصاب)",
|
"name": "نوروسرجری (جراحی مغز و اعصاب)",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "560",
|
"id": "661",
|
||||||
"name": "پزشکی شغلی",
|
"name": "پزشکی شغلی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "561",
|
"id": "662",
|
||||||
"name": "اندوکرینولوژی (غدد درونریز)",
|
"name": "اندوکرینولوژی (غدد درونریز)",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "562",
|
"id": "663",
|
||||||
"name": "میکروبیولوژی و ویروسشناسی پزشکی",
|
"name": "میکروبیولوژی و ویروسشناسی پزشکی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "563",
|
"id": "664",
|
||||||
"name": "ایمونولوژی (سیستم ایمنی)",
|
"name": "ایمونولوژی (سیستم ایمنی)",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "564",
|
"id": "665",
|
||||||
"name": "بیماریهای عفونی",
|
"name": "بیماریهای عفونی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "565",
|
"id": "666",
|
||||||
"name": "گوش، حلق و بینی",
|
"name": "گوش، حلق و بینی",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "566",
|
"id": "667",
|
||||||
"name": "نورولوژی (عصبی)",
|
"name": "نورولوژی (عصبی)",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "567",
|
"id": "668",
|
||||||
"name": "پزشکی خواب",
|
"name": "پزشکی خواب",
|
||||||
"parent": null
|
"parent": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "568",
|
"id": "1500",
|
||||||
"name": "سکته مغزی",
|
"name": "سکته مغزی",
|
||||||
"parent": null
|
"parent": null
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -120,7 +120,7 @@
|
|||||||
"name": "همدان"
|
"name": "همدان"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "31",
|
"id": "100",
|
||||||
"name": "یزد"
|
"name": "یزد"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+60
-8
@@ -104,14 +104,6 @@ export const alert = (type, text, prop) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addLabelToList = (list) =>
|
|
||||||
list.map((item) => {
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
label: item.name,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
export const formatPhoneNumber = (input) => {
|
export const formatPhoneNumber = (input) => {
|
||||||
if (typeof input !== "string") input = String(input);
|
if (typeof input !== "string") input = String(input);
|
||||||
|
|
||||||
@@ -363,6 +355,36 @@ export const QueryForDoctorsReq = (newFilter) => {
|
|||||||
return params;
|
return params;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const QueryForClinicsFilter = (searchParams) => {
|
||||||
|
const params = {};
|
||||||
|
|
||||||
|
// 🔹 specialty (find by name in specialties.json)
|
||||||
|
if (searchParams.specialty) {
|
||||||
|
const spec = specialties.find((s) => s.name === searchParams.specialty);
|
||||||
|
if (spec) {
|
||||||
|
params.specialty = spec.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 city (find by name in city.json)
|
||||||
|
if (searchParams.city) {
|
||||||
|
const cityObj = cities.find((c) => c.name === searchParams.city.name);
|
||||||
|
if (cityObj) {
|
||||||
|
params.city = cityObj.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 state (find by name in state.json)
|
||||||
|
if (searchParams.province) {
|
||||||
|
const stateObj = states.find((s) => s.name === searchParams.province.name);
|
||||||
|
if (stateObj) {
|
||||||
|
params.state = stateObj.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return params;
|
||||||
|
};
|
||||||
|
|
||||||
export const buildDoctorParams = (searchParams) => {
|
export const buildDoctorParams = (searchParams) => {
|
||||||
const params = {};
|
const params = {};
|
||||||
|
|
||||||
@@ -436,6 +458,36 @@ export const buildDoctorParams = (searchParams) => {
|
|||||||
return params;
|
return params;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const buildClinicParams = (searchParams) => {
|
||||||
|
const params = {};
|
||||||
|
|
||||||
|
// 🔹 city (find by name in city.json)
|
||||||
|
if (searchParams.city) {
|
||||||
|
const cityObj = cities.find((c) => c.name === searchParams.city);
|
||||||
|
if (cityObj) {
|
||||||
|
params.city = cityObj.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 state (find by name in state.json)
|
||||||
|
if (searchParams.state) {
|
||||||
|
const stateObj = states.find((s) => s.name === searchParams.state);
|
||||||
|
if (stateObj) {
|
||||||
|
params.state = stateObj.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 specialty (find by name in specialties.json)
|
||||||
|
if (searchParams.specialty) {
|
||||||
|
const spec = specialties.find((s) => s.name === searchParams.specialty);
|
||||||
|
if (spec) {
|
||||||
|
params.specialty = spec.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return params;
|
||||||
|
};
|
||||||
|
|
||||||
export function timeAgo(timestamp) {
|
export function timeAgo(timestamp) {
|
||||||
const now = moment();
|
const now = moment();
|
||||||
const then = moment.unix(timestamp);
|
const then = moment.unix(timestamp);
|
||||||
|
|||||||
@@ -86,4 +86,11 @@ export const request = {
|
|||||||
postDoctorComment: (data) => api.post("api/v1/clinicpro/comment", data),
|
postDoctorComment: (data) => api.post("api/v1/clinicpro/comment", data),
|
||||||
postDoctorRate: (data) => api.post("api/v1/clinicpro/rate", data),
|
postDoctorRate: (data) => api.post("api/v1/clinicpro/rate", data),
|
||||||
postCommentsLike: (data) => api.post("/api/v1/clinicpro/like", data),
|
postCommentsLike: (data) => api.post("/api/v1/clinicpro/like", data),
|
||||||
|
getClinicList: (params) =>
|
||||||
|
api.get("/api/v1/clinics", {
|
||||||
|
params,
|
||||||
|
headers: {
|
||||||
|
Authorization: "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user