mozrest-sdk-react-dev 0.2.56 → 0.2.60
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/mozrest-sdk.es.js +659 -133
- package/package.json +1 -1
- package/style.css +1 -1
package/mozrest-sdk.es.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React$1 from "react";
|
|
|
2
2
|
import React__default, { createContext, useContext, useRef, useCallback, useDebugValue, useEffect, useLayoutEffect as useLayoutEffect$1, useState, useMemo as useMemo$1, createElement as createElement$1, version as version$3, isValidElement as isValidElement$1, Component, forwardRef, useImperativeHandle, Children, useReducer, Fragment, PureComponent, cloneElement as cloneElement$1 } from "react";
|
|
3
3
|
import * as ReactDOM from "react-dom";
|
|
4
4
|
import ReactDOM__default, { createPortal } from "react-dom";
|
|
5
|
-
var index$
|
|
5
|
+
var index$c = /* @__PURE__ */ (() => '@import"https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Noto+Sans:wght@600&display=swap";.moz *,.moz :before,.moz :after{box-sizing:border-box}.moz html{-moz-tab-size:4;tab-size:4}.moz html{line-height:1.15;-webkit-text-size-adjust:100%}.moz body{margin:0!important}.moz body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"}.moz hr{height:0;color:inherit}.moz abbr[title]{text-decoration:underline dotted}.moz b,.moz strong{font-weight:bolder}.moz code,.moz kbd,.moz samp,.moz pre{font-family:ui-monospace,SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:1em}.moz small{font-size:80%}.moz sub,.moz sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.moz sub{bottom:-.25em}.moz sup{top:-.5em}.moz table{text-indent:0;border-color:inherit}.moz button,.moz input,.moz optgroup,.moz select,.moz textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}.moz button,.moz select{text-transform:none}.moz button,.moz [type=button],.moz [type=reset],.moz [type=submit]{-webkit-appearance:button}.moz ::-moz-focus-inner{border-style:none;padding:0}.moz :-moz-focusring{outline:1px dotted ButtonText}.moz :-moz-ui-invalid{box-shadow:none}.moz legend{padding:0}.moz progress{vertical-align:baseline}.moz ::-webkit-inner-spin-button,.moz ::-webkit-outer-spin-button{height:auto}.moz [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.moz ::-webkit-search-decoration{-webkit-appearance:none}.moz ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.moz summary{display:list-item}.moz p,.moz h1,.moz h2,.moz h3,.moz h4,.moz h5,.moz h6{overflow-wrap:break-word;margin:0}:root{--moz-container-width: 100%;--moz-container-padding: 1.25rem;--moz-scrollbar-color: colors.$bg-gray-light;--moz-scrollbar-bg: transparent;--moz-scrollbar-border: colors.$white;--moz-font-family: "Lato", sans-serif;--moz-font-family-title: "Noto Sans", sans-serif;--moz-font-size-label: .857rem;--moz-font-weight-label: 300;--moz-line-height-label: 1.5715;--moz-font-family-label: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--moz-font-size-input: .9rem;--moz-font-weight-input: 400;--moz-line-height-input: 1.45;--moz-font-family-input: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--moz-cta-primary: #ff9b00;--moz-cta-primary-text: white;--moz-cta-primary-hover: rgb(255 155 0/ 70%);--moz-cta-primary-text-hover: #1e155a;--moz-cta-secondary: #1e155a;--moz-cta-secondary-hover: rgb(30 21 90 / 75%);--moz-cta-secondary-text: #fff;--moz-cta-secondary-text-hover: #fff;--moz-cta-danger: #f83d32;--moz-cta-danger-text: white;--moz-cta-danger-hover: #e12015;--moz-cta-danger-text-hover: white;--moz-cta-success: #34cc16;--moz-cta-success-text: white;--moz-cta-success-hover: #2aa911;--moz-cta-success-text-hover: white;--moz-bg-gray: #787676;--moz-bg-gray-light: #e5e7eb;--moz-bg-gray-lighter: #f9f9f9;--moz-bg-primary: #017f74;--moz-bg-active: rgb(1 126 116 / 15%);--moz-text-input: #333;--moz-text-label: #5e5873;--moz-text-title: #1e2048;--moz-text-primary: #545454;--moz-text-secondary: #787676;--moz-text-success: #84cc16;--moz-input-active: #ff9b00;--moz-input-default: #787676;--moz-input-border: #cccccc;--moz-state-active: #1e155a;--moz-state-error: #f83d32;--moz-state-disabled: gray;--moz-state-disabled-bg: #f9f9f9;--moz-checbox-active: #1e155a;--checkbox-disabled: #e5e7eb;--checkbox-disabled-bg: #f9f9f9;--moz-border: #e5e7eb;--moz-border-hover: #b1b1b1}@media (min-width: 768px){:root{--moz-container-width: 100%;--moz-container-padding: 1.5rem}}@media (min-width: 1024px){:root{--moz-container-width: 100%;--moz-container-padding: 2rem}}@media (min-width: 1600px){:root{--moz-container-width: 1600px;--moz-container-padding: 4rem}}.moz html{scroll-behavior:smooth;max-width:100%;overflow-x:hidden}.moz body{color:var(--moz-text-primary);font:1rem/1.5 var(--moz-font-family);font-family:var(--moz-font-family)}.moz a{color:var(--moz-text-primary)}.moz :focus-visible{outline:1px solid var(--moz-cta-primary);border-color:transparent}\n')();
|
|
6
6
|
const pulse$5 = "_pulse_1xz3t_1";
|
|
7
7
|
const container$I = "_container_1xz3t_13";
|
|
8
8
|
const item$b = "_item_1xz3t_20";
|
|
@@ -6473,6 +6473,15 @@ const RESERVATION_DURATION_DESC = "Set your rules in order to maximise and optim
|
|
|
6473
6473
|
const SHIFT_X = "Shift {{shift}}";
|
|
6474
6474
|
const SHIFTS = "Shifts";
|
|
6475
6475
|
const SHIFTS_DESC = "Specify your business timings. This information is critical to increase reservations.";
|
|
6476
|
+
const SPECIAL_DATES = "Special dates";
|
|
6477
|
+
const SPECIAL_DATES_DESC = "Special closing dates or different shifts (special day, events, etc...)";
|
|
6478
|
+
const SPECIAL_SHIFTS = "Special shifts";
|
|
6479
|
+
const ADD_SPECIAL_DATE = "Add special date";
|
|
6480
|
+
const DELETE_SPECIAL_DATE = "Delete special date";
|
|
6481
|
+
const ARE_YOU_SURE_DELETE_SPECIAL_DATE = "Are you sure you want to delete this special date?";
|
|
6482
|
+
const RESERVATION_PREFERENCES = "Reservation preferences";
|
|
6483
|
+
const RESERVATION_PREFERENCES_DESC = "Set your rules in order to maximise and optimise your occupation rate.";
|
|
6484
|
+
const MAX_RESERVATIONS_ARRIVAL_PER_SLOT = "Max reservations arrival per slot";
|
|
6476
6485
|
var en = {
|
|
6477
6486
|
errors,
|
|
6478
6487
|
SPECIALCLOSINGDATES,
|
|
@@ -6832,7 +6841,16 @@ var en = {
|
|
|
6832
6841
|
RESERVATION_DURATION_DESC,
|
|
6833
6842
|
SHIFT_X,
|
|
6834
6843
|
SHIFTS,
|
|
6835
|
-
SHIFTS_DESC
|
|
6844
|
+
SHIFTS_DESC,
|
|
6845
|
+
SPECIAL_DATES,
|
|
6846
|
+
SPECIAL_DATES_DESC,
|
|
6847
|
+
SPECIAL_SHIFTS,
|
|
6848
|
+
ADD_SPECIAL_DATE,
|
|
6849
|
+
DELETE_SPECIAL_DATE,
|
|
6850
|
+
ARE_YOU_SURE_DELETE_SPECIAL_DATE,
|
|
6851
|
+
RESERVATION_PREFERENCES,
|
|
6852
|
+
RESERVATION_PREFERENCES_DESC,
|
|
6853
|
+
MAX_RESERVATIONS_ARRIVAL_PER_SLOT
|
|
6836
6854
|
};
|
|
6837
6855
|
instance.use(initReactI18next).init({
|
|
6838
6856
|
resources: {
|
|
@@ -7757,10 +7775,10 @@ var infinite = function(useSWRNext) {
|
|
|
7757
7775
|
};
|
|
7758
7776
|
};
|
|
7759
7777
|
};
|
|
7760
|
-
var index$
|
|
7778
|
+
var index$b = withMiddleware(useSWR, infinite);
|
|
7761
7779
|
const useInfinite = (service, params, limit = 5) => {
|
|
7762
7780
|
var _a2, _b;
|
|
7763
|
-
const { data: data2, error: error3, isValidating, mutate: mutate2, size, setSize } = index$
|
|
7781
|
+
const { data: data2, error: error3, isValidating, mutate: mutate2, size, setSize } = index$b((page, previousPageData) => {
|
|
7764
7782
|
if (previousPageData && !previousPageData.length) {
|
|
7765
7783
|
return null;
|
|
7766
7784
|
}
|
|
@@ -9973,7 +9991,7 @@ var ResizeObserver$1 = function() {
|
|
|
9973
9991
|
return (_a2 = observers.get(this))[method4].apply(_a2, arguments);
|
|
9974
9992
|
};
|
|
9975
9993
|
});
|
|
9976
|
-
var index$
|
|
9994
|
+
var index$a = function() {
|
|
9977
9995
|
if (typeof global$1$1.ResizeObserver !== "undefined") {
|
|
9978
9996
|
return global$1$1.ResizeObserver;
|
|
9979
9997
|
}
|
|
@@ -9981,7 +9999,7 @@ var index$8 = function() {
|
|
|
9981
9999
|
}();
|
|
9982
10000
|
var ResizeObserver_es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9983
10001
|
__proto__: null,
|
|
9984
|
-
"default": index$
|
|
10002
|
+
"default": index$a
|
|
9985
10003
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
9986
10004
|
function omit(obj, fields) {
|
|
9987
10005
|
var clone3 = Object.assign({}, obj);
|
|
@@ -18889,7 +18907,7 @@ function monitorResize(element, callback) {
|
|
|
18889
18907
|
prevWidth = fixedWidth;
|
|
18890
18908
|
prevHeight = fixedHeight;
|
|
18891
18909
|
}
|
|
18892
|
-
var resizeObserver = new index$
|
|
18910
|
+
var resizeObserver = new index$a(onResize);
|
|
18893
18911
|
if (element) {
|
|
18894
18912
|
resizeObserver.observe(element);
|
|
18895
18913
|
}
|
|
@@ -41287,7 +41305,7 @@ function autoUpdate(reference, floating, update, options2) {
|
|
|
41287
41305
|
}
|
|
41288
41306
|
};
|
|
41289
41307
|
}
|
|
41290
|
-
var index$
|
|
41308
|
+
var index$9 = useLayoutEffect$1;
|
|
41291
41309
|
function _defineProperty$t(obj, key2, value2) {
|
|
41292
41310
|
if (key2 in obj) {
|
|
41293
41311
|
Object.defineProperty(obj, key2, {
|
|
@@ -41858,7 +41876,7 @@ var MenuPortal = function MenuPortal2(_ref7) {
|
|
|
41858
41876
|
});
|
|
41859
41877
|
}
|
|
41860
41878
|
}, [controlElement, menuPosition, placement, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width]);
|
|
41861
|
-
index$
|
|
41879
|
+
index$9(function() {
|
|
41862
41880
|
updateComputedPosition();
|
|
41863
41881
|
}, [updateComputedPosition]);
|
|
41864
41882
|
var runAutoUpdate = useCallback(function() {
|
|
@@ -41870,7 +41888,7 @@ var MenuPortal = function MenuPortal2(_ref7) {
|
|
|
41870
41888
|
cleanupRef.current = autoUpdate(controlElement, menuPortalRef.current, updateComputedPosition);
|
|
41871
41889
|
}
|
|
41872
41890
|
}, [controlElement, updateComputedPosition]);
|
|
41873
|
-
index$
|
|
41891
|
+
index$9(function() {
|
|
41874
41892
|
runAutoUpdate();
|
|
41875
41893
|
}, [runAutoUpdate]);
|
|
41876
41894
|
var setMenuPortalElement = useCallback(function(menuPortalElement) {
|
|
@@ -90524,8 +90542,14 @@ const UpdateResbook = async ({
|
|
|
90524
90542
|
await instance$1.put(`${BASE_URL$2}${venue_id}/tables/${table_id}`, formatTableRules$1(data2));
|
|
90525
90543
|
return { data: "updated" };
|
|
90526
90544
|
case "opHour":
|
|
90527
|
-
|
|
90528
|
-
|
|
90545
|
+
if (data2 == null ? void 0 : data2.ignoreFormat) {
|
|
90546
|
+
delete data2.ignoreFormat;
|
|
90547
|
+
await instance$1.put(`${BASE_URL$2}${venue_id}/opening-hours`, data2);
|
|
90548
|
+
return { data: "updated" };
|
|
90549
|
+
} else {
|
|
90550
|
+
await instance$1.put(`${BASE_URL$2}${venue_id}/opening-hours`, formarRegularHours$1(data2));
|
|
90551
|
+
return { data: "updated" };
|
|
90552
|
+
}
|
|
90529
90553
|
case "arrRule":
|
|
90530
90554
|
await instance$1.put(`${BASE_URL$2}${venue_id}/arrival-rules/${table_id}`, formatArrivalRules$1(data2));
|
|
90531
90555
|
return { data: "updated" };
|
|
@@ -90534,10 +90558,19 @@ const UpdateResbook = async ({
|
|
|
90534
90558
|
return { data: "updated" };
|
|
90535
90559
|
case "specialDate":
|
|
90536
90560
|
if (table_id) {
|
|
90537
|
-
await instance$1.put(
|
|
90561
|
+
await instance$1.put(
|
|
90562
|
+
`${BASE_URL$2}${venue_id}/special-dates/${table_id}`,
|
|
90563
|
+
(data2 == null ? void 0 : data2.ignoreFormat) ? (() => {
|
|
90564
|
+
delete data2.ignoreFormat;
|
|
90565
|
+
return data2;
|
|
90566
|
+
})() : formarSpecialHours$1((_a2 = Object.values(data2)[0]) != null ? _a2 : {})
|
|
90567
|
+
);
|
|
90538
90568
|
return { data: "updated" };
|
|
90539
90569
|
} else {
|
|
90540
|
-
await instance$1.post(`${BASE_URL$2}${venue_id}/special-dates`,
|
|
90570
|
+
await instance$1.post(`${BASE_URL$2}${venue_id}/special-dates`, (data2 == null ? void 0 : data2.ignoreFormat) ? (() => {
|
|
90571
|
+
delete data2.ignoreFormat;
|
|
90572
|
+
return data2;
|
|
90573
|
+
})() : formarSpecialHours$1((_b = Object.values(data2)[0]) != null ? _b : {}));
|
|
90541
90574
|
return { data: "created" };
|
|
90542
90575
|
}
|
|
90543
90576
|
case "deleteSpecialDate":
|
|
@@ -90606,7 +90639,6 @@ const formatArrivalRules$1 = (input2) => {
|
|
|
90606
90639
|
};
|
|
90607
90640
|
};
|
|
90608
90641
|
const formatTableRules$1 = (input2) => {
|
|
90609
|
-
console.log(input2, "input");
|
|
90610
90642
|
const { name, minCapacity, maxCapacity, area } = input2;
|
|
90611
90643
|
return {
|
|
90612
90644
|
name,
|
|
@@ -92553,12 +92585,14 @@ const GetCreateBookingSelectsData = async ({
|
|
|
92553
92585
|
const responseAreas = await instance$1.get(`/v1/rms/venues/${venue_id}/areas`);
|
|
92554
92586
|
const responseHours = await instance$1.get(`/resbook/venue/${venue_id}/opening-hours`);
|
|
92555
92587
|
const responseTables = await instance$1.get(`/resbook/venue/${venue_id}/tables?sortby[orderPriority]=ASC`);
|
|
92588
|
+
const responseChannels = await instance$1.get(`/resbook/smart-channels`);
|
|
92556
92589
|
const data2 = {
|
|
92557
92590
|
partySizes: formatPartySizeData(responseVenueData),
|
|
92558
92591
|
areas: formatAreasData(responseAreas),
|
|
92559
92592
|
hours: formatHoursData(responseHours),
|
|
92560
92593
|
tables: formatTableData(responseTables, includeAreaInTables, includeCoversInTables),
|
|
92561
92594
|
channels: formatChannelsData(responseVenueData),
|
|
92595
|
+
smartChannels: formatSmartChannelsData(responseChannels),
|
|
92562
92596
|
timeZone: formatTimezone(responseVenueData),
|
|
92563
92597
|
sources
|
|
92564
92598
|
};
|
|
@@ -92581,6 +92615,9 @@ const formatChannelsData = (data2) => {
|
|
|
92581
92615
|
const { reservationPortals } = data2;
|
|
92582
92616
|
return [{ id: null, label: "All" }, ...reservationPortals.map((p2) => ({ id: p2.id, label: p2.name }))];
|
|
92583
92617
|
};
|
|
92618
|
+
const formatSmartChannelsData = (data2) => {
|
|
92619
|
+
return data2.map((p2) => ({ value: p2.id, label: p2.name }));
|
|
92620
|
+
};
|
|
92584
92621
|
const formatHoursData = (data2) => {
|
|
92585
92622
|
if (!data2 || typeof data2 !== "object") {
|
|
92586
92623
|
console.error("Error fetching opening hours data: Invalid response data");
|
|
@@ -102506,6 +102543,23 @@ var styles$f = {
|
|
|
102506
102543
|
bookingInfoCardTitle,
|
|
102507
102544
|
bookingInfoCardText
|
|
102508
102545
|
};
|
|
102546
|
+
const LetterX = () => /* @__PURE__ */ React.createElement("svg", {
|
|
102547
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102548
|
+
width: "24",
|
|
102549
|
+
height: "24",
|
|
102550
|
+
viewBox: "0 0 24 24"
|
|
102551
|
+
}, /* @__PURE__ */ React.createElement("rect", {
|
|
102552
|
+
width: "24",
|
|
102553
|
+
height: "24",
|
|
102554
|
+
fill: "none"
|
|
102555
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
102556
|
+
fill: "none",
|
|
102557
|
+
stroke: "currentColor",
|
|
102558
|
+
strokeLinecap: "round",
|
|
102559
|
+
strokeLinejoin: "round",
|
|
102560
|
+
strokeWidth: "2",
|
|
102561
|
+
d: "m7 4l10 16m0-16L7 20"
|
|
102562
|
+
}));
|
|
102509
102563
|
const TrashX = () => /* @__PURE__ */ React.createElement("svg", {
|
|
102510
102564
|
xmlns: "http://www.w3.org/2000/svg",
|
|
102511
102565
|
width: "24",
|
|
@@ -103882,6 +103936,7 @@ const clock = () => {
|
|
|
103882
103936
|
};
|
|
103883
103937
|
var icons = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
103884
103938
|
__proto__: null,
|
|
103939
|
+
LetterX,
|
|
103885
103940
|
TrashX,
|
|
103886
103941
|
EyeOff,
|
|
103887
103942
|
CalendarTime,
|
|
@@ -106138,7 +106193,7 @@ const SelectedBookingProvider = ({ children }) => {
|
|
|
106138
106193
|
value: { selectedBooking, setSelectedBooking }
|
|
106139
106194
|
}, children);
|
|
106140
106195
|
};
|
|
106141
|
-
const index$
|
|
106196
|
+
const index$8 = ({ filters: filters2, setFilters }) => {
|
|
106142
106197
|
const { t: t2 } = useTranslation();
|
|
106143
106198
|
const { selectedBooking, setSelectedBooking } = useSelectedBookingContext();
|
|
106144
106199
|
const [datePickerOpen, setDatePickerOpen] = useState(false);
|
|
@@ -106504,7 +106559,6 @@ const TableBody = ({ data: data2, filtersData, venueId }) => {
|
|
|
106504
106559
|
useEffect(() => {
|
|
106505
106560
|
if (data2 && filtersData) {
|
|
106506
106561
|
const groupedByHour = _23.groupBy(data2, (item2) => {
|
|
106507
|
-
console.log(filtersData == null ? void 0 : filtersData.timeZone, "LOL");
|
|
106508
106562
|
const formattedTime = new Date(item2.date).toLocaleTimeString([], {
|
|
106509
106563
|
...(filtersData == null ? void 0 : filtersData.timeZone) ? {
|
|
106510
106564
|
timeZone: filtersData == null ? void 0 : filtersData.timeZone
|
|
@@ -106520,7 +106574,6 @@ const TableBody = ({ data: data2, filtersData, venueId }) => {
|
|
|
106520
106574
|
["asc"]
|
|
106521
106575
|
).fromPairs().value();
|
|
106522
106576
|
setFormattedData(sortedGroupedByHour);
|
|
106523
|
-
console.log(sortedGroupedByHour, "SORTED");
|
|
106524
106577
|
}
|
|
106525
106578
|
}, [data2, filtersData]);
|
|
106526
106579
|
return /* @__PURE__ */ React__default.createElement("div", null, _23.isEmpty(formattedData) ? /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -106546,7 +106599,7 @@ const TableBody = ({ data: data2, filtersData, venueId }) => {
|
|
|
106546
106599
|
})));
|
|
106547
106600
|
}));
|
|
106548
106601
|
};
|
|
106549
|
-
const index$
|
|
106602
|
+
const index$7 = ({ data: data2, filters: filters2, filtersData, venueId }) => {
|
|
106550
106603
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(TableTopHeader, {
|
|
106551
106604
|
date: filters2.fromDate,
|
|
106552
106605
|
total: data2 == null ? void 0 : data2.length
|
|
@@ -106886,7 +106939,7 @@ const Header = () => {
|
|
|
106886
106939
|
style: { width: "100%", marginTop: 15 }
|
|
106887
106940
|
}));
|
|
106888
106941
|
};
|
|
106889
|
-
const index$
|
|
106942
|
+
const index$6 = ({ filtersData, venueId }) => {
|
|
106890
106943
|
const { t: t2 } = useTranslation();
|
|
106891
106944
|
const { reload: reloadMainTable } = useReloadContext();
|
|
106892
106945
|
const { selectedBooking, setSelectedBooking } = useSelectedBookingContext();
|
|
@@ -106898,7 +106951,7 @@ const index$4 = ({ filtersData, venueId }) => {
|
|
|
106898
106951
|
const [timeOptions, setTimeOptions] = useState([]);
|
|
106899
106952
|
const [tableOptions, setTableOptions] = useState([]);
|
|
106900
106953
|
const defaultValue = {
|
|
106901
|
-
source:
|
|
106954
|
+
source: null,
|
|
106902
106955
|
date: "",
|
|
106903
106956
|
time: null,
|
|
106904
106957
|
partySize: null,
|
|
@@ -106965,7 +107018,7 @@ const index$4 = ({ filtersData, venueId }) => {
|
|
|
106965
107018
|
name: "partySize"
|
|
106966
107019
|
});
|
|
106967
107020
|
const { data: data2, reload, isLoading } = useFetch(
|
|
106968
|
-
|
|
107021
|
+
date4 && time2 && (time2 == null ? void 0 : time2.value) && partySize && (partySize == null ? void 0 : partySize.value) ? GetTableAvailability : () => Promise.resolve([]),
|
|
106969
107022
|
{
|
|
106970
107023
|
cacheId: "reservation0dashboard0table0availability",
|
|
106971
107024
|
venue_id: venueId,
|
|
@@ -106979,7 +107032,7 @@ const index$4 = ({ filtersData, venueId }) => {
|
|
|
106979
107032
|
}
|
|
106980
107033
|
});
|
|
106981
107034
|
const onSubmit = async () => {
|
|
106982
|
-
var _a2, _b, _c, _d;
|
|
107035
|
+
var _a2, _b, _c, _d, _e2;
|
|
106983
107036
|
const data22 = await getValues();
|
|
106984
107037
|
const result = await trigger();
|
|
106985
107038
|
if (!result) {
|
|
@@ -106988,9 +107041,10 @@ const index$4 = ({ filtersData, venueId }) => {
|
|
|
106988
107041
|
}
|
|
106989
107042
|
if (!selectedBooking) {
|
|
106990
107043
|
const toSend = {
|
|
106991
|
-
|
|
106992
|
-
|
|
106993
|
-
|
|
107044
|
+
bookingChannel: (_a2 = data22 == null ? void 0 : data22.source) == null ? void 0 : _a2.value,
|
|
107045
|
+
partySize: (_b = data22 == null ? void 0 : data22.partySize) == null ? void 0 : _b.value,
|
|
107046
|
+
table: (_c = data22 == null ? void 0 : data22.table) == null ? void 0 : _c.value,
|
|
107047
|
+
date: data22.date ? moment$1.tz(`${data22.date} ${(_d = data22.time) == null ? void 0 : _d.value}`, currentTimeZone ? currentTimeZone : "").valueOf() / 1e3 : moment$1.tz(moment$1(), currentTimeZone ? currentTimeZone : "").valueOf() / 1e3,
|
|
106994
107048
|
notes: data22 == null ? void 0 : data22.notes,
|
|
106995
107049
|
contact: {
|
|
106996
107050
|
firstname: data22 == null ? void 0 : data22.firstName,
|
|
@@ -107006,7 +107060,7 @@ const index$4 = ({ filtersData, venueId }) => {
|
|
|
107006
107060
|
});
|
|
107007
107061
|
reloadMainTable();
|
|
107008
107062
|
} else {
|
|
107009
|
-
executeUpdate({ data: { table: (
|
|
107063
|
+
executeUpdate({ data: { table: (_e2 = data22 == null ? void 0 : data22.table) == null ? void 0 : _e2.value }, venueId, bookingId: selectedBooking.id });
|
|
107010
107064
|
}
|
|
107011
107065
|
};
|
|
107012
107066
|
useEffect(() => {
|
|
@@ -107031,8 +107085,8 @@ const index$4 = ({ filtersData, venueId }) => {
|
|
|
107031
107085
|
if (filtersData == null ? void 0 : filtersData.partySizes) {
|
|
107032
107086
|
setPartySizeOptions(filtersData.partySizes.map((item2) => ({ value: item2.id, label: item2.label })));
|
|
107033
107087
|
}
|
|
107034
|
-
if (filtersData == null ? void 0 : filtersData.
|
|
107035
|
-
setSourceOptions(filtersData.
|
|
107088
|
+
if (filtersData == null ? void 0 : filtersData.smartChannels) {
|
|
107089
|
+
setSourceOptions(filtersData.smartChannels);
|
|
107036
107090
|
}
|
|
107037
107091
|
if (filtersData == null ? void 0 : filtersData.hours) {
|
|
107038
107092
|
setTimeByDayOptions(filtersData == null ? void 0 : filtersData.hours);
|
|
@@ -107220,7 +107274,6 @@ function MainComponent({ venueId }) {
|
|
|
107220
107274
|
);
|
|
107221
107275
|
const { selectedBooking, setSelectedBooking } = useSelectedBookingContext();
|
|
107222
107276
|
const { data: data2, isLoading, error: error3, reload } = useFetch(GetBookings, { cacheId: "reservation0dashboard", venue_id: venueId, params });
|
|
107223
|
-
console.log(venueId, "VENUE ID");
|
|
107224
107277
|
const { data: filtersData, isLoading: filtersLoading, error: filtersError, reload: reloadSelectsData } = useFetch(GetCreateBookingSelectsData, {
|
|
107225
107278
|
cacheId: "venueCapacity",
|
|
107226
107279
|
venue_id: currentVenue,
|
|
@@ -107254,17 +107307,17 @@ function MainComponent({ venueId }) {
|
|
|
107254
107307
|
className: styles$f.mainConatiner
|
|
107255
107308
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
107256
107309
|
className: styles$f.mainTableContainer
|
|
107257
|
-
}, /* @__PURE__ */ React__default.createElement(index$
|
|
107310
|
+
}, /* @__PURE__ */ React__default.createElement(index$8, {
|
|
107258
107311
|
filters: filters2,
|
|
107259
107312
|
setFilters
|
|
107260
|
-
}), /* @__PURE__ */ React__default.createElement(index$
|
|
107313
|
+
}), /* @__PURE__ */ React__default.createElement(index$7, {
|
|
107261
107314
|
data: data2,
|
|
107262
107315
|
filters: filters2,
|
|
107263
107316
|
filtersData,
|
|
107264
107317
|
venueId
|
|
107265
107318
|
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
107266
107319
|
className: styles$f.mainSidebarContainer
|
|
107267
|
-
}, /* @__PURE__ */ React__default.createElement(index$
|
|
107320
|
+
}, /* @__PURE__ */ React__default.createElement(index$6, {
|
|
107268
107321
|
filtersData,
|
|
107269
107322
|
venueId
|
|
107270
107323
|
}))));
|
|
@@ -107331,7 +107384,7 @@ const AreaManagementCard$1 = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) =>
|
|
|
107331
107384
|
style: { flex: 1, textAlign: "center" }
|
|
107332
107385
|
}, (data2 == null ? void 0 : data2.bookableAreas) ? t2("YES") : t2("NO"))), /* @__PURE__ */ React__default.createElement("br", null), (data2 == null ? void 0 : data2.areas) && data2.areas.length > 0 && /* @__PURE__ */ React__default.createElement("div", {
|
|
107333
107386
|
style: { display: "flex", flexDirection: "column", gap: 20 }
|
|
107334
|
-
}, data2.areas.map((area, index2) => /* @__PURE__ */ React__default.createElement("p", {
|
|
107387
|
+
}, data2.areas.slice(0, 2).map((area, index2) => /* @__PURE__ */ React__default.createElement("p", {
|
|
107335
107388
|
key: index2,
|
|
107336
107389
|
style: { fontWeight: "bold" }
|
|
107337
107390
|
}, area.name)))), /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -107382,17 +107435,17 @@ const formatData = (data2) => {
|
|
|
107382
107435
|
const formatVenueData = (data2) => {
|
|
107383
107436
|
return { bookableAreas: data2.bookableAreas };
|
|
107384
107437
|
};
|
|
107385
|
-
const drawer = "
|
|
107386
|
-
const drawer__overlay = "
|
|
107387
|
-
const drawer__content = "
|
|
107388
|
-
const drawer__header = "
|
|
107389
|
-
const drawer__header__content = "
|
|
107390
|
-
const drawer__header__content__desc = "
|
|
107391
|
-
const drawer__close = "
|
|
107392
|
-
const drawer__body = "
|
|
107438
|
+
const drawer = "_drawer_1h00k_1";
|
|
107439
|
+
const drawer__overlay = "_drawer__overlay_1h00k_18";
|
|
107440
|
+
const drawer__content = "_drawer__content_1h00k_34";
|
|
107441
|
+
const drawer__header = "_drawer__header_1h00k_42";
|
|
107442
|
+
const drawer__header__content = "_drawer__header__content_1h00k_50";
|
|
107443
|
+
const drawer__header__content__desc = "_drawer__header__content__desc_1h00k_56";
|
|
107444
|
+
const drawer__close = "_drawer__close_1h00k_60";
|
|
107445
|
+
const drawer__body = "_drawer__body_1h00k_71";
|
|
107393
107446
|
var styles$3 = {
|
|
107394
107447
|
drawer,
|
|
107395
|
-
"drawer--open": "_drawer--
|
|
107448
|
+
"drawer--open": "_drawer--open_1h00k_14",
|
|
107396
107449
|
drawer__overlay,
|
|
107397
107450
|
drawer__content,
|
|
107398
107451
|
drawer__header,
|
|
@@ -107456,7 +107509,7 @@ const Toggle = ({
|
|
|
107456
107509
|
className: styles$2.label__switch
|
|
107457
107510
|
}), label2));
|
|
107458
107511
|
};
|
|
107459
|
-
const SwitchField = ({ control, name, ...props }) => {
|
|
107512
|
+
const SwitchField = ({ control, name, onChangeEvent, ...props }) => {
|
|
107460
107513
|
return /* @__PURE__ */ React__default.createElement(Controller, {
|
|
107461
107514
|
control,
|
|
107462
107515
|
name,
|
|
@@ -107470,6 +107523,9 @@ const SwitchField = ({ control, name, ...props }) => {
|
|
|
107470
107523
|
label: props.label,
|
|
107471
107524
|
onChange: (e3) => {
|
|
107472
107525
|
onChange3(e3);
|
|
107526
|
+
if (onChangeEvent) {
|
|
107527
|
+
onChangeEvent(e3);
|
|
107528
|
+
}
|
|
107473
107529
|
}
|
|
107474
107530
|
}), error3 && /* @__PURE__ */ React__default.createElement(FieldError, {
|
|
107475
107531
|
error: error3
|
|
@@ -107577,7 +107633,7 @@ const AreaEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =>
|
|
|
107577
107633
|
};
|
|
107578
107634
|
if (!((_a2 = data22.areas[index2]) == null ? void 0 : _a2.id)) {
|
|
107579
107635
|
await executeCreator({ data: toSend, venueId });
|
|
107580
|
-
} else if (((_b = data22.areas[index2]) == null ? void 0 : _b.id) && fieldChanged$
|
|
107636
|
+
} else if (((_b = data22.areas[index2]) == null ? void 0 : _b.id) && fieldChanged$3(data22.areas[index2], initialData)) {
|
|
107581
107637
|
await executeUpdater({ data: toSend, venueId, areaId: data22.areas[index2].id });
|
|
107582
107638
|
}
|
|
107583
107639
|
}
|
|
@@ -107672,7 +107728,7 @@ const AreaEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =>
|
|
|
107672
107728
|
}
|
|
107673
107729
|
}));
|
|
107674
107730
|
};
|
|
107675
|
-
const fieldChanged$
|
|
107731
|
+
const fieldChanged$3 = (currentValue, initialData) => {
|
|
107676
107732
|
if (currentValue.id) {
|
|
107677
107733
|
const initialValue = initialData.areas.find((area) => area.id === currentValue.id);
|
|
107678
107734
|
if (initialValue) {
|
|
@@ -107681,7 +107737,7 @@ const fieldChanged$2 = (currentValue, initialData) => {
|
|
|
107681
107737
|
}
|
|
107682
107738
|
return false;
|
|
107683
107739
|
};
|
|
107684
|
-
const index$
|
|
107740
|
+
const index$5 = ({ venueId }) => {
|
|
107685
107741
|
const [isOpenDrawer, setIsOpenDrawer] = useState(false);
|
|
107686
107742
|
const { data: data2, isLoading, error: error3, reload } = useFetch(GetAreaManagement, { cacheId: "area0management", venue_id: venueId });
|
|
107687
107743
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -107712,7 +107768,7 @@ const AreaManagementCard = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) => {
|
|
|
107712
107768
|
className: styles$4.cardBody
|
|
107713
107769
|
}, data2 && data2.length > 0 && /* @__PURE__ */ React__default.createElement("div", {
|
|
107714
107770
|
style: { display: "flex", flexDirection: "column", gap: 20 }
|
|
107715
|
-
}, data2.map((table2, index2) => {
|
|
107771
|
+
}, data2.slice(0, 3).map((table2, index2) => {
|
|
107716
107772
|
var _a2, _b;
|
|
107717
107773
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
107718
107774
|
key: index2,
|
|
@@ -107856,6 +107912,9 @@ const DeleteResbook = async ({
|
|
|
107856
107912
|
case "seatingRule":
|
|
107857
107913
|
await instance$1.delete(`${BASE_URL}${venue_id}/seating-rules/${table_id}`);
|
|
107858
107914
|
return { data: "deleted" };
|
|
107915
|
+
case "specialDate":
|
|
107916
|
+
await instance$1.delete(`${BASE_URL}${venue_id}/special-dates/${table_id}`);
|
|
107917
|
+
return { data: "deleted" };
|
|
107859
107918
|
default:
|
|
107860
107919
|
await instance$1.delete(
|
|
107861
107920
|
`${BASE_URL}${venue_id}/tables/${table_id}`
|
|
@@ -107929,7 +107988,7 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
|
|
|
107929
107988
|
};
|
|
107930
107989
|
if (!((_c = data22.tables[index2]) == null ? void 0 : _c.id)) {
|
|
107931
107990
|
await executeCreator({ data: { ...toSend, orderPriority: data22.tables.length }, venue_id: venueId, module: "table" });
|
|
107932
|
-
} else if (((_d = data22.tables[index2]) == null ? void 0 : _d.id) && fieldChanged$
|
|
107991
|
+
} else if (((_d = data22.tables[index2]) == null ? void 0 : _d.id) && fieldChanged$2(data22.tables[index2], initialData)) {
|
|
107933
107992
|
await executeUpdater({ data: toSend, venue_id: venueId, table_id: data22.tables[index2].id, module: "table" });
|
|
107934
107993
|
}
|
|
107935
107994
|
}
|
|
@@ -108063,7 +108122,7 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
|
|
|
108063
108122
|
}
|
|
108064
108123
|
}));
|
|
108065
108124
|
};
|
|
108066
|
-
const fieldChanged$
|
|
108125
|
+
const fieldChanged$2 = (currentValue, initialData) => {
|
|
108067
108126
|
var _a2, _b;
|
|
108068
108127
|
if (currentValue.id) {
|
|
108069
108128
|
const initialValue = initialData.find((table2) => table2.id === currentValue.id);
|
|
@@ -108073,7 +108132,7 @@ const fieldChanged$1 = (currentValue, initialData) => {
|
|
|
108073
108132
|
}
|
|
108074
108133
|
return false;
|
|
108075
108134
|
};
|
|
108076
|
-
const index$
|
|
108135
|
+
const index$4 = ({ venueId }) => {
|
|
108077
108136
|
const [isOpenDrawer, setIsOpenDrawer] = useState(false);
|
|
108078
108137
|
const { data: data2, isLoading, error: error3, reload } = useFetch(GetTableManagement, { cacheId: "table0management", venue_id: venueId });
|
|
108079
108138
|
const { data: areasList, isLoading: isLoadingAreas, error: errorAreasList, reload: reloadAreasList } = useFetch(GetAreasList, { cacheId: "areas0list", venue_id: venueId });
|
|
@@ -108124,14 +108183,15 @@ const ReservationDurationCard = ({ isOpenDrawer, setIsOpenDrawer, data: data2 })
|
|
|
108124
108183
|
style: { fontWeight: "bold", width: "100px" }
|
|
108125
108184
|
}, t2("Shift 1")), /* @__PURE__ */ React__default.createElement("p", {
|
|
108126
108185
|
style: { fontWeight: "bold", width: "100px" }
|
|
108127
|
-
}, t2("Shift 2"))),
|
|
108186
|
+
}, t2("Shift 2"))), Object.entries(data2).slice(0, 2).map(([key2, party], index2) => {
|
|
108128
108187
|
var _a2;
|
|
108129
108188
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
108130
108189
|
key: index2,
|
|
108131
108190
|
style: { display: "flex", gap: 10, justifyContent: "space-between" }
|
|
108132
108191
|
}, /* @__PURE__ */ React__default.createElement("p", {
|
|
108133
108192
|
style: { width: "100px" }
|
|
108134
|
-
}, (_a2 = party[0]) == null ? void 0 : _a2.partySize, "pax"),
|
|
108193
|
+
}, (_a2 = party[0]) == null ? void 0 : _a2.partySize, "pax"), party.map((shift, shiftIndex) => /* @__PURE__ */ React__default.createElement("p", {
|
|
108194
|
+
key: shiftIndex,
|
|
108135
108195
|
style: { width: "100px" }
|
|
108136
108196
|
}, (shift == null ? void 0 : shift.duration) ? /* @__PURE__ */ React__default.createElement(TimeFormatter, {
|
|
108137
108197
|
seconds: shift == null ? void 0 : shift.duration
|
|
@@ -108182,10 +108242,10 @@ const ReservationDurationEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2
|
|
|
108182
108242
|
}
|
|
108183
108243
|
try {
|
|
108184
108244
|
for (const shift of formData.shifts) {
|
|
108185
|
-
if (shift.shift1Id && fieldChanged(shift, initialData)) {
|
|
108245
|
+
if (shift.shift1Id && fieldChanged$1(shift, initialData)) {
|
|
108186
108246
|
await executeUpdater({ data: { duration: shift.shift1 }, venue_id: venueId, table_id: shift.shift1Id, module: "seatingRule" });
|
|
108187
108247
|
}
|
|
108188
|
-
if (shift.shift2Id && fieldChanged(shift, initialData)) {
|
|
108248
|
+
if (shift.shift2Id && fieldChanged$1(shift, initialData)) {
|
|
108189
108249
|
await executeUpdater({ data: { duration: shift.shift2 }, venue_id: venueId, table_id: shift.shift2Id, module: "seatingRule" });
|
|
108190
108250
|
}
|
|
108191
108251
|
}
|
|
@@ -108255,14 +108315,14 @@ const ReservationDurationEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2
|
|
|
108255
108315
|
onClick: () => onSubmit()
|
|
108256
108316
|
}, t2("SAVE")))));
|
|
108257
108317
|
};
|
|
108258
|
-
const fieldChanged = (currentValue, initialData) => {
|
|
108318
|
+
const fieldChanged$1 = (currentValue, initialData) => {
|
|
108259
108319
|
const initialValue = initialData.find((item2) => item2.partySize === currentValue.partySize);
|
|
108260
108320
|
if (initialValue) {
|
|
108261
108321
|
return initialValue.shift1 !== currentValue.shift1 || initialValue.shift2 !== currentValue.shift2;
|
|
108262
108322
|
}
|
|
108263
108323
|
return true;
|
|
108264
108324
|
};
|
|
108265
|
-
const index$
|
|
108325
|
+
const index$3 = ({ venueId }) => {
|
|
108266
108326
|
const [isOpenDrawer, setIsOpenDrawer] = useState(false);
|
|
108267
108327
|
const { data: data2, isLoading, error: error3, reload } = useFetch(GetSeatingRules, { cacheId: "reservation0duration", venue_id: venueId });
|
|
108268
108328
|
const [formatedData, setformatedData] = useState(null);
|
|
@@ -108289,6 +108349,320 @@ const index$1 = ({ venueId }) => {
|
|
|
108289
108349
|
reload
|
|
108290
108350
|
}));
|
|
108291
108351
|
};
|
|
108352
|
+
const SpecialDatesCard = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) => {
|
|
108353
|
+
const getOrdinal = (n2) => {
|
|
108354
|
+
const s2 = ["th", "st", "nd", "rd"];
|
|
108355
|
+
const v2 = n2 % 100;
|
|
108356
|
+
return s2[(v2 - 20) % 10] || s2[v2] || s2[0];
|
|
108357
|
+
};
|
|
108358
|
+
const formatDate2 = (dateString) => {
|
|
108359
|
+
const date4 = hooks(dateString);
|
|
108360
|
+
return `${date4.format("ddd.")}${date4.date()}${getOrdinal(date4.date())} ${date4.format("MMM")}`;
|
|
108361
|
+
};
|
|
108362
|
+
const { t: t2 } = useTranslation();
|
|
108363
|
+
return /* @__PURE__ */ React__default.createElement(Card, {
|
|
108364
|
+
className: styles$4.sectionCard
|
|
108365
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108366
|
+
className: styles$4.cardHeader
|
|
108367
|
+
}, /* @__PURE__ */ React__default.createElement("h2", {
|
|
108368
|
+
className: styles$4.cardTitle
|
|
108369
|
+
}, t2("SPECIAL_DATES")), /* @__PURE__ */ React__default.createElement("p", {
|
|
108370
|
+
className: styles$4.cardDesc
|
|
108371
|
+
}, t2("SPECIAL_DATES_DESC"))), /* @__PURE__ */ React__default.createElement("div", {
|
|
108372
|
+
className: styles$4.cardBody
|
|
108373
|
+
}, data2 && data2.length > 0 && /* @__PURE__ */ React__default.createElement("div", {
|
|
108374
|
+
style: { display: "grid", gridTemplateColumns: "2fr 1fr", gap: "10px", rowGap: "20px" }
|
|
108375
|
+
}, data2.slice(0, 3).map((date4, index2) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, {
|
|
108376
|
+
key: index2
|
|
108377
|
+
}, /* @__PURE__ */ React__default.createElement("p", {
|
|
108378
|
+
style: { fontWeight: "bold", textAlign: "left" }
|
|
108379
|
+
}, formatDate2(date4.startDate), " - ", formatDate2(date4.endDate)), date4.closed ? /* @__PURE__ */ React__default.createElement("p", {
|
|
108380
|
+
style: { textAlign: "center" }
|
|
108381
|
+
}, t2("CLOSED")) : /* @__PURE__ */ React__default.createElement("p", {
|
|
108382
|
+
style: { textAlign: "center" }
|
|
108383
|
+
}, t2("SPECIAL_SHIFTS")))))), /* @__PURE__ */ React__default.createElement("div", {
|
|
108384
|
+
className: styles$4.cardFooter
|
|
108385
|
+
}, /* @__PURE__ */ React__default.createElement("hr", null), /* @__PURE__ */ React__default.createElement("div", {
|
|
108386
|
+
className: styles$4.cardFooterContent,
|
|
108387
|
+
style: { color: "#9392a3", cursor: "pointer" },
|
|
108388
|
+
onClick: () => {
|
|
108389
|
+
setIsOpenDrawer(true);
|
|
108390
|
+
}
|
|
108391
|
+
}, "more")));
|
|
108392
|
+
};
|
|
108393
|
+
const SpecialDatesTimeSlots = ({ control, index: index2, watch, setValue: setValue2, trigger }) => {
|
|
108394
|
+
const { t: t2 } = useTranslation();
|
|
108395
|
+
const { fields: timeSlotFields, append: append2, remove } = useFieldArray({
|
|
108396
|
+
control,
|
|
108397
|
+
name: `dates.${index2}.timeSlots`
|
|
108398
|
+
});
|
|
108399
|
+
const currentTimeSlots = watch(`dates.${index2}.timeSlots`) || [];
|
|
108400
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
108401
|
+
style: { display: "flex", gap: "10px", marginTop: "10px", alignItems: "center" }
|
|
108402
|
+
}, timeSlotFields.map((slot2, slotIndex) => /* @__PURE__ */ React__default.createElement("div", {
|
|
108403
|
+
key: slot2.id,
|
|
108404
|
+
style: { display: "flex", alignItems: "center", gap: 10, justifyContent: "space-between" }
|
|
108405
|
+
}, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
108406
|
+
control,
|
|
108407
|
+
id: `dates.${index2}.timeSlots.${slotIndex}.start`,
|
|
108408
|
+
name: `dates.${index2}.timeSlots.${slotIndex}.start`,
|
|
108409
|
+
label: t2("Start"),
|
|
108410
|
+
type: "time"
|
|
108411
|
+
})), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
108412
|
+
control,
|
|
108413
|
+
id: `dates.${index2}.timeSlots.${slotIndex}.end`,
|
|
108414
|
+
name: `dates.${index2}.timeSlots.${slotIndex}.end`,
|
|
108415
|
+
label: t2("End"),
|
|
108416
|
+
type: "time"
|
|
108417
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
108418
|
+
style: { color: "#FF4C51", cursor: "pointer", marginTop: 10 }
|
|
108419
|
+
}, /* @__PURE__ */ React__default.createElement(Icon, {
|
|
108420
|
+
icon: "LetterX",
|
|
108421
|
+
size: "small",
|
|
108422
|
+
onClick: () => {
|
|
108423
|
+
remove(slotIndex);
|
|
108424
|
+
setValue2(
|
|
108425
|
+
`dates.${index2}.timeSlots`,
|
|
108426
|
+
currentTimeSlots.filter((_24, idx) => idx !== slotIndex),
|
|
108427
|
+
{ shouldDirty: true }
|
|
108428
|
+
);
|
|
108429
|
+
trigger(`dates.${index2}.timeSlots`);
|
|
108430
|
+
}
|
|
108431
|
+
})))), timeSlotFields.length < 2 && /* @__PURE__ */ React__default.createElement("div", {
|
|
108432
|
+
style: { marginTop: 10 }
|
|
108433
|
+
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
108434
|
+
mode: "tertiary",
|
|
108435
|
+
size: "small",
|
|
108436
|
+
icon: "plus",
|
|
108437
|
+
iconPosition: "left",
|
|
108438
|
+
onClick: () => {
|
|
108439
|
+
append2({ start: "", end: "" });
|
|
108440
|
+
}
|
|
108441
|
+
}, t2("Add"))));
|
|
108442
|
+
};
|
|
108443
|
+
const SpecialDatesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) => {
|
|
108444
|
+
const { t: t2 } = useTranslation();
|
|
108445
|
+
const { showMessageError } = useMessage();
|
|
108446
|
+
const [initialData, setInitialData] = useState(null);
|
|
108447
|
+
const [showConfirmationModal, setShowConfirmationModal] = useState(false);
|
|
108448
|
+
const [selectedDate, setSelectedDate] = useState(null);
|
|
108449
|
+
const { isExecuting: loadingUpdate, execute: executeUpdater } = useService(UpdateResbook, {});
|
|
108450
|
+
const { isExecuting: loadingDelete, execute: executeDeleter } = useService(DeleteResbook, {
|
|
108451
|
+
onSuccess: () => {
|
|
108452
|
+
setShowConfirmationModal(false);
|
|
108453
|
+
setSelectedDate(null);
|
|
108454
|
+
reload();
|
|
108455
|
+
}
|
|
108456
|
+
});
|
|
108457
|
+
const defaultValue = {
|
|
108458
|
+
dates: []
|
|
108459
|
+
};
|
|
108460
|
+
const datesSchema = () => create$1().shape({
|
|
108461
|
+
dates: create2().of(
|
|
108462
|
+
create$1().shape({
|
|
108463
|
+
id: create$2().nullable(),
|
|
108464
|
+
closed: create$3(),
|
|
108465
|
+
startDate: create$2().required(t2("errors.required")),
|
|
108466
|
+
endDate: create$2().required(t2("errors.required")),
|
|
108467
|
+
timeSlots: create2().of(
|
|
108468
|
+
create$1().shape({
|
|
108469
|
+
start: create$2().required(t2("Start time is required")),
|
|
108470
|
+
end: create$2().required(t2("End time is required"))
|
|
108471
|
+
})
|
|
108472
|
+
).max(2, t2("You can only add up to two timeslots"))
|
|
108473
|
+
})
|
|
108474
|
+
)
|
|
108475
|
+
});
|
|
108476
|
+
const {
|
|
108477
|
+
control,
|
|
108478
|
+
reset,
|
|
108479
|
+
trigger,
|
|
108480
|
+
getValues,
|
|
108481
|
+
setValue: setValue2,
|
|
108482
|
+
watch,
|
|
108483
|
+
formState: { isDirty }
|
|
108484
|
+
} = useForm({
|
|
108485
|
+
mode: "onChange",
|
|
108486
|
+
resolver: o(datesSchema()),
|
|
108487
|
+
defaultValues: defaultValue
|
|
108488
|
+
});
|
|
108489
|
+
const { fields, append: append2, remove } = useFieldArray({
|
|
108490
|
+
control,
|
|
108491
|
+
name: "dates"
|
|
108492
|
+
});
|
|
108493
|
+
const onSubmit = async () => {
|
|
108494
|
+
var _a2;
|
|
108495
|
+
const formData = getValues();
|
|
108496
|
+
const result = await trigger();
|
|
108497
|
+
if (!result) {
|
|
108498
|
+
showMessageError(t2("pleaseCheckFormsErrors"));
|
|
108499
|
+
return;
|
|
108500
|
+
}
|
|
108501
|
+
try {
|
|
108502
|
+
for (const date4 of formData.dates) {
|
|
108503
|
+
const toSend = {
|
|
108504
|
+
startDate: date4.startDate,
|
|
108505
|
+
endDate: date4.endDate,
|
|
108506
|
+
closed: `${date4.closed}`,
|
|
108507
|
+
timeslots: date4.timeSlots,
|
|
108508
|
+
ignoreFormat: true
|
|
108509
|
+
};
|
|
108510
|
+
if (!date4.id) {
|
|
108511
|
+
await executeUpdater({ data: toSend, venue_id: venueId, module: "specialDate", table_id: null });
|
|
108512
|
+
} else if (date4.id && fieldChanged(date4, initialData)) {
|
|
108513
|
+
await executeUpdater({ data: toSend, venue_id: venueId, table_id: (_a2 = date4.id) != null ? _a2 : null, module: "specialDate" });
|
|
108514
|
+
}
|
|
108515
|
+
}
|
|
108516
|
+
reload();
|
|
108517
|
+
setIsOpen(false);
|
|
108518
|
+
} catch (error3) {
|
|
108519
|
+
showMessageError("Failed to update reservation duration");
|
|
108520
|
+
}
|
|
108521
|
+
};
|
|
108522
|
+
const onDelete = (value2, index2) => {
|
|
108523
|
+
if (value2.id) {
|
|
108524
|
+
setShowConfirmationModal(true);
|
|
108525
|
+
setSelectedDate(value2.id);
|
|
108526
|
+
} else {
|
|
108527
|
+
remove(index2);
|
|
108528
|
+
}
|
|
108529
|
+
};
|
|
108530
|
+
useEffect(() => {
|
|
108531
|
+
if (data2) {
|
|
108532
|
+
const formatedData = data2.map((item2) => {
|
|
108533
|
+
return {
|
|
108534
|
+
id: item2.id,
|
|
108535
|
+
closed: item2.closed,
|
|
108536
|
+
startDate: hooks(item2.startDate).format("YYYY-MM-DD"),
|
|
108537
|
+
endDate: hooks(item2.endDate).format("YYYY-MM-DD"),
|
|
108538
|
+
timeSlots: item2.timeSlots
|
|
108539
|
+
};
|
|
108540
|
+
});
|
|
108541
|
+
reset({ dates: formatedData });
|
|
108542
|
+
setInitialData(formatedData);
|
|
108543
|
+
} else {
|
|
108544
|
+
reset(defaultValue);
|
|
108545
|
+
setInitialData(defaultValue);
|
|
108546
|
+
}
|
|
108547
|
+
}, [data2]);
|
|
108548
|
+
return /* @__PURE__ */ React__default.createElement(Drawer, {
|
|
108549
|
+
isOpen,
|
|
108550
|
+
onClose: () => setIsOpen(false),
|
|
108551
|
+
title: t2("SPECIAL_DATES"),
|
|
108552
|
+
titleDesc: t2("SPECIAL_DATES_DESC")
|
|
108553
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108554
|
+
className: styles$4.drawerContent
|
|
108555
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108556
|
+
className: styles$4.scrollableForm
|
|
108557
|
+
}, fields.map((item2, index2) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, {
|
|
108558
|
+
key: item2.id
|
|
108559
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108560
|
+
className: styles$4.sectionFormRow,
|
|
108561
|
+
style: { justifyContent: "flex-start", flexDirection: "column", paddingLeft: 0, paddingRight: 0 }
|
|
108562
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108563
|
+
style: { display: "flex", gap: 10, alignItems: "center" }
|
|
108564
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108565
|
+
style: { color: "#FF4C51", cursor: "pointer", marginTop: 20 }
|
|
108566
|
+
}, /* @__PURE__ */ React__default.createElement(Icon, {
|
|
108567
|
+
icon: "TrashX",
|
|
108568
|
+
onClick: () => {
|
|
108569
|
+
onDelete(getValues(`dates.${index2}`), index2);
|
|
108570
|
+
}
|
|
108571
|
+
})), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
108572
|
+
control,
|
|
108573
|
+
id: `dates.${index2}.startDate`,
|
|
108574
|
+
name: `dates.${index2}.startDate`,
|
|
108575
|
+
label: t2("From"),
|
|
108576
|
+
type: "date"
|
|
108577
|
+
})), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
108578
|
+
control,
|
|
108579
|
+
id: `dates.${index2}.endDate`,
|
|
108580
|
+
name: `dates.${index2}.endDate`,
|
|
108581
|
+
label: t2("Until"),
|
|
108582
|
+
type: "date"
|
|
108583
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
108584
|
+
style: { marginTop: 20 }
|
|
108585
|
+
}, /* @__PURE__ */ React__default.createElement(SwitchField, {
|
|
108586
|
+
control,
|
|
108587
|
+
id: `dates.${index2}.closed`,
|
|
108588
|
+
name: `dates.${index2}.closed`,
|
|
108589
|
+
label: t2("Closed"),
|
|
108590
|
+
onChangeEvent: (e3) => {
|
|
108591
|
+
const isClosed = e3.target.checked;
|
|
108592
|
+
setValue2(`dates.${index2}.closed`, isClosed);
|
|
108593
|
+
if (isClosed) {
|
|
108594
|
+
setValue2(`dates.${index2}.timeSlots`, []);
|
|
108595
|
+
}
|
|
108596
|
+
}
|
|
108597
|
+
}))), !watch(`dates.${index2}.closed`) && /* @__PURE__ */ React__default.createElement(SpecialDatesTimeSlots, {
|
|
108598
|
+
control,
|
|
108599
|
+
index: index2,
|
|
108600
|
+
watch,
|
|
108601
|
+
setValue: setValue2,
|
|
108602
|
+
trigger
|
|
108603
|
+
})), /* @__PURE__ */ React__default.createElement("hr", {
|
|
108604
|
+
style: { width: "100%", flex: 1 }
|
|
108605
|
+
})))), /* @__PURE__ */ React__default.createElement("div", {
|
|
108606
|
+
className: styles$4.fixedActions
|
|
108607
|
+
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
108608
|
+
mode: "tertiary",
|
|
108609
|
+
icon: "plus",
|
|
108610
|
+
iconPosition: "right",
|
|
108611
|
+
type: "button",
|
|
108612
|
+
onClick: () => append2({ closed: false, startDate: "", endDate: "" })
|
|
108613
|
+
}, t2("ADD_SPECIAL_DATE")), isDirty && /* @__PURE__ */ React__default.createElement(Button, {
|
|
108614
|
+
mode: "success",
|
|
108615
|
+
icon: "check",
|
|
108616
|
+
iconPosition: "right",
|
|
108617
|
+
type: "button",
|
|
108618
|
+
onClick: () => onSubmit()
|
|
108619
|
+
}, t2("SAVE")))), /* @__PURE__ */ React__default.createElement(ConfirmationModal, {
|
|
108620
|
+
open: showConfirmationModal,
|
|
108621
|
+
onClose: () => {
|
|
108622
|
+
setShowConfirmationModal(false);
|
|
108623
|
+
},
|
|
108624
|
+
isLoading: loadingDelete,
|
|
108625
|
+
title: t2("DELETE_SPECIAL_DATE"),
|
|
108626
|
+
text: t2("ARE_YOU_SURE_DELETE_SPECIAL_DATE"),
|
|
108627
|
+
onAccept: () => {
|
|
108628
|
+
executeDeleter({ venue_id: venueId, table_id: selectedDate, module: "specialDate" });
|
|
108629
|
+
}
|
|
108630
|
+
}));
|
|
108631
|
+
};
|
|
108632
|
+
const fieldChanged = (currentValue, initialData) => {
|
|
108633
|
+
if (currentValue.id) {
|
|
108634
|
+
const initialValue = initialData.find((item2) => item2.id === currentValue.id);
|
|
108635
|
+
if (initialValue) {
|
|
108636
|
+
if (initialValue.startDate !== currentValue.startDate || initialValue.endDate !== currentValue.endDate || initialValue.closed !== currentValue.closed) {
|
|
108637
|
+
return true;
|
|
108638
|
+
}
|
|
108639
|
+
if (currentValue.timeSlots.length !== initialValue.timeSlots.length || currentValue.timeSlots.some((slot2, index2) => {
|
|
108640
|
+
const initialSlot = initialValue.timeSlots[index2];
|
|
108641
|
+
return slot2.start !== (initialSlot == null ? void 0 : initialSlot.start) || slot2.end !== (initialSlot == null ? void 0 : initialSlot.end);
|
|
108642
|
+
})) {
|
|
108643
|
+
return true;
|
|
108644
|
+
}
|
|
108645
|
+
}
|
|
108646
|
+
}
|
|
108647
|
+
return false;
|
|
108648
|
+
};
|
|
108649
|
+
const index$2 = ({ venueId }) => {
|
|
108650
|
+
const [isOpenDrawer, setIsOpenDrawer] = useState(false);
|
|
108651
|
+
const { data: data2, isLoading, error: error3, reload } = useFetch(GetSpecialDates, { cacheId: "special0dates", venue_id: venueId });
|
|
108652
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
108653
|
+
className: styles$4.sectionManagement
|
|
108654
|
+
}, /* @__PURE__ */ React__default.createElement(SpecialDatesCard, {
|
|
108655
|
+
isOpenDrawer,
|
|
108656
|
+
setIsOpenDrawer,
|
|
108657
|
+
data: data2
|
|
108658
|
+
}), /* @__PURE__ */ React__default.createElement(SpecialDatesEditDrawer, {
|
|
108659
|
+
data: data2,
|
|
108660
|
+
isOpen: isOpenDrawer,
|
|
108661
|
+
setIsOpen: setIsOpenDrawer,
|
|
108662
|
+
venueId,
|
|
108663
|
+
reload
|
|
108664
|
+
}));
|
|
108665
|
+
};
|
|
108292
108666
|
const ShiftsCard = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) => {
|
|
108293
108667
|
const { t: t2 } = useTranslation();
|
|
108294
108668
|
return /* @__PURE__ */ React__default.createElement(Card, {
|
|
@@ -108303,7 +108677,7 @@ const ShiftsCard = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) => {
|
|
|
108303
108677
|
className: styles$4.cardBody
|
|
108304
108678
|
}, data2 && data2.length > 0 && /* @__PURE__ */ React__default.createElement("div", {
|
|
108305
108679
|
style: { display: "grid", gridTemplateColumns: "100px 2fr 2fr", gap: "10px", rowGap: "20px" }
|
|
108306
|
-
}, data2.map((day2, index2) => {
|
|
108680
|
+
}, data2.slice(0, 3).map((day2, index2) => {
|
|
108307
108681
|
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l;
|
|
108308
108682
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, {
|
|
108309
108683
|
key: index2
|
|
@@ -108356,12 +108730,15 @@ const ShiftsEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =
|
|
|
108356
108730
|
reset,
|
|
108357
108731
|
trigger,
|
|
108358
108732
|
getValues,
|
|
108733
|
+
setValue: setValue2,
|
|
108734
|
+
watch,
|
|
108359
108735
|
formState: { isDirty }
|
|
108360
108736
|
} = useForm({
|
|
108361
108737
|
mode: "onChange",
|
|
108362
108738
|
resolver: o(daysSchema()),
|
|
108363
108739
|
defaultValues: defaultValue
|
|
108364
108740
|
});
|
|
108741
|
+
const days2 = watch("days");
|
|
108365
108742
|
const { fields, append: append2, remove } = useFieldArray({
|
|
108366
108743
|
control,
|
|
108367
108744
|
name: "days"
|
|
@@ -108374,15 +108751,14 @@ const ShiftsEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =
|
|
|
108374
108751
|
return;
|
|
108375
108752
|
}
|
|
108376
108753
|
const transformedData = formData.days.reduce((acc, day2) => {
|
|
108377
|
-
acc[day2.
|
|
108754
|
+
acc[day2.day.toLowerCase()] = {
|
|
108378
108755
|
closed: day2.closed.toString(),
|
|
108379
108756
|
timeslots: day2.timeslots || []
|
|
108380
108757
|
};
|
|
108381
108758
|
return acc;
|
|
108382
108759
|
}, {});
|
|
108383
108760
|
try {
|
|
108384
|
-
|
|
108385
|
-
await executeUpdater({ data: transformedData, venue_id: venueId, module: "opHour" });
|
|
108761
|
+
await executeUpdater({ data: { ...transformedData, ignoreFormat: true }, venue_id: venueId, module: "opHour" });
|
|
108386
108762
|
reload();
|
|
108387
108763
|
setIsOpen(false);
|
|
108388
108764
|
} catch (error3) {
|
|
@@ -108401,68 +108777,74 @@ const ShiftsEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =
|
|
|
108401
108777
|
return /* @__PURE__ */ React__default.createElement(Drawer, {
|
|
108402
108778
|
isOpen,
|
|
108403
108779
|
onClose: () => setIsOpen(false),
|
|
108404
|
-
title: t2("
|
|
108405
|
-
titleDesc: t2("
|
|
108780
|
+
title: t2("SHIFTS"),
|
|
108781
|
+
titleDesc: t2("SHIFTS_DESC")
|
|
108406
108782
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108407
108783
|
className: styles$4.drawerContent
|
|
108408
108784
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108409
108785
|
className: styles$4.scrollableForm
|
|
108410
|
-
}, fields.map((item2, index2) =>
|
|
108411
|
-
|
|
108412
|
-
|
|
108413
|
-
|
|
108414
|
-
|
|
108415
|
-
|
|
108416
|
-
|
|
108417
|
-
|
|
108418
|
-
|
|
108419
|
-
|
|
108420
|
-
|
|
108421
|
-
|
|
108422
|
-
|
|
108423
|
-
|
|
108424
|
-
|
|
108425
|
-
|
|
108426
|
-
|
|
108427
|
-
|
|
108428
|
-
|
|
108429
|
-
|
|
108430
|
-
|
|
108431
|
-
|
|
108432
|
-
|
|
108433
|
-
|
|
108434
|
-
|
|
108435
|
-
|
|
108436
|
-
|
|
108437
|
-
|
|
108438
|
-
|
|
108439
|
-
|
|
108440
|
-
|
|
108441
|
-
|
|
108442
|
-
|
|
108443
|
-
|
|
108444
|
-
|
|
108445
|
-
|
|
108446
|
-
|
|
108447
|
-
|
|
108448
|
-
|
|
108449
|
-
|
|
108450
|
-
|
|
108451
|
-
|
|
108452
|
-
|
|
108453
|
-
|
|
108454
|
-
|
|
108455
|
-
|
|
108456
|
-
|
|
108457
|
-
|
|
108458
|
-
|
|
108459
|
-
|
|
108460
|
-
|
|
108461
|
-
|
|
108462
|
-
|
|
108463
|
-
|
|
108464
|
-
|
|
108465
|
-
|
|
108786
|
+
}, fields.map((item2, index2) => {
|
|
108787
|
+
var _a2, _b, _c;
|
|
108788
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
108789
|
+
key: item2.id,
|
|
108790
|
+
className: styles$4.sectionFormRow,
|
|
108791
|
+
style: { justifyContent: "flex-start", paddingLeft: 0, paddingRight: 0 }
|
|
108792
|
+
}, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("p", {
|
|
108793
|
+
style: { width: "100px" }
|
|
108794
|
+
}, item2.day), /* @__PURE__ */ React__default.createElement(SwitchField, {
|
|
108795
|
+
control,
|
|
108796
|
+
id: `days.${index2}.closed`,
|
|
108797
|
+
name: `days.${index2}.closed`,
|
|
108798
|
+
label: t2("Closed"),
|
|
108799
|
+
onChangeEvent: (e3) => {
|
|
108800
|
+
const isClosed = e3.target.checked;
|
|
108801
|
+
setValue2(`days.${index2}.closed`, isClosed);
|
|
108802
|
+
if (isClosed) {
|
|
108803
|
+
setValue2(`days.${index2}.timeslots`, []);
|
|
108804
|
+
}
|
|
108805
|
+
}
|
|
108806
|
+
})), !((_a2 = days2[index2]) == null ? void 0 : _a2.closed) && /* @__PURE__ */ React__default.createElement("div", {
|
|
108807
|
+
style: { display: "flex", flexDirection: "row", gap: "10px" }
|
|
108808
|
+
}, (_b = days2[index2]) == null ? void 0 : _b.timeslots.map((_24, slotIndex) => /* @__PURE__ */ React__default.createElement("div", {
|
|
108809
|
+
key: slotIndex,
|
|
108810
|
+
style: { display: "flex", alignItems: "center", gap: 10 }
|
|
108811
|
+
}, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
108812
|
+
control,
|
|
108813
|
+
id: `days.${index2}.timeslots.${slotIndex}.start`,
|
|
108814
|
+
name: `days.${index2}.timeslots.${slotIndex}.start`,
|
|
108815
|
+
label: t2("Start Time"),
|
|
108816
|
+
type: "time"
|
|
108817
|
+
})), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
108818
|
+
control,
|
|
108819
|
+
id: `days.${index2}.timeslots.${slotIndex}.end`,
|
|
108820
|
+
name: `days.${index2}.timeslots.${slotIndex}.end`,
|
|
108821
|
+
label: t2("End Time"),
|
|
108822
|
+
type: "time"
|
|
108823
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
108824
|
+
style: { color: "#FF4C51", cursor: "pointer", marginTop: 20 }
|
|
108825
|
+
}, /* @__PURE__ */ React__default.createElement(Icon, {
|
|
108826
|
+
icon: "TrashX",
|
|
108827
|
+
onClick: () => {
|
|
108828
|
+
const currentTimeslots = [...days2[index2].timeslots];
|
|
108829
|
+
if (typeof slotIndex === "number") {
|
|
108830
|
+
currentTimeslots.splice(slotIndex, 1);
|
|
108831
|
+
}
|
|
108832
|
+
setValue2(`days.${index2}.timeslots`, currentTimeslots);
|
|
108833
|
+
}
|
|
108834
|
+
})))), ((_c = days2[index2]) == null ? void 0 : _c.timeslots.length) < 2 && /* @__PURE__ */ React__default.createElement("div", {
|
|
108835
|
+
style: { marginTop: 20 }
|
|
108836
|
+
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
108837
|
+
mode: "tertiary",
|
|
108838
|
+
size: "small",
|
|
108839
|
+
icon: "plus",
|
|
108840
|
+
iconPosition: "left",
|
|
108841
|
+
onClick: () => {
|
|
108842
|
+
const currentTimeslots = [...days2[index2].timeslots];
|
|
108843
|
+
currentTimeslots.push({ start: "", end: "" });
|
|
108844
|
+
setValue2(`days.${index2}.timeslots`, currentTimeslots);
|
|
108845
|
+
}
|
|
108846
|
+
}, t2("Add")))));
|
|
108847
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
108466
108848
|
className: styles$4.fixedActions
|
|
108467
108849
|
}, isDirty && /* @__PURE__ */ React__default.createElement(Button, {
|
|
108468
108850
|
mode: "success",
|
|
@@ -108472,11 +108854,10 @@ const ShiftsEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =
|
|
|
108472
108854
|
onClick: () => onSubmit()
|
|
108473
108855
|
}, t2("SAVE")))));
|
|
108474
108856
|
};
|
|
108475
|
-
const index = ({ venueId }) => {
|
|
108857
|
+
const index$1 = ({ venueId }) => {
|
|
108476
108858
|
const [isOpenDrawer, setIsOpenDrawer] = useState(false);
|
|
108477
108859
|
const weekdayOrder = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
|
|
108478
108860
|
const { data: data2, isLoading, error: error3, reload } = useFetch(GetOpeningHours, { cacheId: "shifts0management", venue_id: venueId });
|
|
108479
|
-
console.log(data2, "DATA");
|
|
108480
108861
|
const [formatedData, setFormatedData] = useState([]);
|
|
108481
108862
|
useEffect(() => {
|
|
108482
108863
|
if (data2) {
|
|
@@ -108494,6 +108875,147 @@ const index = ({ venueId }) => {
|
|
|
108494
108875
|
setIsOpenDrawer,
|
|
108495
108876
|
data: formatedData
|
|
108496
108877
|
}), /* @__PURE__ */ React__default.createElement(ShiftsEditDrawer, {
|
|
108878
|
+
data: formatedData,
|
|
108879
|
+
isOpen: isOpenDrawer,
|
|
108880
|
+
setIsOpen: setIsOpenDrawer,
|
|
108881
|
+
venueId,
|
|
108882
|
+
reload
|
|
108883
|
+
}));
|
|
108884
|
+
};
|
|
108885
|
+
const ReservationPreferencesCard = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) => {
|
|
108886
|
+
const { t: t2 } = useTranslation();
|
|
108887
|
+
return /* @__PURE__ */ React__default.createElement(Card, {
|
|
108888
|
+
className: styles$4.sectionCard
|
|
108889
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108890
|
+
className: styles$4.cardHeader
|
|
108891
|
+
}, /* @__PURE__ */ React__default.createElement("h2", {
|
|
108892
|
+
className: styles$4.cardTitle
|
|
108893
|
+
}, t2("RESERVATION_PREFERENCES")), /* @__PURE__ */ React__default.createElement("p", {
|
|
108894
|
+
className: styles$4.cardDesc
|
|
108895
|
+
}, t2("RESERVATION_PREFERENCES_DESC"))), /* @__PURE__ */ React__default.createElement("div", {
|
|
108896
|
+
className: styles$4.cardBody
|
|
108897
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108898
|
+
style: { display: "grid", gridTemplateColumns: "1fr auto", gap: "10px", rowGap: "20px", marginBottom: 40 }
|
|
108899
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108900
|
+
style: { display: "contents" }
|
|
108901
|
+
}, /* @__PURE__ */ React__default.createElement("p", {
|
|
108902
|
+
style: { fontWeight: "bold" }
|
|
108903
|
+
}, t2("MAX_RESERVATIONS_ARRIVAL_PER_SLOT")), /* @__PURE__ */ React__default.createElement("p", {
|
|
108904
|
+
style: { textAlign: "left" }
|
|
108905
|
+
}, data2 == null ? void 0 : data2.maxWelcomeSlot)), /* @__PURE__ */ React__default.createElement("div", {
|
|
108906
|
+
style: { display: "contents" }
|
|
108907
|
+
}, /* @__PURE__ */ React__default.createElement("p", {
|
|
108908
|
+
style: { fontWeight: "bold" }
|
|
108909
|
+
}, t2("TIMEOFFSETTOMEALTIME")), /* @__PURE__ */ React__default.createElement("p", {
|
|
108910
|
+
style: { textAlign: "left" }
|
|
108911
|
+
}, data2 == null ? void 0 : data2.slotDuration, " min")))), /* @__PURE__ */ React__default.createElement("div", {
|
|
108912
|
+
className: styles$4.cardFooter
|
|
108913
|
+
}, /* @__PURE__ */ React__default.createElement("hr", null), /* @__PURE__ */ React__default.createElement("div", {
|
|
108914
|
+
className: styles$4.cardFooterContent,
|
|
108915
|
+
style: { color: "#9392a3", cursor: "pointer" },
|
|
108916
|
+
onClick: () => {
|
|
108917
|
+
setIsOpenDrawer(true);
|
|
108918
|
+
}
|
|
108919
|
+
}, "more")));
|
|
108920
|
+
};
|
|
108921
|
+
const ReservationPreferencesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) => {
|
|
108922
|
+
const { t: t2 } = useTranslation();
|
|
108923
|
+
const { showMessageError } = useMessage();
|
|
108924
|
+
const { isExecuting, execute } = useService(UpdateResbook, {});
|
|
108925
|
+
const defaultValue = {
|
|
108926
|
+
id: "",
|
|
108927
|
+
maxWelcomeSlot: "",
|
|
108928
|
+
slotDuration: ""
|
|
108929
|
+
};
|
|
108930
|
+
const areaSchema = () => create$1().shape({
|
|
108931
|
+
id: create$2().nullable(),
|
|
108932
|
+
maxWelcomeSlot: create$2().required(t2("errors.required")),
|
|
108933
|
+
slotDuration: create$2().required(t2("errors.required"))
|
|
108934
|
+
});
|
|
108935
|
+
const {
|
|
108936
|
+
control,
|
|
108937
|
+
reset,
|
|
108938
|
+
trigger,
|
|
108939
|
+
getValues,
|
|
108940
|
+
formState: { isDirty }
|
|
108941
|
+
} = useForm({
|
|
108942
|
+
mode: "onChange",
|
|
108943
|
+
resolver: o(areaSchema()),
|
|
108944
|
+
defaultValues: defaultValue
|
|
108945
|
+
});
|
|
108946
|
+
const onSubmit = async () => {
|
|
108947
|
+
const data22 = await getValues();
|
|
108948
|
+
const result = await trigger();
|
|
108949
|
+
if (!result) {
|
|
108950
|
+
showMessageError(t2("pleaseCheckFormsErrors"));
|
|
108951
|
+
return;
|
|
108952
|
+
}
|
|
108953
|
+
const toSend = {
|
|
108954
|
+
maxWelcomeSlot: data22.maxWelcomeSlot,
|
|
108955
|
+
slotDuration: data22.slotDuration
|
|
108956
|
+
};
|
|
108957
|
+
await execute({ data: toSend, venue_id: venueId, table_id: data22.id, module: "arrRule" });
|
|
108958
|
+
reload();
|
|
108959
|
+
setIsOpen(false);
|
|
108960
|
+
};
|
|
108961
|
+
useEffect(() => {
|
|
108962
|
+
if (data2) {
|
|
108963
|
+
reset({
|
|
108964
|
+
id: data2.id,
|
|
108965
|
+
maxWelcomeSlot: data2.maxWelcomeSlot,
|
|
108966
|
+
slotDuration: data2.slotDuration
|
|
108967
|
+
});
|
|
108968
|
+
} else {
|
|
108969
|
+
reset(defaultValue);
|
|
108970
|
+
}
|
|
108971
|
+
}, [data2]);
|
|
108972
|
+
return /* @__PURE__ */ React__default.createElement(Drawer, {
|
|
108973
|
+
isOpen,
|
|
108974
|
+
onClose: () => setIsOpen(false),
|
|
108975
|
+
title: t2("RESERVATION_PREFERENCES"),
|
|
108976
|
+
titleDesc: t2("RESERVATION_PREFERENCES_DESC")
|
|
108977
|
+
}, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
|
|
108978
|
+
style: { paddingLeft: 20, paddingRight: 20, display: "flex", flexDirection: "column", gap: 30 }
|
|
108979
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
108980
|
+
className: ""
|
|
108981
|
+
}, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
108982
|
+
control,
|
|
108983
|
+
id: "maxWelcomeSlot",
|
|
108984
|
+
name: "maxWelcomeSlot",
|
|
108985
|
+
label: t2("MAX_RESERVATIONS_ARRIVAL_PER_SLOT"),
|
|
108986
|
+
placeholder: "Max pax per slot ...",
|
|
108987
|
+
radius: "sm",
|
|
108988
|
+
type: "number"
|
|
108989
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
108990
|
+
className: ""
|
|
108991
|
+
}, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
108992
|
+
control,
|
|
108993
|
+
id: "slotDuration",
|
|
108994
|
+
name: "slotDuration",
|
|
108995
|
+
label: "Time offset to mealtime (minutes)",
|
|
108996
|
+
placeholder: "Time offset to mealtime ...",
|
|
108997
|
+
radius: "sm",
|
|
108998
|
+
type: "number"
|
|
108999
|
+
}))), /* @__PURE__ */ React__default.createElement("div", {
|
|
109000
|
+
style: { display: "flex", justifyContent: "flex-end", gap: 10, marginTop: 30 }
|
|
109001
|
+
}, isDirty && /* @__PURE__ */ React__default.createElement(Button, {
|
|
109002
|
+
mode: "success",
|
|
109003
|
+
icon: "check",
|
|
109004
|
+
iconPosition: "right",
|
|
109005
|
+
type: "button",
|
|
109006
|
+
onClick: () => onSubmit()
|
|
109007
|
+
}, t2("SAVE")))));
|
|
109008
|
+
};
|
|
109009
|
+
const index = ({ venueId }) => {
|
|
109010
|
+
const [isOpenDrawer, setIsOpenDrawer] = useState(false);
|
|
109011
|
+
const { data: data2, isLoading, error: error3, reload } = useFetch(GetArrivalRules, { cacheId: "bookingArrivalRules", venue_id: venueId });
|
|
109012
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
109013
|
+
className: styles$4.sectionManagement
|
|
109014
|
+
}, /* @__PURE__ */ React__default.createElement(ReservationPreferencesCard, {
|
|
109015
|
+
isOpenDrawer,
|
|
109016
|
+
setIsOpenDrawer,
|
|
109017
|
+
data: data2
|
|
109018
|
+
}), /* @__PURE__ */ React__default.createElement(ReservationPreferencesEditDrawer, {
|
|
108497
109019
|
data: data2,
|
|
108498
109020
|
isOpen: isOpenDrawer,
|
|
108499
109021
|
setIsOpen: setIsOpenDrawer,
|
|
@@ -108513,23 +109035,21 @@ function Main({ venueId }) {
|
|
|
108513
109035
|
className: styles$4.header
|
|
108514
109036
|
}, /* @__PURE__ */ React__default.createElement("h2", null, t2("RESTAURANTSETUP"))), /* @__PURE__ */ React__default.createElement("div", {
|
|
108515
109037
|
className: styles$4.content
|
|
108516
|
-
}, /* @__PURE__ */ React__default.createElement(
|
|
108517
|
-
breakpointCols: {
|
|
108518
|
-
default: 3,
|
|
108519
|
-
1200: 2,
|
|
108520
|
-
800: 1
|
|
108521
|
-
},
|
|
108522
|
-
className: styles$4["my-masonry-grid"],
|
|
108523
|
-
columnClassName: styles$4["my-masonry-grid_column"]
|
|
108524
|
-
}, /* @__PURE__ */ React__default.createElement(index$3, {
|
|
109038
|
+
}, /* @__PURE__ */ React__default.createElement(index$5, {
|
|
108525
109039
|
venueId: currentVenue
|
|
108526
|
-
}), /* @__PURE__ */ React__default.createElement(index$
|
|
109040
|
+
}), /* @__PURE__ */ React__default.createElement(index$4, {
|
|
109041
|
+
venueId: currentVenue
|
|
109042
|
+
}), /* @__PURE__ */ React__default.createElement(index$3, {
|
|
109043
|
+
venueId: currentVenue
|
|
109044
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
109045
|
+
className: styles$4.content
|
|
109046
|
+
}, /* @__PURE__ */ React__default.createElement(index$1, {
|
|
108527
109047
|
venueId: currentVenue
|
|
108528
|
-
}), /* @__PURE__ */ React__default.createElement(index$
|
|
109048
|
+
}), /* @__PURE__ */ React__default.createElement(index$2, {
|
|
108529
109049
|
venueId: currentVenue
|
|
108530
109050
|
}), /* @__PURE__ */ React__default.createElement(index, {
|
|
108531
109051
|
venueId: currentVenue
|
|
108532
|
-
})))
|
|
109052
|
+
})));
|
|
108533
109053
|
}
|
|
108534
109054
|
const navitem = "_navitem_xp0ch_1";
|
|
108535
109055
|
const navitem__chevron = "_navitem__chevron_xp0ch_14";
|
|
@@ -108810,6 +109330,12 @@ function App({
|
|
|
108810
109330
|
}), /* @__PURE__ */ React__default.createElement(Route, {
|
|
108811
109331
|
path: "/reservations-configuration",
|
|
108812
109332
|
element: /* @__PURE__ */ React__default.createElement(ReservationDashboard, null)
|
|
109333
|
+
}), /* @__PURE__ */ React__default.createElement(Route, {
|
|
109334
|
+
path: "/resbook-configuration",
|
|
109335
|
+
element: /* @__PURE__ */ React__default.createElement(Main, null)
|
|
109336
|
+
}), /* @__PURE__ */ React__default.createElement(Route, {
|
|
109337
|
+
path: "/resbook",
|
|
109338
|
+
element: /* @__PURE__ */ React__default.createElement(Main$1, null)
|
|
108813
109339
|
}), /* @__PURE__ */ React__default.createElement(Route, {
|
|
108814
109340
|
path: "/venues",
|
|
108815
109341
|
element: /* @__PURE__ */ React__default.createElement(Venues, null)
|