add auto-selecotr to home page and handle set in data, search in specialties and send req for filter && add locations and change text
This commit is contained in:
@@ -83,7 +83,9 @@ function ItemDoctor({ doctor }) {
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{Number(doctor?.active)
|
{Number(doctor?.active)
|
||||||
? `اولین نوبت آزاد: ${moment(doctor?.free_turn * 1000)?.format("dddd jD jMMMM")}`
|
? `اولین نوبت آزاد: ${moment(doctor?.free_turn * 1000).format(
|
||||||
|
"dddd jD jMMMM [ساعت] HH:mm"
|
||||||
|
)}`
|
||||||
: "نوبت ندارد"}
|
: "نوبت ندارد"}
|
||||||
</p>
|
</p>
|
||||||
</CustomLoading>
|
</CustomLoading>
|
||||||
|
|||||||
+2
-1
@@ -11,7 +11,8 @@ async function Doctors({ searchParams }) {
|
|||||||
let doctors = null;
|
let doctors = null;
|
||||||
try {
|
try {
|
||||||
let newSearchParams = searchParams;
|
let newSearchParams = searchParams;
|
||||||
if (matchedCity) newSearchParams.city = matchedCity.name;
|
if (matchedCity && matchedCity.id !== "63")
|
||||||
|
newSearchParams.city = matchedCity.name;
|
||||||
if (matchedState) newSearchParams.state = matchedState.name;
|
if (matchedState) newSearchParams.state = matchedState.name;
|
||||||
const params = buildDoctorParams(searchParams);
|
const params = buildDoctorParams(searchParams);
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ function Title({ doctor }) {
|
|||||||
<TextLoading width={100} height={20}>
|
<TextLoading width={100} height={20}>
|
||||||
<h3 className="text-[#525252] text-[14px] md:text-[16px] font-medium">
|
<h3 className="text-[#525252] text-[14px] md:text-[16px] font-medium">
|
||||||
تخصص:
|
تخصص:
|
||||||
{doctor?.expertise?.map(
|
{doctor?.specialties?.map(
|
||||||
(item, idx) =>
|
(item, idx) =>
|
||||||
`${item.name} ${doctor.expertise.length === idx + 1 ? "" : "|"} `
|
`${item.name} ${doctor.specialties.length === idx + 1 ? "" : "|"} `
|
||||||
)}
|
)}
|
||||||
</h3>
|
</h3>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ function AboutDcotor({ doctor }) {
|
|||||||
تخصص ها
|
تخصص ها
|
||||||
</p>
|
</p>
|
||||||
<ul className="flex flex-col mt-[12px] sm:flex-row gap-y-[16px] items-start sm:items-center justify-start gap-4">
|
<ul className="flex flex-col mt-[12px] sm:flex-row gap-y-[16px] items-start sm:items-center justify-start gap-4">
|
||||||
{doctor?.specialties?.map((item, idx) => (
|
{doctor?.expertise?.map((item, idx) => (
|
||||||
<li key={idx} className="flex items-center justify-start gap-1">
|
<li key={idx} className="flex items-center justify-start gap-1">
|
||||||
<span className="w-2 h-2 bg-[#F17732] rounded-full"></span>
|
<span className="w-2 h-2 bg-[#F17732] rounded-full"></span>
|
||||||
<TextLoading width={70} height={18}>
|
<TextLoading width={70} height={18}>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import ModalOpenLocation from "@/app/component/openLocation";
|
|||||||
import RoutingWhiteC from "@/components/icons/RoutingWhiteC";
|
import RoutingWhiteC from "@/components/icons/RoutingWhiteC";
|
||||||
import RoutingC from "@/components/icons/RoutingC";
|
import RoutingC from "@/components/icons/RoutingC";
|
||||||
|
|
||||||
function Item({ data }) {
|
function Item({ doctor, data }) {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
@@ -25,7 +25,7 @@ function Item({ data }) {
|
|||||||
onClick={() => setIsOpen(!isOpen)}
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
className="!px-[2px] !py-[4px] !flex !items-center !justify-between !w-full"
|
className="!px-[2px] !py-[4px] !flex !items-center !justify-between !w-full"
|
||||||
>
|
>
|
||||||
<p className="text-[#616161] text-[16px] font-medium">{data.title}</p>
|
<p className="text-[#616161] text-[16px] font-medium">{data.name}</p>
|
||||||
<div
|
<div
|
||||||
className={`
|
className={`
|
||||||
transition-all duration-500
|
transition-all duration-500
|
||||||
@@ -46,11 +46,11 @@ function Item({ data }) {
|
|||||||
آدرس: {data.address}
|
آدرس: {data.address}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-[#525252] text-[16px] font-normal">
|
<p className="text-[#525252] text-[16px] font-normal">
|
||||||
تلفن: {data.phone}
|
تلفن: {data.telephone}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex w-full items-center justify-between">
|
<div className="flex w-full items-center justify-between">
|
||||||
<p className="text-[#525252] text-[16px] font-normal">
|
<p className="text-[#525252] text-[16px] font-normal">
|
||||||
روزهای کاری: {data.working_days}
|
روزهای کاری: {doctor.hours_of_work}
|
||||||
</p>
|
</p>
|
||||||
<ModalOpenLocation
|
<ModalOpenLocation
|
||||||
open={open}
|
open={open}
|
||||||
@@ -70,14 +70,13 @@ function Item({ data }) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="w-full relative h-[219px] sm:h-[302px] md:h-[385px] lg:h-[470px] mt-[24px]">
|
<div className="w-full relative h-[219px] sm:h-[302px] md:h-[385px] lg:h-[470px] mt-[24px]">
|
||||||
<iframe
|
<iframe
|
||||||
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d99748.77423686371!2d2.264635095144491!3d48.85882549249809!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47e66e1f06e2b70f%3A0x40b82c3688c9460!2sParis%2C%20France!5e1!3m2!1sen!2snl!4v1724802057795!5m2!1sen!2snl"
|
src={`https://maps.google.com/maps?q=${data.map.latitude},${data.map.longitude}&z=14&output=embed`}
|
||||||
className="
|
className="w-full rounded-lg mt-4 h-full"
|
||||||
w-full rounded-lg mt-4 h-full
|
|
||||||
"
|
|
||||||
referrerPolicy="no-referrer-when-downgrade"
|
referrerPolicy="no-referrer-when-downgrade"
|
||||||
allowFullScreen=""
|
allowFullScreen=""
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
></iframe>
|
></iframe>
|
||||||
|
|
||||||
<ModalOpenLocation
|
<ModalOpenLocation
|
||||||
open={open}
|
open={open}
|
||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ function Locations({ doctor }) {
|
|||||||
موقعیت مکانی{" "}
|
موقعیت مکانی{" "}
|
||||||
</p>
|
</p>
|
||||||
<ul className="flex w-full mt-[24px] flex-col justify-center items-start">
|
<ul className="flex w-full mt-[24px] flex-col justify-center items-start">
|
||||||
{doctor?.locations?.map((item, idx) => (
|
{doctor?.address?.map((item, idx) => (
|
||||||
<CustomLoading key={idx} width="full" height={40}>
|
<CustomLoading key={idx} width="full" height={40}>
|
||||||
<li className="w-full">
|
<li className="w-full">
|
||||||
<Item data={item} />
|
<Item doctor={doctor} data={item} />
|
||||||
{doctor?.locations.length > idx + 1 && (
|
{doctor?.address.length > idx + 1 && (
|
||||||
<span className="w-full h-px bg-[#EFEFEF] block my-[12px] md:my-[14px] lg:my-[16px]"></span>
|
<span className="w-full h-px bg-[#EFEFEF] block my-[12px] md:my-[14px] lg:my-[16px]"></span>
|
||||||
)}
|
)}
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ function DoctorPage({ doctor, doctors, comments }) {
|
|||||||
<CustomLoading width={180} height={25}>
|
<CustomLoading width={180} height={25}>
|
||||||
<div className="flex items-center justify-start text-[14px] md:text-[16px] font-normal">
|
<div className="flex items-center justify-start text-[14px] md:text-[16px] font-normal">
|
||||||
<h2 className="text-[#9B9B9B] text-nowrap">
|
<h2 className="text-[#9B9B9B] text-nowrap">
|
||||||
{doctor?.expertise?.map(
|
{doctor?.specialties?.map(
|
||||||
(item, idx) =>
|
(item, idx) =>
|
||||||
`${item.name} ${doctor.expertise.length === idx + 1 ? ">" : "|"} `
|
`${item.name} ${doctor.specialties.length === idx + 1 ? ">" : "|"} `
|
||||||
)}
|
)}
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-[#525252] text-nowrap mr-1">{doctor?.name}</p>
|
<p className="text-[#525252] text-nowrap mr-1">{doctor?.name}</p>
|
||||||
|
|||||||
@@ -1,33 +1,16 @@
|
|||||||
import { TextField } from "@mui/material";
|
import AutoCompleteSearch from "@/components/searchHead/smSearch/AutoCompleteSearch";
|
||||||
import React from "react";
|
import specialties from "@/data/specialties.json";
|
||||||
|
|
||||||
function SearchField({ filter, updateData }) {
|
function SearchField({ filter, updateData }) {
|
||||||
return (
|
return (
|
||||||
<TextField
|
<div className="!min-w-[50%] !w-[524px]">
|
||||||
variant="standard"
|
<AutoCompleteSearch
|
||||||
value={filter.name}
|
data={specialties}
|
||||||
onChange={(e) => updateData("name", e.target.value)}
|
inputValue={filter.name}
|
||||||
InputProps={{
|
handleSearch={(e) => updateData("name", e)}
|
||||||
disableUnderline: true,
|
placeholder="جستجوی نام پزشک، تخصص، بیماری ..."
|
||||||
}}
|
/>
|
||||||
sx={{
|
</div>
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
justifyContent: "center",
|
|
||||||
width: "100% !important",
|
|
||||||
"& .MuiInput-root": {
|
|
||||||
padding: "0",
|
|
||||||
borderBottom: "none",
|
|
||||||
},
|
|
||||||
"& .MuiInputBase-input": {
|
|
||||||
color: "#6C757D",
|
|
||||||
padding: "0px",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
dir="rtl"
|
|
||||||
placeholder="جستجوی نام پزشک، تخصص، بیماری ..."
|
|
||||||
className={`!shadow-none !px-5 !h-full !w-[524px] bg-[#FAFAFA] !text-[14px] md:!text-[16px] !min-w-[50%] !rounded-0 !font-normal !text-[#6C757D]`}
|
|
||||||
/>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,43 @@
|
|||||||
import { Button } from "@mui/material";
|
import { Button } from "@mui/material";
|
||||||
import SearchD from "@/components/icons/SearchD";
|
import SearchD from "@/components/icons/SearchD";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import specialties from "@/data/specialties.json";
|
||||||
|
|
||||||
function SendReq({ sendReq }) {
|
function SendReq({ filter, setFilter, setDataInURL, sendReq }) {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
const checkName = () => {
|
||||||
|
let newFilter = filter;
|
||||||
|
let reqData = filter;
|
||||||
|
const specialtyItem = specialties.find((item) =>
|
||||||
|
item.name.includes(filter.name)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (specialtyItem) {
|
||||||
|
if (specialtyItem.parent) {
|
||||||
|
newFilter.specialty = specialtyItem;
|
||||||
|
newFilter.category = specialties.find(
|
||||||
|
(item) => item.id === specialtyItem.parent
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
newFilter.specialty = specialtyItem;
|
||||||
|
}
|
||||||
|
reqData = newFilter;
|
||||||
|
reqData.name = "";
|
||||||
|
} else {
|
||||||
|
reqData = newFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
setFilter(newFilter);
|
||||||
|
setDataInURL(newFilter);
|
||||||
|
|
||||||
|
return reqData;
|
||||||
|
};
|
||||||
|
|
||||||
const filterData = () => {
|
const filterData = () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
const reqData = checkName();
|
||||||
|
|
||||||
sendReq().finally(() => {
|
sendReq(reqData).finally(() => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,13 +5,7 @@ import FilterModal from "../modal/FilterModal";
|
|||||||
import SendReq from "./SendReq";
|
import SendReq from "./SendReq";
|
||||||
import SearchField from "./SearchField";
|
import SearchField from "./SearchField";
|
||||||
|
|
||||||
function SearchBar({
|
function SearchBar({ filter, sendReq, setFilter, updateData, setDataInURL }) {
|
||||||
filter,
|
|
||||||
sendReq,
|
|
||||||
setFilter,
|
|
||||||
updateData,
|
|
||||||
setDataInURL,
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup
|
<ButtonGroup
|
||||||
variant="contained"
|
variant="contained"
|
||||||
@@ -43,7 +37,12 @@ function SearchBar({
|
|||||||
</Button>
|
</Button>
|
||||||
</FilterModal>
|
</FilterModal>
|
||||||
<SearchField filter={filter} updateData={updateData} />
|
<SearchField filter={filter} updateData={updateData} />
|
||||||
<SendReq sendReq={sendReq} />
|
<SendReq
|
||||||
|
filter={filter}
|
||||||
|
sendReq={sendReq}
|
||||||
|
setFilter={setFilter}
|
||||||
|
setDataInURL={setDataInURL}
|
||||||
|
/>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,18 @@
|
|||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
import FilterText from "./FilterText";
|
|
||||||
import RedirectLink from "./RedirectLink";
|
import RedirectLink from "./RedirectLink";
|
||||||
import ModalSearchCity from "./modal";
|
import ModalSearchCity from "./modal";
|
||||||
import ButtonFilter from "./modal/ButtonFilter";
|
import ButtonFilter from "./modal/ButtonFilter";
|
||||||
|
import specialtiesData from "@/data/specialties.json";
|
||||||
|
import AutoCompleteSearch from "@/components/searchHead/smSearch/AutoCompleteSearch";
|
||||||
|
|
||||||
function Fields({ city, state }) {
|
function Fields({ city, state }) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
province: state?.name || "",
|
province: state?.name || "",
|
||||||
city: city?.name || "",
|
city: city?.name || "",
|
||||||
|
search: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -26,7 +28,14 @@ function Fields({ city, state }) {
|
|||||||
<ButtonFilter setOpen={setOpen} selected={data} />
|
<ButtonFilter setOpen={setOpen} selected={data} />
|
||||||
</ModalSearchCity>
|
</ModalSearchCity>
|
||||||
<span className="black w-px bg-[#EFEFEF]"></span>
|
<span className="black w-px bg-[#EFEFEF]"></span>
|
||||||
<FilterText data={data} setData={setData} />
|
<div className=" !w-full lg:!w-[524px]">
|
||||||
|
<AutoCompleteSearch
|
||||||
|
data={specialtiesData}
|
||||||
|
inputValue={data.search}
|
||||||
|
handleSearch={(e) => setData({ data, search: e })}
|
||||||
|
placeholder="جستجوی نام پزشک، تخصص، بیماری ..."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<RedirectLink data={data} />
|
<RedirectLink data={data} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -20,9 +20,15 @@ function AutoCompleteSearch({
|
|||||||
handleSearch(newInputValue);
|
handleSearch(newInputValue);
|
||||||
}}
|
}}
|
||||||
onChange={(event, newValue) => {
|
onChange={(event, newValue) => {
|
||||||
setSelectedOption(newValue);
|
setSelectedOption && setSelectedOption(newValue);
|
||||||
handleSearch(newValue ? newValue.name : "");
|
handleSearch(newValue ? newValue.name : "");
|
||||||
}}
|
}}
|
||||||
|
renderOption={(props, option) => (
|
||||||
|
<li {...props} key={option.id}>
|
||||||
|
{" "}
|
||||||
|
{option.name}
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
sx={{
|
sx={{
|
||||||
"& .MuiAutocomplete-input": {
|
"& .MuiAutocomplete-input": {
|
||||||
background: "#ffffff !important",
|
background: "#ffffff !important",
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import AutoCompleteSearch from "./AutoCompleteSearch";
|
|||||||
|
|
||||||
function SmSearch({ placeholder, handleSearch, data }) {
|
function SmSearch({ placeholder, handleSearch, data }) {
|
||||||
const [inputValue, setInputValue] = useState("");
|
const [inputValue, setInputValue] = useState("");
|
||||||
const [selectedOption, setSelectedOption] = useState(null);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup
|
<ButtonGroup
|
||||||
@@ -20,7 +19,6 @@ function SmSearch({ placeholder, handleSearch, data }) {
|
|||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
handleSearch={handleSearch}
|
handleSearch={handleSearch}
|
||||||
setInputValue={setInputValue}
|
setInputValue={setInputValue}
|
||||||
setSelectedOption={setSelectedOption}
|
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => handleSearch(inputValue)}
|
onClick={() => handleSearch(inputValue)}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function SpecialtiesPage() {
|
|||||||
setFilteredSpecialties(searchOnList(specialtiesData, value, "name"));
|
setFilteredSpecialties(searchOnList(specialtiesData, value, "name"));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="">
|
<>
|
||||||
<HeadPageList
|
<HeadPageList
|
||||||
title="تخصص مورد نظر شما چیست؟"
|
title="تخصص مورد نظر شما چیست؟"
|
||||||
detail="تخصص مورد نظرتان را جستجو کرده و یا از لیست زیر انتخاب نمایید:"
|
detail="تخصص مورد نظرتان را جستجو کرده و یا از لیست زیر انتخاب نمایید:"
|
||||||
@@ -27,7 +27,7 @@ function SpecialtiesPage() {
|
|||||||
/>
|
/>
|
||||||
</HeadPageList>
|
</HeadPageList>
|
||||||
<List specialties={filteredSpecialties} />
|
<List specialties={filteredSpecialties} />
|
||||||
</div>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user