mozrest-sdk-react-dev 0.2.82 → 0.2.83

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 CHANGED
@@ -77091,7 +77091,7 @@ var styles$1u = {
77091
77091
  spinner,
77092
77092
  spin
77093
77093
  };
77094
- const Spinner = ({ size = 20, color: color2 = "black" }) => {
77094
+ const Spinner$1 = ({ size = 20, color: color2 = "black" }) => {
77095
77095
  const spinnerStyle = {
77096
77096
  width: size,
77097
77097
  height: size,
@@ -77124,7 +77124,7 @@ const StatsCard = ({
77124
77124
  if (loadingValue) {
77125
77125
  return /* @__PURE__ */ React__default.createElement("div", {
77126
77126
  style: { marginTop: 20, marginBottom: 30 }
77127
- }, /* @__PURE__ */ React__default.createElement(Spinner, {
77127
+ }, /* @__PURE__ */ React__default.createElement(Spinner$1, {
77128
77128
  size: 50
77129
77129
  }));
77130
77130
  }
@@ -77154,7 +77154,7 @@ const StatsCard = ({
77154
77154
  })
77155
77155
  }, comparison2 !== 0 ? arrow : /* @__PURE__ */ React__default.createElement("span", {
77156
77156
  style: { height: 20 }
77157
- }), !loadingComparison ? /* @__PURE__ */ React__default.createElement("span", null, comparison2 === 0 ? "" : `${comparison2} %`) : /* @__PURE__ */ React__default.createElement(Spinner, {
77157
+ }), !loadingComparison ? /* @__PURE__ */ React__default.createElement("span", null, comparison2 === 0 ? "" : `${comparison2} %`) : /* @__PURE__ */ React__default.createElement(Spinner$1, {
77158
77158
  size: 15
77159
77159
  })), children) : /* @__PURE__ */ React__default.createElement(SkeletonStatCard, null));
77160
77160
  };
@@ -77474,7 +77474,7 @@ const Param = ({
77474
77474
  className: styles$1s.param
77475
77475
  }, /* @__PURE__ */ React__default.createElement("span", {
77476
77476
  className: styles$1s.title
77477
- }, title2, tooltip2 && /* @__PURE__ */ React__default.createElement(Tooltip$2, null, tooltip2)), loadingValue ? /* @__PURE__ */ React__default.createElement(Spinner, {
77477
+ }, title2, tooltip2 && /* @__PURE__ */ React__default.createElement(Tooltip$2, null, tooltip2)), loadingValue ? /* @__PURE__ */ React__default.createElement(Spinner$1, {
77478
77478
  size: 15
77479
77479
  }) : /* @__PURE__ */ React__default.createElement("span", null, value2));
77480
77480
  const ParamsList = ({ params }) => {
@@ -96415,7 +96415,7 @@ const GetOpeningHours = async ({
96415
96415
  venue_id
96416
96416
  }) => {
96417
96417
  try {
96418
- const responseData = await instance$1.get(`/resbook/venue/${venue_id}/opening-hours`);
96418
+ const responseData = await instance$1.get(`/resbook/venue/${venue_id}/opening-hours?limit=100`);
96419
96419
  if (!responseData || typeof responseData !== "object") {
96420
96420
  console.error("Error fetching opening hours data: Invalid response data");
96421
96421
  return [];
@@ -97071,7 +97071,8 @@ const GetTableManagement = async ({
97071
97071
  `resbook/venue/${venue_id}/tables`,
97072
97072
  {
97073
97073
  params: {
97074
- "sortby[orderPriority]": "ASC"
97074
+ "sortby[name]": "ASC",
97075
+ limit: 100
97075
97076
  }
97076
97077
  }
97077
97078
  );
@@ -97270,7 +97271,7 @@ const GetArrivalRules = async ({
97270
97271
  venue_id
97271
97272
  }) => {
97272
97273
  const responseData = await instance$1.get(
97273
- `/resbook/venue/${venue_id}/arrival-rules`
97274
+ `/resbook/venue/${venue_id}/arrival-rules?limit=100`
97274
97275
  );
97275
97276
  const data2 = responseData.data;
97276
97277
  return formatData$4(data2);
@@ -97550,7 +97551,7 @@ const GetSpecialDates = async ({
97550
97551
  venue_id
97551
97552
  }) => {
97552
97553
  const responseData = await instance$1.get(
97553
- `/resbook/venue/${venue_id}/special-dates`
97554
+ `/resbook/venue/${venue_id}/special-dates?limit=100`
97554
97555
  );
97555
97556
  const data2 = responseData.data;
97556
97557
  return formatData$3(data2);
@@ -98627,10 +98628,10 @@ const GetCreateBookingSelectsData = async ({
98627
98628
  }) => {
98628
98629
  if (!venue_id)
98629
98630
  return;
98630
- const responseVenueData = await instance$1.get(`/v1/rms/venues/${venue_id}`);
98631
- const responseAreas = await instance$1.get(`/v1/rms/venues/${venue_id}/areas`);
98632
- const responseHours = await instance$1.get(`/resbook/venue/${venue_id}/opening-hours`);
98633
- const responseTables = await instance$1.get(`/resbook/venue/${venue_id}/tables?sortby[orderPriority]=ASC`);
98631
+ const responseVenueData = await instance$1.get(`/v1/rms/venues/${venue_id}?limit=100`);
98632
+ const responseAreas = await instance$1.get(`/v1/rms/venues/${venue_id}/areas?limit=100`);
98633
+ const responseHours = await instance$1.get(`/resbook/venue/${venue_id}/opening-hours?limit=100`);
98634
+ const responseTables = await instance$1.get(`/resbook/venue/${venue_id}/tables?sortby[orderPriority]=ASC&limit=100`);
98634
98635
  const responseChannels = await instance$1.get(`/resbook/smart-channels`);
98635
98636
  const data2 = {
98636
98637
  partySizes: formatPartySizeData(responseVenueData),
@@ -100196,7 +100197,7 @@ const GetTableAvailability = async ({
100196
100197
  const responseData = await instance$1.get(
100197
100198
  `/resbook/venue/${venue_id}/table-availablity`,
100198
100199
  {
100199
- params: { ...params, limit: 100 }
100200
+ params: { ...params, "sortby[orderPriority]": "ASC", limit: 100 }
100200
100201
  }
100201
100202
  );
100202
100203
  const data2 = responseData != null ? responseData : [];
@@ -103092,47 +103093,47 @@ const ReservationsAnalytics = ({ userEmail, userFullName }) => {
103092
103093
  totalDays
103093
103094
  }));
103094
103095
  };
103095
- const mainConatiner$2 = "_mainConatiner_1kgdn_48";
103096
- const mainTableContainer = "_mainTableContainer_1kgdn_58";
103097
- const mainSidebarContainer = "_mainSidebarContainer_1kgdn_66";
103098
- const sidebarCloseIcon = "_sidebarCloseIcon_1kgdn_76";
103099
- const headerContainer = "_headerContainer_1kgdn_128";
103100
- const searchContainer = "_searchContainer_1kgdn_134";
103101
- const buttonList = "_buttonList_1kgdn_142";
103102
- const buttonItem = "_buttonItem_1kgdn_147";
103103
- const tableTopHeader = "_tableTopHeader_1kgdn_157";
103104
- const tableTopHeaderContent = "_tableTopHeaderContent_1kgdn_171";
103105
- const tableTopHeaderContentText = "_tableTopHeaderContentText_1kgdn_178";
103106
- const tableRowContainer = "_tableRowContainer_1kgdn_187";
103107
- const tableRowCard = "_tableRowCard_1kgdn_193";
103108
- const noData = "_noData_1kgdn_198";
103109
- const tableRowHour = "_tableRowHour_1kgdn_205";
103110
- const tableRowHourText = "_tableRowHourText_1kgdn_221";
103111
- const hours = "_hours_1kgdn_229";
103112
- const tableRowContent = "_tableRowContent_1kgdn_235";
103113
- const rowImage = "_rowImage_1kgdn_250";
103114
- const rowContactContainer = "_rowContactContainer_1kgdn_264";
103115
- const rowContactText = "_rowContactText_1kgdn_276";
103116
- const rowContactPhone = "_rowContactPhone_1kgdn_282";
103117
- const rowSectionContainer = "_rowSectionContainer_1kgdn_289";
103118
- const rowSectionText = "_rowSectionText_1kgdn_295";
103119
- const rowSectionSecText = "_rowSectionSecText_1kgdn_301";
103120
- const rowActionButton = "_rowActionButton_1kgdn_308";
103121
- const bookingInfoContainer = "_bookingInfoContainer_1kgdn_314";
103122
- const bookingInfoCardRow = "_bookingInfoCardRow_1kgdn_318";
103123
- const bookingInfoCardContainer = "_bookingInfoCardContainer_1kgdn_326";
103124
- const bookingInfoCard = "_bookingInfoCard_1kgdn_318";
103125
- const bookingInfoCardContent = "_bookingInfoCardContent_1kgdn_338";
103126
- const bookingInfoCardTitle = "_bookingInfoCardTitle_1kgdn_344";
103127
- const bookingInfoCardText = "_bookingInfoCardText_1kgdn_347";
103096
+ const mainConatiner$2 = "_mainConatiner_1px60_48";
103097
+ const mainTableContainer = "_mainTableContainer_1px60_58";
103098
+ const mainSidebarContainer = "_mainSidebarContainer_1px60_66";
103099
+ const sidebarCloseIcon = "_sidebarCloseIcon_1px60_76";
103100
+ const headerContainer = "_headerContainer_1px60_128";
103101
+ const searchContainer = "_searchContainer_1px60_134";
103102
+ const buttonList = "_buttonList_1px60_142";
103103
+ const buttonItem = "_buttonItem_1px60_147";
103104
+ const tableTopHeader = "_tableTopHeader_1px60_157";
103105
+ const tableTopHeaderContent = "_tableTopHeaderContent_1px60_171";
103106
+ const tableTopHeaderContentText = "_tableTopHeaderContentText_1px60_178";
103107
+ const tableRowContainer = "_tableRowContainer_1px60_187";
103108
+ const tableRowCard = "_tableRowCard_1px60_193";
103109
+ const noData = "_noData_1px60_198";
103110
+ const tableRowHour = "_tableRowHour_1px60_205";
103111
+ const tableRowHourText = "_tableRowHourText_1px60_221";
103112
+ const hours = "_hours_1px60_229";
103113
+ const tableRowContent = "_tableRowContent_1px60_235";
103114
+ const rowImage = "_rowImage_1px60_250";
103115
+ const rowContactContainer = "_rowContactContainer_1px60_264";
103116
+ const rowContactText = "_rowContactText_1px60_276";
103117
+ const rowContactPhone = "_rowContactPhone_1px60_282";
103118
+ const rowSectionContainer = "_rowSectionContainer_1px60_289";
103119
+ const rowSectionText = "_rowSectionText_1px60_295";
103120
+ const rowSectionSecText = "_rowSectionSecText_1px60_301";
103121
+ const rowActionButton = "_rowActionButton_1px60_308";
103122
+ const bookingInfoContainer = "_bookingInfoContainer_1px60_314";
103123
+ const bookingInfoCardRow = "_bookingInfoCardRow_1px60_318";
103124
+ const bookingInfoCardContainer = "_bookingInfoCardContainer_1px60_326";
103125
+ const bookingInfoCard = "_bookingInfoCard_1px60_318";
103126
+ const bookingInfoCardContent = "_bookingInfoCardContent_1px60_338";
103127
+ const bookingInfoCardTitle = "_bookingInfoCardTitle_1px60_344";
103128
+ const bookingInfoCardText = "_bookingInfoCardText_1px60_347";
103128
103129
  var styles$l = {
103129
103130
  mainConatiner: mainConatiner$2,
103130
103131
  mainTableContainer,
103131
103132
  mainSidebarContainer,
103132
103133
  sidebarCloseIcon,
103133
- "mainSidebarContainer--open": "_mainSidebarContainer--open_1kgdn_84",
103134
- "mainSidebarContainer--close": "_mainSidebarContainer--close_1kgdn_90",
103135
- "sidebarCloseIcon--show": "_sidebarCloseIcon--show_1kgdn_98",
103134
+ "mainSidebarContainer--open": "_mainSidebarContainer--open_1px60_84",
103135
+ "mainSidebarContainer--close": "_mainSidebarContainer--close_1px60_90",
103136
+ "sidebarCloseIcon--show": "_sidebarCloseIcon--show_1px60_98",
103136
103137
  headerContainer,
103137
103138
  searchContainer,
103138
103139
  buttonList,
@@ -103163,6 +103164,47 @@ var styles$l = {
103163
103164
  bookingInfoCardTitle,
103164
103165
  bookingInfoCardText
103165
103166
  };
103167
+ const Spinner = () => /* @__PURE__ */ React__default.createElement("svg", {
103168
+ xmlns: "http://www.w3.org/2000/svg",
103169
+ width: "24",
103170
+ height: "24",
103171
+ viewBox: "0 0 24 24"
103172
+ }, /* @__PURE__ */ React__default.createElement("rect", {
103173
+ width: "24",
103174
+ height: "24",
103175
+ fill: "none"
103176
+ }), /* @__PURE__ */ React__default.createElement("g", {
103177
+ fill: "none",
103178
+ stroke: "currentColor",
103179
+ strokeLinecap: "round",
103180
+ strokeLinejoin: "round",
103181
+ strokeWidth: "2"
103182
+ }, /* @__PURE__ */ React__default.createElement("path", {
103183
+ strokeDasharray: "16",
103184
+ strokeDashoffset: "16",
103185
+ d: "M12 3c4.97 0 9 4.03 9 9"
103186
+ }, /* @__PURE__ */ React__default.createElement("animate", {
103187
+ fill: "freeze",
103188
+ attributeName: "stroke-dashoffset",
103189
+ dur: "0.3s",
103190
+ values: "16;0"
103191
+ }), /* @__PURE__ */ React__default.createElement("animateTransform", {
103192
+ attributeName: "transform",
103193
+ dur: "1.5s",
103194
+ repeatCount: "indefinite",
103195
+ type: "rotate",
103196
+ values: "0 12 12;360 12 12"
103197
+ })), /* @__PURE__ */ React__default.createElement("path", {
103198
+ strokeDasharray: "64",
103199
+ strokeDashoffset: "64",
103200
+ strokeOpacity: "0.3",
103201
+ d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z"
103202
+ }, /* @__PURE__ */ React__default.createElement("animate", {
103203
+ fill: "freeze",
103204
+ attributeName: "stroke-dashoffset",
103205
+ dur: "1.2s",
103206
+ values: "64;0"
103207
+ }))));
103166
103208
  const LetterX = () => /* @__PURE__ */ React__default.createElement("svg", {
103167
103209
  xmlns: "http://www.w3.org/2000/svg",
103168
103210
  width: "24",
@@ -104556,6 +104598,7 @@ const clock = () => {
104556
104598
  };
104557
104599
  var icons = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
104558
104600
  __proto__: null,
104601
+ Spinner,
104559
104602
  LetterX,
104560
104603
  TrashX,
104561
104604
  EyeOff,
@@ -107685,7 +107728,7 @@ const index$a = ({ filtersData, venueId }) => {
107685
107728
  const bookingSchema = () => create$1().shape({
107686
107729
  source: create$4().test(
107687
107730
  "is-valid-partySize",
107688
- "Party Size is required",
107731
+ "Source is required",
107689
107732
  (value2) => value2 !== null && typeof value2 === "object" && !!value2.value
107690
107733
  ).required(),
107691
107734
  date: create$2().required(),
@@ -107747,7 +107790,10 @@ const index$a = ({ filtersData, venueId }) => {
107747
107790
  {
107748
107791
  cacheId: "reservation0dashboard0table0availability",
107749
107792
  venue_id: venueId,
107750
- params: source2 && (source2 == null ? void 0 : source2.value) ? { startSec: moment$1.tz(`${date4} ${time2 == null ? void 0 : time2.value}`, currentTimeZone ? currentTimeZone : "").valueOf() / 1e3, partySize: partySize == null ? void 0 : partySize.value } : {}
107793
+ params: source2 && (source2 == null ? void 0 : source2.value) ? {
107794
+ startSec: moment$1.tz(`${date4} ${time2 == null ? void 0 : time2.value}`, currentTimeZone ? currentTimeZone : "").valueOf() / 1e3,
107795
+ partySize: partySize == null ? void 0 : partySize.value
107796
+ } : {}
107751
107797
  }
107752
107798
  );
107753
107799
  const { execute: executeCreate, data: responBookingCreate, isExecuting: loadingCreate } = useService(AddBooking);
@@ -108162,44 +108208,6 @@ const AreaManagementCard$1 = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) =>
108162
108208
  }
108163
108209
  }, "more")));
108164
108210
  };
108165
- const GetAreaManagement = async ({
108166
- venue_id
108167
- }) => {
108168
- if (!venue_id)
108169
- return;
108170
- const responseData = await instance$1.get(
108171
- `/v1/rms/venues/${venue_id}/areas`
108172
- );
108173
- const responseVenueData = await instance$1.get(`/v1/rms/venues/${venue_id}`);
108174
- const data2 = {
108175
- areas: formatData$1(responseData.data),
108176
- ...formatVenueData(responseVenueData)
108177
- };
108178
- return data2;
108179
- };
108180
- const GetAreasList = async ({
108181
- venue_id
108182
- }) => {
108183
- if (!venue_id)
108184
- return;
108185
- const responseData = await instance$1.get(
108186
- `/v1/rms/venues/${venue_id}/areas`
108187
- );
108188
- return formatData$1(responseData.data);
108189
- };
108190
- const formatData$1 = (data2) => {
108191
- return data2.map((item2) => {
108192
- var _a2;
108193
- return {
108194
- id: item2.id,
108195
- name: item2.name,
108196
- description: (_a2 = item2.description) != null ? _a2 : ""
108197
- };
108198
- });
108199
- };
108200
- const formatVenueData = (data2) => {
108201
- return { bookableAreas: data2.bookableAreas };
108202
- };
108203
108211
  const drawer = "_drawer_1h00k_1";
108204
108212
  const drawer__overlay = "_drawer__overlay_1h00k_18";
108205
108213
  const drawer__content = "_drawer__content_1h00k_34";
@@ -108475,8 +108483,10 @@ const AreaEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =>
108475
108483
  type: "button",
108476
108484
  onClick: () => append2({ name: "", description: "" })
108477
108485
  }, t2("NEW_AREA")), isDirty && /* @__PURE__ */ React__default.createElement(Button, {
108486
+ isLoading: loadingDelete || loadingCreate || loadingUpdate,
108487
+ disabled: loadingDelete || loadingCreate || loadingUpdate,
108478
108488
  mode: "success",
108479
- icon: "check",
108489
+ icon: loadingDelete || loadingCreate || loadingUpdate ? "Spinner" : "check",
108480
108490
  iconPosition: "right",
108481
108491
  type: "button",
108482
108492
  onClick: () => onSubmit()
@@ -108502,21 +108512,20 @@ const fieldChanged$3 = (currentValue, initialData) => {
108502
108512
  }
108503
108513
  return false;
108504
108514
  };
108505
- const index$9 = ({ venueId }) => {
108515
+ const index$9 = ({ venueId, reloadAreas, areas }) => {
108506
108516
  const [isOpenDrawer, setIsOpenDrawer] = useState(false);
108507
- const { data: data2, isLoading, error: error3, reload } = useFetch(GetAreaManagement, { cacheId: "area0management", venue_id: venueId });
108508
108517
  return /* @__PURE__ */ React__default.createElement("div", {
108509
108518
  className: styles$a.sectionManagement
108510
108519
  }, /* @__PURE__ */ React__default.createElement(AreaManagementCard$1, {
108511
108520
  isOpenDrawer,
108512
108521
  setIsOpenDrawer,
108513
- data: data2
108522
+ data: areas
108514
108523
  }), /* @__PURE__ */ React__default.createElement(AreaEditDrawer, {
108515
- data: data2,
108524
+ data: areas,
108516
108525
  isOpen: isOpenDrawer,
108517
108526
  setIsOpen: setIsOpenDrawer,
108518
108527
  venueId,
108519
- reload
108528
+ reload: reloadAreas
108520
108529
  }));
108521
108530
  };
108522
108531
  const AreaManagementCard = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) => {
@@ -108694,6 +108703,7 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108694
108703
  const [formattedAreaList, setFormattedAreaList] = useState([]);
108695
108704
  const [showConfirmationModal, setShowConfirmationModal] = useState(false);
108696
108705
  const [selectedTable, setSelectedTable] = useState(null);
108706
+ const scrollableRef = useRef(null);
108697
108707
  const { isExecuting: loadingCreate, execute: executeCreator } = useService(CreateResbook, {});
108698
108708
  const { isExecuting: loadingUpdate, execute: executeUpdater } = useService(UpdateResbook, {});
108699
108709
  const { isExecuting: loadingDelete, execute: executeDeleter } = useService(DeleteResbook, {
@@ -108769,9 +108779,21 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108769
108779
  remove(index2);
108770
108780
  }
108771
108781
  };
108782
+ const scrollToBottom = () => {
108783
+ if (scrollableRef.current) {
108784
+ scrollableRef.current.scrollTo({
108785
+ top: scrollableRef.current.scrollHeight,
108786
+ behavior: "smooth"
108787
+ });
108788
+ }
108789
+ };
108790
+ const handleAddNewTable = () => {
108791
+ append2({ name: "", minCapacity: "", maxCapacity: "", area: null });
108792
+ setTimeout(scrollToBottom, 0);
108793
+ };
108772
108794
  useEffect(() => {
108773
- if (areasList) {
108774
- setFormattedAreaList(areasList.map((area) => ({ label: area.name, value: area.id })));
108795
+ if (areasList && (areasList == null ? void 0 : areasList.areas)) {
108796
+ setFormattedAreaList(areasList.areas.map((area) => ({ label: area.name, value: area.id })));
108775
108797
  }
108776
108798
  }, [areasList]);
108777
108799
  useEffect(() => {
@@ -108811,7 +108833,8 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108811
108833
  }, /* @__PURE__ */ React__default.createElement("div", {
108812
108834
  className: styles$a.drawerContent
108813
108835
  }, /* @__PURE__ */ React__default.createElement("div", {
108814
- className: styles$a.scrollableForm
108836
+ className: styles$a.scrollableForm,
108837
+ ref: scrollableRef
108815
108838
  }, fields.map((item2, index2) => /* @__PURE__ */ React__default.createElement("div", {
108816
108839
  key: item2.id,
108817
108840
  className: styles$a.sectionFormRow
@@ -108859,7 +108882,7 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108859
108882
  id: `tables.${index2}.area`,
108860
108883
  name: `tables.${index2}.area`,
108861
108884
  label: "Area",
108862
- options: areasList ? areasList.map((area) => ({ label: area.name, value: area.id })) : []
108885
+ options: areasList && (areasList == null ? void 0 : areasList.areas) ? areasList.areas.map((area) => ({ label: area.name, value: area.id })) : []
108863
108886
  }))))), /* @__PURE__ */ React__default.createElement("div", {
108864
108887
  className: styles$a.fixedActions
108865
108888
  }, /* @__PURE__ */ React__default.createElement(Button, {
@@ -108867,10 +108890,12 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108867
108890
  icon: "plus",
108868
108891
  iconPosition: "right",
108869
108892
  type: "button",
108870
- onClick: () => append2({ name: "", description: "" })
108893
+ onClick: handleAddNewTable
108871
108894
  }, t2("NEW_TABLE")), isDirty && /* @__PURE__ */ React__default.createElement(Button, {
108895
+ isLoading: loadingDelete || loadingCreate || loadingUpdate,
108896
+ disabled: loadingDelete || loadingCreate || loadingUpdate,
108872
108897
  mode: "success",
108873
- icon: "check",
108898
+ icon: loadingDelete || loadingCreate || loadingUpdate ? "Spinner" : "check",
108874
108899
  iconPosition: "right",
108875
108900
  type: "button",
108876
108901
  onClick: () => onSubmit()
@@ -108897,10 +108922,9 @@ const fieldChanged$2 = (currentValue, initialData) => {
108897
108922
  }
108898
108923
  return false;
108899
108924
  };
108900
- const index$8 = ({ venueId }) => {
108925
+ const index$8 = ({ venueId, areas }) => {
108901
108926
  const [isOpenDrawer, setIsOpenDrawer] = useState(false);
108902
108927
  const { data: data2, isLoading, error: error3, reload } = useFetch(GetTableManagement, { cacheId: "table0management", venue_id: venueId });
108903
- const { data: areasList, isLoading: isLoadingAreas, error: errorAreasList, reload: reloadAreasList } = useFetch(GetAreasList, { cacheId: "areas0list", venue_id: venueId });
108904
108928
  return /* @__PURE__ */ React__default.createElement("div", {
108905
108929
  className: styles$a.sectionManagement
108906
108930
  }, /* @__PURE__ */ React__default.createElement(AreaManagementCard, {
@@ -108909,7 +108933,7 @@ const index$8 = ({ venueId }) => {
108909
108933
  data: data2
108910
108934
  }), /* @__PURE__ */ React__default.createElement(TableEditDrawer, {
108911
108935
  data: data2,
108912
- areasList,
108936
+ areasList: areas,
108913
108937
  isOpen: isOpenDrawer,
108914
108938
  setIsOpen: setIsOpenDrawer,
108915
108939
  venueId,
@@ -109041,8 +109065,8 @@ const ReservationDurationEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2
109041
109065
  return /* @__PURE__ */ React__default.createElement(Drawer, {
109042
109066
  isOpen,
109043
109067
  onClose: () => setIsOpen(false),
109044
- title: t2("TABLE_MANAGEMENT"),
109045
- titleDesc: t2("TABLE_MANAGEMENT_DESC")
109068
+ title: t2("RESERVATION_DURATION"),
109069
+ titleDesc: t2("RESERVATION_DURATION_DESC")
109046
109070
  }, /* @__PURE__ */ React__default.createElement("div", {
109047
109071
  className: styles$a.drawerContent
109048
109072
  }, /* @__PURE__ */ React__default.createElement("div", {
@@ -109073,8 +109097,10 @@ const ReservationDurationEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2
109073
109097
  }))))), /* @__PURE__ */ React__default.createElement("div", {
109074
109098
  className: styles$a.fixedActions
109075
109099
  }, isDirty && /* @__PURE__ */ React__default.createElement(Button, {
109100
+ isLoading: loadingUpdate,
109101
+ disabled: loadingUpdate,
109076
109102
  mode: "success",
109077
- icon: "check",
109103
+ icon: loadingUpdate ? "Spinner" : "check",
109078
109104
  iconPosition: "right",
109079
109105
  type: "button",
109080
109106
  onClick: () => onSubmit()
@@ -109211,6 +109237,7 @@ const SpecialDatesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reloa
109211
109237
  const [initialData, setInitialData] = useState(null);
109212
109238
  const [showConfirmationModal, setShowConfirmationModal] = useState(false);
109213
109239
  const [selectedDate, setSelectedDate] = useState(null);
109240
+ const scrollableRef = useRef(null);
109214
109241
  const { isExecuting: loadingUpdate, execute: executeUpdater } = useService(UpdateResbook, {});
109215
109242
  const { isExecuting: loadingDelete, execute: executeDeleter } = useService(DeleteResbook, {
109216
109243
  onSuccess: () => {
@@ -109292,6 +109319,14 @@ const SpecialDatesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reloa
109292
109319
  remove(index2);
109293
109320
  }
109294
109321
  };
109322
+ const scrollToBottom = () => {
109323
+ if (scrollableRef.current) {
109324
+ scrollableRef.current.scrollTo({
109325
+ top: scrollableRef.current.scrollHeight,
109326
+ behavior: "smooth"
109327
+ });
109328
+ }
109329
+ };
109295
109330
  useEffect(() => {
109296
109331
  if (data2) {
109297
109332
  const formatedData = data2.map((item2) => {
@@ -109318,7 +109353,8 @@ const SpecialDatesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reloa
109318
109353
  }, /* @__PURE__ */ React__default.createElement("div", {
109319
109354
  className: styles$a.drawerContent
109320
109355
  }, /* @__PURE__ */ React__default.createElement("div", {
109321
- className: styles$a.scrollableForm
109356
+ className: styles$a.scrollableForm,
109357
+ ref: scrollableRef
109322
109358
  }, fields.map((item2, index2) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, {
109323
109359
  key: item2.id
109324
109360
  }, /* @__PURE__ */ React__default.createElement("div", {
@@ -109374,10 +109410,15 @@ const SpecialDatesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reloa
109374
109410
  icon: "plus",
109375
109411
  iconPosition: "right",
109376
109412
  type: "button",
109377
- onClick: () => append2({ closed: false, startDate: "", endDate: "" })
109413
+ onClick: () => {
109414
+ append2({ closed: false, startDate: "", endDate: "" });
109415
+ setTimeout(scrollToBottom, 0);
109416
+ }
109378
109417
  }, t2("ADD_SPECIAL_DATE")), isDirty && /* @__PURE__ */ React__default.createElement(Button, {
109418
+ isLoading: loadingDelete || loadingUpdate,
109419
+ disabled: loadingDelete || loadingUpdate,
109379
109420
  mode: "success",
109380
- icon: "check",
109421
+ icon: loadingDelete || loadingUpdate ? "Spinner" : "check",
109381
109422
  iconPosition: "right",
109382
109423
  type: "button",
109383
109424
  onClick: () => onSubmit()
@@ -109612,9 +109653,10 @@ const ShiftsEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =
109612
109653
  })), /* @__PURE__ */ React__default.createElement("div", {
109613
109654
  className: styles$a.fixedActions
109614
109655
  }, isDirty && /* @__PURE__ */ React__default.createElement(Button, {
109656
+ isLoading: loadingUpdate,
109657
+ disabled: loadingUpdate,
109615
109658
  mode: "success",
109616
- icon: "check",
109617
- iconPosition: "right",
109659
+ icon: loadingUpdate ? "Spinner" : "check",
109618
109660
  type: "button",
109619
109661
  onClick: () => onSubmit()
109620
109662
  }, t2("SAVE")))));
@@ -109764,8 +109806,10 @@ const ReservationPreferencesEditDrawer = ({ isOpen, setIsOpen, venueId, data: da
109764
109806
  }))), /* @__PURE__ */ React__default.createElement("div", {
109765
109807
  style: { display: "flex", justifyContent: "flex-end", gap: 10, marginTop: 30 }
109766
109808
  }, isDirty && /* @__PURE__ */ React__default.createElement(Button, {
109809
+ isLoading: isExecuting,
109810
+ disabled: isExecuting,
109767
109811
  mode: "success",
109768
- icon: "check",
109812
+ icon: isExecuting ? "Spinner" : "check",
109769
109813
  iconPosition: "right",
109770
109814
  type: "button",
109771
109815
  onClick: () => onSubmit()
@@ -109788,9 +109832,38 @@ const index$4 = ({ venueId }) => {
109788
109832
  reload
109789
109833
  }));
109790
109834
  };
109835
+ const GetAreaManagement = async ({
109836
+ venue_id
109837
+ }) => {
109838
+ if (!venue_id)
109839
+ return;
109840
+ const responseData = await instance$1.get(
109841
+ `/v1/rms/venues/${venue_id}/areas?limit=100`
109842
+ );
109843
+ const responseVenueData = await instance$1.get(`/v1/rms/venues/${venue_id}`);
109844
+ const data2 = {
109845
+ areas: formatData$1(responseData.data),
109846
+ ...formatVenueData(responseVenueData)
109847
+ };
109848
+ return data2;
109849
+ };
109850
+ const formatData$1 = (data2) => {
109851
+ return data2.map((item2) => {
109852
+ var _a2;
109853
+ return {
109854
+ id: item2.id,
109855
+ name: item2.name,
109856
+ description: (_a2 = item2.description) != null ? _a2 : ""
109857
+ };
109858
+ });
109859
+ };
109860
+ const formatVenueData = (data2) => {
109861
+ return { bookableAreas: data2.bookableAreas };
109862
+ };
109791
109863
  function Main$1({ venueId }) {
109792
109864
  const { t: t2 } = useTranslation();
109793
109865
  const [currentVenue, setCurrentVenue] = useState(null);
109866
+ const { data: data2, isLoading, error: error3, reload } = useFetch(GetAreaManagement, { cacheId: "area0management", venue_id: currentVenue });
109794
109867
  useEffect(() => {
109795
109868
  setCurrentVenue(venueId);
109796
109869
  }, [venueId]);
@@ -109801,8 +109874,11 @@ function Main$1({ venueId }) {
109801
109874
  }, /* @__PURE__ */ React__default.createElement("h2", null, t2("RESTAURANTSETUP"))), /* @__PURE__ */ React__default.createElement("div", {
109802
109875
  className: styles$a.content
109803
109876
  }, /* @__PURE__ */ React__default.createElement(index$9, {
109877
+ areas: data2,
109878
+ reloadAreas: reload,
109804
109879
  venueId: currentVenue
109805
109880
  }), /* @__PURE__ */ React__default.createElement(index$8, {
109881
+ areas: data2,
109806
109882
  venueId: currentVenue
109807
109883
  }), /* @__PURE__ */ React__default.createElement(index$7, {
109808
109884
  venueId: currentVenue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mozrest-sdk-react-dev",
3
- "version": "0.2.82",
3
+ "version": "0.2.83",
4
4
  "main": "mozrest-sdk.es.js",
5
5
  "keywords": ["mozrest"],
6
6
  "author": {