change design poster and text head && design modal filter & data for filter and doctors & handle functionality filter, set in url, read from url and change state
This commit is contained in:
@@ -34,8 +34,8 @@ function Share({ data }) {
|
||||
<Box
|
||||
sx={styleDefault}
|
||||
className="!pt-[12px] md:!pt-[14px] lg:!py-[16px] !overflow-hidden
|
||||
!px-[12px] sm:!px-[16px] md:!px-[20px] lg:!px-[24px]
|
||||
!pb-[12px] sm:!pb-[16px] lg:!pb-[20px] !rounded-[8px]"
|
||||
!px-[12px] sm:!px-[16px] md:!px-[20px] lg:!px-[24px]
|
||||
!pb-[12px] sm:!pb-[16px] lg:!pb-[20px] !rounded-[8px]"
|
||||
>
|
||||
<div className="flex items-center justify-between w-full">
|
||||
<p className="text-[#3B3B3B] text-[14px] sm:text-[16px] md:text-[18px] lg:text-[20px] font-medium">
|
||||
|
||||
@@ -21,7 +21,7 @@ function Comments({ doctor, comments }) {
|
||||
<ModalAnswer doctor={doctor} />
|
||||
</div>
|
||||
<Chart comments={comments} doctor={doctor} />
|
||||
<Comment data={doctor} comments={comments} />
|
||||
<Comment comments={comments} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,12 +41,9 @@ function ModalAnswer({ doctor }) {
|
||||
rate: newRate,
|
||||
});
|
||||
}
|
||||
const data = res.response?.data;
|
||||
// setComment();
|
||||
})
|
||||
.catch((err) => {
|
||||
const data = err.response?.data;
|
||||
// setComment();
|
||||
.catch(() => {
|
||||
//
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -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 }) {
|
||||
<p className="text-[#495057] text-[16px] font-bold">متن نظر</p>
|
||||
<Field
|
||||
type="number"
|
||||
error={isError}
|
||||
multiline={true}
|
||||
handleChange={(_, val) => changeData("detail", "comment", val)}
|
||||
handleChange={handleChange}
|
||||
title="نظر خود را بنویسید..."
|
||||
/>
|
||||
<Button
|
||||
|
||||
@@ -63,6 +63,7 @@ function Content({
|
||||
comment={comment}
|
||||
loading={loading}
|
||||
setOpen={setOpen}
|
||||
setComment={setComment}
|
||||
changeData={changeData}
|
||||
setLoading={setLoading}
|
||||
/>
|
||||
|
||||
@@ -12,7 +12,9 @@ function Poster({ data }) {
|
||||
<div>
|
||||
<div className="flex items-center justify-start gap-[5px]">
|
||||
<Image src={Logo} width={30} height={30} alt="logo" />
|
||||
<p className="text-[#E7EEF6] text-[16px] font-bold">nobat724.com</p>
|
||||
<p className="text-[#E7EEF6] text-[16px] font-bold !-translate-y-1">
|
||||
nobat724.com
|
||||
</p>
|
||||
</div>
|
||||
<p className="mt-[40px] text-[#E7EEF6] text-[20px] font-bold text-right">
|
||||
{data?.name}
|
||||
|
||||
Reference in New Issue
Block a user