diff --git a/app/component/date/dateTime/hours/List.js b/app/component/date/dateTime/hours/List.js
index 2f25cad..c918c54 100644
--- a/app/component/date/dateTime/hours/List.js
+++ b/app/component/date/dateTime/hours/List.js
@@ -3,6 +3,7 @@ import React from "react";
function List({ appo, hour, setHour, value }) {
const list = appo && appo[value ? "evening" : "morning"];
+ const checkHour = (item) => JSON.stringify(item) === JSON.stringify(hour);
if (list && list.length) {
return (
@@ -14,14 +15,14 @@ function List({ appo, hour, setHour, value }) {
disabled={!item.status === "available"}
className={`
!w-full !rounded-[8px] !bg-[#EFEFEF] !flex !justify-center !items-center !py-[10px] !px-[14px] !h-[40px] md:!h-[42px] lg:!h-[44px]
- ${JSON.stringify(item) === JSON.stringify(hour) ? "!bg-[#F79463] " : ""}
+ ${checkHour(item) ? "!bg-[#F79463] " : ""}
`}
>
{item.time}
diff --git a/components/appointment/date/PlaceVisit.js b/components/appointment/date/PlaceVisit.js
deleted file mode 100644
index f976753..0000000
--- a/components/appointment/date/PlaceVisit.js
+++ /dev/null
@@ -1,29 +0,0 @@
-"use client";
-
-import AutoCompleteSelect from "@/app/component/element/AutoCompleteSelect";
-
-function PlaceVisit({ locateVisit, setLocateVisit, isError }) {
- const clinics = [
- { label: "درمانگاه رازی", id: 10 },
- { label: "درمانگاه ابوعلی", id: 20 },
- { label: "درمانگاه مرکزی", id: 30 },
- ];
-
- const updateData = (event) => setLocateVisit(event);
-
- return (
-
- );
-}
-
-export default PlaceVisit;
diff --git a/components/appointment/date/Time/index.js b/components/appointment/date/Time/index.js
index b69cf87..519fe90 100644
--- a/components/appointment/date/Time/index.js
+++ b/components/appointment/date/Time/index.js
@@ -4,7 +4,7 @@ function Time({ isStep, setDate }) {
return (
- 2. انتخاب روز
+ 1. انتخاب روز
{!isStep && (
diff --git a/components/appointment/date/hour/index.js b/components/appointment/date/hour/index.js
index 5fa1917..8c8268f 100644
--- a/components/appointment/date/hour/index.js
+++ b/components/appointment/date/hour/index.js
@@ -1,16 +1,15 @@
import DateTime from "@/app/component/date/dateTime";
-function Hour({ doctor, setStep, date, setIsError, locateVisit, isStep }) {
+function Hour({ doctor, setStep, date, locateVisit, isStep }) {
return (
- 3. انتخاب ساعت
+ 2. انتخاب ساعت
{!isStep && (
diff --git a/components/appointment/date/index.js b/components/appointment/date/index.js
index d0f3a36..9588edd 100644
--- a/components/appointment/date/index.js
+++ b/components/appointment/date/index.js
@@ -1,7 +1,6 @@
import { useState } from "react";
import Hour from "./hour";
import Time from "./Time";
-import PlaceVisit from "./PlaceVisit";
function Date({ doctor, setStep }) {
const [locateVisit, setLocateVisit] = useState(true);
@@ -14,11 +13,6 @@ function Date({ doctor, setStep }) {
className="p-0 lg:p-[24px] rounded-[8px] border border-solid border-transparent lg:border-[#EFEFEF]
bg-transparent lg:bg-[#FFF]"
>
-
- اولین نوبت آزاد: {turn.first_free_turn}
+ اولین نوبت آزاد: {turn.first_free_turn || "یکشنبه 24 اردیبهشت"}
diff --git a/components/doctor/appointmentList/index.js b/components/doctor/appointmentList/index.js
index cb0a9f1..1ae2ec4 100644
--- a/components/doctor/appointmentList/index.js
+++ b/components/doctor/appointmentList/index.js
@@ -9,9 +9,13 @@ function AppointmentList({ doctors, loading }) {
return (
<>
- {doctors?.map((item) => (
-
- ))}
+ {doctors && doctors.length && (
+
+ )}
specialties.find((item) => item.id === id);
+ const isParent = findItem(fieldId) && findItem(fieldId).parent;
+ console.log(isParent);
+
const findSpecial = (id) => specialties.find((item) => item.id === id);
const [data, setData] = useState({
- category: findSpecial(params.specialties)?.parent
- ? findSpecial(findSpecial(params.specialties)?.parent)
- : findSpecial(params.specialties) || "",
- specialties: findSpecial(params.specialties)?.parent
- ? findSpecial(params.specialties)
- : "",
+ category: isParent ? findItem(isParent) : findItem(fieldId),
+ specialties: isParent && findItem(fieldId),
turn: params && params.hasOwnProperty("turn") ? JSON.parse(params.turn) : 1,
gender: params.gender || "هر دو",
degree: params.degree || "همه موارد",
diff --git a/components/doctors/modal/Content.js b/components/doctors/modal/Content.js
index bc6fbff..75306ec 100644
--- a/components/doctors/modal/Content.js
+++ b/components/doctors/modal/Content.js
@@ -12,27 +12,30 @@ function Content({ data, setData }) {
router.push(`/doctors?${queryString}`);
};
- const changeData = (value, name, isCategory) => {
- changeUrl(value, name);
- const newData = data;
- newData[name] = value;
- const childrenList = specialties.filter((item) => item.parent);
- const filteredChildrenList = childrenList.filter(
- (item) => item.parent === value.id
- );
+ const changeData = (value, name, isCategory, key) => {
+ const newData = { ...data, [name]: value };
+
if (isCategory) {
- newData.specialties = "";
- newData.specialties = filteredChildrenList[0];
+ const childrenList = specialties.filter((item) => item.parent);
+ const filteredChildrenList = childrenList.filter(
+ (item) => item.parent === value.id
+ );
+ const firstChildren = filteredChildrenList[0];
+ console.log(firstChildren);
+
+ newData.specialties = firstChildren || "";
+ changeUrl(firstChildren || value, key);
+ } else {
+ changeUrl(value, key);
}
+
setData(newData);
return newData;
};
- console.log(data);
-
return (
-
+
);
}
diff --git a/components/doctors/modal/form/CateSelector.js b/components/doctors/modal/form/CateSelector.js
new file mode 100644
index 0000000..9249d01
--- /dev/null
+++ b/components/doctors/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({ list, value, isError, updateData, label }) {
+ return (
+
option?.name}
+ className="!w-full !rounded-lg auto-complete-selector"
+ onChange={(_, newValue) => updateData(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/doctors/modal/form/Radios.js b/components/doctors/modal/form/Radios.js
index bec8123..ee65c90 100644
--- a/components/doctors/modal/form/Radios.js
+++ b/components/doctors/modal/form/Radios.js
@@ -5,7 +5,7 @@ function Radios({ group, value, changeData, name }) {
changeData(e.target.value, name)}
+ onChange={(e) => changeData(e.target.value, name, false, name)}
sx={{
"& .MuiFormControlLabel-root": {
marginRight: "0 !important",
diff --git a/components/doctors/modal/form/index.js b/components/doctors/modal/form/index.js
index 5e28dfb..bebc8e4 100644
--- a/components/doctors/modal/form/index.js
+++ b/components/doctors/modal/form/index.js
@@ -1,37 +1,31 @@
-import AutoCompleteSelect from "@/app/component/element/AutoCompleteSelect";
import SwitchContent from "./SwitchContent";
import RadioContent from "./RadioContent";
import { filterList } from "@/helper";
import { useState } from "react";
+import CateSelector from "./CateSelector";
const gender = ["زن", "مرد", "هر دو"];
const degree = ["پزشک عمومی", "پزشک متخصص", "پزشک فوق تخصص", "همه موارد"];
-function Form({ data, changeUrl, changeData }) {
- const [list, setList] = useState({});
+function Form({ data, changeData }) {
const { parentList, childrenList } = filterList(data);
- console.log(filterList(data));
return (
<>
- {
- const newData = changeData(value, "specialties", true);
- setList(filterList(newData));
- console.log(newData);
- }}
+ value={data.category}
+ updateData={(value) => changeData(value, "category", true, "field")}
/>
{!!childrenList.length && (
-
changeData(value, "specialties")}
- sendAll={true}
- value={data.specialties?.name}
+
+ changeData(value, "specialties", false, "field")
+ }
+ value={data.specialties}
label="تخصص"
/>