diff --git a/components/dashboard/userAccount/sidebars/turns/Card.js b/components/dashboard/userAccount/sidebars/turns/Card.js index a7d76d3..5f09ddc 100644 --- a/components/dashboard/userAccount/sidebars/turns/Card.js +++ b/components/dashboard/userAccount/sidebars/turns/Card.js @@ -5,6 +5,16 @@ import { Button } from "@mui/material"; import Image from "next/image"; import { convertTimestampToJalali, convertTimestampToTime } from "@/helper"; +const STATUS_LABELS = { + pending: "در انتظار پرداخت", + confirmed: "تأیید شده", + completed: "انجام شده", + cancelled_by_user: "لغو شده", + cancelled_by_doctor: "لغو توسط پزشک", + expired: "منقضی شده", + no_show: "عدم مراجعه", +}; + function Card({ data, loading, setIsTurnsDetails }) { return (
  • @@ -17,7 +27,7 @@ function Card({ data, loading, setIsTurnsDetails }) {

    - {data.doctor?.specialty?.name || "--"} + {STATUS_LABELS[data.status] || data.status || "--"}

    @@ -31,7 +41,7 @@ function Card({ data, loading, setIsTurnsDetails }) {

    - {convertTimestampToJalali(data.start_time)} + {convertTimestampToJalali(data.slot_start)}

  • @@ -41,7 +51,7 @@ function Card({ data, loading, setIsTurnsDetails }) {

    - {data.slot?.time || convertTimestampToTime(data.start_time)} + {convertTimestampToTime(data.slot_start)}

    diff --git a/components/dashboard/userAccount/sidebars/turns/List.js b/components/dashboard/userAccount/sidebars/turns/List.js index 0281b91..a0672e5 100644 --- a/components/dashboard/userAccount/sidebars/turns/List.js +++ b/components/dashboard/userAccount/sidebars/turns/List.js @@ -9,17 +9,35 @@ import CustomLoading from "@/app/component/loading/Custom"; import Pagination from "@/app/component/Pagination"; import { convertTimestampToJalali, convertTimestampToTime } from "@/helper"; +const STATUS_LABELS = { + pending: "در انتظار پرداخت", + confirmed: "تأیید شده", + completed: "انجام شده", + cancelled_by_user: "لغو شده", + cancelled_by_doctor: "لغو توسط پزشک", + expired: "منقضی شده", + no_show: "عدم مراجعه", +}; + function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange }) { const tableHead = [ "ردیف", "نام پزشک", - "تخصص", "تاریخ", "ساعت", + "وضعیت", "عملیات", ]; const centerTable = [0, 4]; + if (!loading && (!Array.isArray(user) || user.length === 0)) { + return ( +

    + نوبتی ثبت نکرده‌اید. +

    + ); + } + return (
    @@ -43,20 +61,12 @@ function List({ user, loading, setIsTurnsDetails, page, totalPages, onPageChange {row.doctor?.name || "--"} - - - {row.doctor?.specialty?.name || "--"} - - - {convertTimestampToJalali(row.start_time)} + {convertTimestampToJalali(row.slot_start)} - {row.slot?.time || convertTimestampToTime(row.start_time)} + {convertTimestampToTime(row.slot_start)} + + + + + {STATUS_LABELS[row.status] || row.status || "--"}