remove additional code && fix bug select city and state && alert success and error message for comment in doctors page && handle set data after user searched in field doctors page && set data appointment from doctor data && set value in field search after user reload in doctors page

This commit is contained in:
ehsan
2025-09-22 19:56:28 +03:30
parent e11f4ed3c5
commit 74c6cf7b6b
13 changed files with 132 additions and 59 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ function ProgressDetail({ data }) {
{data.label}
</p>
<LinearProgress
value={data.progress}
value={data}
variant="determinate"
className="!w-full lg:!w-[265px] !rounded-[10px] !bg-[#D7D7D7] !h-[11px]"
sx={{
@@ -19,7 +19,7 @@ function ProgressDetail({ data }) {
}}
/>
<p className="text-[#525252] text-[20px] font-medium">
{numberToArStyle(data.progress)}%
{numberToArStyle(data)}%
</p>
</li>
);
+10 -3
View File
@@ -9,7 +9,7 @@ import LikeComment from "@/components/icons/LikeComment";
import Replies from "./Replies";
import AnswerField from "./AnswerField";
import SendAnswer from "./SendAnswer";
import { timeAgo } from "@/helper";
import { alert, isUserLoggedIn, timeAgo } from "@/helper";
import { request } from "@/services/response";
import { useState } from "react";
@@ -142,8 +142,15 @@ function ItemUser({ update, setUpdate, data }) {
<Button
className="!text-[#495057] !text-[12px] !font-medium"
onClick={() => {
data.is_open_answer = !data.is_open_answer;
setUpdate(!update);
if (isUserLoggedIn()) {
data.is_open_answer = !data.is_open_answer;
setUpdate(!update);
} else {
alert(
"warning",
"برای ارسال کامنت باید ابتدا وارد حساب کاربری شوید."
);
}
}}
variant="text"
>
+7 -1
View File
@@ -2,6 +2,7 @@ import { Button } from "@mui/material";
import Field from "./Field";
import { useState } from "react";
import { request } from "@/services/response";
import { alert } from "@/helper";
function SendAnswer({ data }) {
const [comment, setComment] = useState("");
@@ -24,9 +25,14 @@ function SendAnswer({ data }) {
request
.postDoctorComment(body)
.then(() => {
alert(
"success",
"کامنت شما با موفقیت ثبت شد و پس از تأیید نمایش داده می‌شود."
);
resetData();
})
.catch(() => {
alert("error", "خطایی رخ داد! لطفاً دوباره تلاش کنید.");
resetData();
});
};
@@ -45,8 +51,8 @@ function SendAnswer({ data }) {
/>
<Button
loading={loading}
variant="contained"
onClick={sendReq}
variant="contained"
className="!p-2 !h-10 !text-[12px] !font-medium sm:!py-[10px] md:!px-[12px] !rounded-[8px]
!shadow-none sm:!shadow-[0px_4px_30px_0px_rgba(56,_160,_162,_0.30)]"
>