Files
nobat724_front/components/dashboard/userAccount/sidebars/turns/Head.js
T
hamedandClaude Opus 4.8 7949da9ba9 fix(appointment): real status filter + required account fields
- My-appointments tabs sent invalid status values (reserved/waiting_for_payment/
  ...) that don't exist in the backend, so every tab but "all" returned empty.
  Map tabs to real statuses (pending/confirmed/completed/cancelled_by_user/
  expired) so booked appointments show up.
- Booking form now validates required account fields before proceeding to
  payment (national_code 10 digits, name, family, gender, basic_insurance),
  in both self and other-person modes, surfacing per-field errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 10:45:41 +03:30

71 lines
1.7 KiB
JavaScript

import Tabs from "@/app/component/Tabs";
const listTab = [
"همه",
"در انتظار پرداخت",
"تأیید شده",
"انجام شده",
"لغو شده",
"منقضی شده",
];
function Head({ status, setStatus }) {
const statusMap = {
0: undefined, // all
1: "pending",
2: "confirmed",
3: "completed",
4: "cancelled_by_user",
5: "expired",
};
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;
};
return (
<div className="flex items-center justify-start mt-[24px] sm:mt-[26px] md:mt-[28px] lg:mt-[30px]">
<div className="block w-full">
<Tabs
style={{
".MuiTabs-indicator": {
height: "2px",
borderRadius: "16px",
background: "#5559CE",
},
"& .MuiButtonBase-root": {
color: "#7E7E7E",
fontSize: "14px",
fontStyle: "normal",
fontWeight: "700",
},
"& .MuiTabs-flexContainer": {
paddingRight: "15px",
paddingLeft: "15px",
},
"& .mui-11pdt05-MuiButtonBase-root-MuiTab-root.Mui-selected": {
color: "#5559CE !important",
},
"& .MuiButtonBase-root.Mui-selected": {
color: "#5559CE !important",
},
}}
color="#5559CE"
listTab={listTab}
value={getCurrentIndex()}
handleChange={handleChange}
/>
</div>
</div>
);
}
export default Head;