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:
@@ -41,7 +41,7 @@ function ItemAppointment({ turn, loading }) {
|
||||
<GreenCalendarTurn />
|
||||
<TextLoading width={100} height={15} loading={loading}>
|
||||
<p className="text-[#05BA58] text-[12px] font-medium">
|
||||
{Number(turn?.active)
|
||||
{Number(turn?.free_turn)
|
||||
? `اولین نوبت آزاد: ${moment(turn?.free_turn * 1000).format(
|
||||
"dddd jD jMMMM [ساعت] HH:mm"
|
||||
)}`
|
||||
|
||||
@@ -5,16 +5,12 @@ import ItemAppointment from "./ItemAppointment";
|
||||
import ArrowLeftD from "@/components/icons/ArrowLeftD";
|
||||
import Link from "next/link";
|
||||
|
||||
function AppointmentList({ doctors, loading }) {
|
||||
function AppointmentList({ doctor, loading }) {
|
||||
return (
|
||||
<>
|
||||
<ul className="hidden sticky top-[122px] sm:top-[150px] mt:top-[178px] lg:top-[206px] lg:flex w-[38%] flex-col justify-start items-center gap-8">
|
||||
{doctors && doctors.length && (
|
||||
<ItemAppointment
|
||||
loading={loading}
|
||||
turn={doctors[0]}
|
||||
key={doctors[0].id}
|
||||
/>
|
||||
{doctor && (
|
||||
<ItemAppointment loading={loading} turn={doctor} key={doctor.id} />
|
||||
)}
|
||||
</ul>
|
||||
<div
|
||||
@@ -22,9 +18,9 @@ function AppointmentList({ doctors, loading }) {
|
||||
border-solid bottom-0 right-0 w-full p-4 flex items-center justify-between"
|
||||
>
|
||||
<p className="text-[#05BA58] text-[11px] font-normal">
|
||||
اولین نوبت آزاد: {doctors && doctors[0]?.free_turn}
|
||||
اولین نوبت آزاد: {doctor && doctor?.free_turn}
|
||||
</p>
|
||||
<Link href={`/appointment/${doctors && doctors[0]?.id}`}>
|
||||
<Link href={`/appointment/${doctor && doctor?.id}`}>
|
||||
<Button
|
||||
variant="contained"
|
||||
className="!py-2 !px-4 gap-1 !text-[14px] !font-medium"
|
||||
|
||||
@@ -53,7 +53,7 @@ function Chart({ comments, doctor }) {
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center justify-center gap-[50px]">
|
||||
<ul className="flex w-full flex-col items-start justify-start gap-1.5 lg:w-fit">
|
||||
{doctor?.progress_detail?.map((item, idx) => (
|
||||
{Object.values(doctor?.average_rate?.averages).map((item, idx) => (
|
||||
<TextLoading width="full" key={idx} height={20}>
|
||||
<ProgressDetail data={item} />
|
||||
</TextLoading>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { alert, isUserLoggedIn } from "@/helper";
|
||||
import { Button } from "@mui/material";
|
||||
import React from "react";
|
||||
|
||||
function BtnNewComment({ handleOpen }) {
|
||||
const handleClick = () => {
|
||||
if (isUserLoggedIn()) {
|
||||
handleOpen();
|
||||
} else {
|
||||
alert("warning", "برای ارسال کامنت باید ابتدا وارد حساب کاربری شوید.");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={handleClick}
|
||||
className="!py-[6px] md:!py-2 lg:!py-[9px] !px-[16px] sm:!px-[23px] md:!px-[29px]
|
||||
lg:!px-[36px] !mr-0 md:!mr-4 !rounded !w-full md:!w-fit"
|
||||
>
|
||||
ثبت نظر
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
export default BtnNewComment;
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { styleDefault } from "@/mui";
|
||||
import { Box, Button, Modal, Rating, Slider } from "@mui/material";
|
||||
import { Box, Button, Modal, Rating } from "@mui/material";
|
||||
import CloseModalD from "@/components/icons/CloseModalD";
|
||||
import Field from "@/app/component/fields/Field";
|
||||
import ArrowLeftD from "@/components/icons/ArrowLeftD";
|
||||
import ProgressChange from "@/app/component/ProgressChange";
|
||||
import ProgressDetail from "@/data/progress_detail.json";
|
||||
import Link from "next/link";
|
||||
import { request } from "@/services/response";
|
||||
import BtnNewComment from "./BtnNewComment";
|
||||
|
||||
function ModalAnswer({ doctor }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -81,14 +81,7 @@ function ModalAnswer({ doctor }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={handleOpen}
|
||||
className="!py-[6px] md:!py-2 lg:!py-[9px] !px-[16px] sm:!px-[23px] md:!px-[29px]
|
||||
lg:!px-[36px] !mr-0 md:!mr-4 !rounded !w-full md:!w-fit"
|
||||
>
|
||||
ثبت نظر
|
||||
</Button>
|
||||
<BtnNewComment handleOpen={handleOpen} />
|
||||
<Modal open={open} onClose={handleClose}>
|
||||
<Box
|
||||
sx={styleDefault}
|
||||
|
||||
@@ -24,7 +24,7 @@ function DoctorPage({ doctor, doctors, comments }) {
|
||||
</div>
|
||||
<div className="flex items-start justify-center gap-6 mt-[30px]">
|
||||
<DetailDoctor doctor={doctor} comments={comments} />
|
||||
<AppointmentList doctors={doctors} />
|
||||
<AppointmentList doctor={doctor} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user