mozrest-sdk-react-dev 0.2.21 → 0.2.22

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.
Files changed (2) hide show
  1. package/mozrest-sdk.es.js +60 -4
  2. package/package.json +1 -1
package/mozrest-sdk.es.js CHANGED
@@ -6358,6 +6358,9 @@ const NoAvailabilityForPartySize = "Sorry we have not availability for this part
6358
6358
  const ADDANEMAIL = "Add an email";
6359
6359
  const SUGGESTREPLY = "Suggest reply";
6360
6360
  const SHOWTEMPLATES = "Show templates";
6361
+ const NOSHOWRESERVATION = "No show reservation";
6362
+ const AREYOUSURENOSHOWRESERVATION = "Are you sure you want to change this reservation to no-show status?";
6363
+ const NOSHOW = "No show";
6361
6364
  var en = {
6362
6365
  errors,
6363
6366
  SPECIALCLOSINGDATES,
@@ -6674,7 +6677,10 @@ var en = {
6674
6677
  ADDANEMAIL,
6675
6678
  "Provide at lease one email": "Provide at lease one email",
6676
6679
  SUGGESTREPLY,
6677
- SHOWTEMPLATES
6680
+ SHOWTEMPLATES,
6681
+ NOSHOWRESERVATION,
6682
+ AREYOUSURENOSHOWRESERVATION,
6683
+ NOSHOW
6678
6684
  };
6679
6685
  instance.use(initReactI18next).init({
6680
6686
  resources: {
@@ -99898,6 +99904,10 @@ const CancelBooking = async ({ venueId, bookingId, data: data2 }) => {
99898
99904
  await instance$1.put(`/resbook/venue/${venueId}/bookings/${bookingId}/cancel`, data2);
99899
99905
  return { data: "canceled" };
99900
99906
  };
99907
+ const NoShowBooking = async ({ venueId, bookingId }) => {
99908
+ await instance$1.put(`/resbook/venue/${venueId}/bookings/${bookingId}`, { status: "no-show" });
99909
+ return { data: "no show ok" };
99910
+ };
99901
99911
  const TableSelectForm = ({ table: table2, id: id2, tableOptions, initialValues, isEdit, setIsEdit, reloadMainTable, onClose: onClose2, venueId }) => {
99902
99912
  const emptyVal = {
99903
99913
  table: { id: null, label: "Not selected" }
@@ -99962,12 +99972,34 @@ const CancelReservationModal = ({ onAccept, isLoading, message: message2, title:
99962
99972
  isLoading
99963
99973
  }, t2("ACCEPT")))))));
99964
99974
  };
