change name office-info && change name img uploaded && change theme selector && set default tab in appo page && clean code

This commit is contained in:
Ehsan
2025-07-25 00:02:46 +03:30
parent 901bca6529
commit 7e61867e3d
11 changed files with 33 additions and 23 deletions
+3 -3
View File
@@ -28,11 +28,11 @@ function Tabs({ value, handleChange, listTab, inactives, isSm, style }) {
{...a11yProps(idx)} {...a11yProps(idx)}
sx={{ sx={{
"&.MuiButtonBase-root": { "&.MuiButtonBase-root": {
width: !isSm && "fit-content !important", width: !isSm ? "fit-content !important" : undefined, // Fix: Replace `false` with `undefined`
minWidth: !isSm && "fit-content !important", minWidth: !isSm ? "fit-content !important" : undefined,
}, },
"&.MuiButtonBase-root:first-child": { "&.MuiButtonBase-root:first-child": {
marginLeft: !isSm && "9px !important", marginLeft: !isSm ? "9px !important" : undefined,
}, },
}} }}
className={` className={`
+5 -4
View File
@@ -3,16 +3,14 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import Hours from "./hours"; import Hours from "./hours";
import Tabs from "../../Tabs"; import Tabs from "../../Tabs";
import { Button } from "@mui/material";
import ArrowLeftB from "@/components/icons/ArrowLeftB";
import { request } from "@/services/response"; import { request } from "@/services/response";
import { useParams, useSearchParams } from "next/navigation"; import { useParams } from "next/navigation";
import SendAppo from "./SendAppo"; import SendAppo from "./SendAppo";
const listTab = ["صبح", "بعد از ظهر"]; const listTab = ["صبح", "بعد از ظهر"];
const nameHours = ["hours_morning", "hours_afternoon"]; const nameHours = ["hours_morning", "hours_afternoon"];
function DateTime({ date, doctor, setStep, setIsError, locateVisit }) { function DateTime({ date, doctor }) {
const params = useParams(); const params = useParams();
const doctorId = params.doctorId; const doctorId = params.doctorId;
const [value, setValue] = useState(0); const [value, setValue] = useState(0);
@@ -32,6 +30,9 @@ function DateTime({ date, doctor, setStep, setIsError, locateVisit }) {
.getAppointment(doctorId, date) .getAppointment(doctorId, date)
.then((res) => { .then((res) => {
setAppo(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) => { .catch((err) => {
setAppo("در حال حاضر، نوبتی برای ساعت‌های صبح موجود نمی‌باشد."); setAppo("در حال حاضر، نوبتی برای ساعت‌های صبح موجود نمی‌باشد.");
-1
View File
@@ -1,7 +1,6 @@
import MenuItem from "@mui/material/MenuItem"; import MenuItem from "@mui/material/MenuItem";
import ListSubheader from "@mui/material/ListSubheader"; import ListSubheader from "@mui/material/ListSubheader";
import Select from "@mui/material/Select"; import Select from "@mui/material/Select";
import { useState } from "react";
import { styleTextSelectRight } from "@/mui"; import { styleTextSelectRight } from "@/mui";
import IconMultipleSelect from "@/components/icons/IconMultipleSelect"; import IconMultipleSelect from "@/components/icons/IconMultipleSelect";
+7 -4
View File
@@ -8,9 +8,10 @@ function Crop({ data, uploadImg, handleClose }) {
const [zoom, setZoom] = useState(1); const [zoom, setZoom] = useState(1);
const [croppedAreaPixels, setCroppedAreaPixels] = useState(null); const [croppedAreaPixels, setCroppedAreaPixels] = useState(null);
const onComplete = async (imagePromise) => { const onComplete = async (imagePromise, name) => {
const dataUrl = await imagePromise; const dataUrl = await imagePromise;
const file = dataURLtoFile(dataUrl, "cropped-image.jpg");
const file = dataURLtoFile(dataUrl, name);
uploadImg({ blob: dataUrl, file }); uploadImg({ blob: dataUrl, file });
}; };
@@ -22,7 +23,7 @@ function Crop({ data, uploadImg, handleClose }) {
<Cropper <Cropper
crop={crop} crop={crop}
zoom={zoom} zoom={zoom}
aspect={4 / 3} aspect={1}
image={data.blob} image={data.blob}
onCropChange={setCrop} onCropChange={setCrop}
onCropComplete={(_, croppedAreaPixels) => onCropComplete={(_, croppedAreaPixels) =>
@@ -42,7 +43,9 @@ function Crop({ data, uploadImg, handleClose }) {
</Button> </Button>
<Button <Button
variant="contained" variant="contained"
onClick={() => onComplete(cropImage(data.blob, croppedAreaPixels))} onClick={() =>
onComplete(cropImage(data.blob, croppedAreaPixels), data.file?.name)
}
className="!text-[16px] !max-w-[calc(50%_-_8px)] !font-medium !shadow-none !py-[5px] md:!py-[7px] lg:!py-[9px]" className="!text-[16px] !max-w-[calc(50%_-_8px)] !font-medium !shadow-none !py-[5px] md:!py-[7px] lg:!py-[9px]"
> >
ذخیره ذخیره
+4
View File
@@ -714,6 +714,10 @@ html {
color: #fafafa; color: #fafafa;
} }
.MuiPaper-root .MuiList-root .MuiListSubheader-root {
background: #5559ce;
}
.panel-jalaali { .panel-jalaali {
width: 464px !important; width: 464px !important;
} }
+1 -1
View File
@@ -5,7 +5,6 @@ import { useState } from "react";
import Content from "./Content"; import Content from "./Content";
import Layout from "@/components/layout"; import Layout from "@/components/layout";
import doctors from "@/data/doctors.json"; import doctors from "@/data/doctors.json";
import Date from "@/components/appointment/date";
import RegisterPage from "@/components/register"; import RegisterPage from "@/components/register";
import Paying from "@/components/appointment/paying"; import Paying from "@/components/appointment/paying";
import Detail from "@/components/appointment/detail"; import Detail from "@/components/appointment/detail";
@@ -13,6 +12,7 @@ import FailedPay from "@/components/appointment/failedPay";
import LogInPage from "@/components/register/LogInPage"; import LogInPage from "@/components/register/LogInPage";
import SuccessPay from "@/components/appointment/successPay"; import SuccessPay from "@/components/appointment/successPay";
import VerificationPage from "@/components/register/verificationPage"; import VerificationPage from "@/components/register/verificationPage";
import Date from "./date";
function AppointmentPage({ slug, matchedCity }) { function AppointmentPage({ slug, matchedCity }) {
const doctor = doctors.find((item) => item.id === +slug); const doctor = doctors.find((item) => item.id === +slug);
-2
View File
@@ -52,8 +52,6 @@ function ModalSearchCity() {
<SettingD /> <SettingD />
</div> </div>
<p className="text-[#616161] text-[11px] sm:text-[13px] md:text-[15px] lg:text-[16px] font-medium mx-2"> <p className="text-[#616161] text-[11px] sm:text-[13px] md:text-[15px] lg:text-[16px] font-medium mx-2">
{/* {selected.first && selected.second ?
`${selected.first} | ${selected.second}` : 'فیلترها'} */}
فیلترها فیلترها
</p> </p>
<div className="w-[16px] h-[16px] md:w-[20px] md:h-[20px] lg:w-[24px] lg:h-[24px]"> <div className="w-[16px] h-[16px] md:w-[20px] md:h-[20px] lg:w-[24px] lg:h-[24px]">
+1 -1
View File
@@ -1,4 +1,5 @@
import Selector from "./fields/Selector"; import Selector from "./fields/Selector";
import ContentText from "@/app/component/ContentText";
import EditField from "@/app/component/fields/EditField"; import EditField from "@/app/component/fields/EditField";
import GroupedSelect from "@/app/component/selectors/GroupedSelect"; import GroupedSelect from "@/app/component/selectors/GroupedSelect";
import MultipleSelect from "@/app/component/selectors/MultipleSelect"; import MultipleSelect from "@/app/component/selectors/MultipleSelect";
@@ -6,7 +7,6 @@ import MultipleSelect from "@/app/component/selectors/MultipleSelect";
// Data // Data
import specialties from "@/data/specialties.json"; import specialties from "@/data/specialties.json";
import education from "@/data/education.json"; import education from "@/data/education.json";
import ContentText from "@/app/component/ContentText";
const validate_medical_number = { const validate_medical_number = {
min: 1, min: 1,
+1 -1
View File
@@ -51,8 +51,8 @@ function Form({ image, data, setData, resetData }) {
<Fields <Fields
data={data} data={data}
services={services} services={services}
changeData={changeData}
updateNum={updateNum} updateNum={updateNum}
changeData={changeData}
/> />
<div className="flex flex-col gap-y-[24px]"> <div className="flex flex-col gap-y-[24px]">
<FieldDate changeListData={changeData} data={data?.time_work} /> <FieldDate changeListData={changeData} data={data?.time_work} />
@@ -1,9 +1,10 @@
import ArrowLeftPA from "@/components/icons/ArrowLeftPA"; import ArrowLeftPA from "@/components/icons/ArrowLeftPA";
import { checkAllValues } from "@/helper"; import { alert, checkAllValues } from "@/helper";
import { request } from "@/services/response"; import { request } from "@/services/response";
import { Button } from "@mui/material"; import { Button } from "@mui/material";
import { useState } from "react"; import { useEffect, useState } from "react";
import { transformData } from "./function"; import { transformData } from "./function";
import { toast, ToastContainer } from "react-toastify";
function SendReq({ img, data, resetData }) { function SendReq({ img, data, resetData }) {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
@@ -17,12 +18,16 @@ function SendReq({ img, data, resetData }) {
request request
.postDoctor(transformed) .postDoctor(transformed)
.then(() => { .then((res) => {
resetData(); if (res.id) {
setLoading(false); alert("success", "پزشک جدید با موفقیت اضافه شد!");
resetData();
setLoading(false);
}
}) })
.catch(() => { .catch(() => {
setLoading(false); setLoading(false);
alert("error", "خطا در ثبت پزشک! لطفاً دوباره تلاش کنید.");
}); });
}; };
+1 -1
View File
@@ -64,7 +64,7 @@ export const request = {
api.post("file/upload/clinic_pro/doctor/field_image", data, { api.post("file/upload/clinic_pro/doctor/field_image", data, {
headers: { headers: {
"Content-Type": "application/octet-stream", "Content-Type": "application/octet-stream",
"Content-Disposition": 'file; filename="filename.jpg"', "Content-Disposition": `file; filename="${data.name}"`,
"X-CSRF-Token": "", "X-CSRF-Token": "",
}, },
}), }),