@mseva/upyog-ui-module-ads 1.1.59 → 1.1.60

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.
@@ -1,4 +1,4 @@
1
- import { Modal, Card as Card$1, CheckBox, Header, SearchForm, SearchField, TextInput, Dropdown, MobileNumber, CardLabelError as CardLabelError$1, DatePicker, SubmitBar, Table, Loader as Loader$2, Toast, AppContainer, BackButton, PrivateRoute, CloseSvg, RadioButtons, Banner, CardText as CardText$1, ActionBar, KeyNote, DeleteIcon, CardSubHeader, FormStep, CardHeader as CardHeader$1, CardLabel, TelePhone, DisplayPhotos, LocationSearchCard as LocationSearchCard$1, CheckPoint, ConnectingCheckPoints, CardSectionHeader, TickMark, CardLabelDesc, TextArea, LabelFieldPair, UploadFile, StatusTable, Row, LinkButton, EmployeeModuleCard, PropertyHouse, Label, LinkLabel, Localities, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, MultiLink, FormComposer, Menu, CitizenHomeCard } from '@mseva/digit-ui-react-components';
1
+ import { Modal, Card as Card$1, CheckBox, Header, SearchForm, SearchField, TextInput, Dropdown, MobileNumber, CardLabelError as CardLabelError$1, DatePicker, SubmitBar, Table, Loader as Loader$2, Toast, AppContainer, BackButton, PrivateRoute, CloseSvg, RadioButtons, Banner, CardText as CardText$1, ActionBar, KeyNote, DeleteIcon, CardSubHeader, FormStep, CardHeader as CardHeader$1, CardLabel, TelePhone, DisplayPhotos, LocationSearchCard as LocationSearchCard$1, CheckPoint, ConnectingCheckPoints, TickMark, CardLabelDesc, TextArea, LabelFieldPair, UploadFile, StatusTable, Row, LinkButton, EmployeeModuleCard, PropertyHouse, Label, LinkLabel, Localities, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, MultiLink, FormComposer, Menu, CitizenHomeCard } from '@mseva/digit-ui-react-components';
2
2
  import React, { useState, useEffect, useMemo, useCallback, useRef, Fragment as Fragment$1 } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useHistory, Link, useParams, useRouteMatch, Switch, useLocation, Route, Redirect } from 'react-router-dom';
