@mseva/digit-ui-module-rentandlease 1.0.18 → 1.0.20

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.
@@ -6138,7 +6138,6 @@ const capitalize = text => text.substr(0, 1).toUpperCase() + text.substr(1);
6138
6138
  const ulbCamel = ulb => ulb.toLowerCase().split(" ").map(capitalize).join(" ");
6139
6139
  const getAcknowledgementData = async (application, tenantInfo, t) => {
6140
6140
  var _application$OwnerInf, _application$addition, _application$addition2, _application$addition3, _application$addition4, _application$addition5, _application$addition6, _application$addition7, _application$addition8, _application$addition9, _application$Document, _application$addition0, _tenantInfo$city;
6141
- console.log("application in getAcknowledgement", application);
6142
6141
  const details = [];
6143
6142
  application === null || application === void 0 ? void 0 : (_application$OwnerInf = application.OwnerInfo) === null || _application$OwnerInf === void 0 ? void 0 : _application$OwnerInf.forEach((owner, index) => {
6144
6143
  var _owner$permanentAddre, _owner$permanentAddre2, _owner$correspondence, _owner$correspondence2;
@@ -6157,7 +6156,7 @@ const getAcknowledgementData = async (application, tenantInfo, t) => {
6157
6156
  title: t("Permanent Address"),
6158
6157
  value: `${(owner === null || owner === void 0 ? void 0 : (_owner$permanentAddre = owner.permanentAddress) === null || _owner$permanentAddre === void 0 ? void 0 : _owner$permanentAddre.addressId) || t("CS_NA")} , ${(owner === null || owner === void 0 ? void 0 : (_owner$permanentAddre2 = owner.permanentAddress) === null || _owner$permanentAddre2 === void 0 ? void 0 : _owner$permanentAddre2.pincode) || t("CS_NA")}`
6159
6158
  }, {
6160
- title: t("Corresspondence Address"),
6159
+ title: t("Correspondence Address"),
6161
6160
  value: `${(owner === null || owner === void 0 ? void 0 : (_owner$correspondence = owner.correspondenceAddress) === null || _owner$correspondence === void 0 ? void 0 : _owner$correspondence.addressId) || t("CS_NA")} , ${(owner === null || owner === void 0 ? void 0 : (_owner$correspondence2 = owner.correspondenceAddress) === null || _owner$correspondence2 === void 0 ? void 0 : _owner$correspondence2.pincode) || t("CS_NA")}`
6162
6161
  }]
6163
6162
  });
