feat(appointment): implement service-based booking flow with service selection and slot adaptation

This commit is contained in:
hamed
2026-07-15 23:48:40 +03:30
parent d5845bf84d
commit 165a0a2240
11 changed files with 337 additions and 33 deletions
+16
View File
@@ -14,6 +14,22 @@ export function adaptSlots(slotsResponse) {
}));
}
// حالت سرویسی: پاسخ appointment-service-slots فقط start_times دارد (همه کافی).
// آن‌ها را در یک session قالب‌بندی می‌کنیم تا مثل حالت اسلاتی رندر شوند.
export function adaptServiceSlots(slotsResponse) {
const starts =
slotsResponse?.data?.start_times ?? slotsResponse?.start_times ?? [];
if (!starts.length) return [];
return [
{
start_time: starts[0].start_time,
end_time: starts[starts.length - 1].start_time,
label: "زمان‌های خالی",
slots: starts.map((s) => ({ ...s, is_available: true })),
},
];
}
export function hasAvailable(slots) {
return Array.isArray(slots) && slots.some((slot) => slot.is_available);
}