mozrest-sdk-react-dev 0.2.24 → 0.2.26
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 +141 -81
- package/package.json +1 -1
package/mozrest-sdk.es.js
CHANGED
|
@@ -2133,7 +2133,9 @@ const useFetch = (uri, params, extra) => {
|
|
|
2133
2133
|
return;
|
|
2134
2134
|
setTimeout(() => revalidate({ retryCount }), 5e3);
|
|
2135
2135
|
},
|
|
2136
|
-
onSuccess: (extra == null ? void 0 : extra.onSuccess) || noop$c
|
|
2136
|
+
onSuccess: (extra == null ? void 0 : extra.onSuccess) || noop$c,
|
|
2137
|
+
revalidateOnFocus: false,
|
|
2138
|
+
revalidateOnReconnect: true
|
|
2137
2139
|
});
|
|
2138
2140
|
return {
|
|
2139
2141
|
data: handleFormat(data2, (extra == null ? void 0 : extra.formatData) || noopFormat),
|
|
@@ -6361,6 +6363,8 @@ const SHOWTEMPLATES = "Show templates";
|
|
|
6361
6363
|
const NOSHOWRESERVATION = "No show reservation";
|
|
6362
6364
|
const AREYOUSURENOSHOWRESERVATION = "Are you sure you want to change this reservation to no-show status?";
|
|
6363
6365
|
const NOSHOW = "No show";
|
|
6366
|
+
const VENUEISCLOSED = "Venue is closed";
|
|
6367
|
+
const VenueClosedByConfigurationAtThisTime = "Venue is closed by configuration at this time";
|
|
6364
6368
|
var en = {
|
|
6365
6369
|
errors,
|
|
6366
6370
|
SPECIALCLOSINGDATES,
|
|
@@ -6680,7 +6684,9 @@ var en = {
|
|
|
6680
6684
|
SHOWTEMPLATES,
|
|
6681
6685
|
NOSHOWRESERVATION,
|
|
6682
6686
|
AREYOUSURENOSHOWRESERVATION,
|
|
6683
|
-
NOSHOW
|
|
6687
|
+
NOSHOW,
|
|
6688
|
+
VENUEISCLOSED,
|
|
6689
|
+
VenueClosedByConfigurationAtThisTime
|
|
6684
6690
|
};
|
|
6685
6691
|
instance.use(initReactI18next).init({
|
|
6686
6692
|
resources: {
|
|
@@ -96098,25 +96104,25 @@ const UpdateResbook = async ({
|
|
|
96098
96104
|
await instance$1.put(`${BASE_URL}${venue_id}/tables/${table_id}`, formarTableRules(data2));
|
|
96099
96105
|
return { data: "updated" };
|
|
96100
96106
|
case "opHour":
|
|
96101
|
-
instance$1.put(`${BASE_URL}${venue_id}/opening-hours`, formarRegularHours(data2));
|
|
96107
|
+
await instance$1.put(`${BASE_URL}${venue_id}/opening-hours`, formarRegularHours(data2));
|
|
96102
96108
|
return { data: "updated" };
|
|
96103
96109
|
case "arrRule":
|
|
96104
|
-
instance$1.put(`${BASE_URL}${venue_id}/arrival-rules/${table_id}`, formatArrivalRules(data2));
|
|
96110
|
+
await instance$1.put(`${BASE_URL}${venue_id}/arrival-rules/${table_id}`, formatArrivalRules(data2));
|
|
96105
96111
|
return { data: "updated" };
|
|
96106
96112
|
case "seatingRule":
|
|
96107
|
-
instance$1.put(`${BASE_URL}${venue_id}/seating-rules/${table_id}`, formarSeatingRules(data2));
|
|
96113
|
+
await instance$1.put(`${BASE_URL}${venue_id}/seating-rules/${table_id}`, formarSeatingRules(data2));
|
|
96108
96114
|
return { data: "updated" };
|
|
96109
96115
|
case "specialDate":
|
|
96110
96116
|
if (table_id) {
|
|
96111
|
-
instance$1.put(`${BASE_URL}${venue_id}/special-dates/${table_id}`, formarSpecialHours((_a2 = Object.values(data2)[0]) != null ? _a2 : {}));
|
|
96117
|
+
await instance$1.put(`${BASE_URL}${venue_id}/special-dates/${table_id}`, formarSpecialHours((_a2 = Object.values(data2)[0]) != null ? _a2 : {}));
|
|
96112
96118
|
return { data: "updated" };
|
|
96113
96119
|
} else {
|
|
96114
|
-
instance$1.post(`${BASE_URL}${venue_id}/special-dates`, formarSpecialHours((_b = Object.values(data2)[0]) != null ? _b : {}));
|
|
96120
|
+
await instance$1.post(`${BASE_URL}${venue_id}/special-dates`, formarSpecialHours((_b = Object.values(data2)[0]) != null ? _b : {}));
|
|
96115
96121
|
return { data: "created" };
|
|
96116
96122
|
}
|
|
96117
96123
|
case "deleteSpecialDate":
|
|
96118
96124
|
if (table_id) {
|
|
96119
|
-
instance$1.delete(`${BASE_URL}${venue_id}/special-dates/${table_id}`);
|
|
96125
|
+
await instance$1.delete(`${BASE_URL}${venue_id}/special-dates/${table_id}`);
|
|
96120
96126
|
return { data: "deleted" };
|
|
96121
96127
|
} else {
|
|
96122
96128
|
break;
|
|
@@ -96201,9 +96207,8 @@ const Form$3 = ({
|
|
|
96201
96207
|
onCloseForm();
|
|
96202
96208
|
}
|
|
96203
96209
|
});
|
|
96204
|
-
const handleSubmit = (data2) => {
|
|
96205
|
-
execute({ venue_id: venueId, data: data2, module: "opHour" });
|
|
96206
|
-
reload();
|
|
96210
|
+
const handleSubmit = async (data2) => {
|
|
96211
|
+
await execute({ venue_id: venueId, data: data2, module: "opHour" });
|
|
96207
96212
|
};
|
|
96208
96213
|
return /* @__PURE__ */ React__default.createElement(Modal2, {
|
|
96209
96214
|
open,
|
|
@@ -97855,6 +97860,7 @@ const ReservationComp = ({
|
|
|
97855
97860
|
value: value2,
|
|
97856
97861
|
currentTimeZone,
|
|
97857
97862
|
onClick,
|
|
97863
|
+
toggleArrivedConfirmed,
|
|
97858
97864
|
isTablet = false
|
|
97859
97865
|
}) => {
|
|
97860
97866
|
return /* @__PURE__ */ React__default.createElement("tr", {
|
|
@@ -97880,13 +97886,50 @@ const ReservationComp = ({
|
|
|
97880
97886
|
style: { textAlign: "center" }
|
|
97881
97887
|
}, status === "arrived" ? /* @__PURE__ */ React__default.createElement(Button$3, {
|
|
97882
97888
|
size: "mini",
|
|
97883
|
-
className: styles$g.btnWarning
|
|
97884
|
-
|
|
97889
|
+
className: styles$g.btnWarning,
|
|
97890
|
+
onClick: (e3) => {
|
|
97891
|
+
e3.stopPropagation();
|
|
97892
|
+
if (toggleArrivedConfirmed) {
|
|
97893
|
+
toggleArrivedConfirmed(value2, "confirmed");
|
|
97894
|
+
}
|
|
97895
|
+
}
|
|
97896
|
+
}, "Mark as Confirmed") : status === "confirmed" ? /* @__PURE__ */ React__default.createElement(Button$3, {
|
|
97885
97897
|
size: "mini",
|
|
97886
|
-
className: styles$g.btnWarning
|
|
97887
|
-
|
|
97898
|
+
className: styles$g.btnWarning,
|
|
97899
|
+
onClick: (e3) => {
|
|
97900
|
+
e3.stopPropagation();
|
|
97901
|
+
if (toggleArrivedConfirmed) {
|
|
97902
|
+
toggleArrivedConfirmed(value2, "arrived");
|
|
97903
|
+
}
|
|
97904
|
+
}
|
|
97905
|
+
}, "Mark as Arrived") : null));
|
|
97906
|
+
};
|
|
97907
|
+
const UpdateBooking = async ({ venueId, bookingId, data: data2 }) => {
|
|
97908
|
+
await instance$1.put(`/resbook/venue/${venueId}/bookings/${bookingId}`, data2);
|
|
97909
|
+
return { data: "updated" };
|
|
97888
97910
|
};
|
|
97889
|
-
const
|
|
97911
|
+
const UpdateBookingStatusBooking = async ({ venueId, bookingId, data: data2 }) => {
|
|
97912
|
+
await instance$1.put(`/resbook/venue/${venueId}/bookings/${bookingId}`, data2);
|
|
97913
|
+
return { data: "ok" };
|
|
97914
|
+
};
|
|
97915
|
+
const Table$2 = ({ data: data2, venueId, onOpenDetailReservation, selectedRow, setSelectedRow, currentTimeZone, reloadMainTable }) => {
|
|
97916
|
+
const [status, setStatus] = useState("");
|
|
97917
|
+
const { execute } = useService(UpdateBookingStatusBooking, {
|
|
97918
|
+
onSuccess: async () => {
|
|
97919
|
+
setSelectedRow({ ...selectedRow, status });
|
|
97920
|
+
reloadMainTable();
|
|
97921
|
+
}
|
|
97922
|
+
});
|
|
97923
|
+
const toggleArrivedConfirmed = async (row2, status2) => {
|
|
97924
|
+
setStatus(status2);
|
|
97925
|
+
execute({
|
|
97926
|
+
venueId,
|
|
97927
|
+
bookingId: row2.id,
|
|
97928
|
+
data: {
|
|
97929
|
+
status: status2
|
|
97930
|
+
}
|
|
97931
|
+
});
|
|
97932
|
+
};
|
|
97890
97933
|
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
|
|
97891
97934
|
className: styles$g.mainTableTablet
|
|
97892
97935
|
}, data2.map((bookingValue, index2) => /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -97917,17 +97960,26 @@ const Table$2 = ({ data: data2, setSelectedRow, currentTimeZone }) => {
|
|
|
97917
97960
|
status: bookingValue.status,
|
|
97918
97961
|
id: "",
|
|
97919
97962
|
value: bookingValue,
|
|
97920
|
-
onClick: (value2) =>
|
|
97963
|
+
onClick: (value2) => {
|
|
97964
|
+
onOpenDetailReservation();
|
|
97965
|
+
setSelectedRow(value2);
|
|
97966
|
+
},
|
|
97921
97967
|
isTablet: true
|
|
97922
|
-
}), /* @__PURE__ */ React__default.createElement("td", {
|
|
97968
|
+
}), (bookingValue.status === "arrived" || bookingValue.status === "confirmed") && /* @__PURE__ */ React__default.createElement("td", {
|
|
97923
97969
|
style: { textAlign: "center", backgroundColor: "#F8F8F8", padding: 5 },
|
|
97924
97970
|
colSpan: 10
|
|
97925
97971
|
}, bookingValue.status === "arrived" ? /* @__PURE__ */ React__default.createElement(Button$3, {
|
|
97926
97972
|
size: "mini",
|
|
97927
|
-
className: styles$g.btnWarning
|
|
97928
|
-
|
|
97973
|
+
className: styles$g.btnWarning,
|
|
97974
|
+
onClick: () => {
|
|
97975
|
+
toggleArrivedConfirmed(bookingValue, "confirmed");
|
|
97976
|
+
}
|
|
97977
|
+
}, "Mark as Confirmed") : bookingValue.status === "confirmed" ? /* @__PURE__ */ React__default.createElement(Button$3, {
|
|
97929
97978
|
size: "mini",
|
|
97930
|
-
className: styles$g.btnWarning
|
|
97979
|
+
className: styles$g.btnWarning,
|
|
97980
|
+
onClick: () => {
|
|
97981
|
+
toggleArrivedConfirmed(bookingValue, "arrived");
|
|
97982
|
+
}
|
|
97931
97983
|
}, "Mark as Arrived") : /* @__PURE__ */ React__default.createElement("span", null))))))), /* @__PURE__ */ React__default.createElement("div", {
|
|
97932
97984
|
className: styles$g.mainTableDesktop
|
|
97933
97985
|
}, /* @__PURE__ */ React__default.createElement("table", {
|
|
@@ -97957,7 +98009,11 @@ const Table$2 = ({ data: data2, setSelectedRow, currentTimeZone }) => {
|
|
|
97957
98009
|
status: bookingValue.status,
|
|
97958
98010
|
id: "",
|
|
97959
98011
|
value: bookingValue,
|
|
97960
|
-
onClick: (value2) =>
|
|
98012
|
+
onClick: (value2) => {
|
|
98013
|
+
onOpenDetailReservation();
|
|
98014
|
+
setSelectedRow(value2);
|
|
98015
|
+
},
|
|
98016
|
+
toggleArrivedConfirmed
|
|
97961
98017
|
}))))));
|
|
97962
98018
|
};
|
|
97963
98019
|
const container$1 = "_container_1iezk_1";
|
|
@@ -99532,7 +99588,7 @@ const TableRow$1 = ({ row: row2, setSelectedTable }) => {
|
|
|
99532
99588
|
onClick: () => setSelectedTable(row2)
|
|
99533
99589
|
}, /* @__PURE__ */ React__default.createElement("td", {
|
|
99534
99590
|
style: { textAlign: "left", paddingTop: 10, paddingBottom: 10 }
|
|
99535
|
-
}, `${row2.name} ${row2.area ? "(" + row2.area + ")" : ""}`), /* @__PURE__ */ React__default.createElement("td", {
|
|
99591
|
+
}, `${row2.name} ${row2.area ? "(" + row2.area.name + ")" : ""}`), /* @__PURE__ */ React__default.createElement("td", {
|
|
99536
99592
|
style: { textAlign: "center" }
|
|
99537
99593
|
}, `${(_a2 = row2.minCapacity) != null ? _a2 : "?"} - ${(_b = row2.maxCapacity) != null ? _b : "?"}`), /* @__PURE__ */ React__default.createElement("td", {
|
|
99538
99594
|
style: { textAlign: "center" }
|
|
@@ -99897,18 +99953,6 @@ const TableSelectField = ({ value: value2, tableOptions, isEdit, setIsEdit }) =>
|
|
|
99897
99953
|
onClick: () => handleSubmit()
|
|
99898
99954
|
}, "SAVE"));
|
|
99899
99955
|
};
|
|
99900
|
-
const UpdateBooking = async ({ venueId, bookingId, data: data2 }) => {
|
|
99901
|
-
await instance$1.put(`/resbook/venue/${venueId}/bookings/${bookingId}`, data2);
|
|
99902
|
-
return { data: "updated" };
|
|
99903
|
-
};
|
|
99904
|
-
const CancelBooking = async ({ venueId, bookingId, data: data2 }) => {
|
|
99905
|
-
await instance$1.put(`/resbook/venue/${venueId}/bookings/${bookingId}/cancel`, data2);
|
|
99906
|
-
return { data: "canceled" };
|
|
99907
|
-
};
|
|
99908
|
-
const NoShowBooking = async ({ venueId, bookingId }) => {
|
|
99909
|
-
await instance$1.put(`/resbook/venue/${venueId}/bookings/${bookingId}`, { status: "no-show" });
|
|
99910
|
-
return { data: "no show ok" };
|
|
99911
|
-
};
|
|
99912
99956
|
const TableSelectForm = ({ table: table2, id: id2, tableOptions, initialValues, isEdit, setIsEdit, reloadMainTable, onClose: onClose2, venueId }) => {
|
|
99913
99957
|
const emptyVal = {
|
|
99914
99958
|
table: { id: null, label: "Not selected" }
|
|
@@ -99934,32 +99978,10 @@ const TableSelectForm = ({ table: table2, id: id2, tableOptions, initialValues,
|
|
|
99934
99978
|
};
|
|
99935
99979
|
const CancelReservationModal = ({ onAccept, isLoading, message: message2, title: title2, ...props }) => {
|
|
99936
99980
|
const { t: t2 } = useTranslation();
|
|
99937
|
-
const initialValues = {
|
|
99938
|
-
cancelActor: "",
|
|
99939
|
-
cancelReason: ""
|
|
99940
|
-
};
|
|
99941
|
-
const bookingSchema = create$1().shape({
|
|
99942
|
-
cancelActor: create$2().required(t2("errors.required")),
|
|
99943
|
-
cancelReason: create$2()
|
|
99944
|
-
});
|
|
99945
99981
|
return /* @__PURE__ */ React__default.createElement(Modal2, {
|
|
99946
99982
|
...props,
|
|
99947
99983
|
title: t2("CANCELRESERVATION")
|
|
99948
|
-
}, /* @__PURE__ */ React__default.createElement("h5", null, t2("AREYOUSURECANCELRESERVATION")), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(
|
|
99949
|
-
initialValues,
|
|
99950
|
-
validationSchema: bookingSchema,
|
|
99951
|
-
onSubmit: (values, { resetForm }) => {
|
|
99952
|
-
onAccept(values);
|
|
99953
|
-
resetForm({ values: initialValues });
|
|
99954
|
-
}
|
|
99955
|
-
}, ({ values, errors: errors2, touched, isValid: isValid2 }) => /* @__PURE__ */ React__default.createElement(Form$c, null, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
99956
|
-
id: "cancelActor",
|
|
99957
|
-
label: t2("FIRSTNAME")
|
|
99958
|
-
}), /* @__PURE__ */ React__default.createElement(TextAreaField, {
|
|
99959
|
-
id: "cancelReason",
|
|
99960
|
-
label: t2("CANCELREASON"),
|
|
99961
|
-
maxLength: 100
|
|
99962
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
|
99984
|
+
}, /* @__PURE__ */ React__default.createElement("h5", null, t2("AREYOUSURECANCELRESERVATION")), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
|
|
99963
99985
|
style: { display: "flex", justifyContent: "center", gap: 20, marginTop: 20 }
|
|
99964
99986
|
}, /* @__PURE__ */ React__default.createElement(Button$3, {
|
|
99965
99987
|
size: "small",
|
|
@@ -99969,9 +99991,9 @@ const CancelReservationModal = ({ onAccept, isLoading, message: message2, title:
|
|
|
99969
99991
|
}, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
|
|
99970
99992
|
size: "small",
|
|
99971
99993
|
type: "submit",
|
|
99972
|
-
|
|
99994
|
+
onClick: () => onAccept(),
|
|
99973
99995
|
isLoading
|
|
99974
|
-
}, t2("ACCEPT")))))
|
|
99996
|
+
}, t2("ACCEPT")))));
|
|
99975
99997
|
};
|
|
99976
99998
|
const NoShowReservationModal = ({ onAccept, isLoading, message: message2, title: title2, ...props }) => {
|
|
99977
99999
|
const { t: t2 } = useTranslation();
|
|
@@ -100011,29 +100033,37 @@ const ReservationDetail = ({ open, onClose: onClose2, venueId, reloadMainTable,
|
|
|
100011
100033
|
partySize: selectedRow.partySize
|
|
100012
100034
|
} : { startSec: null }
|
|
100013
100035
|
});
|
|
100014
|
-
const { isExecuting, execute } = useService(
|
|
100036
|
+
const { isExecuting, execute } = useService(UpdateBookingStatusBooking, {
|
|
100015
100037
|
onSuccess: async () => {
|
|
100016
100038
|
setSelectedRow({ ...selectedRow, status: "canceled" });
|
|
100017
100039
|
onCloseCancelRevModal();
|
|
100018
100040
|
reloadMainTable();
|
|
100019
100041
|
}
|
|
100020
100042
|
});
|
|
100021
|
-
const { isExecuting: isExecutingNoShow, execute: executoNoShow } = useService(
|
|
100043
|
+
const { isExecuting: isExecutingNoShow, execute: executoNoShow } = useService(UpdateBookingStatusBooking, {
|
|
100022
100044
|
onSuccess: async () => {
|
|
100023
100045
|
setSelectedRow({ ...selectedRow, status: "no-show" });
|
|
100024
100046
|
onCloseNoShowRevModal();
|
|
100025
100047
|
reloadMainTable();
|
|
100026
100048
|
}
|
|
100027
100049
|
});
|
|
100028
|
-
const cancelReservation = async (
|
|
100029
|
-
|
|
100030
|
-
|
|
100031
|
-
|
|
100032
|
-
|
|
100033
|
-
|
|
100050
|
+
const cancelReservation = async () => {
|
|
100051
|
+
execute({
|
|
100052
|
+
venueId,
|
|
100053
|
+
bookingId: selectedRow.id,
|
|
100054
|
+
data: {
|
|
100055
|
+
status: "canceled"
|
|
100056
|
+
}
|
|
100057
|
+
});
|
|
100034
100058
|
};
|
|
100035
100059
|
const noShowReservation = async () => {
|
|
100036
|
-
executoNoShow({
|
|
100060
|
+
executoNoShow({
|
|
100061
|
+
venueId,
|
|
100062
|
+
bookingId: selectedRow.id,
|
|
100063
|
+
data: {
|
|
100064
|
+
status: "no-show"
|
|
100065
|
+
}
|
|
100066
|
+
});
|
|
100037
100067
|
};
|
|
100038
100068
|
useEffect(() => {
|
|
100039
100069
|
if (selectedRow && selectedRow.table && open) {
|
|
@@ -100127,14 +100157,14 @@ const ReservationDetail = ({ open, onClose: onClose2, venueId, reloadMainTable,
|
|
|
100127
100157
|
type: "submit",
|
|
100128
100158
|
className: styles$g.btnDanger,
|
|
100129
100159
|
onClick: () => onOpenNoShowRevModal()
|
|
100130
|
-
}, t2("NOSHOW")))),
|
|
100160
|
+
}, t2("NOSHOW")))), /* @__PURE__ */ React__default.createElement(CancelReservationModal, {
|
|
100131
100161
|
width: 400,
|
|
100132
100162
|
message: t2("AREYOUSURECANCELRESERVATION"),
|
|
100133
100163
|
onAccept: cancelReservation,
|
|
100134
100164
|
open: openCancelReservationModal,
|
|
100135
100165
|
onClose: onCloseCancelRevModal,
|
|
100136
100166
|
isLoading: isExecuting || isExecutingNoShow
|
|
100137
|
-
}),
|
|
100167
|
+
}), /* @__PURE__ */ React__default.createElement(NoShowReservationModal, {
|
|
100138
100168
|
width: 400,
|
|
100139
100169
|
message: t2("AREYOUSURENOSHOWRESERVATION"),
|
|
100140
100170
|
onAccept: noShowReservation,
|
|
@@ -100309,11 +100339,16 @@ const WalkinButton = ({ partyOptions, onOpenCreateWalkInReservation, walkInParty
|
|
|
100309
100339
|
};
|
|
100310
100340
|
const CreateWalkInReservation = ({ open, onClose: onClose2, venueId, reloadMainTable, currentTimeZone, currentDate, partySize }) => {
|
|
100311
100341
|
const { t: t2 } = useTranslation();
|
|
100342
|
+
const [hourOpen, setHourOpen] = useState(true);
|
|
100312
100343
|
const params = {
|
|
100313
100344
|
partySize,
|
|
100314
|
-
startSec: moment$1.tz(`${currentDate}
|
|
100345
|
+
startSec: moment$1.tz(`${currentDate} ${moment$1().format("HH:mm")}`, currentTimeZone ? currentTimeZone : "").valueOf() / 1e3
|
|
100315
100346
|
};
|
|
100316
|
-
const { data: data2, isLoading
|
|
100347
|
+
const { data: data2, isLoading } = useFetch(GetTableWalkInAvailability, { cacheId: "walkIntableAvailability", venue_id: venueId, params });
|
|
100348
|
+
const { data: openingHours, isLoading: isLoadingOpeningHours } = useFetch(GetOpeningHours, {
|
|
100349
|
+
cacheId: "opening0hours",
|
|
100350
|
+
venue_id: venueId
|
|
100351
|
+
});
|
|
100317
100352
|
const { execute, isExecuting } = useService(AddBooking);
|
|
100318
100353
|
const handleOnSubmit = async () => {
|
|
100319
100354
|
const toSend = {
|
|
@@ -100336,18 +100371,40 @@ const CreateWalkInReservation = ({ open, onClose: onClose2, venueId, reloadMainT
|
|
|
100336
100371
|
reloadMainTable();
|
|
100337
100372
|
onClose2();
|
|
100338
100373
|
};
|
|
100339
|
-
|
|
100340
|
-
|
|
100341
|
-
|
|
100342
|
-
|
|
100343
|
-
|
|
100344
|
-
|
|
100374
|
+
const isTimeBetween = (targetTime, startTime, endTime) => {
|
|
100375
|
+
const targetMoment = moment$1(targetTime, "HH:mm");
|
|
100376
|
+
const startMoment = moment$1(startTime, "HH:mm");
|
|
100377
|
+
const endMoment = moment$1(endTime, "HH:mm");
|
|
100378
|
+
return targetMoment.isBetween(startMoment, endMoment, null, "[]");
|
|
100379
|
+
};
|
|
100380
|
+
useEffect(() => {
|
|
100381
|
+
if (openingHours && openingHours.length > 0) {
|
|
100382
|
+
const dayWeekName = moment$1(currentDate).format("dddd").toLocaleLowerCase();
|
|
100383
|
+
const dayWeek = openingHours.find((d2) => d2.day === dayWeekName && !d2.closed);
|
|
100384
|
+
if (dayWeek && dayWeek.timeslots && dayWeek.timeslots.length > 0) {
|
|
100385
|
+
const time2 = moment$1.tz(moment$1(), currentTimeZone ? currentTimeZone : "").format("HH:mm");
|
|
100386
|
+
let isBetween2 = false;
|
|
100387
|
+
dayWeek.timeslots.map((ts) => {
|
|
100388
|
+
if (isTimeBetween(time2, ts.start, ts.end)) {
|
|
100389
|
+
isBetween2 = true;
|
|
100390
|
+
}
|
|
100391
|
+
});
|
|
100392
|
+
setHourOpen(isBetween2);
|
|
100393
|
+
}
|
|
100394
|
+
}
|
|
100395
|
+
}, [openingHours]);
|
|
100396
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !isLoading && !isLoadingOpeningHours && /* @__PURE__ */ React__default.createElement(ModalConfirmation, {
|
|
100397
|
+
title: !hourOpen ? t2("VENUEISCLOSED") : data2 && data2.id ? t2("AREYOUSURE?") : t2("NoBookingAvailability"),
|
|
100398
|
+
icon: hourOpen && data2 && data2.id ? "calendar" : "no",
|
|
100399
|
+
message: !hourOpen ? t2("VenueClosedByConfigurationAtThisTime") : data2 && data2.id ? t2("ConfirmCreateWalkInReservation", { value: partySize }) : t2("NoAvailabilityForPartySize", { value: partySize }),
|
|
100400
|
+
showSubmitButton: hourOpen && data2 && data2.id ? true : false,
|
|
100401
|
+
cancelButtonText: hourOpen && data2 && data2.id ? void 0 : t2("CLOSE"),
|
|
100345
100402
|
onAccept: () => handleOnSubmit(),
|
|
100346
100403
|
open,
|
|
100347
100404
|
onClose: onClose2,
|
|
100348
100405
|
isLoading: isLoading || isExecuting,
|
|
100349
100406
|
width: 500
|
|
100350
|
-
});
|
|
100407
|
+
}));
|
|
100351
100408
|
};
|
|
100352
100409
|
const ReservationDashboard = ({
|
|
100353
100410
|
Header: Header2,
|
|
@@ -100475,9 +100532,12 @@ const ReservationDashboard = ({
|
|
|
100475
100532
|
currentDate
|
|
100476
100533
|
})), isLoading ? /* @__PURE__ */ React__default.createElement(SkeletonPage, null) : /* @__PURE__ */ React__default.createElement(Table$2, {
|
|
100477
100534
|
currentTimeZone: currentTimeZone.current,
|
|
100535
|
+
venueId,
|
|
100478
100536
|
data: data2,
|
|
100537
|
+
reloadMainTable: reload,
|
|
100538
|
+
onOpenDetailReservation,
|
|
100539
|
+
selectedRow,
|
|
100479
100540
|
setSelectedRow: (row2) => {
|
|
100480
|
-
onOpenDetailReservation();
|
|
100481
100541
|
setSelectedRow(row2);
|
|
100482
100542
|
}
|
|
100483
100543
|
})), /* @__PURE__ */ React__default.createElement(HoursAvailability, {
|