mozrest-sdk-react-dev 0.1.69 → 0.1.70
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 +59 -104
- package/package.json +1 -1
- package/style.css +1 -1
package/mozrest-sdk.es.js
CHANGED
|
@@ -97221,19 +97221,22 @@ const Table$1 = ({ data: data2, setSelectedRow, currentTimeZone }) => {
|
|
|
97221
97221
|
onClick: (value2) => setSelectedRow(value2)
|
|
97222
97222
|
}))))));
|
|
97223
97223
|
};
|
|
97224
|
-
const container = "
|
|
97225
|
-
const filterRow = "
|
|
97226
|
-
const table = "
|
|
97227
|
-
const item = "
|
|
97224
|
+
const container = "_container_1ditd_1";
|
|
97225
|
+
const filterRow = "_filterRow_1ditd_7";
|
|
97226
|
+
const table = "_table_1ditd_37";
|
|
97227
|
+
const item = "_item_1ditd_41";
|
|
97228
|
+
const timeSlot = "_timeSlot_1ditd_46";
|
|
97228
97229
|
var styles$6 = {
|
|
97229
97230
|
container,
|
|
97230
97231
|
filterRow,
|
|
97231
97232
|
table,
|
|
97232
|
-
item
|
|
97233
|
+
item,
|
|
97234
|
+
timeSlot,
|
|
97235
|
+
"timeSlot-active-true": "_timeSlot-active-true_1ditd_50",
|
|
97236
|
+
"timeSlot-active-false": "_timeSlot-active-false_1ditd_53"
|
|
97233
97237
|
};
|
|
97234
|
-
const FilterForm = ({
|
|
97238
|
+
const FilterForm = ({ tableOptions, setBookingValues, currentDate, partyOptions }) => {
|
|
97235
97239
|
const { t: t2 } = useTranslation();
|
|
97236
|
-
const [currentDayHours, setCurrentDayHours] = useState([]);
|
|
97237
97240
|
const {
|
|
97238
97241
|
handleChange,
|
|
97239
97242
|
setFieldValue,
|
|
@@ -97241,12 +97244,9 @@ const FilterForm = ({ partyOptions, areasOptions, hoursOptions, setBookingValues
|
|
|
97241
97244
|
values
|
|
97242
97245
|
} = useFormikContext();
|
|
97243
97246
|
useEffect(() => {
|
|
97244
|
-
setBookingValues(values);
|
|
97247
|
+
setBookingValues({ ...values, partyOptions });
|
|
97248
|
+
handleSubmit();
|
|
97245
97249
|
}, [values]);
|
|
97246
|
-
useEffect(() => {
|
|
97247
|
-
setCurrentDayHours(hoursOptions.find((d2) => d2.weekday === hooks(values.date).format("dddd").toLocaleLowerCase()).hours.filter((d2) => d2.id));
|
|
97248
|
-
setFieldValue("time", hoursOptions.find((d2) => d2.weekday === hooks(values.date).format("dddd").toLocaleLowerCase()).hours.filter((d2) => d2.id)[0]);
|
|
97249
|
-
}, [values.date]);
|
|
97250
97250
|
useEffect(() => {
|
|
97251
97251
|
if (currentDate)
|
|
97252
97252
|
setFieldValue("date", currentDate);
|
|
@@ -97255,12 +97255,6 @@ const FilterForm = ({ partyOptions, areasOptions, hoursOptions, setBookingValues
|
|
|
97255
97255
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
97256
97256
|
className: styles$6.filterRow
|
|
97257
97257
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
97258
|
-
style: { minWidth: 100 }
|
|
97259
|
-
}, /* @__PURE__ */ React__default.createElement(SelectField, {
|
|
97260
|
-
id: "partySize",
|
|
97261
|
-
label: t2("PARTYSIZE"),
|
|
97262
|
-
options: partyOptions
|
|
97263
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
97264
97258
|
style: { minWidth: 100, marginRight: 30 }
|
|
97265
97259
|
}, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
97266
97260
|
id: "date",
|
|
@@ -97273,24 +97267,10 @@ const FilterForm = ({ partyOptions, areasOptions, hoursOptions, setBookingValues
|
|
|
97273
97267
|
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
97274
97268
|
style: { minWidth: 100 }
|
|
97275
97269
|
}, /* @__PURE__ */ React__default.createElement(SelectField, {
|
|
97276
|
-
id: "
|
|
97277
|
-
label: t2("
|
|
97278
|
-
options:
|
|
97279
|
-
}))
|
|
97280
|
-
style: { minWidth: 100 }
|
|
97281
|
-
}, /* @__PURE__ */ React__default.createElement(SelectField, {
|
|
97282
|
-
id: "area",
|
|
97283
|
-
label: t2("Area"),
|
|
97284
|
-
options: areasOptions
|
|
97285
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
97286
|
-
style: { display: "flex", justifyContent: "end", flex: 1 }
|
|
97287
|
-
}, /* @__PURE__ */ React__default.createElement(Button$3, {
|
|
97288
|
-
style: { marginTop: 30, justifyContent: "end" },
|
|
97289
|
-
mode: "secondary",
|
|
97290
|
-
icon: "search",
|
|
97291
|
-
size: "small",
|
|
97292
|
-
onClick: () => handleSubmit()
|
|
97293
|
-
}, "")));
|
|
97270
|
+
id: "table",
|
|
97271
|
+
label: t2("TABLE"),
|
|
97272
|
+
options: tableOptions
|
|
97273
|
+
})));
|
|
97294
97274
|
};
|
|
97295
97275
|
var momentTimezone$1 = { exports: {} };
|
|
97296
97276
|
var momentTimezone = { exports: {} };
|
|
@@ -98668,33 +98648,25 @@ const TableFilters = ({ venueId, params, setParams, reload, setBookingValues, cu
|
|
|
98668
98648
|
return /* @__PURE__ */ React__default.createElement(SkeletonFilters, null);
|
|
98669
98649
|
}
|
|
98670
98650
|
const initialValues = {
|
|
98671
|
-
|
|
98672
|
-
time: data2.hours.find((h2) => h2.weekday == moment$1().format("dddd").toLocaleLowerCase()) ? data2.hours.find((h2) => h2.weekday == moment$1().format("dddd").toLocaleLowerCase()).hours.filter((d2) => d2.id)[0] : { label: "Closed", id: null },
|
|
98673
|
-
area: data2.areas ? data2.areas[0] : { label: "No selected", id: null },
|
|
98651
|
+
table: data2.tables ? data2.tables[1] : { label: "No selected", id: null },
|
|
98674
98652
|
date: moment$1().format("YYYY-MM-DD")
|
|
98675
98653
|
};
|
|
98676
98654
|
const handleOnSubmit = (values) => {
|
|
98677
|
-
const formatedDate = moment$1.tz(`${values.date}
|
|
98655
|
+
const formatedDate = moment$1.tz(`${values.date}`, currentTimeZone ? currentTimeZone : "").valueOf() / 1e3;
|
|
98678
98656
|
let auxParams = {
|
|
98679
98657
|
...params,
|
|
98680
|
-
...values.partySize.id ? {
|
|
98681
|
-
partySize: values.partySize.id
|
|
98682
|
-
} : {},
|
|
98683
|
-
...values.area.id ? {
|
|
98684
|
-
area: values.area.id
|
|
98685
|
-
} : {},
|
|
98686
98658
|
...values.date ? {
|
|
98687
98659
|
startSec: formatedDate
|
|
98660
|
+
} : {},
|
|
98661
|
+
...values.table.id ? {
|
|
98662
|
+
table: values.table.id
|
|
98688
98663
|
} : {}
|
|
98689
98664
|
};
|
|
98690
98665
|
if (!values.date && auxParams.startSec) {
|
|
98691
98666
|
delete auxParams.startSec;
|
|
98692
98667
|
}
|
|
98693
|
-
if (!values.
|
|
98694
|
-
delete auxParams.
|
|
98695
|
-
}
|
|
98696
|
-
if (!values.area.id && auxParams.area) {
|
|
98697
|
-
delete auxParams.area;
|
|
98668
|
+
if (!values.table.id && auxParams.table) {
|
|
98669
|
+
delete auxParams.table;
|
|
98698
98670
|
}
|
|
98699
98671
|
setParams(auxParams);
|
|
98700
98672
|
reload();
|
|
@@ -98703,60 +98675,42 @@ const TableFilters = ({ venueId, params, setParams, reload, setBookingValues, cu
|
|
|
98703
98675
|
initialValues,
|
|
98704
98676
|
onSubmit: handleOnSubmit
|
|
98705
98677
|
}, /* @__PURE__ */ React__default.createElement(FilterForm, {
|
|
98706
|
-
partyOptions: data2.partySizes,
|
|
98707
|
-
areasOptions: data2.areas,
|
|
98708
|
-
hoursOptions: data2.hours,
|
|
98709
98678
|
setBookingValues,
|
|
98710
|
-
currentDate
|
|
98679
|
+
currentDate,
|
|
98680
|
+
tableOptions: data2.tables.filter((t2) => t2.id),
|
|
98681
|
+
partyOptions: data2.partySizes.filter((p2) => p2.id)
|
|
98711
98682
|
})));
|
|
98712
98683
|
};
|
|
98713
98684
|
const TableRow = ({ row: row2, setSelectedTable }) => {
|
|
98714
|
-
|
|
98715
|
-
|
|
98716
|
-
|
|
98717
|
-
|
|
98718
|
-
|
|
98719
|
-
|
|
98720
|
-
|
|
98721
|
-
|
|
98722
|
-
}, `${(_a2 = row2.minCapacity) != null ? _a2 : "?"} - ${(_b = row2.maxCapacity) != null ? _b : "?"}`), /* @__PURE__ */ React__default.createElement("td", {
|
|
98723
|
-
style: { textAlign: "center" }
|
|
98724
|
-
}, " ", row2.nextBookingIn ? /* @__PURE__ */ React__default.createElement(TimeFormatter, {
|
|
98725
|
-
seconds: row2.nextBookingIn,
|
|
98726
|
-
type: "minutes"
|
|
98727
|
-
}) : "---"));
|
|
98685
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
98686
|
+
style: { display: "flex", gap: 3 }
|
|
98687
|
+
}, row2 && row2.slots && row2.slots.length && row2.slots.length > 0 ? row2.slots.map((slot2, index2) => /* @__PURE__ */ React__default.createElement("div", {
|
|
98688
|
+
key: index2,
|
|
98689
|
+
onClick: () => slot2.available && setSelectedTable({ ...row2, slot: slot2 })
|
|
98690
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
98691
|
+
className: classNames$2(styles$6["timeSlot"], styles$6[`timeSlot-active-${slot2.available ? "true" : "false"}`])
|
|
98692
|
+
}, slot2.time))) : null);
|
|
98728
98693
|
};
|
|
98729
98694
|
const Table = ({ data: data2, setSelectedTable }) => {
|
|
98730
98695
|
const { t: t2 } = useTranslation();
|
|
98731
98696
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
98732
98697
|
style: { width: "100%", margin: "auto" }
|
|
98733
98698
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
98734
|
-
style: { overflowX: "auto" }
|
|
98735
|
-
}, /* @__PURE__ */ React__default.createElement("table", {
|
|
98736
|
-
className: styles$6.tableName
|
|
98737
|
-
}, /* @__PURE__ */ React__default.createElement("thead", null, /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("th", {
|
|
98738
|
-
style: { paddingLeft: 24, paddingRight: 24, textAlign: "left" }
|
|
98739
|
-
}, "Table"), /* @__PURE__ */ React__default.createElement("th", {
|
|
98740
|
-
style: { paddingLeft: 24, paddingRight: 24, textAlign: "center" }
|
|
98741
|
-
}, "Capacity"), /* @__PURE__ */ React__default.createElement("th", {
|
|
98742
|
-
style: { paddingLeft: 24, paddingRight: 24, textAlign: "center" }
|
|
98743
|
-
}, "Next booking"))), /* @__PURE__ */ React__default.createElement("tbody", {
|
|
98744
|
-
style: { backgroundColor: "white" }
|
|
98699
|
+
style: { overflowX: "auto", display: "flex", flexDirection: "column", gap: 10 }
|
|
98745
98700
|
}, data2.length && data2.length > 0 ? data2.map((table2, index2) => /* @__PURE__ */ React__default.createElement(TableRow, {
|
|
98746
98701
|
row: table2,
|
|
98747
98702
|
key: index2,
|
|
98748
98703
|
setSelectedTable
|
|
98749
98704
|
})) : /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("td", {
|
|
98750
|
-
style: { textAlign: "center" }
|
|
98751
|
-
|
|
98752
|
-
}, /* @__PURE__ */ React__default.createElement("p", null, t2("NOTABLESAVAILABLE"))))))));
|
|
98705
|
+
style: { textAlign: "center", width: "100%", backgroundColor: "#F8F8F8" }
|
|
98706
|
+
}, /* @__PURE__ */ React__default.createElement("p", null, t2("NOTABLESAVAILABLE"))))));
|
|
98753
98707
|
};
|
|
98754
98708
|
const GetTableAvailability = async ({
|
|
98755
98709
|
venue_id,
|
|
98756
98710
|
params
|
|
98757
98711
|
}) => {
|
|
98758
98712
|
if (params && params.startSec) {
|
|
98759
|
-
const responseData = await instance$1.get(`/resbook/venue/${venue_id}/table-availablity`, {
|
|
98713
|
+
const responseData = await instance$1.get(`/resbook/venue/${venue_id}/table-availablity/map`, {
|
|
98760
98714
|
params: { ...params, limit: 100 }
|
|
98761
98715
|
});
|
|
98762
98716
|
const data2 = responseData != null ? responseData : [];
|
|
@@ -98791,7 +98745,7 @@ const AddBooking = async ({
|
|
|
98791
98745
|
await instance$1.post(`/resbook/venue/${venueId}/bookings`, data2);
|
|
98792
98746
|
return { data: "created" };
|
|
98793
98747
|
};
|
|
98794
|
-
const ContactDetailsFormFields = ({ isExecuting = false }) => {
|
|
98748
|
+
const ContactDetailsFormFields = ({ isExecuting = false, partyOptions }) => {
|
|
98795
98749
|
const { t: t2 } = useTranslation();
|
|
98796
98750
|
const {
|
|
98797
98751
|
handleChange,
|
|
@@ -98810,6 +98764,13 @@ const ContactDetailsFormFields = ({ isExecuting = false }) => {
|
|
|
98810
98764
|
}, /* @__PURE__ */ React__default.createElement(Col$1, {
|
|
98811
98765
|
xs: 24,
|
|
98812
98766
|
lg: 10
|
|
98767
|
+
}, /* @__PURE__ */ React__default.createElement(SelectField, {
|
|
98768
|
+
id: "partySize",
|
|
98769
|
+
label: t2("PARTYSIZE"),
|
|
98770
|
+
options: partyOptions
|
|
98771
|
+
})), /* @__PURE__ */ React__default.createElement(Col$1, {
|
|
98772
|
+
xs: 24,
|
|
98773
|
+
lg: 10
|
|
98813
98774
|
}, /* @__PURE__ */ React__default.createElement(TextInputField, {
|
|
98814
98775
|
id: "firstname",
|
|
98815
98776
|
label: t2("FIRSTNAME")
|
|
@@ -98850,28 +98811,31 @@ const ContactDetailsFormFields = ({ isExecuting = false }) => {
|
|
|
98850
98811
|
}, t2("CREATERESERVATION"))));
|
|
98851
98812
|
};
|
|
98852
98813
|
const ContactDetailsForm = ({ venueId, selectedTable, setSelectedTable, setCreated, bookingValues, currentTimeZone, reloadMainTable }) => {
|
|
98814
|
+
var _a2;
|
|
98853
98815
|
const { t: t2 } = useTranslation();
|
|
98854
98816
|
const initialValues = {
|
|
98855
98817
|
notes: "",
|
|
98856
98818
|
firstname: "",
|
|
98857
98819
|
lastname: "",
|
|
98858
98820
|
email: "",
|
|
98859
|
-
telephone: ""
|
|
98821
|
+
telephone: "",
|
|
98822
|
+
partySize: bookingValues.partyOptions[0]
|
|
98860
98823
|
};
|
|
98861
98824
|
const bookingSchema = create$1().shape({
|
|
98862
98825
|
firstname: create$2().required(t2("errors.required")),
|
|
98863
98826
|
lastname: create$2().required(t2("errors.required")),
|
|
98864
98827
|
notes: create$2(),
|
|
98865
98828
|
email: create$2().required(t2("errors.required")).email(t2("errors.email")),
|
|
98866
|
-
telephone: create$2().required(t2("errors.required")).matches(new RegExp(/^\+?[1-9]\d{8,14}$/), t2("errors.phone"))
|
|
98829
|
+
telephone: create$2().required(t2("errors.required")).matches(new RegExp(/^\+?[1-9]\d{8,14}$/), t2("errors.phone")),
|
|
98830
|
+
partySize: create$1()
|
|
98867
98831
|
});
|
|
98868
98832
|
const { execute, data: data2, isExecuting } = useService(AddBooking);
|
|
98869
98833
|
const handleOnSubmit = async (values) => {
|
|
98870
|
-
var
|
|
98834
|
+
var _a3, _b, _c;
|
|
98871
98835
|
const toSend = {
|
|
98872
|
-
partySize:
|
|
98836
|
+
partySize: values.partySize.id ? values.partySize.id : 1,
|
|
98873
98837
|
table: selectedTable.id,
|
|
98874
|
-
date: bookingValues.date ? moment$1.tz(`${bookingValues.date} ${
|
|
98838
|
+
date: bookingValues.date ? moment$1.tz(`${bookingValues.date} ${selectedTable.slot.time}`, currentTimeZone ? currentTimeZone : "").valueOf() / 1e3 : moment$1.tz(moment$1(), currentTimeZone ? currentTimeZone : "").valueOf() / 1e3,
|
|
98875
98839
|
notes: values.notes,
|
|
98876
98840
|
contact: {
|
|
98877
98841
|
firstname: values.firstname,
|
|
@@ -98890,7 +98854,7 @@ const ContactDetailsForm = ({ venueId, selectedTable, setSelectedTable, setCreat
|
|
|
98890
98854
|
setCreated(true);
|
|
98891
98855
|
}
|
|
98892
98856
|
setSelectedTable(null);
|
|
98893
|
-
setCreated({ ...toSend, time:
|
|
98857
|
+
setCreated({ ...toSend, time: selectedTable.slot.time, area: (_b = (_a3 = bookingValues == null ? void 0 : bookingValues.area) == null ? void 0 : _a3.id) != null ? _b : null, dateString: (_c = new Date(`${bookingValues.date} ${selectedTable.slot.time}`).toDateString()) != null ? _c : "?" });
|
|
98894
98858
|
reloadMainTable();
|
|
98895
98859
|
};
|
|
98896
98860
|
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("h4", null, t2("CONTACTDETAILS")), /* @__PURE__ */ React__default.createElement(Formik, {
|
|
@@ -98898,11 +98862,12 @@ const ContactDetailsForm = ({ venueId, selectedTable, setSelectedTable, setCreat
|
|
|
98898
98862
|
onSubmit: handleOnSubmit,
|
|
98899
98863
|
validationSchema: bookingSchema
|
|
98900
98864
|
}, /* @__PURE__ */ React__default.createElement(ContactDetailsFormFields, {
|
|
98901
|
-
isExecuting
|
|
98865
|
+
isExecuting,
|
|
98866
|
+
partyOptions: (_a2 = bookingValues.partyOptions) != null ? _a2 : []
|
|
98902
98867
|
})));
|
|
98903
98868
|
};
|
|
98904
98869
|
const ContactDetails = ({ setSelectedTable, selectedTable, venueId, setCreated, bookingValues, reloadMainTable, currentTimeZone }) => {
|
|
98905
|
-
var _a2
|
|
98870
|
+
var _a2;
|
|
98906
98871
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
98907
98872
|
className: ""
|
|
98908
98873
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -98921,17 +98886,7 @@ const ContactDetails = ({ setSelectedTable, selectedTable, venueId, setCreated,
|
|
|
98921
98886
|
}, /* @__PURE__ */ React__default.createElement(Icon$1, {
|
|
98922
98887
|
icon: "clock",
|
|
98923
98888
|
className: "mr-2"
|
|
98924
|
-
}), (_a2 =
|
|
98925
|
-
style: { display: "flex" }
|
|
98926
|
-
}, /* @__PURE__ */ React__default.createElement(Icon$1, {
|
|
98927
|
-
icon: "people",
|
|
98928
|
-
className: "mr-2"
|
|
98929
|
-
}), (bookingValues == null ? void 0 : bookingValues.partySize.id) ? bookingValues.partySize.id : `${(_b = selectedTable.minCapacity) != null ? _b : "?"}-${(_c = selectedTable.maxCapacity) != null ? _c : "?"}`), (bookingValues == null ? void 0 : bookingValues.area.id) && /* @__PURE__ */ React__default.createElement("div", {
|
|
98930
|
-
style: { display: "flex" }
|
|
98931
|
-
}, /* @__PURE__ */ React__default.createElement(Icon$1, {
|
|
98932
|
-
icon: "business",
|
|
98933
|
-
className: "mr-2"
|
|
98934
|
-
}), (bookingValues == null ? void 0 : bookingValues.area.id) ? bookingValues == null ? void 0 : bookingValues.area.label : "?")), /* @__PURE__ */ React__default.createElement(ContactDetailsForm, {
|
|
98889
|
+
}), (_a2 = selectedTable == null ? void 0 : selectedTable.slot.time) != null ? _a2 : "---")), /* @__PURE__ */ React__default.createElement(ContactDetailsForm, {
|
|
98935
98890
|
venueId,
|
|
98936
98891
|
selectedTable,
|
|
98937
98892
|
setSelectedTable,
|