99975
+ const NoShowReservationModal = ({ onAccept, isLoading, message: message2, title: title2, ...props }) => {
99976
+ const { t: t2 } = useTranslation();
99977
+ return /* @__PURE__ */ React__default.createElement(Modal2, {
99978
+ ...props,
99979
+ title: t2("NOSHOWRESERVATION")
99980
+ }, /* @__PURE__ */ React__default.createElement("h5", null, t2("AREYOUSURENOSHOWRESERVATION")), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
99981
+ style: { display: "flex", justifyContent: "center", gap: 20, marginTop: 20 }
99982
+ }, /* @__PURE__ */ React__default.createElement(Button$3, {
99983
+ size: "small",
99984
+ mode: "tertiary",
99985
+ onClick: props.onClose,
99986
+ disabled: isLoading
99987
+ }, t2("CANCEL")), /* @__PURE__ */ React__default.createElement(Button$3, {
99988
+ size: "small",
99989
+ type: "submit",
99990
+ onClick: () => onAccept(),
99991
+ isLoading
99992
+ }, t2("ACCEPT")))));
99993
+ };
99965
99994
  const ReservationDetail = ({ open, onClose: onClose2, venueId, reloadMainTable, selectedRow, currentTimeZone, setSelectedRow }) => {
99966
99995
  var _a2, _b, _c, _d, _e2, _f, _g;
99967
99996
  const { t: t2 } = useTranslation();
99968
99997
  const [openCancelReservationModal, setOpenCancelReservationModal] = useState(false);
99969
99998
  const onOpenCancelRevModal = () => setOpenCancelReservationModal(true);
99970
99999
  const onCloseCancelRevModal = () => setOpenCancelReservationModal(false);
100000
+ const [openNoShowReservationModal, setOpenNoShowReservationModal] = useState(false);
100001
+ const onOpenNoShowRevModal = () => setOpenNoShowReservationModal(true);
100002
+ const onCloseNoShowRevModal = () => setOpenNoShowReservationModal(false);
99971
100003
  const [isEdit, setIsEdit] = useState(false);
99972
100004
  const [initialValues, setInitialValues] = useState(null);
99973
100005
  const { data: data2 } = useFetch(GetTableAvailability, {
@@ -99985,6 +100017,13 @@ const ReservationDetail = ({ open, onClose: onClose2, venueId, reloadMainTable,
99985
100017
  reloadMainTable();
99986
100018
  }
99987
100019
  });
100020
+ const { isExecuting: isExecutingNoShow, execute: executoNoShow } = useService(NoShowBooking, {
100021
+ onSuccess: async () => {
100022
+ setSelectedRow({ ...selectedRow, status: "no-show" });
100023
+ onCloseNoShowRevModal();
100024
+ reloadMainTable();
100025
+ }
100026
+ });
99988
100027
  const cancelReservation = async (values) => {
99989
100028
  const toSend = {
99990
100029
  cancelActor: values.cancelActor,
@@ -99992,6 +100031,9 @@ const ReservationDetail = ({ open, onClose: onClose2, venueId, reloadMainTable,
99992
100031
  };
99993
100032
  execute({ data: toSend, venueId, bookingId: selectedRow.id });
99994
100033
  };
100034
+ const noShowReservation = async () => {
100035
+ executoNoShow({ venueId, bookingId: selectedRow.id });
100036
+ };
99995
100037
  useEffect(() => {
99996
100038
  if (selectedRow && selectedRow.table && open) {
99997
100039
  setInitialValues({ id: selectedRow.table.id, label: selectedRow.table.name });
@@ -100072,18 +100114,32 @@ const ReservationDetail = ({ open, onClose: onClose2, venueId, reloadMainTable,
100072
100114
  reloadMainTable,
100073
100115
  onClose: onClose2,
100074
100116
  venueId
100075
- })), selectedRow && selectedRow.status && selectedRow.status !== "canceled" && /* @__PURE__ */ React__default.createElement(Button$3, {
100117
+ })), /* @__PURE__ */ React__default.createElement("div", {
100118
+ style: { display: "flex", justifyContent: "center", gap: 10 }
100119
+ }, selectedRow && selectedRow.status && selectedRow.status !== "canceled" && /* @__PURE__ */ React__default.createElement(Button$3, {
100076
100120
  style: { marginTop: 10 },
100077
100121
  type: "submit",
100078
100122
  className: styles$g.btnDanger,
100079
100123
  onClick: () => onOpenCancelRevModal()
100080
- }, t2("CANCELRESERVATION"))), selectedRow && selectedRow.status && selectedRow.status !== "canceled" && /* @__PURE__ */ React__default.createElement(CancelReservationModal, {
100124
+ }, t2("CANCEL")), selectedRow && selectedRow.status && selectedRow.status === "confirmed" && /* @__PURE__ */ React__default.createElement(Button$3, {
100125
+ style: { marginTop: 10 },
100126
+ type: "submit",
100127
+ className: styles$g.btnDanger,
100128
+ onClick: () => onOpenNoShowRevModal()
100129
+ }, t2("NOSHOW")))), selectedRow && selectedRow.status && selectedRow.status !== "canceled" && /* @__PURE__ */ React__default.createElement(CancelReservationModal, {
100081
100130
  width: 400,
100082
100131
  message: t2("AREYOUSURECANCELRESERVATION"),
100083
100132
  onAccept: cancelReservation,
100084
100133
  open: openCancelReservationModal,
100085
100134
  onClose: onCloseCancelRevModal,
100086
- isLoading: isExecuting
100135
+ isLoading: isExecuting || isExecutingNoShow
100136
+ }), selectedRow && selectedRow.status && selectedRow.status === "confirmed" && /* @__PURE__ */ React__default.createElement(NoShowReservationModal, {
100137
+ width: 400,
100138
+ message: t2("AREYOUSURENOSHOWRESERVATION"),
100139
+ onAccept: noShowReservation,
100140
+ open: openNoShowReservationModal,
100141
+ onClose: onCloseNoShowRevModal,
100142
+ isLoading: isExecutingNoShow || isExecuting
100087
100143
  }));
100088
100144
  };
100089
100145
  const timeSlot = "_timeSlot_1d7nu_1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mozrest-sdk-react-dev",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "main": "mozrest-sdk.es.js",
5
5
  "keywords": ["mozrest"],
6
6
  "author": {