style: fix prefer-const and prettier formatting issues
This commit is contained in:
@@ -89,57 +89,57 @@
|
||||
);
|
||||
let placeholderDate = $state<CalendarDate>(minDate);
|
||||
|
||||
let hoursUntilAppointment = $derived(
|
||||
const hoursUntilAppointment = $derived(
|
||||
(new SvelteDate(booking.start_time).getTime() - new SvelteDate().getTime()) / (1000 * 60 * 60)
|
||||
);
|
||||
let hasPayments = $derived((booking.amount_paid ?? 0) > 0);
|
||||
let noticePeriodBlocked = $derived(
|
||||
const hasPayments = $derived((booking.amount_paid ?? 0) > 0);
|
||||
const noticePeriodBlocked = $derived(
|
||||
hasPayments ? hoursUntilAppointment < 72 : hoursUntilAppointment < 24
|
||||
);
|
||||
let noticePeriodWarning = $derived(
|
||||
const noticePeriodWarning = $derived(
|
||||
!hasPayments && hoursUntilAppointment < 24 && hoursUntilAppointment >= 0
|
||||
);
|
||||
let noticeBlockedMessage = $derived(
|
||||
const noticeBlockedMessage = $derived(
|
||||
hasPayments
|
||||
? 'This booking has payments and is too close to the original appointment to reschedule online.'
|
||||
: 'This booking is too close to the original appointment time to reschedule online.'
|
||||
);
|
||||
|
||||
let discountTotal = $derived(
|
||||
const discountTotal = $derived(
|
||||
booking.discounts?.reduce((sum, d) => sum + d.discount_amount, 0) ?? 0
|
||||
);
|
||||
|
||||
let bookingTotalDuration = $derived(
|
||||
const bookingTotalDuration = $derived(
|
||||
booking.services?.reduce(
|
||||
(sum, s) => sum + (s.override_duration_minutes ?? s.duration_minutes ?? 0),
|
||||
0
|
||||
) || 0
|
||||
);
|
||||
|
||||
let selectedServicesDuration = $derived(
|
||||
const selectedServicesDuration = $derived(
|
||||
selectedServices.reduce((sum, s) => sum + (s.duration_minutes ?? 0), 0)
|
||||
);
|
||||
|
||||
let hasOverrides = $derived(
|
||||
const hasOverrides = $derived(
|
||||
booking?.services?.some(
|
||||
(s) => s.override_price != null || s.override_duration_minutes != null
|
||||
) ?? false
|
||||
);
|
||||
|
||||
let slotDuration = $derived(
|
||||
const slotDuration = $derived(
|
||||
editMode === 'time' ? bookingTotalDuration : selectedServicesDuration
|
||||
);
|
||||
|
||||
let canSubmit = $derived(
|
||||
const canSubmit = $derived(
|
||||
submitting === false &&
|
||||
((editMode === 'time' && !!newDate && newTime.length >= 4) ||
|
||||
(editMode === 'services' && selectedServices.length > 0) ||
|
||||
(editMode === 'both-time' && !!newDate && newTime.length >= 4))
|
||||
);
|
||||
|
||||
let notesChanged = $derived(notes.trim() !== originalNotes.trim());
|
||||
const notesChanged = $derived(notes.trim() !== originalNotes.trim());
|
||||
|
||||
let modalTitle = $derived(() => {
|
||||
const modalTitle = $derived(() => {
|
||||
switch (editMode) {
|
||||
case 'select':
|
||||
return 'Edit/Reschedule';
|
||||
@@ -193,7 +193,7 @@
|
||||
|
||||
function calculateEndTime(startTime: string, durationMinutes: number): string {
|
||||
const [hours, minutes] = startTime.split(':').map(Number);
|
||||
let total = hours * 60 + minutes + durationMinutes;
|
||||
const total = hours * 60 + minutes + durationMinutes;
|
||||
const h = Math.floor(total / 60);
|
||||
const m = total % 60;
|
||||
return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`;
|
||||
@@ -201,7 +201,7 @@
|
||||
|
||||
function calculatePreviousTime(time: string): string {
|
||||
const [h, m] = time.split(':').map(Number);
|
||||
let total = h * 60 + m - 15;
|
||||
const total = h * 60 + m - 15;
|
||||
return `${String(Math.floor(total / 60)).padStart(2, '0')}:${String(total % 60).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
@@ -654,7 +654,7 @@
|
||||
return Math.max(0, Math.min(nextBookingStart, workingEndMinutes) - bookingEndMinutes);
|
||||
}
|
||||
|
||||
let availableAdditionalServices = $derived(() => {
|
||||
const availableAdditionalServices = $derived(() => {
|
||||
if (editMode !== 'services') return [];
|
||||
const remaining = calculateRemainingTime();
|
||||
if (remaining <= 0) return [];
|
||||
|
||||
Reference in New Issue
Block a user