Files
nobat724_front/app/component/date/dateTime/SendAppo.js
T
hamedandClaude Opus 4.8 81121ad7d7 fix(appointment): convert picker timestamp to date and fix summary panel
Follow-ups found while sweeping for stale shapes:
- The date picker emits a unix timestamp, but appointment-slots needs
  Y-m-d; convert with moment before calling (slots never loaded before).
- Appointment summary (information/Detail.js) used the auth-required
  getDoctorAddress and selectedSlot.time; derive the address from the
  loaded doctor.address by location_id and use selectedSlot.start_time.
- SendAppo: drop the dead postAppointment block, unused useParams/loading,
  and a duplicate disabled prop on the button.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 15:47:21 +03:30

40 lines
1.1 KiB
JavaScript

import ArrowLeftB from "@/components/icons/ArrowLeftB";
import { Button } from "@mui/material";
import Cookies from "js-cookie";
function SendAppo({ hour, setStep, setSelectedSlot, date, setSelectedDate }) {
const sendReq = () => {
const isLogged = Cookies.get("access_token");
// ذخیره کردن اطلاعات اسلات انتخاب شده
if (hour && date) {
setSelectedSlot(hour);
setSelectedDate(date);
}
if (isLogged) {
// اگر لاگین کرده، به مرحله 3 (Detail) می‌رود
setStep(3);
} else {
// اگر لاگین نکرده، به مرحله 1 (Login) می‌رود
setStep(1);
}
};
return (
<div className="w-full flex justify-end">
<Button
className="!gap-[4px] !text-[16px] !font-medium !shadow-none !px-[12px] !py-[8px] md:!py-[9px] !w-full md:!w-fit !min-w-[157px]"
variant="contained"
onClick={sendReq}
disabled={!hour}
>
تایید نوبت
<ArrowLeftB />
</Button>
</div>
);
}
export default SendAppo;