refactor: update appointment handling to improve data flow and display, including status management and detail views
This commit is contained in:
@@ -7,6 +7,7 @@ import CircularLoading from "@/app/component/loading/Circular";
|
||||
import TextLoading from "@/app/component/loading/Text";
|
||||
import CustomLoading from "@/app/component/loading/Custom";
|
||||
import Pagination from "@/app/component/Pagination";
|
||||
import { convertTimestampToJalali, convertTimestampToTime } from "@/helper";
|
||||
|
||||
function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange }) {
|
||||
const tableHead = [
|
||||
@@ -15,10 +16,9 @@ function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange
|
||||
"تخصص",
|
||||
"تاریخ",
|
||||
"ساعت",
|
||||
"مبلغ (تومان)",
|
||||
"عملیات",
|
||||
];
|
||||
const centerTable = [0, 5];
|
||||
const centerTable = [0, 4];
|
||||
|
||||
return (
|
||||
<div className="!mt-[24px]">
|
||||
@@ -31,7 +31,7 @@ function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange
|
||||
>
|
||||
<TableCell className="!pr-[18px] !text-nowrap" align="center">
|
||||
<TextLoading width={15} height={18} loading={loading}>
|
||||
{idx + 1}
|
||||
{(page - 1) * 10 + idx + 1}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
@@ -39,34 +39,24 @@ function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange
|
||||
component="th"
|
||||
scope="row"
|
||||
>
|
||||
<div className="flex items-center justify-start gap-[8px] !text-nowrap">
|
||||
<CircularLoading width={32} height={32} loading={loading}>
|
||||
<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 width={120} height={18} loading={loading}>
|
||||
{row.doctor?.name || "--"}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
className="!text-start !pr-[18px] !text-nowrap"
|
||||
align="right"
|
||||
>
|
||||
<TextLoading width={50} height={18} loading={loading}>
|
||||
{row.date}
|
||||
<TextLoading width={100} height={18} loading={loading}>
|
||||
{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>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
@@ -74,22 +64,14 @@ function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange
|
||||
align="right"
|
||||
>
|
||||
<TextLoading width={50} height={18} loading={loading}>
|
||||
{row.time}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
className="!text-center !pr-[18px] !text-nowrap"
|
||||
align="right"
|
||||
>
|
||||
<TextLoading width={50} height={18} loading={loading}>
|
||||
{row.amount}
|
||||
{row.slot?.time || convertTimestampToTime(row.start_time)}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] !text-nowrap" align="right">
|
||||
<CustomLoading width={80} height={22} loading={loading}>
|
||||
<Button
|
||||
className="!flex !p-1 !items-center !justify-start !gap-[4px] !text-[14px] !font-bold !text-[#5559CE]"
|
||||
onClick={() => setIsTurnsDetails(true)}
|
||||
onClick={() => setIsTurnsDetails(row)}
|
||||
variant="text"
|
||||
>
|
||||
مشاهده جزئیات
|
||||
|
||||
Reference in New Issue
Block a user