payload-reserve 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1145 -0
- package/dist/collections/Reservations.d.ts +3 -0
- package/dist/collections/Reservations.js +124 -0
- package/dist/collections/Reservations.js.map +1 -0
- package/dist/collections/Resources.d.ts +3 -0
- package/dist/collections/Resources.js +53 -0
- package/dist/collections/Resources.js.map +1 -0
- package/dist/collections/Schedules.d.ts +3 -0
- package/dist/collections/Schedules.js +182 -0
- package/dist/collections/Schedules.js.map +1 -0
- package/dist/collections/Services.d.ts +3 -0
- package/dist/collections/Services.js +75 -0
- package/dist/collections/Services.js.map +1 -0
- package/dist/components/AvailabilityOverview/AvailabilityOverview.module.css +103 -0
- package/dist/components/AvailabilityOverview/index.d.ts +2 -0
- package/dist/components/AvailabilityOverview/index.js +277 -0
- package/dist/components/AvailabilityOverview/index.js.map +1 -0
- package/dist/components/CalendarView/CalendarView.module.css +283 -0
- package/dist/components/CalendarView/index.d.ts +3 -0
- package/dist/components/CalendarView/index.js +508 -0
- package/dist/components/CalendarView/index.js.map +1 -0
- package/dist/components/DashboardWidget/DashboardWidget.module.css +53 -0
- package/dist/components/DashboardWidget/DashboardWidgetServer.d.ts +2 -0
- package/dist/components/DashboardWidget/DashboardWidgetServer.js +126 -0
- package/dist/components/DashboardWidget/DashboardWidgetServer.js.map +1 -0
- package/dist/defaults.d.ts +12 -0
- package/dist/defaults.js +29 -0
- package/dist/defaults.js.map +1 -0
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.js +4 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +3 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/reservations/calculateEndTime.d.ts +3 -0
- package/dist/hooks/reservations/calculateEndTime.js +22 -0
- package/dist/hooks/reservations/calculateEndTime.js.map +1 -0
- package/dist/hooks/reservations/validateCancellation.d.ts +3 -0
- package/dist/hooks/reservations/validateCancellation.js +38 -0
- package/dist/hooks/reservations/validateCancellation.js.map +1 -0
- package/dist/hooks/reservations/validateConflicts.d.ts +3 -0
- package/dist/hooks/reservations/validateConflicts.js +86 -0
- package/dist/hooks/reservations/validateConflicts.js.map +1 -0
- package/dist/hooks/reservations/validateStatusTransition.d.ts +2 -0
- package/dist/hooks/reservations/validateStatusTransition.js +54 -0
- package/dist/hooks/reservations/validateStatusTransition.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.js +106 -0
- package/dist/plugin.js.map +1 -0
- package/dist/translations/en.json +86 -0
- package/dist/translations/index.d.ts +3 -0
- package/dist/translations/index.js +8 -0
- package/dist/translations/index.js.map +1 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/dist/utilities/scheduleUtils.d.ts +54 -0
- package/dist/utilities/scheduleUtils.js +87 -0
- package/dist/utilities/scheduleUtils.js.map +1 -0
- package/dist/utilities/slotUtils.d.ts +21 -0
- package/dist/utilities/slotUtils.js +28 -0
- package/dist/utilities/slotUtils.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import type { Config, Field } from 'payload'\n\nimport { deepMergeSimple } from 'payload/shared'\n\nimport type { ReservationPluginConfig } from './types.js'\n\nimport { createReservationsCollection } from './collections/Reservations.js'\nimport { createResourcesCollection } from './collections/Resources.js'\nimport { createSchedulesCollection } from './collections/Schedules.js'\nimport { createServicesCollection } from './collections/Services.js'\nimport { resolveConfig } from './defaults.js'\nimport { translations } from './translations/index.js'\n\n/** Check whether a top-level field with the given name already exists */\nconst hasField = (fields: Field[], name: string): boolean =>\n fields.some((f) => 'name' in f && f.name === name)\n\nexport const reservationPlugin =\n (pluginOptions: ReservationPluginConfig = {}) =>\n (config: Config): Config => {\n const resolved = resolveConfig(pluginOptions)\n\n // Detect localization from the Payload config\n if (config.localization) {\n resolved.localized = true\n }\n\n if (!config.collections) {\n config.collections = []\n }\n\n if (resolved.disabled) {\n return config\n }\n\n // Add the 4 plugin collections\n config.collections.push(\n createServicesCollection(resolved),\n createResourcesCollection(resolved),\n createSchedulesCollection(resolved),\n createReservationsCollection(resolved),\n )\n\n // Extend the existing user collection with customer fields\n const userCol = config.collections.find((c) => c.slug === resolved.userCollection)\n if (userCol) {\n const fieldsToAdd: Field[] = [\n { name: 'name', type: 'text', maxLength: 200 },\n { name: 'phone', type: 'text', maxLength: 50 },\n { name: 'notes', type: 'textarea' },\n {\n name: 'bookings',\n type: 'join',\n collection: resolved.slugs.reservations,\n on: 'customer',\n },\n ]\n\n for (const field of fieldsToAdd) {\n if (!hasField(userCol.fields, (field as { name: string }).name)) {\n userCol.fields.push(field)\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `[payload-reserve] Could not find collection \"${resolved.userCollection}\" to extend with customer fields. ` +\n 'Make sure your Payload config defines this collection before the reservation plugin runs.',\n )\n }\n\n // Set up admin configuration\n if (!config.admin) {config.admin = {}}\n if (!config.admin.components) {config.admin.components = {}}\n\n // Store slugs in admin custom for component access\n if (!config.admin.custom) {config.admin.custom = {}}\n config.admin.custom.reservationSlugs = {\n ...resolved.slugs,\n userCollection: resolved.userCollection,\n }\n\n // Add dashboard widget\n if (!config.admin.dashboard) {\n config.admin.dashboard = { widgets: [] }\n }\n if (!config.admin.dashboard.widgets) {\n config.admin.dashboard.widgets = []\n }\n config.admin.dashboard.widgets.push({\n slug: 'reservation-todays-reservations',\n ComponentPath: 'payload-reserve/rsc#DashboardWidgetServer',\n label: 'Today\\'s Reservations',\n maxWidth: 'large',\n minWidth: 'medium',\n })\n\n // Add availability overview as custom admin view\n if (!config.admin.components.views) {\n config.admin.components.views = {}\n }\n ;(config.admin.components.views as Record<string, unknown>)['reservation-availability'] = {\n Component: 'payload-reserve/client#AvailabilityOverview',\n path: '/reservation-availability',\n }\n\n // Merge plugin translations (user translations take precedence)\n if (!config.i18n) {config.i18n = {}}\n ;(config.i18n as Record<string, unknown>).translations = deepMergeSimple(\n translations,\n (config.i18n as Record<string, unknown>).translations ?? {},\n )\n\n return config\n }\n"],"names":["deepMergeSimple","createReservationsCollection","createResourcesCollection","createSchedulesCollection","createServicesCollection","resolveConfig","translations","hasField","fields","name","some","f","reservationPlugin","pluginOptions","config","resolved","localization","localized","collections","disabled","push","userCol","find","c","slug","userCollection","fieldsToAdd","type","maxLength","collection","slugs","reservations","on","field","console","warn","admin","components","custom","reservationSlugs","dashboard","widgets","ComponentPath","label","maxWidth","minWidth","views","Component","path","i18n"],"mappings":"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"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"collectionServices": "Services",
|
|
3
|
+
"collectionResources": "Resources",
|
|
4
|
+
"collectionSchedules": "Schedules",
|
|
5
|
+
"collectionReservations": "Reservations",
|
|
6
|
+
"fieldName": "Name",
|
|
7
|
+
"fieldDescription": "Description",
|
|
8
|
+
"fieldPrice": "Price",
|
|
9
|
+
"fieldActive": "Active",
|
|
10
|
+
"fieldServices": "Services",
|
|
11
|
+
"fieldResource": "Resource",
|
|
12
|
+
"fieldService": "Service",
|
|
13
|
+
"fieldCustomer": "Customer",
|
|
14
|
+
"fieldStartTime": "Start Time",
|
|
15
|
+
"fieldEndTime": "End Time",
|
|
16
|
+
"fieldCancellationReason": "Cancellation Reason",
|
|
17
|
+
"fieldNotes": "Notes",
|
|
18
|
+
"fieldStatus": "Status",
|
|
19
|
+
"fieldScheduleType": "Schedule Type",
|
|
20
|
+
"fieldRecurringSlots": "Recurring Slots",
|
|
21
|
+
"fieldDay": "Day",
|
|
22
|
+
"fieldManualSlots": "Manual Slots",
|
|
23
|
+
"fieldDate": "Date",
|
|
24
|
+
"fieldExceptions": "Exceptions",
|
|
25
|
+
"fieldReason": "Reason",
|
|
26
|
+
"fieldDurationMinutes": "Duration (minutes)",
|
|
27
|
+
"fieldBufferTimeBefore": "Buffer Time Before (minutes)",
|
|
28
|
+
"fieldBufferTimeAfter": "Buffer Time After (minutes)",
|
|
29
|
+
"fieldStartTimeHHmm": "Start Time (HH:mm)",
|
|
30
|
+
"fieldEndTimeHHmm": "End Time (HH:mm)",
|
|
31
|
+
"scheduleTypeRecurring": "Recurring",
|
|
32
|
+
"scheduleTypeManual": "Manual",
|
|
33
|
+
"dayMonday": "Monday",
|
|
34
|
+
"dayTuesday": "Tuesday",
|
|
35
|
+
"dayWednesday": "Wednesday",
|
|
36
|
+
"dayThursday": "Thursday",
|
|
37
|
+
"dayFriday": "Friday",
|
|
38
|
+
"daySaturday": "Saturday",
|
|
39
|
+
"daySunday": "Sunday",
|
|
40
|
+
"dayShortSun": "Sun",
|
|
41
|
+
"dayShortMon": "Mon",
|
|
42
|
+
"dayShortTue": "Tue",
|
|
43
|
+
"dayShortWed": "Wed",
|
|
44
|
+
"dayShortThu": "Thu",
|
|
45
|
+
"dayShortFri": "Fri",
|
|
46
|
+
"dayShortSat": "Sat",
|
|
47
|
+
"statusPending": "Pending",
|
|
48
|
+
"statusConfirmed": "Confirmed",
|
|
49
|
+
"statusCompleted": "Completed",
|
|
50
|
+
"statusCancelled": "Cancelled",
|
|
51
|
+
"statusNoShow": "No Show",
|
|
52
|
+
"statusNoShowLabel": "No-show",
|
|
53
|
+
"errorInvalidCreateStatus": "New reservations must start with {{allowed}} status.",
|
|
54
|
+
"errorInvalidTransition": "Cannot transition from \"{{from}}\" to \"{{to}}\".",
|
|
55
|
+
"errorCancellationNotice": "Cancellations require at least {{period}} hours notice. Only {{hours}} hours until the appointment.",
|
|
56
|
+
"errorConflict": "This time slot conflicts with an existing reservation for this resource.",
|
|
57
|
+
"calendarLoading": "Loading reservations...",
|
|
58
|
+
"calendarToday": "Today",
|
|
59
|
+
"calendarCreateNew": "Create New",
|
|
60
|
+
"calendarMonth": "Month",
|
|
61
|
+
"calendarWeek": "Week",
|
|
62
|
+
"calendarDay": "Day",
|
|
63
|
+
"calendarUnknownService": "Unknown service",
|
|
64
|
+
"calendarUnknownCustomer": "Unknown customer",
|
|
65
|
+
"calendarUnknownResource": "Unknown resource",
|
|
66
|
+
"tooltipCustomer": "Customer:",
|
|
67
|
+
"tooltipResource": "Resource:",
|
|
68
|
+
"tooltipStatus": "Status:",
|
|
69
|
+
"availabilityLoading": "Loading availability...",
|
|
70
|
+
"availabilityTitle": "Availability Overview",
|
|
71
|
+
"availabilityThisWeek": "This Week",
|
|
72
|
+
"availabilityNoResources": "No active resources found.",
|
|
73
|
+
"availabilityNotConfigured": "Reservation plugin not configured.",
|
|
74
|
+
"availabilityBooked": "Booked",
|
|
75
|
+
"availabilityUnavailable": "Unavailable",
|
|
76
|
+
"availabilityResource": "Resource",
|
|
77
|
+
"dashboardTitle": "Today's Reservations",
|
|
78
|
+
"dashboardTotal": "Total",
|
|
79
|
+
"dashboardUpcoming": "Upcoming",
|
|
80
|
+
"dashboardCompleted": "Completed",
|
|
81
|
+
"dashboardCancelled": "Cancelled",
|
|
82
|
+
"dashboardNextAppointment": "Next Appointment",
|
|
83
|
+
"dashboardTime": "Time:",
|
|
84
|
+
"dashboardStatus": "Status:",
|
|
85
|
+
"dashboardNoUpcoming": "No upcoming appointments today."
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/translations/index.ts"],"sourcesContent":["import en from './en.json' with { type: 'json' }\n\nexport const translations: Record<string, Record<string, unknown>> = {\n en: { reservation: en },\n}\n\n/** Helper type for plugin translation calls (bypasses DefaultTranslationKeys constraint) */\nexport type PluginT = (key: string, vars?: Record<string, unknown>) => string\n"],"names":["en","translations","reservation"],"mappings":"AAAA,OAAOA,QAAQ,YAAiC;AAEhD,OAAO,MAAMC,eAAwD;IACnED,IAAI;QAAEE,aAAaF;IAAG;AACxB,EAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CollectionConfig } from 'payload';
|
|
2
|
+
export type ReservationPluginConfig = {
|
|
3
|
+
/** Override access control per collection */
|
|
4
|
+
access?: {
|
|
5
|
+
reservations?: CollectionConfig['access'];
|
|
6
|
+
resources?: CollectionConfig['access'];
|
|
7
|
+
schedules?: CollectionConfig['access'];
|
|
8
|
+
services?: CollectionConfig['access'];
|
|
9
|
+
};
|
|
10
|
+
/** Admin group name for all reservation collections */
|
|
11
|
+
adminGroup?: string;
|
|
12
|
+
/** Hours of notice required before cancellation */
|
|
13
|
+
cancellationNoticePeriod?: number;
|
|
14
|
+
/** Default buffer time in minutes between reservations */
|
|
15
|
+
defaultBufferTime?: number;
|
|
16
|
+
/** Disable the plugin entirely */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Override collection slugs */
|
|
19
|
+
slugs?: {
|
|
20
|
+
reservations?: string;
|
|
21
|
+
resources?: string;
|
|
22
|
+
schedules?: string;
|
|
23
|
+
services?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Slug of the existing auth collection to extend with customer fields (default: 'users') */
|
|
26
|
+
userCollection?: string;
|
|
27
|
+
};
|
|
28
|
+
export type ResolvedReservationPluginConfig = {
|
|
29
|
+
access: {
|
|
30
|
+
reservations?: CollectionConfig['access'];
|
|
31
|
+
resources?: CollectionConfig['access'];
|
|
32
|
+
schedules?: CollectionConfig['access'];
|
|
33
|
+
services?: CollectionConfig['access'];
|
|
34
|
+
};
|
|
35
|
+
adminGroup: string;
|
|
36
|
+
cancellationNoticePeriod: number;
|
|
37
|
+
defaultBufferTime: number;
|
|
38
|
+
disabled: boolean;
|
|
39
|
+
localized: boolean;
|
|
40
|
+
slugs: {
|
|
41
|
+
reservations: string;
|
|
42
|
+
resources: string;
|
|
43
|
+
schedules: string;
|
|
44
|
+
services: string;
|
|
45
|
+
};
|
|
46
|
+
userCollection: string;
|
|
47
|
+
};
|
|
48
|
+
export type ReservationStatus = 'cancelled' | 'completed' | 'confirmed' | 'no-show' | 'pending';
|
|
49
|
+
export type DayOfWeek = 'fri' | 'mon' | 'sat' | 'sun' | 'thu' | 'tue' | 'wed';
|
|
50
|
+
export type ScheduleType = 'manual' | 'recurring';
|
|
51
|
+
export declare const VALID_STATUS_TRANSITIONS: Record<ReservationStatus, ReservationStatus[]>;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const VALID_STATUS_TRANSITIONS = {
|
|
2
|
+
cancelled: [],
|
|
3
|
+
completed: [],
|
|
4
|
+
confirmed: [
|
|
5
|
+
'completed',
|
|
6
|
+
'cancelled',
|
|
7
|
+
'no-show'
|
|
8
|
+
],
|
|
9
|
+
'no-show': [],
|
|
10
|
+
pending: [
|
|
11
|
+
'confirmed',
|
|
12
|
+
'cancelled'
|
|
13
|
+
]
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nexport type ReservationPluginConfig = {\n /** Override access control per collection */\n access?: {\n reservations?: CollectionConfig['access']\n resources?: CollectionConfig['access']\n schedules?: CollectionConfig['access']\n services?: CollectionConfig['access']\n }\n /** Admin group name for all reservation collections */\n adminGroup?: string\n /** Hours of notice required before cancellation */\n cancellationNoticePeriod?: number\n /** Default buffer time in minutes between reservations */\n defaultBufferTime?: number\n /** Disable the plugin entirely */\n disabled?: boolean\n /** Override collection slugs */\n slugs?: {\n reservations?: string\n resources?: string\n schedules?: string\n services?: string\n }\n /** Slug of the existing auth collection to extend with customer fields (default: 'users') */\n userCollection?: string\n}\n\nexport type ResolvedReservationPluginConfig = {\n access: {\n reservations?: CollectionConfig['access']\n resources?: CollectionConfig['access']\n schedules?: CollectionConfig['access']\n services?: CollectionConfig['access']\n }\n adminGroup: string\n cancellationNoticePeriod: number\n defaultBufferTime: number\n disabled: boolean\n localized: boolean\n slugs: {\n reservations: string\n resources: string\n schedules: string\n services: string\n }\n userCollection: string\n}\n\nexport type ReservationStatus = 'cancelled' | 'completed' | 'confirmed' | 'no-show' | 'pending'\n\nexport type DayOfWeek = 'fri' | 'mon' | 'sat' | 'sun' | 'thu' | 'tue' | 'wed'\n\nexport type ScheduleType = 'manual' | 'recurring'\n\nexport const VALID_STATUS_TRANSITIONS: Record<ReservationStatus, ReservationStatus[]> = {\n cancelled: [],\n completed: [],\n confirmed: ['completed', 'cancelled', 'no-show'],\n 'no-show': [],\n pending: ['confirmed', 'cancelled'],\n}\n"],"names":["VALID_STATUS_TRANSITIONS","cancelled","completed","confirmed","pending"],"mappings":"AAwDA,OAAO,MAAMA,2BAA2E;IACtFC,WAAW,EAAE;IACbC,WAAW,EAAE;IACbC,WAAW;QAAC;QAAa;QAAa;KAAU;IAChD,WAAW,EAAE;IACbC,SAAS;QAAC;QAAa;KAAY;AACrC,EAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DayOfWeek } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the DayOfWeek value for a given Date.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getDayOfWeek(date: Date): DayOfWeek;
|
|
6
|
+
/**
|
|
7
|
+
* Check if a date string (ISO) matches a DayOfWeek.
|
|
8
|
+
*/
|
|
9
|
+
export declare function dateMatchesDay(date: Date, day: DayOfWeek): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Parse a HH:mm time string to hours and minutes.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseTime(time: string): {
|
|
14
|
+
hours: number;
|
|
15
|
+
minutes: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Combine a date (day) with a HH:mm time string into a full Date.
|
|
19
|
+
*/
|
|
20
|
+
export declare function combineDateAndTime(date: Date, time: string): Date;
|
|
21
|
+
/**
|
|
22
|
+
* Check if a given date is an exception date in the schedule.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isExceptionDate(date: Date, exceptions: Array<{
|
|
25
|
+
date: string;
|
|
26
|
+
}>): boolean;
|
|
27
|
+
type RecurringSlot = {
|
|
28
|
+
day: DayOfWeek;
|
|
29
|
+
endTime: string;
|
|
30
|
+
startTime: string;
|
|
31
|
+
};
|
|
32
|
+
type ManualSlot = {
|
|
33
|
+
date: string;
|
|
34
|
+
endTime: string;
|
|
35
|
+
startTime: string;
|
|
36
|
+
};
|
|
37
|
+
type Schedule = {
|
|
38
|
+
active?: boolean;
|
|
39
|
+
exceptions?: Array<{
|
|
40
|
+
date: string;
|
|
41
|
+
}>;
|
|
42
|
+
manualSlots?: ManualSlot[];
|
|
43
|
+
recurringSlots?: RecurringSlot[];
|
|
44
|
+
scheduleType: 'manual' | 'recurring';
|
|
45
|
+
};
|
|
46
|
+
type TimeRange = {
|
|
47
|
+
end: Date;
|
|
48
|
+
start: Date;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a schedule to concrete available time ranges for a given date.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveScheduleForDate(schedule: Schedule, date: Date): TimeRange[];
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const DAY_MAP = {
|
|
2
|
+
fri: 5,
|
|
3
|
+
mon: 1,
|
|
4
|
+
sat: 6,
|
|
5
|
+
sun: 0,
|
|
6
|
+
thu: 4,
|
|
7
|
+
tue: 2,
|
|
8
|
+
wed: 3
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Get the DayOfWeek value for a given Date.
|
|
12
|
+
*/ export function getDayOfWeek(date) {
|
|
13
|
+
const jsDay = date.getDay();
|
|
14
|
+
const entries = Object.entries(DAY_MAP);
|
|
15
|
+
const found = entries.find(([, num])=>num === jsDay);
|
|
16
|
+
return found ? found[0] : 'mon';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Check if a date string (ISO) matches a DayOfWeek.
|
|
20
|
+
*/ export function dateMatchesDay(date, day) {
|
|
21
|
+
return date.getDay() === DAY_MAP[day];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse a HH:mm time string to hours and minutes.
|
|
25
|
+
*/ export function parseTime(time) {
|
|
26
|
+
const [h, m] = time.split(':').map(Number);
|
|
27
|
+
return {
|
|
28
|
+
hours: h,
|
|
29
|
+
minutes: m
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Combine a date (day) with a HH:mm time string into a full Date.
|
|
34
|
+
*/ export function combineDateAndTime(date, time) {
|
|
35
|
+
const { hours, minutes } = parseTime(time);
|
|
36
|
+
const combined = new Date(date);
|
|
37
|
+
combined.setHours(hours, minutes, 0, 0);
|
|
38
|
+
return combined;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check if a given date is an exception date in the schedule.
|
|
42
|
+
*/ export function isExceptionDate(date, exceptions) {
|
|
43
|
+
const dateStr = date.toISOString().split('T')[0];
|
|
44
|
+
return exceptions.some((exc)=>{
|
|
45
|
+
const excDateStr = new Date(exc.date).toISOString().split('T')[0];
|
|
46
|
+
return excDateStr === dateStr;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Resolve a schedule to concrete available time ranges for a given date.
|
|
51
|
+
*/ export function resolveScheduleForDate(schedule, date) {
|
|
52
|
+
if (schedule.active === false) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
const exceptions = schedule.exceptions ?? [];
|
|
56
|
+
if (isExceptionDate(date, exceptions)) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
const ranges = [];
|
|
60
|
+
if (schedule.scheduleType === 'recurring') {
|
|
61
|
+
const slots = schedule.recurringSlots ?? [];
|
|
62
|
+
const dayOfWeek = getDayOfWeek(date);
|
|
63
|
+
for (const slot of slots){
|
|
64
|
+
if (slot.day === dayOfWeek) {
|
|
65
|
+
ranges.push({
|
|
66
|
+
end: combineDateAndTime(date, slot.endTime),
|
|
67
|
+
start: combineDateAndTime(date, slot.startTime)
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} else if (schedule.scheduleType === 'manual') {
|
|
72
|
+
const slots = schedule.manualSlots ?? [];
|
|
73
|
+
const dateStr = date.toISOString().split('T')[0];
|
|
74
|
+
for (const slot of slots){
|
|
75
|
+
const slotDateStr = new Date(slot.date).toISOString().split('T')[0];
|
|
76
|
+
if (slotDateStr === dateStr) {
|
|
77
|
+
ranges.push({
|
|
78
|
+
end: combineDateAndTime(date, slot.endTime),
|
|
79
|
+
start: combineDateAndTime(date, slot.startTime)
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return ranges;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=scheduleUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/scheduleUtils.ts"],"sourcesContent":["import type { DayOfWeek } from '../types.js'\n\nconst DAY_MAP: Record<DayOfWeek, number> = {\n fri: 5,\n mon: 1,\n sat: 6,\n sun: 0,\n thu: 4,\n tue: 2,\n wed: 3,\n}\n\n/**\n * Get the DayOfWeek value for a given Date.\n */\nexport function getDayOfWeek(date: Date): DayOfWeek {\n const jsDay = date.getDay()\n const entries = Object.entries(DAY_MAP) as [DayOfWeek, number][]\n const found = entries.find(([, num]) => num === jsDay)\n return found ? found[0] : 'mon'\n}\n\n/**\n * Check if a date string (ISO) matches a DayOfWeek.\n */\nexport function dateMatchesDay(date: Date, day: DayOfWeek): boolean {\n return date.getDay() === DAY_MAP[day]\n}\n\n/**\n * Parse a HH:mm time string to hours and minutes.\n */\nexport function parseTime(time: string): { hours: number; minutes: number } {\n const [h, m] = time.split(':').map(Number)\n return { hours: h, minutes: m }\n}\n\n/**\n * Combine a date (day) with a HH:mm time string into a full Date.\n */\nexport function combineDateAndTime(date: Date, time: string): Date {\n const { hours, minutes } = parseTime(time)\n const combined = new Date(date)\n combined.setHours(hours, minutes, 0, 0)\n return combined\n}\n\n/**\n * Check if a given date is an exception date in the schedule.\n */\nexport function isExceptionDate(\n date: Date,\n exceptions: Array<{ date: string }>,\n): boolean {\n const dateStr = date.toISOString().split('T')[0]\n return exceptions.some((exc) => {\n const excDateStr = new Date(exc.date).toISOString().split('T')[0]\n return excDateStr === dateStr\n })\n}\n\ntype RecurringSlot = {\n day: DayOfWeek\n endTime: string\n startTime: string\n}\n\ntype ManualSlot = {\n date: string\n endTime: string\n startTime: string\n}\n\ntype Schedule = {\n active?: boolean\n exceptions?: Array<{ date: string }>\n manualSlots?: ManualSlot[]\n recurringSlots?: RecurringSlot[]\n scheduleType: 'manual' | 'recurring'\n}\n\ntype TimeRange = {\n end: Date\n start: Date\n}\n\n/**\n * Resolve a schedule to concrete available time ranges for a given date.\n */\nexport function resolveScheduleForDate(schedule: Schedule, date: Date): TimeRange[] {\n if (schedule.active === false) {return []}\n\n const exceptions = schedule.exceptions ?? []\n if (isExceptionDate(date, exceptions)) {return []}\n\n const ranges: TimeRange[] = []\n\n if (schedule.scheduleType === 'recurring') {\n const slots = schedule.recurringSlots ?? []\n const dayOfWeek = getDayOfWeek(date)\n for (const slot of slots) {\n if (slot.day === dayOfWeek) {\n ranges.push({\n end: combineDateAndTime(date, slot.endTime),\n start: combineDateAndTime(date, slot.startTime),\n })\n }\n }\n } else if (schedule.scheduleType === 'manual') {\n const slots = schedule.manualSlots ?? []\n const dateStr = date.toISOString().split('T')[0]\n for (const slot of slots) {\n const slotDateStr = new Date(slot.date).toISOString().split('T')[0]\n if (slotDateStr === dateStr) {\n ranges.push({\n end: combineDateAndTime(date, slot.endTime),\n start: combineDateAndTime(date, slot.startTime),\n })\n }\n }\n }\n\n return ranges\n}\n"],"names":["DAY_MAP","fri","mon","sat","sun","thu","tue","wed","getDayOfWeek","date","jsDay","getDay","entries","Object","found","find","num","dateMatchesDay","day","parseTime","time","h","m","split","map","Number","hours","minutes","combineDateAndTime","combined","Date","setHours","isExceptionDate","exceptions","dateStr","toISOString","some","exc","excDateStr","resolveScheduleForDate","schedule","active","ranges","scheduleType","slots","recurringSlots","dayOfWeek","slot","push","end","endTime","start","startTime","manualSlots","slotDateStr"],"mappings":"AAEA,MAAMA,UAAqC;IACzCC,KAAK;IACLC,KAAK;IACLC,KAAK;IACLC,KAAK;IACLC,KAAK;IACLC,KAAK;IACLC,KAAK;AACP;AAEA;;CAEC,GACD,OAAO,SAASC,aAAaC,IAAU;IACrC,MAAMC,QAAQD,KAAKE,MAAM;IACzB,MAAMC,UAAUC,OAAOD,OAAO,CAACZ;IAC/B,MAAMc,QAAQF,QAAQG,IAAI,CAAC,CAAC,GAAGC,IAAI,GAAKA,QAAQN;IAChD,OAAOI,QAAQA,KAAK,CAAC,EAAE,GAAG;AAC5B;AAEA;;CAEC,GACD,OAAO,SAASG,eAAeR,IAAU,EAAES,GAAc;IACvD,OAAOT,KAAKE,MAAM,OAAOX,OAAO,CAACkB,IAAI;AACvC;AAEA;;CAEC,GACD,OAAO,SAASC,UAAUC,IAAY;IACpC,MAAM,CAACC,GAAGC,EAAE,GAAGF,KAAKG,KAAK,CAAC,KAAKC,GAAG,CAACC;IACnC,OAAO;QAAEC,OAAOL;QAAGM,SAASL;IAAE;AAChC;AAEA;;CAEC,GACD,OAAO,SAASM,mBAAmBnB,IAAU,EAAEW,IAAY;IACzD,MAAM,EAAEM,KAAK,EAAEC,OAAO,EAAE,GAAGR,UAAUC;IACrC,MAAMS,WAAW,IAAIC,KAAKrB;IAC1BoB,SAASE,QAAQ,CAACL,OAAOC,SAAS,GAAG;IACrC,OAAOE;AACT;AAEA;;CAEC,GACD,OAAO,SAASG,gBACdvB,IAAU,EACVwB,UAAmC;IAEnC,MAAMC,UAAUzB,KAAK0B,WAAW,GAAGZ,KAAK,CAAC,IAAI,CAAC,EAAE;IAChD,OAAOU,WAAWG,IAAI,CAAC,CAACC;QACtB,MAAMC,aAAa,IAAIR,KAAKO,IAAI5B,IAAI,EAAE0B,WAAW,GAAGZ,KAAK,CAAC,IAAI,CAAC,EAAE;QACjE,OAAOe,eAAeJ;IACxB;AACF;AA2BA;;CAEC,GACD,OAAO,SAASK,uBAAuBC,QAAkB,EAAE/B,IAAU;IACnE,IAAI+B,SAASC,MAAM,KAAK,OAAO;QAAC,OAAO,EAAE;IAAA;IAEzC,MAAMR,aAAaO,SAASP,UAAU,IAAI,EAAE;IAC5C,IAAID,gBAAgBvB,MAAMwB,aAAa;QAAC,OAAO,EAAE;IAAA;IAEjD,MAAMS,SAAsB,EAAE;IAE9B,IAAIF,SAASG,YAAY,KAAK,aAAa;QACzC,MAAMC,QAAQJ,SAASK,cAAc,IAAI,EAAE;QAC3C,MAAMC,YAAYtC,aAAaC;QAC/B,KAAK,MAAMsC,QAAQH,MAAO;YACxB,IAAIG,KAAK7B,GAAG,KAAK4B,WAAW;gBAC1BJ,OAAOM,IAAI,CAAC;oBACVC,KAAKrB,mBAAmBnB,MAAMsC,KAAKG,OAAO;oBAC1CC,OAAOvB,mBAAmBnB,MAAMsC,KAAKK,SAAS;gBAChD;YACF;QACF;IACF,OAAO,IAAIZ,SAASG,YAAY,KAAK,UAAU;QAC7C,MAAMC,QAAQJ,SAASa,WAAW,IAAI,EAAE;QACxC,MAAMnB,UAAUzB,KAAK0B,WAAW,GAAGZ,KAAK,CAAC,IAAI,CAAC,EAAE;QAChD,KAAK,MAAMwB,QAAQH,MAAO;YACxB,MAAMU,cAAc,IAAIxB,KAAKiB,KAAKtC,IAAI,EAAE0B,WAAW,GAAGZ,KAAK,CAAC,IAAI,CAAC,EAAE;YACnE,IAAI+B,gBAAgBpB,SAAS;gBAC3BQ,OAAOM,IAAI,CAAC;oBACVC,KAAKrB,mBAAmBnB,MAAMsC,KAAKG,OAAO;oBAC1CC,OAAOvB,mBAAmBnB,MAAMsC,KAAKK,SAAS;gBAChD;YACF;QACF;IACF;IAEA,OAAOV;AACT"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add minutes to a date and return a new Date.
|
|
3
|
+
*/
|
|
4
|
+
export declare function addMinutes(date: Date, minutes: number): Date;
|
|
5
|
+
/**
|
|
6
|
+
* Check if two time ranges overlap.
|
|
7
|
+
* Ranges are [startA, endA) and [startB, endB) (half-open intervals).
|
|
8
|
+
*/
|
|
9
|
+
export declare function doRangesOverlap(startA: Date, endA: Date, startB: Date, endB: Date): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Compute the effective blocked window for a reservation,
|
|
12
|
+
* applying buffer times before and after.
|
|
13
|
+
*/
|
|
14
|
+
export declare function computeBlockedWindow(startTime: Date, endTime: Date, bufferBefore: number, bufferAfter: number): {
|
|
15
|
+
effectiveEnd: Date;
|
|
16
|
+
effectiveStart: Date;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Calculate hours between now and a future date.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hoursUntil(futureDate: Date, now?: Date): number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add minutes to a date and return a new Date.
|
|
3
|
+
*/ export function addMinutes(date, minutes) {
|
|
4
|
+
return new Date(date.getTime() + minutes * 60_000);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Check if two time ranges overlap.
|
|
8
|
+
* Ranges are [startA, endA) and [startB, endB) (half-open intervals).
|
|
9
|
+
*/ export function doRangesOverlap(startA, endA, startB, endB) {
|
|
10
|
+
return startA < endB && startB < endA;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Compute the effective blocked window for a reservation,
|
|
14
|
+
* applying buffer times before and after.
|
|
15
|
+
*/ export function computeBlockedWindow(startTime, endTime, bufferBefore, bufferAfter) {
|
|
16
|
+
return {
|
|
17
|
+
effectiveEnd: addMinutes(endTime, bufferAfter),
|
|
18
|
+
effectiveStart: addMinutes(startTime, -bufferBefore)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Calculate hours between now and a future date.
|
|
23
|
+
*/ export function hoursUntil(futureDate, now) {
|
|
24
|
+
const reference = now ?? new Date();
|
|
25
|
+
return (futureDate.getTime() - reference.getTime()) / (1000 * 60 * 60);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=slotUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/slotUtils.ts"],"sourcesContent":["/**\n * Add minutes to a date and return a new Date.\n */\nexport function addMinutes(date: Date, minutes: number): Date {\n return new Date(date.getTime() + minutes * 60_000)\n}\n\n/**\n * Check if two time ranges overlap.\n * Ranges are [startA, endA) and [startB, endB) (half-open intervals).\n */\nexport function doRangesOverlap(\n startA: Date,\n endA: Date,\n startB: Date,\n endB: Date,\n): boolean {\n return startA < endB && startB < endA\n}\n\n/**\n * Compute the effective blocked window for a reservation,\n * applying buffer times before and after.\n */\nexport function computeBlockedWindow(\n startTime: Date,\n endTime: Date,\n bufferBefore: number,\n bufferAfter: number,\n): { effectiveEnd: Date; effectiveStart: Date } {\n return {\n effectiveEnd: addMinutes(endTime, bufferAfter),\n effectiveStart: addMinutes(startTime, -bufferBefore),\n }\n}\n\n/**\n * Calculate hours between now and a future date.\n */\nexport function hoursUntil(futureDate: Date, now?: Date): number {\n const reference = now ?? new Date()\n return (futureDate.getTime() - reference.getTime()) / (1000 * 60 * 60)\n}\n"],"names":["addMinutes","date","minutes","Date","getTime","doRangesOverlap","startA","endA","startB","endB","computeBlockedWindow","startTime","endTime","bufferBefore","bufferAfter","effectiveEnd","effectiveStart","hoursUntil","futureDate","now","reference"],"mappings":"AAAA;;CAEC,GACD,OAAO,SAASA,WAAWC,IAAU,EAAEC,OAAe;IACpD,OAAO,IAAIC,KAAKF,KAAKG,OAAO,KAAKF,UAAU;AAC7C;AAEA;;;CAGC,GACD,OAAO,SAASG,gBACdC,MAAY,EACZC,IAAU,EACVC,MAAY,EACZC,IAAU;IAEV,OAAOH,SAASG,QAAQD,SAASD;AACnC;AAEA;;;CAGC,GACD,OAAO,SAASG,qBACdC,SAAe,EACfC,OAAa,EACbC,YAAoB,EACpBC,WAAmB;IAEnB,OAAO;QACLC,cAAcf,WAAWY,SAASE;QAClCE,gBAAgBhB,WAAWW,WAAW,CAACE;IACzC;AACF;AAEA;;CAEC,GACD,OAAO,SAASI,WAAWC,UAAgB,EAAEC,GAAU;IACrD,MAAMC,YAAYD,OAAO,IAAIhB;IAC7B,OAAO,AAACe,CAAAA,WAAWd,OAAO,KAAKgB,UAAUhB,OAAO,EAAC,IAAM,CAAA,OAAO,KAAK,EAAC;AACtE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "payload-reserve",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A Payload CMS 3.x plugin for reservation and booking management with conflict detection, status workflows, and calendar UI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"payload",
|
|
7
|
+
"payloadcms",
|
|
8
|
+
"plugin",
|
|
9
|
+
"reservation",
|
|
10
|
+
"booking",
|
|
11
|
+
"appointment",
|
|
12
|
+
"scheduling",
|
|
13
|
+
"calendar"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "elghaied",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/elghaied/payload-reserve.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/elghaied/payload-reserve#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/elghaied/payload-reserve/issues"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./client": {
|
|
33
|
+
"import": "./dist/exports/client.js",
|
|
34
|
+
"types": "./dist/exports/client.d.ts",
|
|
35
|
+
"default": "./dist/exports/client.js"
|
|
36
|
+
},
|
|
37
|
+
"./rsc": {
|
|
38
|
+
"import": "./dist/exports/rsc.js",
|
|
39
|
+
"types": "./dist/exports/rsc.d.ts",
|
|
40
|
+
"default": "./dist/exports/rsc.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"main": "./dist/index.js",
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"files": [
|
|
46
|
+
"dist"
|
|
47
|
+
],
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
50
|
+
"@payloadcms/db-mongodb": "3.76.1",
|
|
51
|
+
"@payloadcms/db-postgres": "3.76.1",
|
|
52
|
+
"@payloadcms/db-sqlite": "3.76.1",
|
|
53
|
+
"@payloadcms/eslint-config": "3.9.0",
|
|
54
|
+
"@payloadcms/next": "3.76.1",
|
|
55
|
+
"@payloadcms/richtext-lexical": "3.76.1",
|
|
56
|
+
"@payloadcms/ui": "3.76.1",
|
|
57
|
+
"@playwright/test": "1.56.1",
|
|
58
|
+
"@swc-node/register": "1.10.9",
|
|
59
|
+
"@swc/cli": "0.6.0",
|
|
60
|
+
"@types/node": "22.19.9",
|
|
61
|
+
"@types/react": "19.2.9",
|
|
62
|
+
"@types/react-dom": "19.2.3",
|
|
63
|
+
"copyfiles": "2.4.1",
|
|
64
|
+
"cross-env": "^7.0.3",
|
|
65
|
+
"eslint": "^9.23.0",
|
|
66
|
+
"eslint-config-next": "15.4.11",
|
|
67
|
+
"graphql": "^16.8.1",
|
|
68
|
+
"mongodb-memory-server": "10.1.4",
|
|
69
|
+
"next": "15.4.11",
|
|
70
|
+
"open": "^10.1.0",
|
|
71
|
+
"payload": "3.76.1",
|
|
72
|
+
"prettier": "^3.4.2",
|
|
73
|
+
"qs-esm": "7.0.2",
|
|
74
|
+
"react": "19.2.1",
|
|
75
|
+
"react-dom": "19.2.1",
|
|
76
|
+
"rimraf": "3.0.2",
|
|
77
|
+
"sharp": "0.34.2",
|
|
78
|
+
"sort-package-json": "^2.10.0",
|
|
79
|
+
"typescript": "5.7.3",
|
|
80
|
+
"vite-tsconfig-paths": "6.0.5",
|
|
81
|
+
"vitest": "4.0.18"
|
|
82
|
+
},
|
|
83
|
+
"peerDependencies": {
|
|
84
|
+
"payload": "^3.76.1"
|
|
85
|
+
},
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": "^18.20.2 || >=20.9.0",
|
|
88
|
+
"pnpm": "^9 || ^10"
|
|
89
|
+
},
|
|
90
|
+
"scripts": {
|
|
91
|
+
"build": "pnpm copyfiles && pnpm build:types && pnpm build:swc",
|
|
92
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
93
|
+
"build:types": "tsc --outDir dist --rootDir ./src",
|
|
94
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
95
|
+
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
96
|
+
"dev": "next dev dev --turbo",
|
|
97
|
+
"dev:generate-importmap": "pnpm dev:payload generate:importmap",
|
|
98
|
+
"dev:generate-types": "pnpm dev:payload generate:types",
|
|
99
|
+
"dev:payload": "cross-env PAYLOAD_CONFIG_PATH=./dev/payload.config.ts payload",
|
|
100
|
+
"generate:importmap": "pnpm dev:generate-importmap",
|
|
101
|
+
"generate:types": "pnpm dev:generate-types",
|
|
102
|
+
"lint": "eslint",
|
|
103
|
+
"lint:fix": "eslint ./src --fix",
|
|
104
|
+
"test": "pnpm test:int && pnpm test:e2e",
|
|
105
|
+
"test:e2e": "playwright test",
|
|
106
|
+
"test:int": "vitest"
|
|
107
|
+
}
|
|
108
|
+
}
|