diff --git a/src/components/booking/BookingOrderSummary.vue b/src/components/booking/BookingOrderSummary.vue index 63b186e..2e8f289 100644 --- a/src/components/booking/BookingOrderSummary.vue +++ b/src/components/booking/BookingOrderSummary.vue @@ -5,8 +5,11 @@

خلاصه سفارش

-

- کلاس {{ classTitle }} +

+ کلاس خدمات: {{ classTitle }}

+ +
+

انتخاب‌های شما

+
+
+
کلاس خدمات
+
{{ selectedClassTitle }}
+
+
+
خدمات
+
{{ selectedServiceTitle }}
+
+
+
زمان
+
{{ scheduledLabel }}
+
+
+
مبلغ
+
+ {{ formatPriceToman(selectedPrice) }} تومان +
+
+
+
+

{{ currentStepLabel }}

بررسی نهایی

-
+
کلاس
{{ selectedClassTitle }}
@@ -169,7 +203,7 @@ class="hidden flex-wrap items-center justify-between gap-3 lg:flex" >
Boolean(props.business.serviceClassesEnabled) && serviceClasses.value.length > 0, ); +const firstBookingStep = computed(() => { + if (!classStepRequired.value) return 2; + if (serviceClasses.value.length <= 1) return 2; + return 1; +}); + +const showSelectionRecap = computed( + () => + currentStep.value >= 2 && + (Boolean(selectedClassTitle.value) || + selectedServices.value.length > 0 || + Boolean(scheduledAt.value)), +); + const classesEnabled = computed(() => Boolean(props.business.serviceClassesEnabled)); const perClass = computed( @@ -503,6 +551,9 @@ async function loadClasses() { if (serviceClasses.value.length === 1) { selectedClassId.value = serviceClasses.value[0].id; } + if (currentStep.value < firstBookingStep.value) { + currentStep.value = firstBookingStep.value; + } } catch (e) { classesError.value = e instanceof ApiError ? e.message : 'بارگذاری کلاس‌های خدمات ناموفق بود'; @@ -542,7 +593,7 @@ function applyEarliestSlot() { } function goBack() { - if (currentStep.value > 1) { + if (currentStep.value > firstBookingStep.value) { currentStep.value -= 1; bookingError.value = ''; } diff --git a/src/views/app/AppOwnerView.vue b/src/views/app/AppOwnerView.vue index b8ec114..e60f4cb 100644 --- a/src/views/app/AppOwnerView.vue +++ b/src/views/app/AppOwnerView.vue @@ -90,7 +90,7 @@ type="button" class="flex w-full items-center justify-between gap-3 rounded-2xl border border-border bg-surface-2 px-4 py-3 text-start transition hover:border-brand-500/30" :aria-expanded="bookingExpanded" - @click="bookingExpanded = !bookingExpanded" + @click="bookingExpanded = !bookingExpanded; bookingMessage = ''; bookingError = ''" >
@@ -108,6 +108,19 @@ /> +

+ {{ bookingMessage }} +

+

+ {{ bookingError }} +

+
20) { - error.value = 'پذیرش همزمان باید عددی بین ۱ تا ۲۰ باشد.'; + bookingError.value = 'پذیرش همزمان باید عددی بین ۱ تا ۲۰ باشد.'; + bookingMessage.value = ''; return; } const slotStepMinutes = Number.parseInt(bookingForm.value.slotStepMinutes, 10); if (!Number.isFinite(slotStepMinutes) || slotStepMinutes < 5 || slotStepMinutes > 120) { - error.value = 'گام نوبت‌دهی باید عددی بین ۵ تا ۱۲۰ دقیقه باشد.'; + bookingError.value = 'گام نوبت‌دهی باید عددی بین ۵ تا ۱۲۰ دقیقه باشد.'; + bookingMessage.value = ''; return; } savingBooking.value = true; + bookingError.value = ''; + bookingMessage.value = ''; error.value = ''; message.value = ''; try { @@ -796,9 +815,11 @@ async function onSaveBookingSettings() { autoApproveBookings: bookingForm.value.autoApproveBookings, }); tenant.syncSingleBusiness(business.value); + bookingMessage.value = 'تنظیمات نوبت‌دهی ذخیره شد.'; + bookingExpanded.value = false; message.value = 'تنظیمات نوبت‌دهی ذخیره شد.'; } catch (e) { - error.value = e instanceof ApiError ? e.message : 'خطا در ذخیره'; + bookingError.value = e instanceof ApiError ? e.message : 'خطا در ذخیره'; } finally { savingBooking.value = false; }