@@ -17043,7 +17043,7 @@ const ApplicationTimeline = ({
17043
17043
  };
17044
17044
 
17045
17045
  const ADSWFApplicationTimeline = props => {
17046
- var _props$application2, _props$application3, _props$application4, _data$timeline;
17046
+ var _props$application2, _props$application3, _props$application4;
17047
17047
  const {
17048
17048
  t
17049
17049
  } = useTranslation();
@@ -17056,12 +17056,7 @@ const ADSWFApplicationTimeline = props => {
17056
17056
  moduleCode: "advandhoarding-services"
17057
17057
  });
17058
17058
  if (isLoading) return /*#__PURE__*/React.createElement(Loader$2, null);
17059
- return /*#__PURE__*/React.createElement(React.Fragment, null, (data === null || data === void 0 ? void 0 : (_data$timeline = data.timeline) === null || _data$timeline === void 0 ? void 0 : _data$timeline.length) > 0 && /*#__PURE__*/React.createElement(CardSectionHeader, {
17060
- style: {
17061
- marginBottom: "16px",
17062
- marginTop: "32px"
17063
- }
17064
- }, t("CS_APPLICATION_DETAILS_APPLICATION_TIMELINE")), /*#__PURE__*/React.createElement(ApplicationTimeline, {
17059
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ApplicationTimeline, {
17065
17060
  workflowDetails: data,
17066
17061
  t: t
17067
17062
  }));
@@ -19769,7 +19764,8 @@ const ReservationTimer = ({
19769
19764
  const AdsApplication = ({
19770
19765
  application,
19771
19766
  tenantId,
19772
- buttonLabel
19767
+ buttonLabel,
19768
+ refetchBookings
19773
19769
  }) => {
19774
19770
  var _application$auditDet, _application$auditDet2, _application$applican;
19775
19771
  const {
@@ -19780,6 +19776,35 @@ const AdsApplication = ({
19780
19776
  const handleMakePayment = () => {
19781
19777
  history.push(`/digit-ui/citizen/payment/my-bills/adv-services/${application === null || application === void 0 ? void 0 : application.bookingNo}`);
19782
19778
  };
19779
+ const handleCancelBooking = async () => {
19780
+ const formData = {
19781
+ tenantId: application === null || application === void 0 ? void 0 : application.tenantId,
19782
+ ...application,
19783
+ workflow: {
19784
+ businessService: "advandhoarding",
19785
+ action: "CANCEL",
19786
+ comments: "User cancelled booking"
19787
+ }
19788
+ };
19789
+ try {
19790
+ var _response$ResponseInf;
19791
+ const response = await Digit.ADSServices.update({
19792
+ bookingApplication: formData
19793
+ }, application === null || application === void 0 ? void 0 : application.tenantId);
19794
+ if ((response === null || response === void 0 ? void 0 : (_response$ResponseInf = response.ResponseInfo) === null || _response$ResponseInf === void 0 ? void 0 : _response$ResponseInf.status) == "SUCCESSFUL" || (response === null || response === void 0 ? void 0 : response.status) == "SUCCESSFUL") {
19795
+ setShowToast({
19796
+ label: t((response === null || response === void 0 ? void 0 : response.resMsgId) || "ADS_CANCEL_SUCCESS"),
19797
+ error: false
19798
+ });
19799
+ refetchBookings();
19800
+ }
19801
+ } catch (err) {
19802
+ setShowToast({
19803
+ label: "ADS_CANCEL_FAILED",
19804
+ error: true
19805
+ });
19806
+ }
19807
+ };
19783
19808
  useEffect(() => {
19784
19809
  if (showToast) {
19785
19810
  const timer = setTimeout(() => {
@@ -19822,6 +19847,13 @@ const AdsApplication = ({
19822
19847
  margin: "20px"
19823
19848
  },
19824
19849
  disabled: expired
19850
+ }), application.bookingStatus === "BOOKED" && /*#__PURE__*/React.createElement(SubmitBar, {
19851
+ label: t("ADS_CANCEL_BOOKING"),
19852
+ onSubmit: handleCancelBooking,
19853
+ style: {
19854
+ margin: "20px"
19855
+ },
19856
+ disabled: expired
19825
19857
  })), showToast && /*#__PURE__*/React.createElement(Toast, {
19826
19858
  error: showToast.error,
19827
19859
  warning: showToast.warning,
@@ -19913,7 +19945,8 @@ const ADSMyApplications = () => {
19913
19945
  }, /*#__PURE__*/React.createElement(AdsApplication, {
19914
19946
  application: application,
19915
19947
  tenantId: tenantId,
19916
- buttonLabel: t("ADS_SUMMARY")
19948
+ buttonLabel: t("ADS_SUMMARY"),
19949
+ refetchBookings: refetch
19917
19950
  }))), !(applications !== null && applications !== void 0 && applications.length) > 0 && /*#__PURE__*/React.createElement("p", {
19918
19951
  style: {
19919
19952
  marginLeft: "16px",
@@ -23119,7 +23152,7 @@ const ApplicationDetails = () => {
23119
23152
  const appNo = (displayData === null || displayData === void 0 ? void 0 : (_displayData$applican3 = displayData.applicantData) === null || _displayData$applican3 === void 0 ? void 0 : _displayData$applican3.applicationNo) || id;
23120
23153
  return history.push(`/digit-ui/employee/payment/collect/adv-services/${appNo}/${tenantId}?tenantId=${tenantId}`);
23121
23154
  }
23122
- if (wfAction.action === "SUBMIT" || wfAction.action === "INITIATE") {
23155
+ if (wfAction.action === "SUBMIT" || wfAction.action === "INITIATE" || wfAction.action === "CANCEL") {
23123
23156
  const payloadAction = {
23124
23157
  action: wfAction.action,
23125
23158
  comment: wfAction.action || ""