diff --git a/app/component/ItemDoctor.js b/app/component/ItemDoctor.js
index 129aaac..8b0bae5 100644
--- a/app/component/ItemDoctor.js
+++ b/app/component/ItemDoctor.js
@@ -13,13 +13,13 @@ import PointD from "@/components/icons/PointD";
function ItemDoctor({ doctor, loading, setDoctors }) {
const handleLoading = () => {
- setDoctors((prevDoctors) =>
- prevDoctors.map((item) =>
- item.id === doctor.id
- ? { ...item, loading: true }
- : { ...item, loading: false }
- )
- );
+ // setDoctors((prevDoctors) =>
+ // prevDoctors.map((item) =>
+ // item.id === doctor.id
+ // ? { ...item, loading: true }
+ // : { ...item, loading: false }
+ // )
+ // );
};
return (
diff --git a/app/component/comment/index.js b/app/component/comment/index.js
index eed81f7..373e4ba 100644
--- a/app/component/comment/index.js
+++ b/app/component/comment/index.js
@@ -2,8 +2,7 @@
import { useState } from "react";
import ItemUser from "./ItemUser";
-function Comment({ data, comments }) {
- const [list, setList] = useState(data?.comments);
+function Comment({ comments }) {
const [update, setUpdate] = useState(false);
return (
diff --git a/app/component/fields/Field.js b/app/component/fields/Field.js
index 5a3e0f2..dbbd4d4 100644
--- a/app/component/fields/Field.js
+++ b/app/component/fields/Field.js
@@ -3,6 +3,7 @@ import { TextField } from "@mui/material";
function Field({
type,
name,
+ error,
title,
props,
value,
@@ -31,7 +32,9 @@ function Field({
"& .MuiInputBase-input": { padding: "12.5px 14px" },
"& .MuiInputBase-root": { borderRadius: "6px !important" },
"& .MuiOutlinedInput-notchedOutline": {
- border: "1px solid #E9ECEF !important",
+ border: error
+ ? "1px solid red !important"
+ : "1px solid #E9ECEF !important",
},
".Mui-focused": {
"& .MuiOutlinedInput-notchedOutline": {
diff --git a/app/component/openLocation/Content.js b/app/component/openLocation/Content.js
index 67494ac..7e3ad6b 100644
--- a/app/component/openLocation/Content.js
+++ b/app/component/openLocation/Content.js
@@ -2,33 +2,35 @@ import CloseModalD from "@/components/icons/CloseModalD";
import Image from "next/image";
function Content({ data, onClose }) {
+ console.log(data);
+
const { latitude, longitude } = data && data.map;
const maps = [
{
src: "/assets/images/snapp.png",
name: "snapp",
- url: `https://snapp.ir/route?lat=${latitude}&lng=${longitude}`,
+ url: `https://snapp.ir/route?lat=${"latitude"}&lng=${"longitude"}`,
},
{
src: "/assets/images/tapsi.png",
name: "tapsi",
- url: `https://tapsi.ir/route?lat=${latitude}&lng=${longitude}`,
+ url: `https://tapsi.ir/route?lat=${"latitude"}&lng=${"longitude"}`,
},
{
src: "/assets/images/maps.png",
name: "maps",
- url: `https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}`,
+ url: `https://www.google.com/maps/dir/?api=1&destination=${"latitude"},${"longitude"}`,
},
{
src: "/assets/images/balad.png",
name: "balad",
- url: `https://balad.ir/map?lat=${latitude}&lng=${longitude}`,
+ url: `https://balad.ir/map?lat=${"latitude"}&lng=${"longitude"}`,
},
{
src: "/assets/images/waze.png",
name: "waze",
- url: `https://waze.com/ul?ll=${latitude},${longitude}&navigate=yes`,
+ url: `https://waze.com/ul?ll=${"latitude"},${"longitude"}&navigate=yes`,
},
];
@@ -61,7 +63,7 @@ function Content({ data, onClose }) {
height={40}
width={40}
/>
-
+
{item.name}
diff --git a/app/component/openLocation/index.js b/app/component/openLocation/index.js
index 90fe8c8..0f7b122 100644
--- a/app/component/openLocation/index.js
+++ b/app/component/openLocation/index.js
@@ -5,6 +5,8 @@ import { styleDefault } from "@/mui";
import Content from "./Content";
function ModalOpenLocation({ open, data, setOpen, handleClose, children }) {
+ console.log(data);
+
const toggleDrawer = (newOpen) => () => {
setOpen(newOpen);
};
diff --git a/components/clinic/components/about/ListBime.js b/components/clinic/components/about/ListBime.js
index fee3cf1..d66442d 100644
--- a/components/clinic/components/about/ListBime.js
+++ b/components/clinic/components/about/ListBime.js
@@ -1,55 +1,95 @@
+"use client";
import CustomLoading from "@/app/component/loading/Custom";
import ArrowLeftList from "@/components/icons/ArrowLeftList";
import { Button } from "@mui/material";
import Image from "next/image";
-import { useRef } from "react";
+import { useRef, useEffect, useState } from "react";
function ListBime({ data }) {
const list = useRef();
+ const [showArrows, setShowArrows] = useState(false);
+ const [itemWidth, setItemWidth] = useState(156);
+
+ useEffect(() => {
+ if (data?.list_bime?.length > 4) {
+ setShowArrows(true);
+ } else {
+ setShowArrows(false);
+ }
+ }, [data]);
+
+ useEffect(() => {
+ const handleResize = () => {
+ if (window.innerWidth < 640) {
+ setItemWidth(window.innerWidth / 2.5);
+ } else if (window.innerWidth < 1024) {
+ setItemWidth(window.innerWidth / 3.5);
+ } else {
+ setItemWidth(156);
+ }
+ };
+
+ handleResize();
+ window.addEventListener("resize", handleResize);
+ return () => window.removeEventListener("resize", handleResize);
+ }, []);
const handleScroll = (type) => {
+ if (!list.current) return;
list.current.scrollBy({
- left: type === "left" ? -200 : 200,
+ left: type === "left" ? -itemWidth : itemWidth,
behavior: "smooth",
});
};
return (
-
-
+
+ {showArrows && (
+
+ )}
+
{data?.list_bime?.map((item, idx) => (
-
- -
+
+
-
-
+
{item.name}
))}
+
+
+ {showArrows && (
-
+ )}
);
}
diff --git a/components/clinic/components/contact/Detail.js b/components/clinic/components/contact/Detail.js
index 655d841..48cc887 100644
--- a/components/clinic/components/contact/Detail.js
+++ b/components/clinic/components/contact/Detail.js
@@ -7,10 +7,7 @@ function Detail({ data }) {
head="روزهای کاری: "
detail={`ساعت کاری: ${data.hours_of_work}`}
/>
-
+
diff --git a/components/clinic/components/contact/index.js b/components/clinic/components/contact/index.js
index 171288c..74e253f 100644
--- a/components/clinic/components/contact/index.js
+++ b/components/clinic/components/contact/index.js
@@ -15,14 +15,15 @@ function Contact({ data }) {
return (
{
+ const query = QueryForDoctorsFilter(newFilter);
+
+ const searchParams = new URLSearchParams(query).toString();
+ router.push(`?${searchParams}`);
+ };
+
+ const findItem = (key, name) =>
+ specialties.find((item) => item[key] === name);
+ const isParent =
+ findItem("name", fieldName) && findItem("name", fieldName).parent;
+
+ const valCategory = isParent
+ ? findItem("id", isParent)
+ : findItem("name", fieldName);
+ const valSpecialty = isParent && findItem("name", fieldName);
+
+ const defaultFilter = {
+ category: valCategory,
+ specialty: valSpecialty,
+ active: searchParams.get("active") || 0,
+ gender: searchParams.get("gender") || "هر دو",
+ degree: searchParams.get("degree") || "همه موارد",
+ sort: (searchParams.get("sort") && Number(searchParams.get("sort"))) || "",
+ name:
+ searchParams.get("name") || valSpecialty?.name || valCategory?.name || "",
+ };
+ const [filter, setFilter] = useState(defaultFilter);
+
+ const updateData = (name, value, isReq) => {
+ const newFilter = { ...filter, [name]: value };
+ setDataInURL(newFilter);
+ setFilter(newFilter);
+ isReq && sendReq(newFilter);
+ };
+
+ const sendReq = (newFilter) => {
+ // const data = newFilter || filter;
+ // const params = QueryForDoctorsReq(data);
+ // let filteredName = params;
+ // if (
+ // data?.name === data.specialty?.name ||
+ // data?.name === data.category?.name
+ // ) {
+ // filteredName.name = "";
+ // delete filteredName.name;
+ // }
+ // filteredName.page = 1;
+ // filteredName.limit = 12;
+ // setPage(1);
+ // return request
+ // .getDoctors(filteredName)
+ // .then((res) => {
+ // setDoctors(res.data);
+ // return res;
+ // })
+ // .catch((err) => {
+ // throw err;
+ // });
+ };
+
+ return (
+
+
+
+
+ );
+}
+
+export default Head;
diff --git a/components/clinic/components/doctors/head/modal/ButtonApply.js b/components/clinic/components/doctors/head/modal/ButtonApply.js
new file mode 100644
index 0000000..6c0ee12
--- /dev/null
+++ b/components/clinic/components/doctors/head/modal/ButtonApply.js
@@ -0,0 +1,33 @@
+import { Button } from "@mui/material";
+import { useState } from "react";
+
+function ButtonApply({ sendReq, setOpen }) {
+ const [loading, setLoading] = useState(false);
+
+ const handleClick = () => {
+ setLoading(false);
+ setOpen(false);
+
+ // setLoading(true);
+
+ // sendReq().finally(() => {
+ // setOpen(false);
+ // setLoading(false);
+ // });
+ };
+
+ return (
+
+
+
+ );
+}
+
+export default ButtonApply;
diff --git a/components/clinic/components/doctors/head/modal/Content.js b/components/clinic/components/doctors/head/modal/Content.js
new file mode 100644
index 0000000..6e5cea8
--- /dev/null
+++ b/components/clinic/components/doctors/head/modal/Content.js
@@ -0,0 +1,34 @@
+import specialties from "@/data/specialties.json";
+import Form from "./form";
+
+function Content({ filter, setFilter, updateData, setDataInURL }) {
+ const changeSpecialty = (name, value) => {
+ const newFilter = { ...filter, [name]: value };
+
+ if (name === "category") {
+ const childrenList = specialties.filter((item) => item.parent);
+ const filteredChildrenList = childrenList.filter(
+ (item) => item.parent === value.id
+ );
+ const firstChildren = filteredChildrenList[0];
+
+ newFilter.specialty = firstChildren || "";
+ }
+
+ setFilter(newFilter);
+ setDataInURL(newFilter);
+ return newFilter;
+ };
+
+ return (
+
+
+
+ );
+}
+
+export default Content;
diff --git a/components/clinic/components/doctors/head/modal/DeleteAllButton.js b/components/clinic/components/doctors/head/modal/DeleteAllButton.js
new file mode 100644
index 0000000..25cfffb
--- /dev/null
+++ b/components/clinic/components/doctors/head/modal/DeleteAllButton.js
@@ -0,0 +1,58 @@
+import CloseOrangeModal from "@/components/icons/CloseOrangeModal";
+import { Button, CircularProgress } from "@mui/material";
+import { useRouter } from "next/navigation";
+import { clearFilterParams } from "@/helper";
+import { useState } from "react";
+
+function DeleteAllButton({ filter, sendReq, setFilter, handleClose }) {
+ const [loading, setLoading] = useState(false);
+ const router = useRouter();
+
+ const resetFilter = () => {
+ setLoading(true);
+ clearFilterParams(router, [
+ "category",
+ "specialty",
+ "active",
+ "gender",
+ "degree",
+ ]);
+
+ const newFilter = {
+ ...filter,
+ ...{
+ category: undefined,
+ specialty: undefined,
+ active: 0,
+ gender: "هر دو",
+ degree: "همه موارد",
+ },
+ };
+ sendReq(newFilter).finally(() => {
+ setLoading(false);
+ handleClose();
+ setFilter(newFilter);
+ });
+ };
+
+ return (
+
+
فیلترها
+
+
+ );
+}
+
+export default DeleteAllButton;
diff --git a/components/clinic/components/doctors/head/modal/FilterModal.js b/components/clinic/components/doctors/head/modal/FilterModal.js
new file mode 100644
index 0000000..49f4e2a
--- /dev/null
+++ b/components/clinic/components/doctors/head/modal/FilterModal.js
@@ -0,0 +1,58 @@
+"use client";
+
+import { styleDefault } from "@/mui";
+import { Modal } from "@mui/material";
+import { useState } from "react";
+import Content from "./Content";
+import ButtonApply from "./ButtonApply";
+import DeleteAllButton from "./DeleteAllButton";
+
+function FilterModal({
+ filter,
+ sendReq,
+ children,
+ setFilter,
+ updateData,
+ setDataInURL,
+}) {
+ const [open, setOpen] = useState(false);
+
+ const handleOpen = () => setOpen(true);
+ const handleClose = () => {
+ setOpen(false);
+ };
+
+ return (
+ <>
+ {/* Button Modal */}
+ {children}
+
+ {/* Content Modal */}
+
+
+
+ >
+ );
+}
+
+export default FilterModal;
diff --git a/components/clinic/components/doctors/head/modal/form/CateSelector.js b/components/clinic/components/doctors/head/modal/form/CateSelector.js
new file mode 100644
index 0000000..7c15743
--- /dev/null
+++ b/components/clinic/components/doctors/head/modal/form/CateSelector.js
@@ -0,0 +1,82 @@
+import BottomSelect from "@/components/icons/BottomSelect";
+import { Autocomplete, Button, TextField } from "@mui/material";
+import { styleTextSelectRight } from "@/mui";
+
+function CateSelector({ name, list, value, isError, updateData, label }) {
+ return (
+ option?.name}
+ className="!w-full !rounded-lg auto-complete-selector"
+ onChange={(_, newValue) => updateData(name, newValue)}
+ 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) => (
+
+ )}
+ renderInput={(params) => (
+
+
+
+ ),
+ }}
+ placeholder={label}
+ sx={{
+ borderRadius: "8px",
+ }}
+ />
+ )}
+ />
+ );
+}
+
+export default CateSelector;
diff --git a/components/clinic/components/doctors/head/modal/form/RadioContent.js b/components/clinic/components/doctors/head/modal/form/RadioContent.js
new file mode 100644
index 0000000..09069af
--- /dev/null
+++ b/components/clinic/components/doctors/head/modal/form/RadioContent.js
@@ -0,0 +1,19 @@
+import Radios from "./Radios";
+
+function RadioContent({ group, text, value, updateData, name }) {
+ return (
+
+ );
+}
+
+export default RadioContent;
diff --git a/components/clinic/components/doctors/head/modal/form/Radios.js b/components/clinic/components/doctors/head/modal/form/Radios.js
new file mode 100644
index 0000000..dde5bfa
--- /dev/null
+++ b/components/clinic/components/doctors/head/modal/form/Radios.js
@@ -0,0 +1,29 @@
+import { FormControlLabel, Radio, RadioGroup } from "@mui/material";
+
+function Radios({ group, value, updateData, name }) {
+ return (
+
updateData(name, e.target.value)}
+ sx={{
+ "& .MuiFormControlLabel-root": {
+ marginRight: "0 !important",
+ transform: "translateX(9px)",
+ },
+ }}
+ >
+ {group.map((item, idx) => (
+ }
+ className="!text-[#525252]"
+ label={item}
+ value={item}
+ key={idx}
+ />
+ ))}
+
+ );
+}
+
+export default Radios;
diff --git a/components/clinic/components/doctors/head/modal/form/SwitchContent.js b/components/clinic/components/doctors/head/modal/form/SwitchContent.js
new file mode 100644
index 0000000..f5b1323
--- /dev/null
+++ b/components/clinic/components/doctors/head/modal/form/SwitchContent.js
@@ -0,0 +1,30 @@
+import { FormControlLabel, Switch } from "@mui/material";
+
+function SwitchContent({ filter, updateData }) {
+ return (
+
+
+ updateData("active", event.target.checked ? 1 : 0)
+ }
+ />
+ }
+ sx={{
+ ".MuiFormControlLabel-label": {
+ color: "#3B3B3B",
+ fontSize: "16px",
+ fontWeight: 500,
+ },
+ marginLeft: "0 !important",
+ }}
+ label="فقط پزشکان دارای نوبت"
+ labelPlacement="start"
+ />
+
+ );
+}
+
+export default SwitchContent;
diff --git a/components/clinic/components/doctors/head/modal/form/index.js b/components/clinic/components/doctors/head/modal/form/index.js
new file mode 100644
index 0000000..1642968
--- /dev/null
+++ b/components/clinic/components/doctors/head/modal/form/index.js
@@ -0,0 +1,55 @@
+import SwitchContent from "./SwitchContent";
+import RadioContent from "./RadioContent";
+import { filterList } from "@/helper";
+import CateSelector from "./CateSelector";
+
+const gender = ["زن", "مرد", "هر دو"];
+const degree = ["پزشک عمومی", "پزشک متخصص", "پزشک فوق تخصص", "همه موارد"];
+
+function Form({ filter, changeSpecialty, updateData }) {
+ const { parentList, childrenList } = filterList(filter);
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+}
+
+export default Form;
diff --git a/components/clinic/components/doctors/head/search/AutoComplete.js b/components/clinic/components/doctors/head/search/AutoComplete.js
new file mode 100644
index 0000000..83c5eac
--- /dev/null
+++ b/components/clinic/components/doctors/head/search/AutoComplete.js
@@ -0,0 +1,106 @@
+import { Autocomplete, TextField } from "@mui/material";
+import { useRef, useState, useEffect } from "react";
+
+function AutoComplete({
+ data,
+ noneBg,
+ clearText,
+ 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 (
+
+ typeof option === "string" ? option : option.name
+ }
+ disableClearable
+ inputValue={localInput}
+ className="!w-full"
+ onInputChange={onInputChange}
+ onChange={onChange}
+ renderOption={(props, option) => (
+
+ {option.name}
+
+ )}
+ sx={{
+ "& .MuiAutocomplete-input": {
+ background: noneBg ? "" : "#ffffff !important",
+ },
+ }}
+ renderInput={(params) => (
+
+ )}
+ />
+ );
+}
+
+export default AutoComplete;
diff --git a/components/clinic/components/doctors/head/search/SearchField.js b/components/clinic/components/doctors/head/search/SearchField.js
new file mode 100644
index 0000000..65a90bd
--- /dev/null
+++ b/components/clinic/components/doctors/head/search/SearchField.js
@@ -0,0 +1,82 @@
+import { clearFilterParams } from "@/helper";
+import { useRouter } from "next/navigation";
+import specialties from "@/data/specialties.json";
+import AutoComplete from "./AutoComplete";
+
+function SearchField({ filter, setFilter, setDataInURL }) {
+ const router = useRouter();
+
+ const clearText = () => {
+ clearFilterParams(router, ["name", "category", "specialty"]);
+ const newFilter = {
+ ...filter,
+ ...{
+ name: "",
+ category: undefined,
+ specialty: undefined,
+ },
+ };
+ setFilter(newFilter);
+ };
+
+ const handleSearch = (e) => {
+ const findName = specialties.find((item) => item.name === e);
+ const searchParams = new URLSearchParams(window.location.search);
+ let dataUrl = {};
+
+ if (findName) {
+ let newFilter = { ...filter };
+ if (findName.parent) {
+ const itemParent = specialties.find(
+ (item) => item.id === findName.parent
+ );
+ dataUrl.specialty = findName.name;
+ newFilter.category = itemParent;
+ newFilter.specialty = findName;
+ } else {
+ dataUrl.specialty = findName.name;
+ newFilter.category = findName;
+ newFilter.specialty = "";
+ }
+
+ searchParams.delete("name");
+ Object.entries(dataUrl).forEach(([key, value]) => {
+ if (value) {
+ searchParams.set(key, value);
+ }
+ });
+ router.push(`?${searchParams.toString()}`);
+ newFilter.name = e;
+ setFilter(newFilter);
+ } else {
+ let newFilter = filter;
+
+ if (
+ filter.name === filter.specialty?.name ||
+ filter.name === filter.category?.name
+ ) {
+ searchParams.delete("specialty");
+ newFilter.specialty = "";
+ newFilter.category = "";
+ router.push(`?${searchParams.toString()}`);
+ }
+ newFilter.name = e;
+ setFilter(newFilter);
+ setDataInURL(newFilter);
+ }
+ };
+
+ return (
+
+ );
+}
+
+export default SearchField;
diff --git a/components/clinic/components/doctors/head/search/SendReq.js b/components/clinic/components/doctors/head/search/SendReq.js
new file mode 100644
index 0000000..53c3998
--- /dev/null
+++ b/components/clinic/components/doctors/head/search/SendReq.js
@@ -0,0 +1,55 @@
+import { Button } from "@mui/material";
+import SearchD from "@/components/icons/SearchD";
+import { useState } from "react";
+import specialties from "@/data/specialties.json";
+
+function SendReq({ filter, setFilter, setDataInURL, sendReq }) {
+ const [loading, setLoading] = useState(false);
+ // const checkName = () => {
+ // let newFilter = filter;
+ // const specialtyItem =
+ // filter.name &&
+ // 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;
+ // }
+ // }
+
+ // return newFilter;
+ // };
+
+ const filterData = () => {
+ setLoading(false);
+
+ // setLoading(true);
+ // // const newFilter = checkName();
+ // // setFilter(filter);
+ // // setDataInURL(filter);
+
+ // sendReq(filter).finally(() => {
+ // setLoading(false);
+ // });
+ };
+
+ return (
+
+ );
+}
+
+export default SendReq;
diff --git a/components/clinic/components/doctors/head/search/index.js b/components/clinic/components/doctors/head/search/index.js
new file mode 100644
index 0000000..e4520de
--- /dev/null
+++ b/components/clinic/components/doctors/head/search/index.js
@@ -0,0 +1,54 @@
+import { Button, ButtonGroup } from "@mui/material";
+import SettingD from "@/components/icons/SettingD";
+import ArrowBottomD from "@/components/icons/ArrowBottomD";
+import SendReq from "./SendReq";
+import SearchField from "./SearchField";
+import FilterModal from "../modal/FilterModal";
+
+function SearchBar({ filter, sendReq, setFilter, updateData, setDataInURL }) {
+ return (
+
+
+
+
+
+
+
+ );
+}
+
+export default SearchBar;
diff --git a/components/clinic/components/doctors/head/sortlist/FilterBtn.js b/components/clinic/components/doctors/head/sortlist/FilterBtn.js
new file mode 100644
index 0000000..d3601a3
--- /dev/null
+++ b/components/clinic/components/doctors/head/sortlist/FilterBtn.js
@@ -0,0 +1,25 @@
+import ArrowBottomD from "@/components/icons/ArrowBottomD";
+import SettingD from "@/components/icons/SettingD";
+import { Button } from "@mui/material";
+
+function FilterBtn() {
+ return (
+
+ );
+}
+
+export default FilterBtn;
diff --git a/components/clinic/components/doctors/head/sortlist/SelectSort.js b/components/clinic/components/doctors/head/sortlist/SelectSort.js
new file mode 100644
index 0000000..efd862a
--- /dev/null
+++ b/components/clinic/components/doctors/head/sortlist/SelectSort.js
@@ -0,0 +1,88 @@
+import { MenuItem, Select, SvgIcon } from "@mui/material";
+import SortD from "@/components/icons/SortD";
+import StarDI from "@/components/icons/StarDI";
+import ArrowBottomD from "@/components/icons/ArrowBottomD";
+
+const listSort = [
+ { label: 3, id: 3 },
+ { label: 4, id: 4 },
+ { label: 5, id: 5 },
+];
+
+function SelectSort({ filter, updateData }) {
+ const handleClick = (e) => {
+ updateData("sort", Number(e.target.value), true);
+ };
+
+ return (
+
+ );
+}
+
+export default SelectSort;
diff --git a/components/clinic/components/doctors/head/sortlist/index.js b/components/clinic/components/doctors/head/sortlist/index.js
new file mode 100644
index 0000000..948a6c0
--- /dev/null
+++ b/components/clinic/components/doctors/head/sortlist/index.js
@@ -0,0 +1,24 @@
+"use client";
+
+import FilterModal from "../modal/FilterModal";
+import FilterBtn from "./FilterBtn";
+import SelectSort from "./SelectSort";
+
+function SortList({ filter, sendReq, setFilter, updateData, setDataInURL }) {
+ return (
+
+
+
+
+
+
+ );
+}
+
+export default SortList;
diff --git a/components/clinic/components/doctors/index.js b/components/clinic/components/doctors/index.js
index c2324a7..8f1d38c 100644
--- a/components/clinic/components/doctors/index.js
+++ b/components/clinic/components/doctors/index.js
@@ -1,9 +1,9 @@
"use client";
-import SmSearch from "@/components/searchHead/smSearch";
-import List from "./List";
-import { useState } from "react";
import { searchOnList } from "@/helper";
+import { useState } from "react";
+import List from "./List";
+import Head from "./head";
function Doctors({ doctors }) {
const [filteredSpecialties, setFilteredSpecialties] = useState(doctors);
@@ -13,13 +13,15 @@ function Doctors({ doctors }) {
return (
);
diff --git a/components/clinic/index.js b/components/clinic/index.js
index e074738..fe0ba29 100644
--- a/components/clinic/index.js
+++ b/components/clinic/index.js
@@ -10,8 +10,8 @@ import Tabs from "@/app/component/Tabs";
const listTab = ["درباره کلینیک", "اطلاعات تماس", "پزشک ها"];
function ClinicPage({ data, doctors }) {
- const [value, setValue] = useState(0);
- const handleChange = (event, newValue) => setValue(newValue);
+ const [value, setValue] = useState(2);
+ const handleChange = (_, newValue) => setValue(newValue);
const Components = [
,
diff --git a/components/doctor/detailDoctor/Share.js b/components/doctor/detailDoctor/Share.js
index 897cac9..c0ed040 100644
--- a/components/doctor/detailDoctor/Share.js
+++ b/components/doctor/detailDoctor/Share.js
@@ -34,8 +34,8 @@ function Share({ data }) {
diff --git a/components/doctor/detailDoctor/cards/comments/index.js b/components/doctor/detailDoctor/cards/comments/index.js
index a12d96c..f5c1f60 100644
--- a/components/doctor/detailDoctor/cards/comments/index.js
+++ b/components/doctor/detailDoctor/cards/comments/index.js
@@ -21,7 +21,7 @@ function Comments({ doctor, comments }) {
-
+
);
}
diff --git a/components/doctor/detailDoctor/cards/comments/modal/ModalAnswer.js b/components/doctor/detailDoctor/cards/comments/modal/ModalAnswer.js
index 0ef9be6..feac744 100644
--- a/components/doctor/detailDoctor/cards/comments/modal/ModalAnswer.js
+++ b/components/doctor/detailDoctor/cards/comments/modal/ModalAnswer.js
@@ -41,12 +41,9 @@ function ModalAnswer({ doctor }) {
rate: newRate,
});
}
- const data = res.response?.data;
- // setComment();
})
- .catch((err) => {
- const data = err.response?.data;
- // setComment();
+ .catch(() => {
+ //
});
}
}, []);
diff --git a/components/doctor/detailDoctor/cards/comments/modal/content/Form.js b/components/doctor/detailDoctor/cards/comments/modal/content/Form.js
index 5063116..244fb6d 100644
--- a/components/doctor/detailDoctor/cards/comments/modal/content/Form.js
+++ b/components/doctor/detailDoctor/cards/comments/modal/content/Form.js
@@ -1,45 +1,70 @@
-import React from "react";
+import React, { useState } from "react";
import Field from "@/app/component/fields/Field";
import { Button } from "@mui/material";
import { request } from "@/services/response";
import ArrowLeftD from "@/components/icons/ArrowLeftD";
-function Form({ doctor, changeData, setOpen, comment, loading, setLoading }) {
- console.log(comment.rate);
-
+function Form({
+ doctor,
+ setOpen,
+ comment,
+ loading,
+ changeData,
+ setComment,
+ setLoading,
+}) {
+ const [isError, setIsError] = useState(false);
+
const sendReq = () => {
- setLoading(true);
+ if (comment?.detail?.comment) {
+ setLoading(true);
- request
- .postDoctorComment(comment.detail)
- .then((res) => {
- let newComment = comment.rate;
- newComment = {
- doctor_id: doctor?.id,
- accuracy_of_diagnosis: newComment[1].progress,
- doctor_expertise: newComment[4].progress,
- doctor_behavior: newComment[2].progress,
- clinic_cleanliness: newComment[3].progress,
- waiting_time_at_clinic: newComment[0].progress,
- };
-
- request[comment.defaultRate ? "patchDoctorRate" : "postDoctorRate"](
- newComment,
- comment.uuid
- )
- .then((res) => {
- setLoading(false);
- setOpen(false);
- })
- .catch((err) => {
- setLoading(false);
- setOpen(false);
+ request
+ .postDoctorComment(comment.detail)
+ .then(() => {
+ let newComment = comment.rate;
+ newComment = {
+ doctor_id: doctor?.id,
+ accuracy_of_diagnosis: newComment[1].progress,
+ doctor_expertise: newComment[4].progress,
+ doctor_behavior: newComment[2].progress,
+ clinic_cleanliness: newComment[3].progress,
+ waiting_time_at_clinic: newComment[0].progress,
+ };
+ setComment({
+ ...comment,
+ detail: {
+ ...comment.detail,
+ comment: "",
+ },
});
- })
- .catch((err) => {
- setLoading(false);
- setOpen(false);
- });
+
+ request[comment.defaultRate ? "patchDoctorRate" : "postDoctorRate"](
+ newComment,
+ comment.uuid
+ )
+ .then(() => {
+ setLoading(false);
+ setOpen(false);
+ })
+ .catch(() => {
+ setLoading(false);
+ setOpen(false);
+ });
+ })
+ .catch(() => {
+ setLoading(false);
+ setOpen(false);
+ });
+ } else {
+ setIsError(true);
+ }
+ };
+
+ const handleChange = (_, val) => {
+ if (val && isError) setIsError(false);
+ else if (!val && !isError) setIsError(true);
+ changeData("detail", "comment", val);
};
return (
@@ -47,8 +72,9 @@ function Form({ doctor, changeData, setOpen, comment, loading, setLoading }) {
متن نظر
changeData("detail", "comment", val)}
+ handleChange={handleChange}
title="نظر خود را بنویسید..."
/>
diff --git a/components/doctor/poster/index.js b/components/doctor/poster/index.js
index 37e846c..6c1598f 100644
--- a/components/doctor/poster/index.js
+++ b/components/doctor/poster/index.js
@@ -12,7 +12,9 @@ function Poster({ data }) {
-
nobat724.com
+
+ nobat724.com
+
{data?.name}
diff --git a/data/progress_detail.json b/data/progress_detail.json
index ce76db0..d9eb550 100644
--- a/data/progress_detail.json
+++ b/data/progress_detail.json
@@ -1,6 +1,6 @@
[
{
- "name": "clinic_cleanliness",
+ "name": "waiting_time_at_clinic",
"label": "زمان انتظار در مطب",
"progress": 70
},
diff --git a/lib/getStateInfoClient.js b/lib/getStateInfoClient.js
index 5ed74be..61ea4df 100644
--- a/lib/getStateInfoClient.js
+++ b/lib/getStateInfoClient.js
@@ -6,7 +6,7 @@ export function getStateInfoClient() {
if (typeof window === "undefined")
return { matchedCity: null, matchedState: null, fullUrl: "" };
- const fullUrl = window.location.href; // کل URL
+ const fullUrl = window.location.href;
const host = window.location.host || "";
const subdomain = host.split(".")[0];