mozrest-sdk-react-dev 0.2.80 → 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
@@ -28756,7 +28756,7 @@ var now_1 = now$1;
28756
28756
  var isObject$c = isObject_1, now = now_1, toNumber = toNumber_1;
28757
28757
  var FUNC_ERROR_TEXT$3 = "Expected a function";
28758
28758
  var nativeMax$3 = Math.max, nativeMin = Math.min;
28759
- function debounce$1(func, wait, options2) {
28759
+ function debounce$2(func, wait, options2) {
28760
28760
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
28761
28761
  if (typeof func != "function") {
28762
28762
  throw new TypeError(FUNC_ERROR_TEXT$3);
@@ -28837,7 +28837,7 @@ function debounce$1(func, wait, options2) {
28837
28837
  debounced.flush = flush;
28838
28838
  return debounced;
28839
28839
  }
28840
- var debounce_1 = debounce$1;
28840
+ var debounce_1 = debounce$2;
28841
28841
  var RowContext = /* @__PURE__ */ createContext({});
28842
28842
  var RowContext$1 = RowContext;
28843
28843
  var __rest$7 = globalThis && globalThis.__rest || function(s2, e3) {
@@ -53997,6 +53997,9 @@ const Notifications = ({
53997
53997
  cacheId: `user-data`
53998
53998
  }
53999
53999
  );
54000
+ const showAiPrompt = userData2 == null ? void 0 : userData2.roles.some(
54001
+ (role) => role === "ROLE_COMPANY_SUPER_ADMIN" || role === "ROLE_COMPANY_SUPER_ADMIN_BOT"
54002
+ );
54000
54003
  const _reload = () => {
54001
54004
  reload();
54002
54005
  };
@@ -54078,7 +54081,7 @@ const Notifications = ({
54078
54081
  className: styles$1D.item
54079
54082
  }, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Icon$2, {
54080
54083
  icon: "mail"
54081
- })), t2("NOTDEFINED"))), ((_a3 = userData2 == null ? void 0 : userData2.data) == null ? void 0 : _a3.company) && /* @__PURE__ */ React__default.createElement(Card, {
54084
+ })), t2("NOTDEFINED"))), ((_a3 = userData2 == null ? void 0 : userData2.data) == null ? void 0 : _a3.company) && showAiPrompt && /* @__PURE__ */ React__default.createElement(Card, {
54082
54085
  header: {
54083
54086
  title: t2("AIPROMPT"),
54084
54087
  icon: "edit",
@@ -74729,7 +74732,7 @@ var findIndex_1 = findIndex$2;
74729
74732
  var createFind = _createFind, findIndex$1 = findIndex_1;
74730
74733
  var find2 = createFind(findIndex$1);
74731
74734
  var find_1 = find2;
74732
- var debounce = debounce_1, isObject$2 = isObject_1;
74735
+ var debounce$1 = debounce_1, isObject$2 = isObject_1;
74733
74736
  var FUNC_ERROR_TEXT = "Expected a function";
74734
74737
  function throttle(func, wait, options2) {
74735
74738
  var leading = true, trailing = true;
@@ -74740,7 +74743,7 @@ function throttle(func, wait, options2) {
74740
74743
  leading = "leading" in options2 ? !!options2.leading : leading;
74741
74744
  trailing = "trailing" in options2 ? !!options2.trailing : trailing;
74742
74745
  }
74743
- return debounce(func, wait, {
74746
+ return debounce$1(func, wait, {
74744
74747
  "leading": leading,
74745
74748
  "maxWait": wait,
74746
74749
  "trailing": trailing
@@ -77088,7 +77091,7 @@ var styles$1u = {
77088
77091
  spinner,
77089
77092
  spin
77090
77093
  };
77091
- const Spinner = ({ size = 20, color: color2 = "black" }) => {
77094
+ const Spinner$1 = ({ size = 20, color: color2 = "black" }) => {
77092
77095
  const spinnerStyle = {
77093
77096
  width: size,
77094
77097
  height: size,
@@ -77121,7 +77124,7 @@ const StatsCard = ({
77121
77124
  if (loadingValue) {
77122
77125
  return /* @__PURE__ */ React__default.createElement("div", {
77123
77126
  style: { marginTop: 20, marginBottom: 30 }
77124
- }, /* @__PURE__ */ React__default.createElement(Spinner, {
77127
+ }, /* @__PURE__ */ React__default.createElement(Spinner$1, {
77125
77128
  size: 50
77126
77129
  }));
77127
77130
  }
@@ -77151,7 +77154,7 @@ const StatsCard = ({
77151
77154
  })
77152
77155
  }, comparison2 !== 0 ? arrow : /* @__PURE__ */ React__default.createElement("span", {
77153
77156
  style: { height: 20 }
77154
- }), !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, {
77155
77158
  size: 15
77156
77159
  })), children) : /* @__PURE__ */ React__default.createElement(SkeletonStatCard, null));
77157
77160
  };
@@ -77471,7 +77474,7 @@ const Param = ({
77471
77474
  className: styles$1s.param
77472
77475
  }, /* @__PURE__ */ React__default.createElement("span", {
77473
77476
  className: styles$1s.title
77474
- }, 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, {
77475
77478
  size: 15
77476
77479
  }) : /* @__PURE__ */ React__default.createElement("span", null, value2));
77477
77480
  const ParamsList = ({ params }) => {
@@ -96412,7 +96415,7 @@ const GetOpeningHours = async ({
96412
96415
  venue_id
96413
96416
  }) => {
96414
96417
  try {
96415
- 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`);
96416
96419
  if (!responseData || typeof responseData !== "object") {
96417
96420
  console.error("Error fetching opening hours data: Invalid response data");
96418
96421
  return [];
@@ -97068,7 +97071,8 @@ const GetTableManagement = async ({
97068
97071
  `resbook/venue/${venue_id}/tables`,
97069
97072
  {
97070
97073
  params: {
97071
- "sortby[orderPriority]": "ASC"
97074
+ "sortby[name]": "ASC",
97075
+ limit: 100
97072
97076
  }
97073
97077
  }
97074
97078
  );
@@ -97267,7 +97271,7 @@ const GetArrivalRules = async ({
97267
97271
  venue_id
97268
97272
  }) => {
97269
97273
  const responseData = await instance$1.get(
97270
- `/resbook/venue/${venue_id}/arrival-rules`
97274
+ `/resbook/venue/${venue_id}/arrival-rules?limit=100`
97271
97275
  );
97272
97276
  const data2 = responseData.data;
97273
97277
  return formatData$4(data2);
@@ -97547,7 +97551,7 @@ const GetSpecialDates = async ({
97547
97551
  venue_id
97548
97552
  }) => {
97549
97553
  const responseData = await instance$1.get(
97550
- `/resbook/venue/${venue_id}/special-dates`
97554
+ `/resbook/venue/${venue_id}/special-dates?limit=100`
97551
97555
  );
97552
97556
  const data2 = responseData.data;
97553
97557
  return formatData$3(data2);
@@ -98624,10 +98628,10 @@ const GetCreateBookingSelectsData = async ({
98624
98628
  }) => {
98625
98629
  if (!venue_id)
98626
98630
  return;
98627
- const responseVenueData = await instance$1.get(`/v1/rms/venues/${venue_id}`);
98628
- const responseAreas = await instance$1.get(`/v1/rms/venues/${venue_id}/areas`);
98629
- const responseHours = await instance$1.get(`/resbook/venue/${venue_id}/opening-hours`);
98630
- 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`);
98631
98635
  const responseChannels = await instance$1.get(`/resbook/smart-channels`);
98632
98636
  const data2 = {
98633
98637
  partySizes: formatPartySizeData(responseVenueData),
@@ -100193,7 +100197,7 @@ const GetTableAvailability = async ({
100193
100197
  const responseData = await instance$1.get(
100194
100198
  `/resbook/venue/${venue_id}/table-availablity`,
100195
100199
  {
100196
- params: { ...params, limit: 100 }
100200
+ params: { ...params, "sortby[orderPriority]": "ASC", limit: 100 }
100197
100201
  }
100198
100202
  );
100199
100203
  const data2 = responseData != null ? responseData : [];
@@ -103089,46 +103093,59 @@ const ReservationsAnalytics = ({ userEmail, userFullName }) => {
103089
103093
  totalDays
103090
103094
  }));
103091
103095
  };
103092
- const mainConatiner$2 = "_mainConatiner_lnm3d_48";
103093
- const mainTableContainer = "_mainTableContainer_lnm3d_58";
103094
- const mainSidebarContainer = "_mainSidebarContainer_lnm3d_65";
103095
- const headerContainer = "_headerContainer_lnm3d_74";
103096
- const buttonList = "_buttonList_lnm3d_79";
103097
- const tableTopHeader = "_tableTopHeader_lnm3d_85";
103098
- const tableTopHeaderContent = "_tableTopHeaderContent_lnm3d_93";
103099
- const tableRowContainer = "_tableRowContainer_lnm3d_101";
103100
- const tableRowCard = "_tableRowCard_lnm3d_107";
103101
- const noData = "_noData_lnm3d_112";
103102
- const tableRowHour = "_tableRowHour_lnm3d_119";
103103
- const hours = "_hours_lnm3d_130";
103104
- const tableRowContent = "_tableRowContent_lnm3d_136";
103105
- const rowImage = "_rowImage_lnm3d_145";
103106
- const rowContactContainer = "_rowContactContainer_lnm3d_151";
103107
- const rowContactText = "_rowContactText_lnm3d_158";
103108
- const rowContactPhone = "_rowContactPhone_lnm3d_164";
103109
- const rowSectionContainer = "_rowSectionContainer_lnm3d_171";
103110
- const rowSectionText = "_rowSectionText_lnm3d_177";
103111
- const rowSectionSecText = "_rowSectionSecText_lnm3d_183";
103112
- const rowActionButton = "_rowActionButton_lnm3d_190";
103113
- const bookingInfoContainer = "_bookingInfoContainer_lnm3d_196";
103114
- const bookingInfoCardRow = "_bookingInfoCardRow_lnm3d_200";
103115
- const bookingInfoCardContainer = "_bookingInfoCardContainer_lnm3d_208";
103116
- const bookingInfoCard = "_bookingInfoCard_lnm3d_200";
103117
- const bookingInfoCardContent = "_bookingInfoCardContent_lnm3d_220";
103118
- const bookingInfoCardTitle = "_bookingInfoCardTitle_lnm3d_226";
103119
- const bookingInfoCardText = "_bookingInfoCardText_lnm3d_229";
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";
103120
103129
  var styles$l = {
103121
103130
  mainConatiner: mainConatiner$2,
103122
103131
  mainTableContainer,
103123
103132
  mainSidebarContainer,
103133
+ sidebarCloseIcon,
103134
+ "mainSidebarContainer--open": "_mainSidebarContainer--open_1px60_84",
103135
+ "mainSidebarContainer--close": "_mainSidebarContainer--close_1px60_90",
103136
+ "sidebarCloseIcon--show": "_sidebarCloseIcon--show_1px60_98",
103124
103137
  headerContainer,
103138
+ searchContainer,
103125
103139
  buttonList,
103140
+ buttonItem,
103126
103141
  tableTopHeader,
103127
103142
  tableTopHeaderContent,
103143
+ tableTopHeaderContentText,
103128
103144
  tableRowContainer,
103129
103145
  tableRowCard,
103130
103146
  noData,
103131
103147
  tableRowHour,
103148
+ tableRowHourText,
103132
103149
  hours,
103133
103150
  tableRowContent,
103134
103151
  rowImage,
@@ -103147,6 +103164,47 @@ var styles$l = {
103147
103164
  bookingInfoCardTitle,
103148
103165
  bookingInfoCardText
103149
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
+ }))));
103150
103208
  const LetterX = () => /* @__PURE__ */ React__default.createElement("svg", {
103151
103209
  xmlns: "http://www.w3.org/2000/svg",
103152
103210
  width: "24",
@@ -104540,6 +104598,7 @@ const clock = () => {
104540
104598
  };
104541
104599
  var icons = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
104542
104600
  __proto__: null,
104601
+ Spinner,
104543
104602
  LetterX,
104544
104603
  TrashX,
104545
104604
  EyeOff,
@@ -106668,6 +106727,7 @@ const Input2 = ({
106668
106727
  borderLess = false,
106669
106728
  rounded = false,
106670
106729
  customStyles: customStyles2,
106730
+ className,
106671
106731
  ...props
106672
106732
  }) => {
106673
106733
  return /* @__PURE__ */ React__default.createElement("div", {
@@ -106700,7 +106760,8 @@ const Input2 = ({
106700
106760
  }), icon2 && /* @__PURE__ */ React__default.createElement("div", {
106701
106761
  className: classNames$2(
106702
106762
  styles$e["inputIcon"],
106703
- styles$e[`inputIcon--p-${iconPosition}`]
106763
+ styles$e[`inputIcon--p-${iconPosition}`],
106764
+ className ? className : ""
106704
106765
  )
106705
106766
  }, /* @__PURE__ */ React__default.createElement(Icon, {
106706
106767
  icon: icon2,
@@ -106797,8 +106858,26 @@ const SelectedBookingProvider = ({ children }) => {
106797
106858
  value: { selectedBooking, setSelectedBooking }
106798
106859
  }, children);
106799
106860
  };
106861
+ const debounce = (func, delay) => {
106862
+ let timeoutId;
106863
+ return (...args) => {
106864
+ clearTimeout(timeoutId);
106865
+ timeoutId = setTimeout(() => func(...args), delay);
106866
+ };
106867
+ };
106868
+ const ShowSidebarContext = createContext(false);
106869
+ const useShowSidebarContext = () => {
106870
+ return useContext(ShowSidebarContext);
106871
+ };
106872
+ const ShowSidebarProvider = ({ children }) => {
106873
+ const [showSidebar, setShowSidebar] = useState(false);
106874
+ return /* @__PURE__ */ React__default.createElement(ShowSidebarContext.Provider, {
106875
+ value: { showSidebar, setShowSidebar }
106876
+ }, children);
106877
+ };
106800
106878
  const index$c = ({ filters: filters2, setFilters }) => {
106801
106879
  const { t: t2 } = useTranslation();
106880
+ const { showSidebar, setShowSidebar } = useShowSidebarContext();
106802
106881
  const { selectedBooking, setSelectedBooking } = useSelectedBookingContext();
106803
106882
  const [datePickerOpen, setDatePickerOpen] = useState(false);
106804
106883
  const datePickerRef = useRef(null);
@@ -106854,14 +106933,25 @@ const index$c = ({ filters: filters2, setFilters }) => {
106854
106933
  setValue2("fromDate", dateString);
106855
106934
  setDatePickerOpen(false);
106856
106935
  };
106936
+ const debouncedCriteriaUpdate = useCallback(
106937
+ debounce((criteriaValue) => {
106938
+ setFilters((prevFilters) => ({
106939
+ ...prevFilters,
106940
+ criteria: criteriaValue
106941
+ }));
106942
+ }, 500),
106943
+ [setFilters]
106944
+ );
106857
106945
  useEffect(() => {
106858
- setFilters({
106859
- ...filters2,
106860
- criteria,
106861
- commingUp,
106862
- fromDate
106863
- });
106864
- }, [criteria, fromDate, commingUp]);
106946
+ setFilters((prevFilters) => ({
106947
+ ...prevFilters,
106948
+ fromDate,
106949
+ commingUp
106950
+ }));
106951
+ }, [fromDate, commingUp, setFilters]);
106952
+ useEffect(() => {
106953
+ debouncedCriteriaUpdate(criteria);
106954
+ }, [criteria, debouncedCriteriaUpdate]);
106865
106955
  useEffect(() => {
106866
106956
  function handleDocumentClick(event) {
106867
106957
  var _a2, _b;
@@ -106876,6 +106966,8 @@ const index$c = ({ filters: filters2, setFilters }) => {
106876
106966
  }, []);
106877
106967
  return /* @__PURE__ */ React__default.createElement("div", {
106878
106968
  className: styles$l.headerContainer
106969
+ }, /* @__PURE__ */ React__default.createElement("div", {
106970
+ className: styles$l.searchContainer
106879
106971
  }, /* @__PURE__ */ React__default.createElement(TextInputField, {
106880
106972
  control,
106881
106973
  id: "criteria",
@@ -106891,16 +106983,19 @@ const index$c = ({ filters: filters2, setFilters }) => {
106891
106983
  borderLess: true,
106892
106984
  rounded: true,
106893
106985
  customStyles: { backgroundColor: "#2F3349" }
106894
- }), /* @__PURE__ */ React__default.createElement("div", {
106986
+ })), /* @__PURE__ */ React__default.createElement("div", {
106895
106987
  className: styles$l.buttonList
106896
106988
  }, /* @__PURE__ */ React__default.createElement(Button, {
106897
106989
  mode: "tertiary",
106990
+ className: styles$l.buttonItem,
106898
106991
  onClick: () => selectDate("commingUp")
106899
106992
  }, t2("COMMINGUP")), /* @__PURE__ */ React__default.createElement(Button, {
106900
106993
  mode: "tertiary",
106994
+ className: styles$l.buttonItem,
106901
106995
  onClick: () => selectDate("today")
106902
106996
  }, t2("TODAY")), /* @__PURE__ */ React__default.createElement(Button, {
106903
106997
  mode: "tertiary",
106998
+ className: styles$l.buttonItem,
106904
106999
  onClick: () => selectDate("tomorrow")
106905
107000
  }, t2("TOMORROW")), /* @__PURE__ */ React__default.createElement("div", {
106906
107001
  style: { display: "flex", flexDirection: "column", justifyContent: "center" }
@@ -106911,6 +107006,7 @@ const index$c = ({ filters: filters2, setFilters }) => {
106911
107006
  ref: datePickerRef,
106912
107007
  onChange: onChange3,
106913
107008
  open: datePickerOpen,
107009
+ showToday: false,
106914
107010
  style: {
106915
107011
  marginTop: "30px",
106916
107012
  width: 0,
@@ -106918,10 +107014,34 @@ const index$c = ({ filters: filters2, setFilters }) => {
106918
107014
  opacity: 0,
106919
107015
  position: "absolute",
106920
107016
  pointerEvents: "none"
106921
- }
107017
+ },
107018
+ renderExtraFooter: () => /* @__PURE__ */ React__default.createElement("div", {
107019
+ className: "ant-custom-footer"
107020
+ }, /* @__PURE__ */ React__default.createElement("button", {
107021
+ className: "ant-button",
107022
+ onClick: () => {
107023
+ selectDate("commingUp");
107024
+ setDatePickerOpen(false);
107025
+ }
107026
+ }, t2("COMMINGUP")), /* @__PURE__ */ React__default.createElement("button", {
107027
+ className: "ant-button",
107028
+ onClick: () => {
107029
+ selectDate("today");
107030
+ setDatePickerOpen(false);
107031
+ }
107032
+ }, t2("TODAY")), /* @__PURE__ */ React__default.createElement("button", {
107033
+ className: "ant-button",
107034
+ onClick: () => {
107035
+ selectDate("tomorrow");
107036
+ setDatePickerOpen(false);
107037
+ }
107038
+ }, t2("TOMORROW")))
106922
107039
  })), /* @__PURE__ */ React__default.createElement(Button, {
106923
107040
  mode: "success",
106924
- onClick: () => setSelectedBooking(null)
107041
+ onClick: () => {
107042
+ setSelectedBooking(null);
107043
+ setShowSidebar(true);
107044
+ }
106925
107045
  }, t2("ADDRESERVATION"))));
106926
107046
  };
106927
107047
  const injectStyles = () => {
@@ -107005,6 +107125,24 @@ const injectStyles = () => {
107005
107125
  .ant-picker-today-btn:hover {
107006
107126
  background-color: #4C4F64 !important;
107007
107127
  }
107128
+
107129
+ .ant-custom-footer {
107130
+ display: flex;
107131
+ justify-content: space-around;
107132
+ padding: 8px;
107133
+ background: #2F3349;
107134
+ }
107135
+ .ant-custom-footer button {
107136
+ color: white;
107137
+ background: #4C4F64;
107138
+ border: none;
107139
+ padding: 6px 12px;
107140
+ border-radius: 4px;
107141
+ cursor: pointer;
107142
+ }
107143
+ .ant-custom-footer button:hover {
107144
+ background: #3A3D54;
107145
+ }
107008
107146
  `;
107009
107147
  document.head.appendChild(styleElement);
107010
107148
  };
@@ -107051,6 +107189,7 @@ const TableRow = ({ item: item2, filtersData, venueId }) => {
107051
107189
  var _a2, _b, _c, _d;
107052
107190
  const { t: t2 } = useTranslation();
107053
107191
  const { reload: reloadMainTable } = useReloadContext();
107192
+ const { showSidebar, setShowSidebar } = useShowSidebarContext();
107054
107193
  const { selectedBooking, setSelectedBooking } = useSelectedBookingContext();
107055
107194
  const { execute } = useService(UpdateBookingStatusBooking, {
107056
107195
  onSuccess: async () => {
@@ -107117,10 +107256,15 @@ const TableRow = ({ item: item2, filtersData, venueId }) => {
107117
107256
  className: styles$l.tableRowCard
107118
107257
  }, /* @__PURE__ */ React__default.createElement("div", {
107119
107258
  style: { display: "flex", cursor: "pointer" },
107120
- onClick: () => setSelectedBooking(item2)
107259
+ onClick: () => {
107260
+ setSelectedBooking(item2);
107261
+ setShowSidebar(true);
107262
+ }
107121
107263
  }, /* @__PURE__ */ React__default.createElement("div", {
107122
107264
  className: styles$l.tableRowHour
107123
- }, /* @__PURE__ */ React__default.createElement("h2", null, /* @__PURE__ */ React__default.createElement(TimeFormat, {
107265
+ }, /* @__PURE__ */ React__default.createElement("h2", {
107266
+ className: styles$l.tableRowHourText
107267
+ }, /* @__PURE__ */ React__default.createElement(TimeFormat, {
107124
107268
  currentTimeZone: filtersData == null ? void 0 : filtersData.timeZone,
107125
107269
  dateTime: item2 == null ? void 0 : item2.date
107126
107270
  }))), /* @__PURE__ */ React__default.createElement("div", {
@@ -107193,7 +107337,11 @@ const TableBody = ({ data: data2, filtersData, venueId }) => {
107193
107337
  key: key2
107194
107338
  }, /* @__PURE__ */ React__default.createElement("div", {
107195
107339
  className: styles$l.tableTopHeaderContent
107196
- }, /* @__PURE__ */ React__default.createElement("h2", null, key2), /* @__PURE__ */ React__default.createElement("h2", null, group.length, " ", t2("RESERVATIONS"))), /* @__PURE__ */ React__default.createElement("div", {
107340
+ }, /* @__PURE__ */ React__default.createElement("h2", {
107341
+ className: styles$l.tableTopHeaderContentText
107342
+ }, key2), /* @__PURE__ */ React__default.createElement("h2", {
107343
+ className: styles$l.tableTopHeaderContentText
107344
+ }, group.length, " ", t2("RESERVATIONS"))), /* @__PURE__ */ React__default.createElement("div", {
107197
107345
  className: styles$l.tableRowContainer
107198
107346
  }, group.map((item2) => {
107199
107347
  return /* @__PURE__ */ React__default.createElement(TableRow, {
@@ -107536,8 +107684,21 @@ const BookingInfo = ({ item: item2 }) => {
107536
107684
  };
107537
107685
  const Header = () => {
107538
107686
  const { t: t2 } = useTranslation();
107687
+ const { showSidebar, setShowSidebar } = useShowSidebarContext();
107539
107688
  const { selectedBooking } = useSelectedBookingContext();
107540
- return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("h3", null, t2(selectedBooking ? "UPDATERESERVATION" : "ADDRESERVATION")), /* @__PURE__ */ React__default.createElement("hr", {
107689
+ return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
107690
+ style: { display: "flex", justifyContent: "space-between", alignItems: "center" }
107691
+ }, /* @__PURE__ */ React__default.createElement("h3", null, t2(selectedBooking ? "UPDATERESERVATION" : "ADDRESERVATION")), /* @__PURE__ */ React__default.createElement(Icon, {
107692
+ className: classNames$2(
107693
+ styles$l["sidebarCloseIcon"],
107694
+ showSidebar ? styles$l["sidebarCloseIcon--show"] : ""
107695
+ ),
107696
+ icon: "close",
107697
+ size: "small",
107698
+ onClick: () => {
107699
+ setShowSidebar(!showSidebar);
107700
+ }
107701
+ })), /* @__PURE__ */ React__default.createElement("hr", {
107541
107702
  style: { width: "100%", marginTop: 15 }
107542
107703
  }));
107543
107704
  };
@@ -107567,7 +107728,7 @@ const index$a = ({ filtersData, venueId }) => {
107567
107728
  const bookingSchema = () => create$1().shape({
107568
107729
  source: create$4().test(
107569
107730
  "is-valid-partySize",
107570
- "Party Size is required",
107731
+ "Source is required",
107571
107732
  (value2) => value2 !== null && typeof value2 === "object" && !!value2.value
107572
107733
  ).required(),
107573
107734
  date: create$2().required(),
@@ -107629,7 +107790,10 @@ const index$a = ({ filtersData, venueId }) => {
107629
107790
  {
107630
107791
  cacheId: "reservation0dashboard0table0availability",
107631
107792
  venue_id: venueId,
107632
- 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
+ } : {}
107633
107797
  }
107634
107798
  );
107635
107799
  const { execute: executeCreate, data: responBookingCreate, isExecuting: loadingCreate } = useService(AddBooking);
@@ -107885,6 +108049,7 @@ const index$a = ({ filtersData, venueId }) => {
107885
108049
  };
107886
108050
  function MainComponent({ venueId }) {
107887
108051
  const [currentVenue, setCurrentVenue] = useState(null);
108052
+ const { showSidebar, setShowSidebar } = useShowSidebarContext();
107888
108053
  const [filters2, setFilters] = useState({
107889
108054
  fromDate: hooks().format("YYYY-MM-DD")
107890
108055
  });
@@ -107930,6 +108095,20 @@ function MainComponent({ venueId }) {
107930
108095
  reloadSelectsData();
107931
108096
  }
107932
108097
  }, [selectedBooking]);
108098
+ useEffect(() => {
108099
+ function handleOutsideClick(event) {
108100
+ const sidebarElement = document.querySelector(`.${styles$l.mainSidebarContainer}`);
108101
+ if (sidebarElement && !sidebarElement.contains(event.target)) {
108102
+ setShowSidebar(false);
108103
+ }
108104
+ }
108105
+ if (showSidebar) {
108106
+ document.addEventListener("mousedown", handleOutsideClick);
108107
+ }
108108
+ return () => {
108109
+ document.removeEventListener("mousedown", handleOutsideClick);
108110
+ };
108111
+ }, [showSidebar, setShowSidebar]);
107933
108112
  return /* @__PURE__ */ React__default.createElement(ReloadProvider, {
107934
108113
  reload
107935
108114
  }, /* @__PURE__ */ React__default.createElement("div", {
@@ -107945,36 +108124,39 @@ function MainComponent({ venueId }) {
107945
108124
  filtersData,
107946
108125
  venueId
107947
108126
  })), /* @__PURE__ */ React__default.createElement("div", {
107948
- className: styles$l.mainSidebarContainer
108127
+ className: classNames$2(
108128
+ styles$l.mainSidebarContainer,
108129
+ showSidebar ? styles$l[`mainSidebarContainer--open`] : "styles[`mainSidebarContainer--close`]"
108130
+ )
107949
108131
  }, /* @__PURE__ */ React__default.createElement(index$a, {
107950
108132
  filtersData,
107951
108133
  venueId
107952
108134
  }))));
107953
108135
  }
107954
108136
  function Main$2({ venueId }) {
107955
- return /* @__PURE__ */ React__default.createElement(SelectedBookingProvider, null, /* @__PURE__ */ React__default.createElement(MainComponent, {
108137
+ return /* @__PURE__ */ React__default.createElement(SelectedBookingProvider, null, /* @__PURE__ */ React__default.createElement(ShowSidebarProvider, null, /* @__PURE__ */ React__default.createElement(MainComponent, {
107956
108138
  venueId
107957
- }));
108139
+ })));
107958
108140
  }
107959
- const mainConatiner$1 = "_mainConatiner_13dsr_70";
107960
- const header$3 = "_header_13dsr_81";
107961
- const content$1 = "_content_13dsr_87";
107962
- const textSecondary$1 = "_textSecondary_13dsr_96";
107963
- const sectionCard$1 = "_sectionCard_13dsr_100";
107964
- const cardHeader$1 = "_cardHeader_13dsr_105";
107965
- const cardTitle$1 = "_cardTitle_13dsr_108";
107966
- const cardDesc$1 = "_cardDesc_13dsr_112";
107967
- const cardBody$1 = "_cardBody_13dsr_116";
107968
- const cardFooter$1 = "_cardFooter_13dsr_120";
107969
- const cardFooterContent$1 = "_cardFooterContent_13dsr_120";
107970
- const sectionManagement$1 = "_sectionManagement_13dsr_130";
107971
- const sectionFormRow$1 = "_sectionFormRow_13dsr_130";
107972
- const drawerContent$1 = "_drawerContent_13dsr_137";
107973
- const scrollableForm$1 = "_scrollableForm_13dsr_142";
107974
- const fixedActions$1 = "_fixedActions_13dsr_148";
108141
+ const mainConatiner$1 = "_mainConatiner_au98t_70";
108142
+ const header$3 = "_header_au98t_81";
108143
+ const content$1 = "_content_au98t_87";
108144
+ const textSecondary$1 = "_textSecondary_au98t_96";
108145
+ const sectionCard$1 = "_sectionCard_au98t_100";
108146
+ const cardHeader$1 = "_cardHeader_au98t_105";
108147
+ const cardTitle$1 = "_cardTitle_au98t_108";
108148
+ const cardDesc$1 = "_cardDesc_au98t_112";
108149
+ const cardBody$1 = "_cardBody_au98t_116";
108150
+ const cardFooter$1 = "_cardFooter_au98t_120";
108151
+ const cardFooterContent$1 = "_cardFooterContent_au98t_120";
108152
+ const sectionManagement$1 = "_sectionManagement_au98t_130";
108153
+ const sectionFormRow$1 = "_sectionFormRow_au98t_130";
108154
+ const drawerContent$1 = "_drawerContent_au98t_137";
108155
+ const scrollableForm$1 = "_scrollableForm_au98t_142";
108156
+ const fixedActions$1 = "_fixedActions_au98t_148";
107975
108157
  var styles$a = {
107976
- "my-masonry-grid": "_my-masonry-grid_13dsr_48",
107977
- "my-masonry-grid_column": "_my-masonry-grid_column_13dsr_59",
108158
+ "my-masonry-grid": "_my-masonry-grid_au98t_48",
108159
+ "my-masonry-grid_column": "_my-masonry-grid_column_au98t_59",
107978
108160
  mainConatiner: mainConatiner$1,
107979
108161
  header: header$3,
107980
108162
  content: content$1,
@@ -108026,44 +108208,6 @@ const AreaManagementCard$1 = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) =>
108026
108208
  }
108027
108209
  }, "more")));
108028
108210
  };
108029
- const GetAreaManagement = async ({
108030
- venue_id
108031
- }) => {
108032
- if (!venue_id)
108033
- return;
108034
- const responseData = await instance$1.get(
108035
- `/v1/rms/venues/${venue_id}/areas`
108036
- );
108037
- const responseVenueData = await instance$1.get(`/v1/rms/venues/${venue_id}`);
108038
- const data2 = {
108039
- areas: formatData$1(responseData.data),
108040
- ...formatVenueData(responseVenueData)
108041
- };
108042
- return data2;
108043
- };
108044
- const GetAreasList = async ({
108045
- venue_id
108046
- }) => {
108047
- if (!venue_id)
108048
- return;
108049
- const responseData = await instance$1.get(
108050
- `/v1/rms/venues/${venue_id}/areas`
108051
- );
108052
- return formatData$1(responseData.data);
108053
- };
108054
- const formatData$1 = (data2) => {
108055
- return data2.map((item2) => {
108056
- var _a2;
108057
- return {
108058
- id: item2.id,
108059
- name: item2.name,
108060
- description: (_a2 = item2.description) != null ? _a2 : ""
108061
- };
108062
- });
108063
- };
108064
- const formatVenueData = (data2) => {
108065
- return { bookableAreas: data2.bookableAreas };
108066
- };
108067
108211
  const drawer = "_drawer_1h00k_1";
108068
108212
  const drawer__overlay = "_drawer__overlay_1h00k_18";
108069
108213
  const drawer__content = "_drawer__content_1h00k_34";
@@ -108339,8 +108483,10 @@ const AreaEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =>
108339
108483
  type: "button",
108340
108484
  onClick: () => append2({ name: "", description: "" })
108341
108485
  }, t2("NEW_AREA")), isDirty && /* @__PURE__ */ React__default.createElement(Button, {
108486
+ isLoading: loadingDelete || loadingCreate || loadingUpdate,
108487
+ disabled: loadingDelete || loadingCreate || loadingUpdate,
108342
108488
  mode: "success",
108343
- icon: "check",
108489
+ icon: loadingDelete || loadingCreate || loadingUpdate ? "Spinner" : "check",
108344
108490
  iconPosition: "right",
108345
108491
  type: "button",
108346
108492
  onClick: () => onSubmit()
@@ -108366,21 +108512,20 @@ const fieldChanged$3 = (currentValue, initialData) => {
108366
108512
  }
108367
108513
  return false;
108368
108514
  };
108369
- const index$9 = ({ venueId }) => {
108515
+ const index$9 = ({ venueId, reloadAreas, areas }) => {
108370
108516
  const [isOpenDrawer, setIsOpenDrawer] = useState(false);
108371
- const { data: data2, isLoading, error: error3, reload } = useFetch(GetAreaManagement, { cacheId: "area0management", venue_id: venueId });
108372
108517
  return /* @__PURE__ */ React__default.createElement("div", {
108373
108518
  className: styles$a.sectionManagement
108374
108519
  }, /* @__PURE__ */ React__default.createElement(AreaManagementCard$1, {
108375
108520
  isOpenDrawer,
108376
108521
  setIsOpenDrawer,
108377
- data: data2
108522
+ data: areas
108378
108523
  }), /* @__PURE__ */ React__default.createElement(AreaEditDrawer, {
108379
- data: data2,
108524
+ data: areas,
108380
108525
  isOpen: isOpenDrawer,
108381
108526
  setIsOpen: setIsOpenDrawer,
108382
108527
  venueId,
108383
- reload
108528
+ reload: reloadAreas
108384
108529
  }));
108385
108530
  };
108386
108531
  const AreaManagementCard = ({ isOpenDrawer, setIsOpenDrawer, data: data2 }) => {
@@ -108558,6 +108703,7 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108558
108703
  const [formattedAreaList, setFormattedAreaList] = useState([]);
108559
108704
  const [showConfirmationModal, setShowConfirmationModal] = useState(false);
108560
108705
  const [selectedTable, setSelectedTable] = useState(null);
108706
+ const scrollableRef = useRef(null);
108561
108707
  const { isExecuting: loadingCreate, execute: executeCreator } = useService(CreateResbook, {});
108562
108708
  const { isExecuting: loadingUpdate, execute: executeUpdater } = useService(UpdateResbook, {});
108563
108709
  const { isExecuting: loadingDelete, execute: executeDeleter } = useService(DeleteResbook, {
@@ -108633,9 +108779,21 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108633
108779
  remove(index2);
108634
108780
  }
108635
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
+ };
108636
108794
  useEffect(() => {
108637
- if (areasList) {
108638
- 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 })));
108639
108797
  }
108640
108798
  }, [areasList]);
108641
108799
  useEffect(() => {
@@ -108675,7 +108833,8 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108675
108833
  }, /* @__PURE__ */ React__default.createElement("div", {
108676
108834
  className: styles$a.drawerContent
108677
108835
  }, /* @__PURE__ */ React__default.createElement("div", {
108678
- className: styles$a.scrollableForm
108836
+ className: styles$a.scrollableForm,
108837
+ ref: scrollableRef
108679
108838
  }, fields.map((item2, index2) => /* @__PURE__ */ React__default.createElement("div", {
108680
108839
  key: item2.id,
108681
108840
  className: styles$a.sectionFormRow
@@ -108723,7 +108882,7 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108723
108882
  id: `tables.${index2}.area`,
108724
108883
  name: `tables.${index2}.area`,
108725
108884
  label: "Area",
108726
- 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 })) : []
108727
108886
  }))))), /* @__PURE__ */ React__default.createElement("div", {
108728
108887
  className: styles$a.fixedActions
108729
108888
  }, /* @__PURE__ */ React__default.createElement(Button, {
@@ -108731,10 +108890,12 @@ const TableEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, areasList, r
108731
108890
  icon: "plus",
108732
108891
  iconPosition: "right",
108733
108892
  type: "button",
108734
- onClick: () => append2({ name: "", description: "" })
108893
+ onClick: handleAddNewTable
108735
108894
  }, t2("NEW_TABLE")), isDirty && /* @__PURE__ */ React__default.createElement(Button, {
108895
+ isLoading: loadingDelete || loadingCreate || loadingUpdate,
108896
+ disabled: loadingDelete || loadingCreate || loadingUpdate,
108736
108897
  mode: "success",
108737
- icon: "check",
108898
+ icon: loadingDelete || loadingCreate || loadingUpdate ? "Spinner" : "check",
108738
108899
  iconPosition: "right",
108739
108900
  type: "button",
108740
108901
  onClick: () => onSubmit()
@@ -108761,10 +108922,9 @@ const fieldChanged$2 = (currentValue, initialData) => {
108761
108922
  }
108762
108923
  return false;
108763
108924
  };
108764
- const index$8 = ({ venueId }) => {
108925
+ const index$8 = ({ venueId, areas }) => {
108765
108926
  const [isOpenDrawer, setIsOpenDrawer] = useState(false);
108766
108927
  const { data: data2, isLoading, error: error3, reload } = useFetch(GetTableManagement, { cacheId: "table0management", venue_id: venueId });
108767
- const { data: areasList, isLoading: isLoadingAreas, error: errorAreasList, reload: reloadAreasList } = useFetch(GetAreasList, { cacheId: "areas0list", venue_id: venueId });
108768
108928
  return /* @__PURE__ */ React__default.createElement("div", {
108769
108929
  className: styles$a.sectionManagement
108770
108930
  }, /* @__PURE__ */ React__default.createElement(AreaManagementCard, {
@@ -108773,7 +108933,7 @@ const index$8 = ({ venueId }) => {
108773
108933
  data: data2
108774
108934
  }), /* @__PURE__ */ React__default.createElement(TableEditDrawer, {
108775
108935
  data: data2,
108776
- areasList,
108936
+ areasList: areas,
108777
108937
  isOpen: isOpenDrawer,
108778
108938
  setIsOpen: setIsOpenDrawer,
108779
108939
  venueId,
@@ -108905,8 +109065,8 @@ const ReservationDurationEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2
108905
109065
  return /* @__PURE__ */ React__default.createElement(Drawer, {
108906
109066
  isOpen,
108907
109067
  onClose: () => setIsOpen(false),
108908
- title: t2("TABLE_MANAGEMENT"),
108909
- titleDesc: t2("TABLE_MANAGEMENT_DESC")
109068
+ title: t2("RESERVATION_DURATION"),
109069
+ titleDesc: t2("RESERVATION_DURATION_DESC")
108910
109070
  }, /* @__PURE__ */ React__default.createElement("div", {
108911
109071
  className: styles$a.drawerContent
108912
109072
  }, /* @__PURE__ */ React__default.createElement("div", {
@@ -108937,8 +109097,10 @@ const ReservationDurationEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2
108937
109097
  }))))), /* @__PURE__ */ React__default.createElement("div", {
108938
109098
  className: styles$a.fixedActions
108939
109099
  }, isDirty && /* @__PURE__ */ React__default.createElement(Button, {
109100
+ isLoading: loadingUpdate,
109101
+ disabled: loadingUpdate,
108940
109102
  mode: "success",
108941
- icon: "check",
109103
+ icon: loadingUpdate ? "Spinner" : "check",
108942
109104
  iconPosition: "right",
108943
109105
  type: "button",
108944
109106
  onClick: () => onSubmit()
@@ -109075,6 +109237,7 @@ const SpecialDatesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reloa
109075
109237
  const [initialData, setInitialData] = useState(null);
109076
109238
  const [showConfirmationModal, setShowConfirmationModal] = useState(false);
109077
109239
  const [selectedDate, setSelectedDate] = useState(null);
109240
+ const scrollableRef = useRef(null);
109078
109241
  const { isExecuting: loadingUpdate, execute: executeUpdater } = useService(UpdateResbook, {});
109079
109242
  const { isExecuting: loadingDelete, execute: executeDeleter } = useService(DeleteResbook, {
109080
109243
  onSuccess: () => {
@@ -109156,6 +109319,14 @@ const SpecialDatesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reloa
109156
109319
  remove(index2);
109157
109320
  }
109158
109321
  };
109322
+ const scrollToBottom = () => {
109323
+ if (scrollableRef.current) {
109324
+ scrollableRef.current.scrollTo({
109325
+ top: scrollableRef.current.scrollHeight,
109326
+ behavior: "smooth"
109327
+ });
109328
+ }
109329
+ };
109159
109330
  useEffect(() => {
109160
109331
  if (data2) {
109161
109332
  const formatedData = data2.map((item2) => {
@@ -109182,7 +109353,8 @@ const SpecialDatesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reloa
109182
109353
  }, /* @__PURE__ */ React__default.createElement("div", {
109183
109354
  className: styles$a.drawerContent
109184
109355
  }, /* @__PURE__ */ React__default.createElement("div", {
109185
- className: styles$a.scrollableForm
109356
+ className: styles$a.scrollableForm,
109357
+ ref: scrollableRef
109186
109358
  }, fields.map((item2, index2) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, {
109187
109359
  key: item2.id
109188
109360
  }, /* @__PURE__ */ React__default.createElement("div", {
@@ -109238,10 +109410,15 @@ const SpecialDatesEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reloa
109238
109410
  icon: "plus",
109239
109411
  iconPosition: "right",
109240
109412
  type: "button",
109241
- onClick: () => append2({ closed: false, startDate: "", endDate: "" })
109413
+ onClick: () => {
109414
+ append2({ closed: false, startDate: "", endDate: "" });
109415
+ setTimeout(scrollToBottom, 0);
109416
+ }
109242
109417
  }, t2("ADD_SPECIAL_DATE")), isDirty && /* @__PURE__ */ React__default.createElement(Button, {
109418
+ isLoading: loadingDelete || loadingUpdate,
109419
+ disabled: loadingDelete || loadingUpdate,
109243
109420
  mode: "success",
109244
- icon: "check",
109421
+ icon: loadingDelete || loadingUpdate ? "Spinner" : "check",
109245
109422
  iconPosition: "right",
109246
109423
  type: "button",
109247
109424
  onClick: () => onSubmit()
@@ -109476,9 +109653,10 @@ const ShiftsEditDrawer = ({ isOpen, setIsOpen, venueId, data: data2, reload }) =
109476
109653
  })), /* @__PURE__ */ React__default.createElement("div", {
109477
109654
  className: styles$a.fixedActions
109478
109655
  }, isDirty && /* @__PURE__ */ React__default.createElement(Button, {
109656
+ isLoading: loadingUpdate,
109657
+ disabled: loadingUpdate,
109479
109658
  mode: "success",
109480
- icon: "check",
109481
- iconPosition: "right",
109659
+ icon: loadingUpdate ? "Spinner" : "check",
109482
109660
  type: "button",
109483
109661
  onClick: () => onSubmit()
109484
109662
  }, t2("SAVE")))));
@@ -109628,8 +109806,10 @@ const ReservationPreferencesEditDrawer = ({ isOpen, setIsOpen, venueId, data: da
109628
109806
  }))), /* @__PURE__ */ React__default.createElement("div", {
109629
109807
  style: { display: "flex", justifyContent: "flex-end", gap: 10, marginTop: 30 }
109630
109808
  }, isDirty && /* @__PURE__ */ React__default.createElement(Button, {
109809
+ isLoading: isExecuting,
109810
+ disabled: isExecuting,
109631
109811
  mode: "success",
109632
- icon: "check",
109812
+ icon: isExecuting ? "Spinner" : "check",
109633
109813
  iconPosition: "right",
109634
109814
  type: "button",
109635
109815
  onClick: () => onSubmit()
@@ -109652,9 +109832,38 @@ const index$4 = ({ venueId }) => {
109652
109832
  reload
109653
109833
  }));
109654
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
+ };
109655
109863
  function Main$1({ venueId }) {
109656
109864
  const { t: t2 } = useTranslation();
109657
109865
  const [currentVenue, setCurrentVenue] = useState(null);
109866
+ const { data: data2, isLoading, error: error3, reload } = useFetch(GetAreaManagement, { cacheId: "area0management", venue_id: currentVenue });
109658
109867
  useEffect(() => {
109659
109868
  setCurrentVenue(venueId);
109660
109869
  }, [venueId]);
@@ -109665,8 +109874,11 @@ function Main$1({ venueId }) {
109665
109874
  }, /* @__PURE__ */ React__default.createElement("h2", null, t2("RESTAURANTSETUP"))), /* @__PURE__ */ React__default.createElement("div", {
109666
109875
  className: styles$a.content
109667
109876
  }, /* @__PURE__ */ React__default.createElement(index$9, {
109877
+ areas: data2,
109878
+ reloadAreas: reload,
109668
109879
  venueId: currentVenue
109669
109880
  }), /* @__PURE__ */ React__default.createElement(index$8, {
109881
+ areas: data2,
109670
109882
  venueId: currentVenue
109671
109883
  }), /* @__PURE__ */ React__default.createElement(index$7, {
109672
109884
  venueId: currentVenue