The site offered a "personal practice" for a doctor who has no personal address at all — the schedule existed but its shifts pointed at the clinic's address, so there was nowhere to go. The backend now filters those out; this consumes the filtered contract and adds the per-day dimension. - getBookingLocations takes an optional date and the appointment page refetches on it, merging available_on_date into the existing list rather than replacing it, so browsing the calendar never resets the user's choice. - The browsed day had to be lifted out of the Date step: selectedDate is only set once a slot is confirmed, far too late to drive availability. - A location closed on the chosen day renders disabled with «در این روز نوبت ندارد», and when every location is closed the step says so instead of showing an empty slot list. If the already-selected location closes, a notice appears with a link back to the picker — silently showing nothing was the failure mode worth avoiding. - Doctor profile: workLocation in the Physician JSON-LD is limited to addresses that appear in booking_locations, since schema.org presents them as places a patient can attend. The address card still lists the others — they are real practice details — tagged «بدون نوبتدهی آنلاین». Verified end-to-end with a temporary unused address on the test doctor: the visible card listed both and tagged the unused one, while workLocation carried only the bookable one. The row was removed afterwards. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
94 lines
2.7 KiB
JavaScript
94 lines
2.7 KiB
JavaScript
import { useState } from "react";
|
||
import Hour from "./hour";
|
||
import Time from "./Time";
|
||
|
||
function Date({
|
||
doctor,
|
||
setStep,
|
||
disabledDates,
|
||
setSelectedSlot,
|
||
setSelectedDate,
|
||
serviceMode = false,
|
||
selectedServiceUuids = [],
|
||
onChangeService,
|
||
selectedLocation = null,
|
||
clinicUuid = null,
|
||
onChangeLocation,
|
||
onDateChange,
|
||
closedOnDate = false,
|
||
}) {
|
||
const [date, setDate] = useState();
|
||
|
||
const pickDate = (value) => {
|
||
setDate(value);
|
||
onDateChange?.(value);
|
||
};
|
||
|
||
return (
|
||
<div className="w-full lg:w-[61%]">
|
||
<div
|
||
className="p-0 lg:p-[24px] rounded-[8px] border border-solid border-transparent lg:border-[#EFEFEF] bg-transparent lg:bg-[#FFF]"
|
||
>
|
||
{(onChangeLocation || (serviceMode && onChangeService)) && (
|
||
<div className="mb-3 flex flex-wrap items-center gap-x-4 gap-y-1">
|
||
{onChangeLocation && (
|
||
<button
|
||
type="button"
|
||
onClick={onChangeLocation}
|
||
className="text-[13px] text-[#5559CE] hover:underline"
|
||
>
|
||
← تغییر محل{selectedLocation?.title ? ` (${selectedLocation.title})` : ""}
|
||
</button>
|
||
)}
|
||
{serviceMode && onChangeService && (
|
||
<button
|
||
type="button"
|
||
onClick={onChangeService}
|
||
className="text-[13px] text-[#5559CE] hover:underline"
|
||
>
|
||
← تغییر سرویس
|
||
</button>
|
||
)}
|
||
</div>
|
||
)}
|
||
{closedOnDate && (
|
||
<div className="mb-3 rounded-[8px] border border-solid border-[#F17732] bg-[rgba(241,119,50,0.08)] p-[12px]">
|
||
<p className="text-[13px] text-[#B4541F] leading-relaxed">
|
||
«{selectedLocation?.title}» در روز انتخابشده نوبتدهی ندارد.
|
||
{onChangeLocation && (
|
||
<button
|
||
type="button"
|
||
onClick={onChangeLocation}
|
||
className="mr-1 font-medium text-[#5559CE] hover:underline"
|
||
>
|
||
انتخاب محل دیگر
|
||
</button>
|
||
)}
|
||
</p>
|
||
</div>
|
||
)}
|
||
<Time
|
||
setDate={pickDate}
|
||
isStep
|
||
disabledDates={disabledDates}
|
||
clinicUuid={clinicUuid}
|
||
/>
|
||
<Hour
|
||
isStep
|
||
setStep={setStep}
|
||
doctor={doctor}
|
||
date={date}
|
||
setSelectedSlot={setSelectedSlot}
|
||
setSelectedDate={setSelectedDate}
|
||
serviceMode={serviceMode}
|
||
selectedServiceUuids={selectedServiceUuids}
|
||
clinicUuid={clinicUuid}
|
||
selectedLocation={selectedLocation}
|
||
/>
|
||
</div>
|
||
</div>
|
||
);
|
||
}
|
||
|
||
export default Date;
|