refactor: update appointment handling to improve data flow and display, including status management and detail views
This commit is contained in:
@@ -9,7 +9,7 @@ import UserAccountPage from "./userAccount";
|
|||||||
function Content({ matchedCity, params, logged }) {
|
function Content({ matchedCity, params, logged }) {
|
||||||
const [value, setValue] = useState(Number(params?.sidebar) || 0);
|
const [value, setValue] = useState(Number(params?.sidebar) || 0);
|
||||||
const [isOpenSide, setIsOpenSide] = useState();
|
const [isOpenSide, setIsOpenSide] = useState();
|
||||||
const [isTurnsDetails, setIsTurnsDetails] = useState(false);
|
const [isTurnsDetails, setIsTurnsDetails] = useState(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardPage
|
<DashboardPage
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function HeadTab({
|
|||||||
return (
|
return (
|
||||||
<div className="opacity-page">
|
<div className="opacity-page">
|
||||||
{isTurnsDetails ? (
|
{isTurnsDetails ? (
|
||||||
<IsTurnsDetails user={user} setIsTurnsDetails={setIsTurnsDetails} />
|
<IsTurnsDetails appointmentData={isTurnsDetails} setIsTurnsDetails={setIsTurnsDetails} />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className="!w-full">
|
<div className="!w-full">
|
||||||
|
|||||||
@@ -3,23 +3,21 @@ import TextLoading from "@/app/component/loading/Text";
|
|||||||
import ArrowLeftCardD from "@/components/icons/ArrowLeftCardD";
|
import ArrowLeftCardD from "@/components/icons/ArrowLeftCardD";
|
||||||
import { Button } from "@mui/material";
|
import { Button } from "@mui/material";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
import { convertTimestampToJalali, convertTimestampToTime } from "@/helper";
|
||||||
|
|
||||||
function Card({ data, loading, setIsTurnsDetails }) {
|
function Card({ data, loading, setIsTurnsDetails }) {
|
||||||
return (
|
return (
|
||||||
<li className="shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)] pb-[8px] bg-[#FFF] rounded-[8px]">
|
<li className="shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)] pb-[8px] bg-[#FFF] rounded-[8px]">
|
||||||
<div className="flex items-center justify-start gap-[8px] p-[12px]">
|
<div className="flex items-center justify-start gap-[8px] p-[12px]">
|
||||||
<CircularLoading width={32} height={32} loading={loading}>
|
|
||||||
<Image width={32} height={32} alt="profile" src={data.image} />
|
|
||||||
</CircularLoading>
|
|
||||||
<div className="flex flex-col items-start justify-center gap-[8px]">
|
<div className="flex flex-col items-start justify-center gap-[8px]">
|
||||||
<TextLoading loading={loading} width={65} height={18}>
|
<TextLoading loading={loading} width={120} height={18}>
|
||||||
<p className="text-[#616161] text-[14px] font-medium">
|
<p className="text-[#616161] text-[14px] font-medium">
|
||||||
{data.name}
|
{data.doctor?.name || "--"}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading loading={loading} width={50} height={18}>
|
<TextLoading loading={loading} width={100} height={18}>
|
||||||
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
||||||
{data.expertise}
|
{data.doctor?.specialty?.name || "--"}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</div>
|
</div>
|
||||||
@@ -33,7 +31,7 @@ function Card({ data, loading, setIsTurnsDetails }) {
|
|||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading loading={loading} width={110} height={18}>
|
<TextLoading loading={loading} width={110} height={18}>
|
||||||
<p className="text-[#525252] text-[14px] font-medium">
|
<p className="text-[#525252] text-[14px] font-medium">
|
||||||
{data.date}
|
{convertTimestampToJalali(data.start_time)}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</li>
|
</li>
|
||||||
@@ -43,21 +41,16 @@ function Card({ data, loading, setIsTurnsDetails }) {
|
|||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading loading={loading} width={60} height={18}>
|
<TextLoading loading={loading} width={60} height={18}>
|
||||||
<p className="text-[#525252] text-[14px] font-medium">
|
<p className="text-[#525252] text-[14px] font-medium">
|
||||||
{data.time}
|
{data.slot?.time || convertTimestampToTime(data.start_time)}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div className="mt-[12px] flex items-center justify-between px-[12px]">
|
<div className="mt-[12px] flex items-center justify-end px-[12px]">
|
||||||
<TextLoading loading={loading} width={120} height={18}>
|
|
||||||
<p className="text-[#7E7E7E] text-[12px] font-normal">
|
|
||||||
مبلغ پیش پرداخت: {data.amount} تومان
|
|
||||||
</p>
|
|
||||||
</TextLoading>
|
|
||||||
<TextLoading loading={loading} width={80} height={25}>
|
<TextLoading loading={loading} width={80} height={25}>
|
||||||
<Button
|
<Button
|
||||||
className="!flex !p-1 !items-center !justify-end !gap-[2px]"
|
className="!flex !p-1 !items-center !justify-end !gap-[2px]"
|
||||||
onClick={() => setIsTurnsDetails(true)}
|
onClick={() => setIsTurnsDetails(data)}
|
||||||
variant="text"
|
variant="text"
|
||||||
>
|
>
|
||||||
مشاهده
|
مشاهده
|
||||||
|
|||||||
@@ -1,12 +1,37 @@
|
|||||||
import Tabs from "@/app/component/Tabs";
|
import Tabs from "@/app/component/Tabs";
|
||||||
import { Button } from "@mui/material";
|
|
||||||
|
|
||||||
const listTab = ["نوبت های جاری", "نوبت های انجام شده"];
|
const listTab = [
|
||||||
|
"همه",
|
||||||
|
"در انتظار پرداخت",
|
||||||
|
"رزرو شده",
|
||||||
|
"ویزیت شده",
|
||||||
|
"لغو خودکار",
|
||||||
|
"تکمیل شده",
|
||||||
|
];
|
||||||
|
|
||||||
|
function Head({ status, setStatus }) {
|
||||||
|
const statusMap = {
|
||||||
|
0: undefined, // all
|
||||||
|
1: "waiting_for_payment",
|
||||||
|
2: "reserved",
|
||||||
|
3: "visited",
|
||||||
|
4: "auto_cancel_unpaid",
|
||||||
|
5: "completed",
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleChange = (e, value) => {
|
||||||
|
setStatus(statusMap[value]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getCurrentIndex = () => {
|
||||||
|
const entries = Object.entries(statusMap);
|
||||||
|
const found = entries.find(([_, val]) => val === status);
|
||||||
|
return found ? parseInt(found[0]) : 0;
|
||||||
|
};
|
||||||
|
|
||||||
function Head({ isDone, setIsDone }) {
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-start gap-[32px] mt-[24px] sm:mt-[26px] md:mt-[28px] lg:mt-[30px]">
|
<div className="flex items-center justify-start mt-[24px] sm:mt-[26px] md:mt-[28px] lg:mt-[30px]">
|
||||||
<div className="block w-full lg:hidden">
|
<div className="block w-full">
|
||||||
<Tabs
|
<Tabs
|
||||||
style={{
|
style={{
|
||||||
".MuiTabs-indicator": {
|
".MuiTabs-indicator": {
|
||||||
@@ -33,36 +58,13 @@ function Head({ isDone, setIsDone }) {
|
|||||||
}}
|
}}
|
||||||
color="#5559CE"
|
color="#5559CE"
|
||||||
listTab={listTab}
|
listTab={listTab}
|
||||||
value={isDone ? 0 : 1}
|
value={getCurrentIndex()}
|
||||||
handleChange={(e, value) => setIsDone(!!!value)}
|
handleChange={handleChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
|
||||||
className={`!hidden lg:!flex !border !border-solid !py-[8px] !shadow-none !px-[12px] !text-[16px] !font-medium
|
|
||||||
${
|
|
||||||
isDone
|
|
||||||
? "!bg-transparent !border-[#5559CE] !text-[#5559CE]"
|
|
||||||
: "!text-[#EFEFEF] !border-transparent"
|
|
||||||
}`}
|
|
||||||
onClick={() => setIsDone(!isDone)}
|
|
||||||
variant="contained"
|
|
||||||
>
|
|
||||||
نوبت های جاری
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
className={`!hidden lg:!flex !border !border-solid !py-[8px] !shadow-none !px-[12px] !text-[16px] !font-medium
|
|
||||||
${
|
|
||||||
!isDone
|
|
||||||
? "!bg-transparent !border-[#5559CE] !text-[#5559CE]"
|
|
||||||
: "!text-[#EFEFEF] !border-transparent"
|
|
||||||
}`}
|
|
||||||
onClick={() => setIsDone(!isDone)}
|
|
||||||
variant="contained"
|
|
||||||
>
|
|
||||||
نوبت های انجام شده
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Head;
|
export default Head;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import CircularLoading from "@/app/component/loading/Circular";
|
|||||||
import TextLoading from "@/app/component/loading/Text";
|
import TextLoading from "@/app/component/loading/Text";
|
||||||
import CustomLoading from "@/app/component/loading/Custom";
|
import CustomLoading from "@/app/component/loading/Custom";
|
||||||
import Pagination from "@/app/component/Pagination";
|
import Pagination from "@/app/component/Pagination";
|
||||||
|
import { convertTimestampToJalali, convertTimestampToTime } from "@/helper";
|
||||||
|
|
||||||
function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange }) {
|
function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange }) {
|
||||||
const tableHead = [
|
const tableHead = [
|
||||||
@@ -15,10 +16,9 @@ function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange
|
|||||||
"تخصص",
|
"تخصص",
|
||||||
"تاریخ",
|
"تاریخ",
|
||||||
"ساعت",
|
"ساعت",
|
||||||
"مبلغ (تومان)",
|
|
||||||
"عملیات",
|
"عملیات",
|
||||||
];
|
];
|
||||||
const centerTable = [0, 5];
|
const centerTable = [0, 4];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="!mt-[24px]">
|
<div className="!mt-[24px]">
|
||||||
@@ -31,7 +31,7 @@ function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange
|
|||||||
>
|
>
|
||||||
<TableCell className="!pr-[18px] !text-nowrap" align="center">
|
<TableCell className="!pr-[18px] !text-nowrap" align="center">
|
||||||
<TextLoading width={15} height={18} loading={loading}>
|
<TextLoading width={15} height={18} loading={loading}>
|
||||||
{idx + 1}
|
{(page - 1) * 10 + idx + 1}
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell
|
<TableCell
|
||||||
@@ -39,34 +39,24 @@ function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange
|
|||||||
component="th"
|
component="th"
|
||||||
scope="row"
|
scope="row"
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-start gap-[8px] !text-nowrap">
|
<TextLoading width={120} height={18} loading={loading}>
|
||||||
<CircularLoading width={32} height={32} loading={loading}>
|
{row.doctor?.name || "--"}
|
||||||
<Image
|
|
||||||
src={row.image}
|
|
||||||
alt="doctor"
|
|
||||||
height={32}
|
|
||||||
width={32}
|
|
||||||
/>
|
|
||||||
</CircularLoading>
|
|
||||||
<TextLoading width={40} height={18} loading={loading}>
|
|
||||||
{row.name}
|
|
||||||
</TextLoading>
|
|
||||||
</div>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell
|
|
||||||
className="!text-start !pr-[18px] !text-nowrap"
|
|
||||||
align="right"
|
|
||||||
>
|
|
||||||
<TextLoading width={50} height={18} loading={loading}>
|
|
||||||
{row.expertise}
|
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell
|
<TableCell
|
||||||
className="!text-start !pr-[18px] !text-nowrap"
|
className="!text-start !pr-[18px] !text-nowrap"
|
||||||
align="right"
|
align="right"
|
||||||
>
|
>
|
||||||
<TextLoading width={50} height={18} loading={loading}>
|
<TextLoading width={100} height={18} loading={loading}>
|
||||||
{row.date}
|
{row.doctor?.specialty?.name || "--"}
|
||||||
|
</TextLoading>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell
|
||||||
|
className="!text-start !pr-[18px] !text-nowrap"
|
||||||
|
align="right"
|
||||||
|
>
|
||||||
|
<TextLoading width={80} height={18} loading={loading}>
|
||||||
|
{convertTimestampToJalali(row.start_time)}
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell
|
<TableCell
|
||||||
@@ -74,22 +64,14 @@ function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange
|
|||||||
align="right"
|
align="right"
|
||||||
>
|
>
|
||||||
<TextLoading width={50} height={18} loading={loading}>
|
<TextLoading width={50} height={18} loading={loading}>
|
||||||
{row.time}
|
{row.slot?.time || convertTimestampToTime(row.start_time)}
|
||||||
</TextLoading>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell
|
|
||||||
className="!text-center !pr-[18px] !text-nowrap"
|
|
||||||
align="right"
|
|
||||||
>
|
|
||||||
<TextLoading width={50} height={18} loading={loading}>
|
|
||||||
{row.amount}
|
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="!pr-[18px] !text-nowrap" align="right">
|
<TableCell className="!pr-[18px] !text-nowrap" align="right">
|
||||||
<CustomLoading width={80} height={22} loading={loading}>
|
<CustomLoading width={80} height={22} loading={loading}>
|
||||||
<Button
|
<Button
|
||||||
className="!flex !p-1 !items-center !justify-start !gap-[4px] !text-[14px] !font-bold !text-[#5559CE]"
|
className="!flex !p-1 !items-center !justify-start !gap-[4px] !text-[14px] !font-bold !text-[#5559CE]"
|
||||||
onClick={() => setIsTurnsDetails(true)}
|
onClick={() => setIsTurnsDetails(row)}
|
||||||
variant="text"
|
variant="text"
|
||||||
>
|
>
|
||||||
مشاهده جزئیات
|
مشاهده جزئیات
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { request } from "@/services/response";
|
|||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
function Turns({ user, setIsTurnsDetails, loading }) {
|
function Turns({ user, setIsTurnsDetails, loading }) {
|
||||||
const [isDone, setIsDone] = useState(true);
|
const [status, setStatus] = useState(undefined);
|
||||||
const [appointments, setAppointments] = useState([]);
|
const [appointments, setAppointments] = useState([]);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
@@ -31,16 +31,27 @@ function Turns({ user, setIsTurnsDetails, loading }) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await request.getMyAppointments(userId, {
|
const params = {
|
||||||
page,
|
page,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
params.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await request.getMyAppointments(userId, params);
|
||||||
|
|
||||||
if (response?.data) {
|
if (response?.data) {
|
||||||
setAppointments(response.data);
|
setAppointments(response.data);
|
||||||
if (response.page) {
|
if (response.page) {
|
||||||
setTotalPages(response.page.totalPages);
|
setTotalPages(response.page.totalPages || 1);
|
||||||
|
} else {
|
||||||
|
setTotalPages(1);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setAppointments([]);
|
||||||
|
setTotalPages(1);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching appointments:", error);
|
console.error("Error fetching appointments:", error);
|
||||||
@@ -50,18 +61,23 @@ function Turns({ user, setIsTurnsDetails, loading }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchAppointments();
|
fetchAppointments();
|
||||||
}, [page]);
|
}, [page, status]);
|
||||||
|
|
||||||
const handlePageChange = (event, value) => {
|
const handlePageChange = (event, value) => {
|
||||||
setPage(value);
|
setPage(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleStatusChange = (newStatus) => {
|
||||||
|
setStatus(newStatus);
|
||||||
|
setPage(1); // Reset to first page when status changes
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="opacity-page">
|
<div className="opacity-page">
|
||||||
<p className="text-[#3B3B3B] hidden md:flex text-[16px] font-bold">
|
<p className="text-[#3B3B3B] hidden md:flex text-[16px] font-bold">
|
||||||
تاریخچه نوبت ها
|
تاریخچه نوبت ها
|
||||||
</p>
|
</p>
|
||||||
<Head isDone={isDone} setIsDone={setIsDone} />
|
<Head status={status} setStatus={handleStatusChange} />
|
||||||
<List
|
<List
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
setIsTurnsDetails={setIsTurnsDetails}
|
setIsTurnsDetails={setIsTurnsDetails}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import CircularLoading from "@/app/component/loading/Circular";
|
|
||||||
import TextLoading from "@/app/component/loading/Text";
|
import TextLoading from "@/app/component/loading/Text";
|
||||||
import CalendarD from "@/components/icons/CalendarD";
|
import CalendarD from "@/components/icons/CalendarD";
|
||||||
import CallD from "@/components/icons/CallD";
|
import CallD from "@/components/icons/CallD";
|
||||||
@@ -6,35 +5,24 @@ import ClockClinic from "@/components/icons/ClockClinic";
|
|||||||
import DownloadD from "@/components/icons/DownloadD";
|
import DownloadD from "@/components/icons/DownloadD";
|
||||||
import LocationClinic from "@/components/icons/LocationClinic";
|
import LocationClinic from "@/components/icons/LocationClinic";
|
||||||
import RoutingC from "@/components/icons/RoutingC";
|
import RoutingC from "@/components/icons/RoutingC";
|
||||||
import TicketD from "@/components/icons/TicketD";
|
|
||||||
import { Button } from "@mui/material";
|
import { Button } from "@mui/material";
|
||||||
import Image from "next/image";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { convertTimestampToJalali, convertTimestampToTime } from "@/helper";
|
||||||
|
|
||||||
function DetailLg({ user, loading }) {
|
function DetailLg({ appointmentData, loading }) {
|
||||||
const data = user.turns.done[1];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="lg:mt-[18px] hidden md:block">
|
<div className="lg:mt-[18px] hidden md:block">
|
||||||
<div className="flex md:mt-[24px] lg:mt-0 items-center justify-start gap-[8px] md:gap-[12px] lg:gap-[16px]">
|
<div className="flex md:mt-[24px] lg:mt-0 items-center justify-start gap-[8px] md:gap-[12px] lg:gap-[16px]">
|
||||||
<CircularLoading width={95} height={95} loading={loading}>
|
|
||||||
<Image
|
|
||||||
width={95}
|
|
||||||
height={95}
|
|
||||||
alt="profile"
|
|
||||||
src={data.image}
|
|
||||||
className="w-[32px] h-[32px] sm:w-[53px] sm:h-[53px] md:w-[74px] md:h-[74px] lg:w-[95px] lg:h-[95px]"
|
|
||||||
/>
|
|
||||||
</CircularLoading>
|
|
||||||
<div className="flex flex-col items-start justify-center gap-[20px]">
|
<div className="flex flex-col items-start justify-center gap-[20px]">
|
||||||
<TextLoading loading={loading} width={70} height={18}>
|
<TextLoading loading={loading} width={70} height={18}>
|
||||||
<p className="text-[#3B3B3B] text-[14px] sm:text-[16px] md:text-[18px] lg:text-[20px] font-medium">
|
<p className="text-[#3B3B3B] text-[14px] sm:text-[16px] md:text-[18px] lg:text-[20px] font-medium">
|
||||||
{data.name}
|
{appointmentData?.doctor?.name}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading loading={loading} width={80} height={18}>
|
<TextLoading loading={loading} width={80} height={18}>
|
||||||
<p className="text-[#616161] text-[14px] md:text-[15px] lg:text-[16px] font-medium">
|
<p className="text-[#616161] text-[14px] md:text-[15px] lg:text-[16px] font-medium">
|
||||||
تخصص: {data.expertise}
|
تخصص: {appointmentData?.doctor?.specialty?.name}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</div>
|
</div>
|
||||||
@@ -47,7 +35,7 @@ function DetailLg({ user, loading }) {
|
|||||||
<p className="text-[#616161] text-[14px] lg:text-[20px] font-medium">
|
<p className="text-[#616161] text-[14px] lg:text-[20px] font-medium">
|
||||||
تاریخ نوبت:{" "}
|
تاریخ نوبت:{" "}
|
||||||
<span className="text-[#2F2F2F] text-[14px] lg:text-[20px] font-bold">
|
<span className="text-[#2F2F2F] text-[14px] lg:text-[20px] font-bold">
|
||||||
{data.date_turn}
|
{convertTimestampToJalali(appointmentData?.start_time)}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -58,7 +46,7 @@ function DetailLg({ user, loading }) {
|
|||||||
<p className="text-[#616161] text-[14px] lg:text-[20px] font-medium">
|
<p className="text-[#616161] text-[14px] lg:text-[20px] font-medium">
|
||||||
زمان نوبت:{" "}
|
زمان نوبت:{" "}
|
||||||
<span className="text-[#2F2F2F] text-[14px] lg:text-[20px] font-bold">
|
<span className="text-[#2F2F2F] text-[14px] lg:text-[20px] font-bold">
|
||||||
ساعت {data.time}
|
ساعت {appointmentData?.slot?.time}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -71,13 +59,17 @@ function DetailLg({ user, loading }) {
|
|||||||
<p className="text-[#616161] text-[14px] lg:text-[16px] font-normal">
|
<p className="text-[#616161] text-[14px] lg:text-[16px] font-normal">
|
||||||
آدرس:{" "}
|
آدرس:{" "}
|
||||||
<span className="text-[#2F2F2F] text-[14px] lg:text-[16px] font-normal">
|
<span className="text-[#2F2F2F] text-[14px] lg:text-[16px] font-normal">
|
||||||
{data.location}
|
{appointmentData?.address?.address}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading loading={loading} width={120} height={30}>
|
<TextLoading loading={loading} width={120} height={30}>
|
||||||
<Button className="!py-[8px] !px-[12px] !gap-[8px]" variant="text">
|
<Button
|
||||||
|
className="!py-[8px] !px-[12px] !gap-[8px]"
|
||||||
|
variant="text"
|
||||||
|
onClick={() => appointmentData?.address?.map && window.open(appointmentData.address.map, '_blank')}
|
||||||
|
>
|
||||||
<RoutingC />
|
<RoutingC />
|
||||||
<p className="text-[#5559CE] text-[14px] font-medium">
|
<p className="text-[#5559CE] text-[14px] font-medium">
|
||||||
مسیریابی آدرس
|
مسیریابی آدرس
|
||||||
@@ -91,23 +83,12 @@ function DetailLg({ user, loading }) {
|
|||||||
<p className="text-[#616161] text-[14px] lg:text-[16px] font-normal">
|
<p className="text-[#616161] text-[14px] lg:text-[16px] font-normal">
|
||||||
تلفن:{" "}
|
تلفن:{" "}
|
||||||
<span className="text-[#2F2F2F] text-[14px] lg:text-[16px] font-normal">
|
<span className="text-[#2F2F2F] text-[14px] lg:text-[16px] font-normal">
|
||||||
{data.phone}
|
{appointmentData?.address?.phone}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</ul>
|
</ul>
|
||||||
<div className="flex items-center gap-[4px] w-fit">
|
|
||||||
<TextLoading loading={loading} width={150} height={18}>
|
|
||||||
<TicketD />
|
|
||||||
<p className="text-[#616161] text-[14px] lg:text-[20px] font-medium">
|
|
||||||
مبلغ پرداخت شده :{" "}
|
|
||||||
<span className="text-[#2F2F2F] text-[14px] lg:text-[20px] font-bold">
|
|
||||||
{data.amount_paid} تومان
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</TextLoading>
|
|
||||||
</div>
|
|
||||||
<Button
|
<Button
|
||||||
className="!px-[12px] !hidden md:!flex !mt-[24px] !py-[8px] !border !border-solid !border-[#D7D7D7] !rounded-[4px] !w-fit !items-center !justify-center !gap-[4px]"
|
className="!px-[12px] !hidden md:!flex !mt-[24px] !py-[8px] !border !border-solid !border-[#D7D7D7] !rounded-[4px] !w-fit !items-center !justify-center !gap-[4px]"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
|
|||||||
@@ -1,30 +1,24 @@
|
|||||||
import RoutingC from "@/components/icons/RoutingC";
|
import RoutingC from "@/components/icons/RoutingC";
|
||||||
import TicketD from "@/components/icons/TicketD";
|
|
||||||
import { Button } from "@mui/material";
|
import { Button } from "@mui/material";
|
||||||
import Image from "next/image";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import ButtonData from "./ButtonData";
|
import ButtonData from "./ButtonData";
|
||||||
import CircularLoading from "@/app/component/loading/Circular";
|
|
||||||
import TextLoading from "@/app/component/loading/Text";
|
import TextLoading from "@/app/component/loading/Text";
|
||||||
|
import { convertTimestampToJalali } from "@/helper";
|
||||||
|
|
||||||
function DetailSm({ user, loading }) {
|
function DetailSm({ appointmentData, loading }) {
|
||||||
const data = user.turns.done[1];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-[20px] block md:hidden">
|
<div className="mt-[20px] block md:hidden">
|
||||||
<div className="flex items-center justify-start gap-[8px]">
|
<div className="flex items-center justify-start gap-[8px]">
|
||||||
<CircularLoading width={32} height={32} loading={loading}>
|
|
||||||
<Image src={data.image} alt="profile" height={32} width={32} />
|
|
||||||
</CircularLoading>
|
|
||||||
<div className="flex flex-col justify-center items-start gap-[8px]">
|
<div className="flex flex-col justify-center items-start gap-[8px]">
|
||||||
<TextLoading loading={loading} width={60} height={14}>
|
<TextLoading loading={loading} width={60} height={14}>
|
||||||
<p className="text-[#616161] text-[14px] font-medium">
|
<p className="text-[#616161] text-[14px] font-medium">
|
||||||
{data.name}
|
{appointmentData?.doctor?.name}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading loading={loading} width={70} height={14}>
|
<TextLoading loading={loading} width={70} height={14}>
|
||||||
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
||||||
{data.expertise}
|
{appointmentData?.doctor?.specialty?.name}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,7 +32,7 @@ function DetailSm({ user, loading }) {
|
|||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading loading={loading} width={55} height={16}>
|
<TextLoading loading={loading} width={55} height={16}>
|
||||||
<p className="text-[#525252] text-[16px] font-medium">
|
<p className="text-[#525252] text-[16px] font-medium">
|
||||||
{data.date}
|
{convertTimestampToJalali(appointmentData?.start_time)}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</li>
|
</li>
|
||||||
@@ -49,7 +43,7 @@ function DetailSm({ user, loading }) {
|
|||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading loading={loading} width={60} height={16}>
|
<TextLoading loading={loading} width={60} height={16}>
|
||||||
<p className="text-[#525252] text-[16px] font-medium">
|
<p className="text-[#525252] text-[16px] font-medium">
|
||||||
{data.time}
|
{appointmentData?.slot?.time}
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
</li>
|
</li>
|
||||||
@@ -57,13 +51,14 @@ function DetailSm({ user, loading }) {
|
|||||||
<li className="flex flex-wrap gap-x-[12px] gap-y-[12px] items-center w-full justify-between">
|
<li className="flex flex-wrap gap-x-[12px] gap-y-[12px] items-center w-full justify-between">
|
||||||
<TextLoading loading={loading} width={200} height={16}>
|
<TextLoading loading={loading} width={200} height={16}>
|
||||||
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
||||||
آدرس:<span className="text-[#616161]">{data.location}</span>
|
آدرس:<span className="text-[#616161]">{appointmentData?.address?.address}</span>
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
<TextLoading loading={loading} width={130} height={40}>
|
<TextLoading loading={loading} width={130} height={40}>
|
||||||
<Button
|
<Button
|
||||||
className="!py-[8px] !border-[#EFEFEF] !px-[12px] !gap-[8px]"
|
className="!py-[8px] !border-[#EFEFEF] !px-[12px] !gap-[8px]"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
|
onClick={() => appointmentData?.address?.map && window.open(appointmentData.address.map, '_blank')}
|
||||||
>
|
>
|
||||||
<RoutingC />
|
<RoutingC />
|
||||||
<p className="text-[#5559CE] text-[14px] font-medium">
|
<p className="text-[#5559CE] text-[14px] font-medium">
|
||||||
@@ -74,28 +69,9 @@ function DetailSm({ user, loading }) {
|
|||||||
</li>
|
</li>
|
||||||
<TextLoading loading={loading} width={100} height={18}>
|
<TextLoading loading={loading} width={100} height={18}>
|
||||||
<p className="text-[#7E7E7E] text-[14px] font-normal mt-[12px]">
|
<p className="text-[#7E7E7E] text-[14px] font-normal mt-[12px]">
|
||||||
تلفن: <span className="text-[#616161]">{data.phone}</span>
|
تلفن: <span className="text-[#616161]">{appointmentData?.address?.phone}</span>
|
||||||
</p>
|
</p>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
<span className="block w-full h-px bg-[#EFEFEF] mt-[12px] mb-[16px]"></span>
|
|
||||||
<li className="flex items-center justify-between w-full">
|
|
||||||
<TextLoading loading={loading} width={120} height={18}>
|
|
||||||
<div className="flex items-center gap-[4px] w-fit">
|
|
||||||
<TicketD />
|
|
||||||
<p className="text-[#616161] text-[14px] lg:text-[20px] font-medium">
|
|
||||||
مبلغ پرداخت شده :{" "}
|
|
||||||
<span className="text-[#2F2F2F] text-[14px] lg:text-[20px] font-bold">
|
|
||||||
{data.amount_paid} تومان
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</TextLoading>
|
|
||||||
<TextLoading loading={loading} width={60} height={18}>
|
|
||||||
<p className="text-[#616161] text-[14px] font-bold">
|
|
||||||
{data.amount_paid} تومان
|
|
||||||
</p>
|
|
||||||
</TextLoading>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<ButtonData loading={loading} />
|
<ButtonData loading={loading} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ function Head({ setIsTurnsDetails }) {
|
|||||||
<div className="hidden md:flex flex-wrap gap-x-[24px] gap-y-[12px] items-center justify-between">
|
<div className="hidden md:flex flex-wrap gap-x-[24px] gap-y-[12px] items-center justify-between">
|
||||||
<div className="flex items-center justify-start gap-[12px] sm:gap-[16px] md:gap-[20px] lg:gap-[24px]">
|
<div className="flex items-center justify-start gap-[12px] sm:gap-[16px] md:gap-[20px] lg:gap-[24px]">
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setIsTurnsDetails(false)}
|
onClick={() => setIsTurnsDetails(null)}
|
||||||
className="!p-[6px] !border !border-solid !border-[#EFEFEF] !rounded-[4px] !min-w-0"
|
className="!p-[6px] !border !border-solid !border-[#EFEFEF] !rounded-[4px] !min-w-0"
|
||||||
>
|
>
|
||||||
<ArrowRightS />
|
<ArrowRightS />
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import DetailLg from "./DetailLg";
|
|||||||
import DetailSm from "./DetailSm";
|
import DetailSm from "./DetailSm";
|
||||||
import Head from "./Head";
|
import Head from "./Head";
|
||||||
|
|
||||||
function IsTurnsDetails({ user, setIsTurnsDetails }) {
|
function IsTurnsDetails({ appointmentData, setIsTurnsDetails }) {
|
||||||
return (
|
return (
|
||||||
<div className="md:py-[20px] md:px-[24px] opacity-page">
|
<div className="md:py-[20px] md:px-[24px] opacity-page">
|
||||||
<Head setIsTurnsDetails={setIsTurnsDetails} />
|
<Head setIsTurnsDetails={setIsTurnsDetails} />
|
||||||
<DetailLg user={user} loading={false} />
|
<DetailLg appointmentData={appointmentData} loading={false} />
|
||||||
<DetailSm user={user} loading={false} />
|
<DetailSm appointmentData={appointmentData} loading={false} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user