@@ -7397,7 +7396,7 @@ function NewApplicationTimeline({
7397
7396
  }, t("Action")), /*#__PURE__*/React.createElement("div", {
7398
7397
  className: "custom-status-text"
7399
7398
  }, t((item === null || item === void 0 ? void 0 : item.performedAction) || "CS_COMMON_NA")))), (item === null || item === void 0 ? void 0 : item.wfComment) && (item === null || item === void 0 ? void 0 : (_item$wfComment = item.wfComment) === null || _item$wfComment === void 0 ? void 0 : _item$wfComment.length) > 0 && (item === null || item === void 0 ? void 0 : (_item$wfComment2 = item.wfComment) === null || _item$wfComment2 === void 0 ? void 0 : _item$wfComment2.some(c => c === null || c === void 0 ? void 0 : c.trim())) && /*#__PURE__*/React.createElement("div", {
7400
- className: "custom-assignee-section"
7399
+ className: "custom-comments-section"
7401
7400
  }, /*#__PURE__*/React.createElement("div", {
7402
7401
  className: "custom-comment-text"
7403
7402
  }, /*#__PURE__*/React.createElement("h4", {
@@ -7405,13 +7404,13 @@ function NewApplicationTimeline({
7405
7404
  }, t("Officer Comments")), item === null || item === void 0 ? void 0 : (_item$wfComment3 = item.wfComment) === null || _item$wfComment3 === void 0 ? void 0 : _item$wfComment3.map((comment, idx) => /*#__PURE__*/React.createElement("p", {
7406
7405
  key: idx
7407
7406
  }, comment))), (item === null || item === void 0 ? void 0 : (_item$assignes = item.assignes) === null || _item$assignes === void 0 ? void 0 : _item$assignes.length) > 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
7408
- className: "custom-action-title"
7407
+ className: "custom-comments-title"
7409
7408
  }, t("Assigned To")), /*#__PURE__*/React.createElement("div", {
7410
7409
  className: "custom-officer-info"
7411
7410
  }, /*#__PURE__*/React.createElement("div", {
7412
7411
  className: "custom-officer-name"
7413
7412
  }, (_item$assignes$ = item.assignes[0]) === null || _item$assignes$ === void 0 ? void 0 : _item$assignes$.name)))), (item === null || item === void 0 ? void 0 : item.wfDocuments) && (item === null || item === void 0 ? void 0 : (_item$wfDocuments = item.wfDocuments) === null || _item$wfDocuments === void 0 ? void 0 : _item$wfDocuments.length) > 0 && /*#__PURE__*/React.createElement("div", {
7414
- className: "custom-comments-section custom-comments-section-no-border"
7413
+ className: "custom-comments-section-no-border"
7415
7414
  }, /*#__PURE__*/React.createElement("h4", {
7416
7415
  className: "custom-comments-title"
7417
7416
  }, "Document Attached:"), /*#__PURE__*/React.createElement("div", {
@@ -7545,6 +7544,9 @@ const RALApplicationDetails = () => {
7545
7544
  moduleCode: "RENT_N_LEASE_NEW",
7546
7545
  role: "EMPLOYEE"
7547
7546
  });
7547
+ const getDate = epoch => {
7548
+ return Digit.DateUtils.ConvertEpochToDate(epoch);
7549
+ };
7548
7550
  const propertyDetails = applicationData !== null && applicationData !== void 0 && applicationData.additionalDetails ? applicationData.additionalDetails : {};
7549
7551
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
7550
7552
  className: "cardHeaderWithOptions ral-app-details-header"
@@ -7615,6 +7617,15 @@ const RALApplicationDetails = () => {
7615
7617
  }), /*#__PURE__*/React.createElement(Row, {
7616
7618
  label: t("RENT_LEASE_LOCATION_TYPE"),
7617
7619
  text: (propertyDetails === null || propertyDetails === void 0 ? void 0 : propertyDetails.locationType) || t("CS_NA")
7620
+ }), /*#__PURE__*/React.createElement(Row, {
7621
+ label: t("RAL_START_DATE"),
7622
+ text: getDate(applicationData === null || applicationData === void 0 ? void 0 : applicationData.startDate) || t("CS_NA")
7623
+ }), /*#__PURE__*/React.createElement(Row, {
7624
+ label: t("RAL_END_DATE"),
7625
+ text: getDate(applicationData === null || applicationData === void 0 ? void 0 : applicationData.endDate) || t("CS_NA")
7626
+ }), (applicationData === null || applicationData === void 0 ? void 0 : applicationData.tradeLicenseNumber) && /*#__PURE__*/React.createElement(Row, {
7627
+ label: t("RENT_LEASE_TRADE_LICENSE_NUMBER"),
7628
+ text: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.tradeLicenseNumber) || t("CS_NA")
7618
7629
  })), /*#__PURE__*/React.createElement(CardSubHeader, {
7619
7630
  className: "ral-card-subheader-24-margin"
7620
7631
  }, t("CS_COMMON_DOCUMENTS")), /*#__PURE__*/React.createElement(StatusTable, null, /*#__PURE__*/React.createElement(Card, {
@@ -8962,7 +8973,6 @@ const RALApplicationDetails$1 = () => {
8962
8973
  const [loader, setLoader] = useState(false);
8963
8974
  const state = tenantId === null || tenantId === void 0 ? void 0 : tenantId.split(".")[0];
8964
8975
  const [applicationData, setApplicationData] = useState();
8965
- console.log("applicationData", applicationData);
8966
8976
  const [showToast, setShowToast] = useState(null);
8967
8977
  const [displayMenu, setDisplayMenu] = useState(false);
8968
8978
  const [selectedAction, setSelectedAction] = useState(null);
@@ -8970,6 +8980,8 @@ const RALApplicationDetails$1 = () => {
8970
8980
  const [getEmployees, setEmployees] = useState([]);
8971
8981
  const history = useHistory();
8972
8982
  const [getWorkflowService, setWorkflowService] = useState([]);
8983
+ const menuRef = useRef();
8984
+ Digit.Hooks.useClickOutside(menuRef, () => setDisplayMenu(false), displayMenu);
8973
8985
  const fetchApplications = async filters => {
8974
8986
  setLoader(true);
8975
8987
  try {
@@ -9002,9 +9014,14 @@ const RALApplicationDetails$1 = () => {
9002
9014
  moduleCode: "RENT_N_LEASE_NEW",
9003
9015
  role: "EMPLOYEE"
9004
9016
  });
9017
+ const handleNavigation = () => {
9018
+ const timer = setTimeout(() => {
9019
+ history.push("/digit-ui/employee/rentandlease/inbox");
9020
+ }, 2000);
9021
+ return () => clearTimeout(timer);
9022
+ };
9005
9023
  const propertyDetails = applicationData !== null && applicationData !== void 0 && applicationData.additionalDetails ? applicationData.additionalDetails : {};
9006
9024
  let user = Digit.UserService.getUser();
9007
- const menuRef = useRef();
9008
9025
  const userRoles = user === null || user === void 0 ? void 0 : (_user$info = user.info) === null || _user$info === void 0 ? void 0 : (_user$info$roles = _user$info.roles) === null || _user$info$roles === void 0 ? void 0 : _user$info$roles.map(e => e.code);
9009
9026
  let actions = (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data = workflowDetails.data) === null || _workflowDetails$data === void 0 ? void 0 : (_workflowDetails$data2 = _workflowDetails$data.actionState) === null || _workflowDetails$data2 === void 0 ? void 0 : (_workflowDetails$data3 = _workflowDetails$data2.nextActions) === null || _workflowDetails$data3 === void 0 ? void 0 : _workflowDetails$data3.filter(e => {
9010
9027
  return (userRoles === null || userRoles === void 0 ? void 0 : userRoles.some(role => {
@@ -9017,7 +9034,7 @@ const RALApplicationDetails$1 = () => {
9017
9034
  return (_e$roles2 = e.roles) === null || _e$roles2 === void 0 ? void 0 : _e$roles2.includes(role);
9018
9035
  })) || !e.roles;
9019
9036
  }));
9020
- if ((_actions = actions) !== null && _actions !== void 0 && _actions.some(action => action.action === "REQUEST_FOR_DISCONNECTION") && (applicationData === null || applicationData === void 0 ? void 0 : applicationData.endDate) > Date.now()) {
9037
+ if ((_actions = actions) !== null && _actions !== void 0 && _actions.some(action => action.action === "REQUEST_FOR_DISCONNECTION") && Date.now() >= (applicationData === null || applicationData === void 0 ? void 0 : applicationData.endDate) - 15 * 24 * 60 * 60 * 1000) {
9021
9038
  actions = [...(actions || []), {
9022
9039
  action: "RENEWAL"
9023
9040
  }];
@@ -9030,6 +9047,9 @@ const RALApplicationDetails$1 = () => {
9030
9047
  setShowModal(false);
9031
9048
  setShowToast(false);
9032
9049
  };
9050
+ const getDate = epoch => {
9051
+ return Digit.DateUtils.ConvertEpochToDate(epoch);
9052
+ };
9033
9053
  function onActionSelect(action) {
9034
9054
  var _ref, _action$state, _filterRoles$;
9035
9055
  const payload = {
@@ -9046,7 +9066,7 @@ const RALApplicationDetails$1 = () => {
9046
9066
  } else if ((action === null || action === void 0 ? void 0 : action.action) == "PAY") {
9047
9067
  const appNo = acknowledgementIds;
9048
9068
  history.push(`/digit-ui/employee/payment/collect/rl-services/${appNo}/${tenantId}`);
9049
- } else if ((action === null || action === void 0 ? void 0 : action.action) === "RENEWAL") {
9069
+ } else if ((action === null || action === void 0 ? void 0 : action.action) === "RAL_RENEWAL") {
9050
9070
  setShowModal(true);
9051
9071
  setSelectedAction(action);
9052
9072
  } else {
@@ -9092,9 +9112,7 @@ const RALApplicationDetails$1 = () => {
9092
9112
  key: false,
9093
9113
  label: "Successfully updated the status"
9094
9114
  });
9095
- setTimeout(() => {
9096
- history.push("/digit-ui/employee/rentandlease/inbox");
9097
- }, 2000);
9115
+ handleNavigation();
9098
9116
  setSelectedAction(null);
9099
9117
  setShowModal(false);
9100
9118
  }
@@ -9179,7 +9197,7 @@ const RALApplicationDetails$1 = () => {
9179
9197
  ...response,
9180
9198
  Document: sanitizedDocuments,
9181
9199
  workflow: {
9182
- action: "SAVEASDRAFT"
9200
+ action: "APPLY"
9183
9201
  }
9184
9202
  }
9185
9203
  };
@@ -9196,6 +9214,7 @@ const RALApplicationDetails$1 = () => {
9196
9214
  key: false,
9197
9215
  label: "Renewal application submitted successfully"
9198
9216
  });
9217
+ handleNavigation();
9199
9218
  } catch (error) {
9200
9219
  setLoader(false);
9201
9220
  setShowToast({
@@ -9235,7 +9254,10 @@ const RALApplicationDetails$1 = () => {
9235
9254
  text: t("CS_NA")
9236
9255
  })), /*#__PURE__*/React.createElement(CardSubHeader, {
9237
9256
  className: "ral-card-subheader-24"
9238
- }, t("ES_TITILE_PROPERTY_DETAILS")), /*#__PURE__*/React.createElement(StatusTable, null, /*#__PURE__*/React.createElement(Row, {
9257
+ }, t("ES_TITILE_PROPERTY_DETAILS")), /*#__PURE__*/React.createElement(StatusTable, null, (applicationData === null || applicationData === void 0 ? void 0 : applicationData.registrationNumber) && /*#__PURE__*/React.createElement(Row, {
9258
+ label: t("RAL_REGISTRATION_NUMBER"),
9259
+ text: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.registrationNumber) || t("CS_NA")
9260
+ }), /*#__PURE__*/React.createElement(Row, {
9239
9261
  label: t("APPLICATION_NUMBER"),
9240
9262
  text: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationNumber) || t("CS_NA")
9241
9263
  }), /*#__PURE__*/React.createElement(Row, {
@@ -9268,6 +9290,15 @@ const RALApplicationDetails$1 = () => {
9268
9290
  }), /*#__PURE__*/React.createElement(Row, {
9269
9291
  label: t("RENT_LEASE_LOCATION_TYPE"),
9270
9292
  text: (propertyDetails === null || propertyDetails === void 0 ? void 0 : propertyDetails.locationType) || t("CS_NA")
9293
+ }), /*#__PURE__*/React.createElement(Row, {
9294
+ label: t("RAL_START_DATE"),
9295
+ text: getDate(applicationData === null || applicationData === void 0 ? void 0 : applicationData.startDate) || t("CS_NA")
9296
+ }), /*#__PURE__*/React.createElement(Row, {
9297
+ label: t("RAL_END_DATE"),
9298
+ text: getDate(applicationData === null || applicationData === void 0 ? void 0 : applicationData.endDate) || t("CS_NA")
9299
+ }), (applicationData === null || applicationData === void 0 ? void 0 : applicationData.tradeLicenseNumber) && /*#__PURE__*/React.createElement(Row, {
9300
+ label: t("RENT_LEASE_TRADE_LICENSE_NUMBER"),
9301
+ text: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.tradeLicenseNumber) || t("CS_NA")
9271
9302
  })), /*#__PURE__*/React.createElement(CardSubHeader, {
9272
9303
  className: "ral-card-subheader-24-margin"
9273
9304
  }, t("CS_COMMON_DOCUMENTS")), /*#__PURE__*/React.createElement(StatusTable, null, /*#__PURE__*/React.createElement(Card, {
@@ -9281,17 +9312,18 @@ const RALApplicationDetails$1 = () => {
9281
9312
  }), t(doc === null || doc === void 0 ? void 0 : doc.documentType))) : /*#__PURE__*/React.createElement("h5", null, t("CS_NO_DOCUMENTS_UPLOADED"))))), /*#__PURE__*/React.createElement(NewApplicationTimeline, {
9282
9313
  workflowDetails: workflowDetails,
9283
9314
  t: t
9284
- }), (applicationData === null || applicationData === void 0 ? void 0 : applicationData.status) != "INITIATED" && ((_actions2 = actions) === null || _actions2 === void 0 ? void 0 : _actions2.length) > 0 && /*#__PURE__*/React.createElement(ActionBar, null, displayMenu ? /*#__PURE__*/React.createElement(Menu, {
9315
+ }), (applicationData === null || applicationData === void 0 ? void 0 : applicationData.status) != "INITIATED" && ((_actions2 = actions) === null || _actions2 === void 0 ? void 0 : _actions2.length) > 0 && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement("div", {
9316
+ ref: menuRef
9317
+ }, displayMenu ? /*#__PURE__*/React.createElement(Menu, {
9285
9318
  localeKeyPrefix: `WF_EMPLOYEE_${"PTR"}`,
9286
9319
  options: actions,
9287
9320
  optionKey: "action",
9288
9321
  t: t,
9289
9322
  onSelect: onActionSelect
9290
9323
  }) : null, /*#__PURE__*/React.createElement(SubmitBar, {
9291
- ref: menuRef,
9292
9324
  label: t("WF_TAKE_ACTION"),
9293
9325
  onSubmit: () => setDisplayMenu(!displayMenu)
9294
- })), (applicationData === null || applicationData === void 0 ? void 0 : applicationData.status) == "INITIATED" && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
9326
+ }))), (applicationData === null || applicationData === void 0 ? void 0 : applicationData.status) == "INITIATED" && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
9295
9327
  label: t("COMMON_EDIT"),
