mozrest-sdk-react-dev 0.2.95 → 0.2.96
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 +73 -29
- package/package.json +1 -1
package/mozrest-sdk.es.js
CHANGED
|
@@ -103374,7 +103374,7 @@ var styles$n = {
|
|
|
103374
103374
|
filtersContainer,
|
|
103375
103375
|
filters
|
|
103376
103376
|
};
|
|
103377
|
-
const RestaurantsSelector = ({ open, onClose: onClose2, selectedRestaurants, setSelectedRestaurants, selectedBrand, setSelectedBrand }) => {
|
|
103377
|
+
const RestaurantsSelector = ({ open, onClose: onClose2, selectedRestaurants, setSelectedRestaurants, selectedBrand, setSelectedBrand, setShowRestaurantsSelector }) => {
|
|
103378
103378
|
const { t: t2 } = useTranslation();
|
|
103379
103379
|
const [searchValue, setSearchValue] = useState("");
|
|
103380
103380
|
const [currentPage, setCurrentPage] = useState(1);
|
|
@@ -103430,6 +103430,11 @@ const RestaurantsSelector = ({ open, onClose: onClose2, selectedRestaurants, set
|
|
|
103430
103430
|
setBrandToFilter(null);
|
|
103431
103431
|
}
|
|
103432
103432
|
}, [selectedBrand]);
|
|
103433
|
+
useEffect(() => {
|
|
103434
|
+
if (data2 && data2.total && data2.total > 1) {
|
|
103435
|
+
setShowRestaurantsSelector(true);
|
|
103436
|
+
}
|
|
103437
|
+
}, [data2]);
|
|
103433
103438
|
const tableHeader = [
|
|
103434
103439
|
{
|
|
103435
103440
|
label: /* @__PURE__ */ React__default.createElement("input", {
|
|
@@ -103578,6 +103583,7 @@ const IconButton = ({
|
|
|
103578
103583
|
};
|
|
103579
103584
|
const ToolbarFormFields = ({ handleOnFilter, isExportLoading, onOpenExportDataModal }) => {
|
|
103580
103585
|
const { t: t2 } = useTranslation();
|
|
103586
|
+
const [showRestaurantsSelector, setShowRestaurantsSelector] = useState(false);
|
|
103581
103587
|
const [openRestaurantsSelector, setOpenRestaurantsSelector] = useState(false);
|
|
103582
103588
|
const onOpenRestaurantsSelector = () => setOpenRestaurantsSelector(true);
|
|
103583
103589
|
const onCloseRestaurantsSelector = () => setOpenRestaurantsSelector(false);
|
|
@@ -103635,7 +103641,7 @@ const ToolbarFormFields = ({ handleOnFilter, isExportLoading, onOpenExportDataMo
|
|
|
103635
103641
|
xs: 24,
|
|
103636
103642
|
sm: 12,
|
|
103637
103643
|
md: 6,
|
|
103638
|
-
lg: 3
|
|
103644
|
+
lg: showRestaurantsSelector ? 3 : 5
|
|
103639
103645
|
}, /* @__PURE__ */ React__default.createElement(NewSelect, {
|
|
103640
103646
|
options: partySizeOptions,
|
|
103641
103647
|
placeholder: t2("ALL"),
|
|
@@ -103646,8 +103652,8 @@ const ToolbarFormFields = ({ handleOnFilter, isExportLoading, onOpenExportDataMo
|
|
|
103646
103652
|
xs: 24,
|
|
103647
103653
|
sm: 12,
|
|
103648
103654
|
md: 8,
|
|
103649
|
-
lg: 5
|
|
103650
|
-
}, /* @__PURE__ */ React__default.createElement(SelectChannels, null)), /* @__PURE__ */ React__default.createElement(Col$1, {
|
|
103655
|
+
lg: showRestaurantsSelector ? 5 : 6
|
|
103656
|
+
}, /* @__PURE__ */ React__default.createElement(SelectChannels, null)), showRestaurantsSelector && /* @__PURE__ */ React__default.createElement(Col$1, {
|
|
103651
103657
|
xs: 12,
|
|
103652
103658
|
sm: 12,
|
|
103653
103659
|
md: 8,
|
|
@@ -103677,7 +103683,8 @@ const ToolbarFormFields = ({ handleOnFilter, isExportLoading, onOpenExportDataMo
|
|
|
103677
103683
|
selectedBrand,
|
|
103678
103684
|
setSelectedBrand,
|
|
103679
103685
|
open: openRestaurantsSelector,
|
|
103680
|
-
onClose: onCloseRestaurantsSelector
|
|
103686
|
+
onClose: onCloseRestaurantsSelector,
|
|
103687
|
+
setShowRestaurantsSelector
|
|
103681
103688
|
}));
|
|
103682
103689
|
};
|
|
103683
103690
|
const ExportReservationAnalytics = async ({ params }) => {
|
|
@@ -103687,13 +103694,33 @@ const ExportReservationAnalytics = async ({ params }) => {
|
|
|
103687
103694
|
);
|
|
103688
103695
|
return { data: "requested" };
|
|
103689
103696
|
};
|
|
103690
|
-
const
|
|
103697
|
+
const ExportResbookReservationAnalytics = async ({ params, venueId }) => {
|
|
103698
|
+
await instance$1.get(
|
|
103699
|
+
`reports/resbook-booking-summary/${venueId}`,
|
|
103700
|
+
{ params }
|
|
103701
|
+
);
|
|
103702
|
+
return { data: "requested" };
|
|
103703
|
+
};
|
|
103704
|
+
const ExportDataModal = ({ open, onClose: onClose2, filters: filters2, isExportLoading, setIsExportLoading, userEmail, userFullName, venueId }) => {
|
|
103705
|
+
var _a2;
|
|
103691
103706
|
const { t: t2 } = useTranslation();
|
|
103707
|
+
const roles = (_a2 = userData == null ? void 0 : userData.roles) != null ? _a2 : [];
|
|
103708
|
+
const [rolePos, setRolePos] = useState(false);
|
|
103692
103709
|
const [exportFilters, setExportFilters] = useState(filters2 != null ? filters2 : {});
|
|
103693
103710
|
const [openConfirmationModal, setOpenConfirmationModal] = useState(false);
|
|
103694
103711
|
const onOpenConfirmationModal = () => setOpenConfirmationModal(true);
|
|
103695
103712
|
const onCloseConfirmationModal = () => setOpenConfirmationModal(false);
|
|
103696
|
-
const { isExecuting, execute, error:
|
|
103713
|
+
const { isExecuting: isExecutingAnalytics, execute: executeAnalytics, error: errorAnalytics } = useService(ExportReservationAnalytics, {
|
|
103714
|
+
onSuccess: async () => {
|
|
103715
|
+
onClose2();
|
|
103716
|
+
setIsExportLoading(false);
|
|
103717
|
+
},
|
|
103718
|
+
onError: async () => {
|
|
103719
|
+
setIsExportLoading(false);
|
|
103720
|
+
},
|
|
103721
|
+
successText: "Successfully requested"
|
|
103722
|
+
});
|
|
103723
|
+
const { isExecuting: isExecutingResbookAnalytics, execute: executeResbookAnalytics, error: errorResbookAnalytics } = useService(ExportResbookReservationAnalytics, {
|
|
103697
103724
|
onSuccess: async () => {
|
|
103698
103725
|
onClose2();
|
|
103699
103726
|
setIsExportLoading(false);
|
|
@@ -103706,18 +103733,41 @@ const ExportDataModal = ({ open, onClose: onClose2, filters: filters2, isExportL
|
|
|
103706
103733
|
const onRequestExcel = () => {
|
|
103707
103734
|
setIsExportLoading(true);
|
|
103708
103735
|
onCloseConfirmationModal();
|
|
103709
|
-
|
|
103710
|
-
|
|
103711
|
-
|
|
103712
|
-
|
|
103713
|
-
|
|
103714
|
-
|
|
103715
|
-
|
|
103716
|
-
|
|
103717
|
-
|
|
103718
|
-
|
|
103719
|
-
|
|
103736
|
+
if (rolePos) {
|
|
103737
|
+
executeResbookAnalytics({
|
|
103738
|
+
venueId,
|
|
103739
|
+
params: {
|
|
103740
|
+
...{
|
|
103741
|
+
["filters[fromZ]"]: hooks(exportFilters["filters[from]"]).format("YYYY-MM-DD"),
|
|
103742
|
+
["filters[tillZ]"]: hooks(exportFilters["filters[till]"]).format("YYYY-MM-DD")
|
|
103743
|
+
},
|
|
103744
|
+
...userEmail ? {
|
|
103745
|
+
["filters[userEmail]"]: userEmail
|
|
103746
|
+
} : {},
|
|
103747
|
+
...userFullName ? {
|
|
103748
|
+
["filters[userFullName]"]: userFullName
|
|
103749
|
+
} : {}
|
|
103750
|
+
}
|
|
103751
|
+
});
|
|
103752
|
+
} else {
|
|
103753
|
+
executeAnalytics({
|
|
103754
|
+
params: {
|
|
103755
|
+
...exportFilters,
|
|
103756
|
+
...userEmail ? {
|
|
103757
|
+
["filters[userEmail]"]: userEmail
|
|
103758
|
+
} : {},
|
|
103759
|
+
...userFullName ? {
|
|
103760
|
+
["filters[userFullName]"]: userFullName
|
|
103761
|
+
} : {}
|
|
103762
|
+
}
|
|
103763
|
+
});
|
|
103764
|
+
}
|
|
103720
103765
|
};
|
|
103766
|
+
useEffect(() => {
|
|
103767
|
+
if (!roles.includes("ROLE_SUPER_ADMIN") && roles.includes("ROLE_POS")) {
|
|
103768
|
+
setRolePos(true);
|
|
103769
|
+
}
|
|
103770
|
+
}, [roles]);
|
|
103721
103771
|
useEffect(() => {
|
|
103722
103772
|
setExportFilters(filters2);
|
|
103723
103773
|
}, [filters2]);
|
|
@@ -103756,11 +103806,11 @@ const ExportDataModal = ({ open, onClose: onClose2, filters: filters2, isExportL
|
|
|
103756
103806
|
onAccept: () => onRequestExcel(),
|
|
103757
103807
|
message: `Do you want to export an excel file from ${exportFilters["filters[from]"]} until ${exportFilters["filters[till]"]}? You will receive shortly the report on you email inbox.`,
|
|
103758
103808
|
width: 500,
|
|
103759
|
-
isLoading: isExportLoading ||
|
|
103809
|
+
isLoading: isExportLoading || isExecutingAnalytics || isExecutingResbookAnalytics,
|
|
103760
103810
|
icon: "calendar"
|
|
103761
103811
|
}));
|
|
103762
103812
|
};
|
|
103763
|
-
const ToolBar = ({ filters: filters2, setFilters, setTotalDays, userEmail, userFullName }) => {
|
|
103813
|
+
const ToolBar = ({ filters: filters2, setFilters, setTotalDays, userEmail, userFullName, venueId }) => {
|
|
103764
103814
|
const [openExportDataModal, setOpenExportDataModal] = useState(false);
|
|
103765
103815
|
const onOpenExportDataModal = () => setOpenExportDataModal(true);
|
|
103766
103816
|
const onCloseExportDataModal = () => setOpenExportDataModal(false);
|
|
@@ -103814,6 +103864,7 @@ const ToolBar = ({ filters: filters2, setFilters, setTotalDays, userEmail, userF
|
|
|
103814
103864
|
onOpenExportDataModal: () => onOpenExportDataModal()
|
|
103815
103865
|
})), /* @__PURE__ */ React__default.createElement(ExportDataModal, {
|
|
103816
103866
|
filters: filters2,
|
|
103867
|
+
venueId,
|
|
103817
103868
|
userEmail,
|
|
103818
103869
|
userFullName,
|
|
103819
103870
|
open: openExportDataModal,
|
|
@@ -104024,7 +104075,7 @@ const StatsBar = ({ params }) => {
|
|
|
104024
104075
|
loadingComparison: isLoadingPrevCancelations
|
|
104025
104076
|
}, /* @__PURE__ */ React__default.createElement("small", null, t2("ComparedPeriod"), ": ", `${periodDates[0] ? periodDates[0] : ""}-${periodDates[1] ? periodDates[1] : ""}`))));
|
|
104026
104077
|
};
|
|
104027
|
-
const ReservationsAnalytics = ({ userEmail, userFullName }) => {
|
|
104078
|
+
const ReservationsAnalytics = ({ userEmail, userFullName, venueId }) => {
|
|
104028
104079
|
const [filters2, setFilters] = useState({
|
|
104029
104080
|
"filters[comparision]": "period",
|
|
104030
104081
|
"filters[from]": hooks().startOf("week").format("YYYY-MM-DD"),
|
|
@@ -104037,6 +104088,7 @@ const ReservationsAnalytics = ({ userEmail, userFullName }) => {
|
|
|
104037
104088
|
);
|
|
104038
104089
|
return /* @__PURE__ */ React__default.createElement(LayoutPage$1, {
|
|
104039
104090
|
header: /* @__PURE__ */ React__default.createElement(Container, null, /* @__PURE__ */ React__default.createElement(FiltersWrapper, null, /* @__PURE__ */ React__default.createElement(ToolBar, {
|
|
104091
|
+
venueId,
|
|
104040
104092
|
userEmail,
|
|
104041
104093
|
userFullName,
|
|
104042
104094
|
filters: filters2,
|
|
@@ -107906,13 +107958,6 @@ const ConfirmationModal = ({ onAccept, isLoading, title: title2, text: text2 = "
|
|
|
107906
107958
|
isLoading
|
|
107907
107959
|
}, t2("ACCEPT")))));
|
|
107908
107960
|
};
|
|
107909
|
-
const ExportResbookReservationAnalytics = async ({ params, venueId }) => {
|
|
107910
|
-
await instance$1.get(
|
|
107911
|
-
`reports/resbook-booking-summary/${venueId}`,
|
|
107912
|
-
{ params }
|
|
107913
|
-
);
|
|
107914
|
-
return { data: "requested" };
|
|
107915
|
-
};
|
|
107916
107961
|
const ExportBookingModal = ({ open, onClose: onClose2, isExportLoading, setIsExportLoading, userEmail, userFullName, currentVenue }) => {
|
|
107917
107962
|
const { t: t2 } = useTranslation();
|
|
107918
107963
|
const [exportFilters, setExportFilters] = useState({
|
|
@@ -108459,7 +108504,6 @@ const TableBody = ({ data: data2, filtersData, venueId }) => {
|
|
|
108459
108504
|
["asc"]
|
|
108460
108505
|
).fromPairs().value();
|
|
108461
108506
|
setFormattedData(sortedGroupedByHour);
|
|
108462
|
-
console.log(sortedGroupedByHour, "sortedGroupedByHour");
|
|
108463
108507
|
}
|
|
108464
108508
|
}, [data2, filtersData]);
|
|
108465
108509
|
return /* @__PURE__ */ React__default.createElement("div", null, _23.isEmpty(formattedData) ? /* @__PURE__ */ React__default.createElement("div", {
|