From 7e61867e3d46a334b562b4f89b886f8deef3c94d Mon Sep 17 00:00:00 2001 From: Ehsan Date: Fri, 25 Jul 2025 00:02:46 +0330 Subject: [PATCH] change name office-info && change name img uploaded && change theme selector && set default tab in appo page && clean code --- app/component/Tabs.js | 6 +++--- app/component/date/dateTime/index.js | 9 +++++---- app/component/selectors/GroupedSelect.js | 1 - app/component/uploadFile/Crop.js | 11 +++++++---- app/globals.css | 4 ++++ components/appointment/index.js | 2 +- components/clinics/head/modal/index.js | 2 -- components/panel/addDoctor/form/Fields.js | 2 +- components/panel/addDoctor/form/index.js | 2 +- components/panel/addDoctor/form/sendReq/index.js | 15 ++++++++++----- services/response.js | 2 +- 11 files changed, 33 insertions(+), 23 deletions(-) diff --git a/app/component/Tabs.js b/app/component/Tabs.js index c2155a0..4661e3a 100644 --- a/app/component/Tabs.js +++ b/app/component/Tabs.js @@ -28,11 +28,11 @@ function Tabs({ value, handleChange, listTab, inactives, isSm, style }) { {...a11yProps(idx)} sx={{ "&.MuiButtonBase-root": { - width: !isSm && "fit-content !important", - minWidth: !isSm && "fit-content !important", + width: !isSm ? "fit-content !important" : undefined, // Fix: Replace `false` with `undefined` + minWidth: !isSm ? "fit-content !important" : undefined, }, "&.MuiButtonBase-root:first-child": { - marginLeft: !isSm && "9px !important", + marginLeft: !isSm ? "9px !important" : undefined, }, }} className={` diff --git a/app/component/date/dateTime/index.js b/app/component/date/dateTime/index.js index 4662395..e39d21a 100644 --- a/app/component/date/dateTime/index.js +++ b/app/component/date/dateTime/index.js @@ -3,16 +3,14 @@ import { useEffect, useState } from "react"; import Hours from "./hours"; import Tabs from "../../Tabs"; -import { Button } from "@mui/material"; -import ArrowLeftB from "@/components/icons/ArrowLeftB"; import { request } from "@/services/response"; -import { useParams, useSearchParams } from "next/navigation"; +import { useParams } from "next/navigation"; import SendAppo from "./SendAppo"; const listTab = ["صبح", "بعد از ظهر"]; const nameHours = ["hours_morning", "hours_afternoon"]; -function DateTime({ date, doctor, setStep, setIsError, locateVisit }) { +function DateTime({ date, doctor }) { const params = useParams(); const doctorId = params.doctorId; const [value, setValue] = useState(0); @@ -32,6 +30,9 @@ function DateTime({ date, doctor, setStep, setIsError, locateVisit }) { .getAppointment(doctorId, date) .then((res) => { setAppo(res); + if (res.morning?.length && res.evening?.length) setValue(0); + else if (res.morning?.length && value !== 0) setValue(0); + else if (res.evening?.length && value !== 1) setValue(1); }) .catch((err) => { setAppo("در حال حاضر، نوبتی برای ساعت‌های صبح موجود نمی‌باشد."); diff --git a/app/component/selectors/GroupedSelect.js b/app/component/selectors/GroupedSelect.js index 8cad342..31acfdf 100644 --- a/app/component/selectors/GroupedSelect.js +++ b/app/component/selectors/GroupedSelect.js @@ -1,7 +1,6 @@ import MenuItem from "@mui/material/MenuItem"; import ListSubheader from "@mui/material/ListSubheader"; import Select from "@mui/material/Select"; -import { useState } from "react"; import { styleTextSelectRight } from "@/mui"; import IconMultipleSelect from "@/components/icons/IconMultipleSelect"; diff --git a/app/component/uploadFile/Crop.js b/app/component/uploadFile/Crop.js index e4bf9df..cd2ec6f 100644 --- a/app/component/uploadFile/Crop.js +++ b/app/component/uploadFile/Crop.js @@ -8,9 +8,10 @@ function Crop({ data, uploadImg, handleClose }) { const [zoom, setZoom] = useState(1); const [croppedAreaPixels, setCroppedAreaPixels] = useState(null); - const onComplete = async (imagePromise) => { + const onComplete = async (imagePromise, name) => { const dataUrl = await imagePromise; - const file = dataURLtoFile(dataUrl, "cropped-image.jpg"); + + const file = dataURLtoFile(dataUrl, name); uploadImg({ blob: dataUrl, file }); }; @@ -22,7 +23,7 @@ function Crop({ data, uploadImg, handleClose }) { @@ -42,7 +43,9 @@ function Crop({ data, uploadImg, handleClose }) {