9296
9328
  onSubmit: () => {
9297
9329
  history.push(`/digit-ui/employee/rentandlease/allot-property/${acknowledgementIds}`);
@@ -10028,12 +10060,29 @@ const RentAndLeasePropertyDetails = ({
10028
10060
  }) => {
10029
10061
  const dispatch = useDispatch();
10030
10062
  const tenantId = window.location.href.includes("citizen") ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
10063
+ const filters = {
10064
+ tenantId,
10065
+ searchType: "1"
10066
+ };
10031
10067
  const {
10032
- data: mdmsPropertyData
10033
- } = Digit.Hooks.rentandlease.useRALPropertyMDMS(tenantId);
10068
+ data,
10069
+ isLoading,
10070
+ isError
10071
+ } = Digit.Hooks.rentandlease.useRentAndLeaseProperties(filters);
10034
10072
  const {
10035
- triggerLoader
10073
+ triggerLoader,
10074
+ triggerToast
10036
10075
  } = config === null || config === void 0 ? void 0 : config.currStepConfig[0];
10076
+ useEffect(() => {
10077
+ if (triggerLoader) {
10078
+ triggerLoader(isLoading);
10079
+ }
10080
+ }, [isLoading, triggerLoader]);
10081
+ useEffect(() => {
10082
+ if (isError && triggerToast) {
10083
+ triggerToast("ERROR_WHILE_FETCHING_PROPERTIES", true);
10084
+ }
10085
+ }, [isError, triggerToast]);
10037
10086
  const propertyTypeOptions = [{
10038
10087
  name: t("ON_RENT"),
10039
10088
  code: "rent",
@@ -10095,14 +10144,14 @@ const RentAndLeasePropertyDetails = ({
10095
10144
  const selectedLocationType = watch("locationType");
10096
10145
  const [filteredProperties, setFilteredProperties] = useState([]);
10097
10146
  useEffect(() => {
10098
- if (mdmsPropertyData) {
10099
- let properties = mdmsPropertyData;
10147
+ if (data !== null && data !== void 0 && data.property) {
10148
+ let properties = data === null || data === void 0 ? void 0 : data.property;
10100
10149
  if (selectedPropertyType && selectedPropertySpecific && selectedLocationType) {
10101
10150
  properties = properties.filter(p => p.allotmentType === (selectedPropertyType === null || selectedPropertyType === void 0 ? void 0 : selectedPropertyType.code) && p.propertyType === (selectedPropertySpecific === null || selectedPropertySpecific === void 0 ? void 0 : selectedPropertySpecific.code) && p.locationType === (selectedLocationType === null || selectedLocationType === void 0 ? void 0 : selectedLocationType.code));
10102
10151
  }
10103
10152
  setFilteredProperties(properties);
10104
10153
  }
10105
- }, [mdmsPropertyData, selectedPropertyType, selectedPropertySpecific, selectedLocationType]);
10154
+ }, [data, selectedPropertyType, selectedPropertySpecific, selectedLocationType]);
10106
10155
  const todayISO = new Date().toISOString().split("T")[0];
10107
10156
  const getErrorMessage = fieldName => {
10108
10157
  var _errors$fieldName;
@@ -13325,7 +13374,10 @@ const MyProperties = ({
13325
13374
  var _property$additionalD, _property$additionalD2;
13326
13375
  return /*#__PURE__*/React.createElement(Card, {
13327
13376
  key: index
13328
- }, /*#__PURE__*/React.createElement(KeyNote, {
13377
+ }, (property === null || property === void 0 ? void 0 : property.registrationNumber) && /*#__PURE__*/React.createElement(KeyNote, {
13378
+ keyValue: t("RAL_REGISTRATION_NUMBER"),
13379
+ note: (property === null || property === void 0 ? void 0 : property.registrationNumber) || t("CS_NA")
13380
+ }), /*#__PURE__*/React.createElement(KeyNote, {
13329
13381
  keyValue: t("RAL_APPLICATION_NUMBER"),
13330
13382
  note: (property === null || property === void 0 ? void 0 : property.applicationNumber) || t("CS_NA")
13331
13383
  }), /*#__PURE__*/React.createElement(KeyNote, {