@mseva/upyog-ui-module-ads 1.1.7 → 1.1.8

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$1, 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, CardSectionHeader, 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';
1
+ import { Modal, Card as Card$1, CheckBox, Header, SearchForm, SearchField, TextInput, Dropdown, MobileNumber, CardLabelError as CardLabelError$1, DatePicker, SubmitBar, Table, Loader as Loader$1, 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, CardSectionHeader, CheckPoint, ConnectingCheckPoints, TickMark, CardLabelDesc, TextArea, LabelFieldPair, UploadFile, StatusTable, Row, LinkButton, EmployeeModuleCard, PropertyHouse, Label, LinkLabel, Localities, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, FormComposer, MultiLink, 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';
@@ -238,27 +238,6 @@ const transformBookingResponseToBookingData = (apiResponse = {}) => {
238
238
  bookingData
239
239
  };
240
240
  };
241
- const areCartSlotsEqual = (a = [], b = []) => {
242
- if ((a === null || a === void 0 ? void 0 : a.length) !== (b === null || b === void 0 ? void 0 : b.length)) return false;
243
- const sortByAd = arr => {
244
- var _ref;
245
- return (_ref = [...arr]) === null || _ref === void 0 ? void 0 : _ref.sort((x, y) => {
246
- var _x$ad, _y$ad;
247
- return String(x === null || x === void 0 ? void 0 : (_x$ad = x.ad) === null || _x$ad === void 0 ? void 0 : _x$ad.id).localeCompare(String(y === null || y === void 0 ? void 0 : (_y$ad = y.ad) === null || _y$ad === void 0 ? void 0 : _y$ad.id));
248
- });
249
- };
250
- const sortedA = sortByAd(a);
251
- const sortedB = sortByAd(b);
252
- return sortedA.every((item, idx) => {
253
- var _item$ad, _other$ad, _item$slots, _item$slots$map, _other$slots, _other$slots$map;
254
- const other = sortedB[idx];
255
- if (String(item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id) !== String(other === null || other === void 0 ? void 0 : (_other$ad = other.ad) === null || _other$ad === void 0 ? void 0 : _other$ad.id)) return false;
256
- const slotsA = item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : (_item$slots$map = _item$slots.map(s => s === null || s === void 0 ? void 0 : s.bookingDate)) === null || _item$slots$map === void 0 ? void 0 : _item$slots$map.sort();
257
- const slotsB = other === null || other === void 0 ? void 0 : (_other$slots = other.slots) === null || _other$slots === void 0 ? void 0 : (_other$slots$map = _other$slots.map(s => s === null || s === void 0 ? void 0 : s.bookingDate)) === null || _other$slots$map === void 0 ? void 0 : _other$slots$map.sort();
258
- if ((slotsA === null || slotsA === void 0 ? void 0 : slotsA.length) !== (slotsB === null || slotsB === void 0 ? void 0 : slotsB.length)) return false;
259
- return slotsA === null || slotsA === void 0 ? void 0 : slotsA.every((date, i) => date === slotsB[i]);
260
- });
261
- };
262
241
  const areSlotsEqual = (a = [], b = []) => {
263
242
  if ((a === null || a === void 0 ? void 0 : a.length) !== (b === null || b === void 0 ? void 0 : b.length)) return false;
264
243
  const key = s => s === null || s === void 0 ? void 0 : s.bookingDate;
@@ -6932,12 +6911,12 @@ const TableConfig = t => ({
6932
6911
  Cell: ({
6933
6912
  row
6934
6913
  }) => {
6935
- var _row$original4, _row$original4$search, _row$original5, _row$original5$workfl, _row$original5$workfl2;
6936
- return GetCell(t(`${row === null || row === void 0 ? void 0 : (_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : (_row$original4$search = _row$original4.searchData) === null || _row$original4$search === void 0 ? void 0 : _row$original4$search["bookingStatus"]}` || `${row === null || row === void 0 ? void 0 : (_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$workfl = _row$original5.workflowData) === null || _row$original5$workfl === void 0 ? void 0 : (_row$original5$workfl2 = _row$original5$workfl.state) === null || _row$original5$workfl2 === void 0 ? void 0 : _row$original5$workfl2["applicationStatus"]}`));
6914
+ var _row$original5, _row$original5$workfl, _row$original5$workfl2;
6915
+ return GetCell(t(`${row === null || row === void 0 ? void 0 : (_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$workfl = _row$original5.workflowData) === null || _row$original5$workfl === void 0 ? void 0 : (_row$original5$workfl2 = _row$original5$workfl.state) === null || _row$original5$workfl2 === void 0 ? void 0 : _row$original5$workfl2["applicationStatus"]}`));
6937
6916
  },
6938
6917
  mobileCell: original => {
6939
- var _original$searchData7, _original$workflowDat, _original$workflowDat2;
6940
- return GetMobCell(t(`ES_ADS_COMMON_STATUS_${(original === null || original === void 0 ? void 0 : (_original$searchData7 = original.searchData) === null || _original$searchData7 === void 0 ? void 0 : _original$searchData7["bookingStatus"]) || (original === null || original === void 0 ? void 0 : (_original$workflowDat = original.workflowData) === null || _original$workflowDat === void 0 ? void 0 : (_original$workflowDat2 = _original$workflowDat.state) === null || _original$workflowDat2 === void 0 ? void 0 : _original$workflowDat2["applicationStatus"])}`));
6918
+ var _original$workflowDat, _original$workflowDat2;
6919
+ return GetMobCell(t(`ES_ADS_COMMON_STATUS_${original === null || original === void 0 ? void 0 : (_original$workflowDat = original.workflowData) === null || _original$workflowDat === void 0 ? void 0 : (_original$workflowDat2 = _original$workflowDat.state) === null || _original$workflowDat2 === void 0 ? void 0 : _original$workflowDat2["applicationStatus"]}`));
6941
6920
  }
6942
6921
  }, {
6943
6922
  Header: t("ADS_DATE"),
@@ -6950,8 +6929,8 @@ const TableConfig = t => ({
6950
6929
  return GetCell(dateStr);
6951
6930
  },
6952
6931
  mobileCell: original => {
6953
- var _original$searchData8;
6954
- const createdTime = original === null || original === void 0 ? void 0 : (_original$searchData8 = original.searchData) === null || _original$searchData8 === void 0 ? void 0 : _original$searchData8["applicationDate"];
6932
+ var _original$searchData7;
6933
+ const createdTime = original === null || original === void 0 ? void 0 : (_original$searchData7 = original.searchData) === null || _original$searchData7 === void 0 ? void 0 : _original$searchData7["applicationDate"];
6955
6934
  const dateStr = createdTime ? new Date(createdTime).toLocaleDateString("en-GB") : "";
6956
6935
  return GetMobCell(dateStr);
6957
6936
  }
@@ -19732,59 +19711,311 @@ const ADSMyApplications = () => {
19732
19711
  }, t("ADS_NEW_BOOKING") + " +"))));
19733
19712
  };
19734
19713
 
19735
- var isArray = Array.isArray;
19736
- var isArray_1 = isArray;
19737
-
19738
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
19739
- var _freeGlobal = freeGlobal;
19740
-
19741
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
19742
- var root = _freeGlobal || freeSelf || Function('return this')();
19743
- var _root = root;
19744
-
19745
- var Symbol$1 = _root.Symbol;
19746
- var _Symbol = Symbol$1;
19714
+ const ModalConfig = ({
19715
+ t,
19716
+ action,
19717
+ approvers,
19718
+ selectedApprover,
19719
+ setSelectedApprover,
19720
+ selectFile,
19721
+ uploadedFile,
19722
+ setUploadedFile,
19723
+ assigneeLabel,
19724
+ businessService
19725
+ }) => {
19726
+ let checkCondtions = true;
19727
+ if ((action === null || action === void 0 ? void 0 : action.action) == "SENDBACKTOCITIZEN" || (action === null || action === void 0 ? void 0 : action.action) == "APPROVE" || (action === null || action === void 0 ? void 0 : action.action) == "REJECT" || (action === null || action === void 0 ? void 0 : action.action) == "SENDBACK") checkCondtions = false;
19728
+ if (action.isTerminateState) checkCondtions = false;
19729
+ return {
19730
+ label: {
19731
+ heading: `WF_${action === null || action === void 0 ? void 0 : action.action}_APPLICATION`,
19732
+ submit: `${action === null || action === void 0 ? void 0 : action.action}`,
19733
+ cancel: "WF_EMPLOYEE_NEWTL_CANCEL"
19734
+ },
19735
+ form: [{
19736
+ body: [{
19737
+ label: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_LABEL"),
19738
+ placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"),
19739
+ type: "dropdown",
19740
+ populators: !checkCondtions ? null : /*#__PURE__*/React.createElement(Dropdown, {
19741
+ option: approvers,
19742
+ autoComplete: "off",
19743
+ optionKey: "name",
19744
+ id: "fieldInspector",
19745
+ select: setSelectedApprover,
19746
+ selected: selectedApprover
19747
+ })
19748
+ }, {
19749
+ label: t("WF_COMMON_COMMENTS"),
19750
+ type: "textarea",
19751
+ populators: {
19752
+ name: "comments"
19753
+ }
19754
+ }, {
19755
+ label: t("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),
19756
+ populators: /*#__PURE__*/React.createElement(UploadFile, {
19757
+ id: "workflow-doc",
19758
+ onUpload: selectFile,
19759
+ onDelete: () => {
19760
+ setUploadedFile(null);
19761
+ },
19762
+ message: uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)
19763
+ })
19764
+ }]
19765
+ }]
19766
+ };
19767
+ };
19747
19768
 
19748
- var objectProto = Object.prototype;
19749
- var hasOwnProperty$1 = objectProto.hasOwnProperty;
19750
- var nativeObjectToString = objectProto.toString;
19751
- var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
19752
- function getRawTag(value) {
19753
- var isOwn = hasOwnProperty$1.call(value, symToStringTag),
19754
- tag = value[symToStringTag];
19755
- try {
19756
- value[symToStringTag] = undefined;
19757
- var unmasked = true;
19758
- } catch (e) {}
19759
- var result = nativeObjectToString.call(value);
19760
- if (unmasked) {
19761
- if (isOwn) {
19762
- value[symToStringTag] = tag;
19763
- } else {
19764
- delete value[symToStringTag];
19769
+ const Heading$1 = props => {
19770
+ return /*#__PURE__*/React.createElement("h1", {
19771
+ className: "heading-m"
19772
+ }, props.label);
19773
+ };
19774
+ const Close$4 = () => /*#__PURE__*/React.createElement("svg", {
19775
+ xmlns: "http://www.w3.org/2000/svg",
19776
+ viewBox: "0 0 24 24",
19777
+ fill: "#FFFFFF"
19778
+ }, /*#__PURE__*/React.createElement("path", {
19779
+ d: "M0 0h24v24H0V0z",
19780
+ fill: "none"
19781
+ }), /*#__PURE__*/React.createElement("path", {
19782
+ d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
19783
+ }));
19784
+ const CloseBtn$4 = props => {
19785
+ return /*#__PURE__*/React.createElement("div", {
19786
+ className: "icon-bg-secondary",
19787
+ onClick: props.onClick
19788
+ }, /*#__PURE__*/React.createElement(Close$4, null));
19789
+ };
19790
+ const ADSModal = ({
19791
+ t,
19792
+ action,
19793
+ tenantId,
19794
+ state,
19795
+ bookingNo,
19796
+ closeModal,
19797
+ submitAction,
19798
+ actionData,
19799
+ applicationDetails,
19800
+ applicationData,
19801
+ businessService,
19802
+ moduleCode,
19803
+ workflowConfig,
19804
+ workflowDetails,
19805
+ workflowActions,
19806
+ showToast,
19807
+ closeToast,
19808
+ errors
19809
+ }) => {
19810
+ var _action$_rawStateObj, _action$assigneeRoles, _action$assigneeRoles2;
19811
+ const [config, setConfig] = useState({});
19812
+ const [defaultValues, setDefaultValues] = useState({});
19813
+ const [approvers, setApprovers] = useState([]);
19814
+ const [selectedApprover, setSelectedApprover] = useState({});
19815
+ const [file, setFile] = useState(null);
19816
+ const [uploadedFile, setUploadedFile] = useState(null);
19817
+ const [error, setError] = useState(null);
19818
+ const [financialYears, setFinancialYears] = useState([]);
19819
+ const [selectedFinancialYear, setSelectedFinancialYear] = useState(null);
19820
+ const preferToStateFor = new Set(["SUBMIT", "INITIATE", "PAY"]);
19821
+ const fromState = (action === null || action === void 0 ? void 0 : action.fromStateCode) || (action === null || action === void 0 ? void 0 : (_action$_rawStateObj = action._rawStateObj) === null || _action$_rawStateObj === void 0 ? void 0 : _action$_rawStateObj.state) || null;
19822
+ const toState = (action === null || action === void 0 ? void 0 : action.toStateCode) || null;
19823
+ const statusToSend = (action === null || action === void 0 ? void 0 : action.status) || (preferToStateFor.has(action === null || action === void 0 ? void 0 : action.action) ? toState || fromState || (action === null || action === void 0 ? void 0 : action.nextState) : fromState || toState || (action === null || action === void 0 ? void 0 : action.nextState));
19824
+ const {
19825
+ data: approverData,
19826
+ isLoading: PTALoading
19827
+ } = Digit.Hooks.useEmployeeSearch(tenantId, {
19828
+ roles: action === null || action === void 0 ? void 0 : (_action$assigneeRoles = action.assigneeRoles) === null || _action$assigneeRoles === void 0 ? void 0 : (_action$assigneeRoles2 = _action$assigneeRoles.map) === null || _action$assigneeRoles2 === void 0 ? void 0 : _action$assigneeRoles2.call(_action$assigneeRoles, e => ({
19829
+ code: e
19830
+ })),
19831
+ isActive: true
19832
+ }, {
19833
+ enabled: !(action !== null && action !== void 0 && action.isTerminateState)
19834
+ });
19835
+ const {
19836
+ isLoading: financialYearsLoading,
19837
+ data: financialYearsData
19838
+ } = Digit.Hooks.pt.useMDMS(tenantId, businessService, "FINANCIAL_YEARLS", {}, {
19839
+ details: {
19840
+ tenantId: Digit.ULBService.getStateId(),
19841
+ moduleDetails: [{
19842
+ moduleName: "egf-master",
19843
+ masterDetails: [{
19844
+ name: "FinancialYear",
19845
+ filter: "[?(@.module == 'ADV')]"
19846
+ }]
19847
+ }]
19848
+ }
19849
+ });
19850
+ useEffect(() => {
19851
+ if (financialYearsData && financialYearsData["egf-master"]) {
19852
+ var _financialYearsData$e;
19853
+ setFinancialYears((_financialYearsData$e = financialYearsData["egf-master"]) === null || _financialYearsData$e === void 0 ? void 0 : _financialYearsData$e["FinancialYear"]);
19854
+ }
19855
+ }, [financialYearsData]);
19856
+ const {
19857
+ data: EmployeeStatusData
19858
+ } = Digit.Hooks.useCustomMDMS(tenantId, "common-masters", [{
19859
+ name: "Department"
19860
+ }]);
19861
+ useEffect(() => {
19862
+ if (approverData && EmployeeStatusData) {
19863
+ var _approverData$Employe;
19864
+ const departments = EmployeeStatusData["common-masters"].Department;
19865
+ setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
19866
+ var _employee$assignments, _employee$assignments2, _employee$user;
19867
+ const deptCode = employee === null || employee === void 0 ? void 0 : (_employee$assignments = employee.assignments) === null || _employee$assignments === void 0 ? void 0 : (_employee$assignments2 = _employee$assignments[0]) === null || _employee$assignments2 === void 0 ? void 0 : _employee$assignments2.department;
19868
+ const matchedDept = departments === null || departments === void 0 ? void 0 : departments.find(d => (d === null || d === void 0 ? void 0 : d.code) === deptCode);
19869
+ return {
19870
+ uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
19871
+ name: `${employee === null || employee === void 0 ? void 0 : (_employee$user = employee.user) === null || _employee$user === void 0 ? void 0 : _employee$user.name} - ${matchedDept === null || matchedDept === void 0 ? void 0 : matchedDept.name}`
19872
+ };
19873
+ }));
19765
19874
  }
19875
+ }, [approverData]);
19876
+ function selectFile(e) {
19877
+ setFile(e.target.files[0]);
19766
19878
  }
19767
- return result;
19768
- }
19769
- var _getRawTag = getRawTag;
19770
-
19771
- var objectProto$1 = Object.prototype;
19772
- var nativeObjectToString$1 = objectProto$1.toString;
19773
- function objectToString(value) {
19774
- return nativeObjectToString$1.call(value);
19775
- }
19776
- var _objectToString = objectToString;
19777
-
19778
- var nullTag = '[object Null]',
19779
- undefinedTag = '[object Undefined]';
19780
- var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
19781
- function baseGetTag(value) {
19782
- if (value == null) {
19783
- return value === undefined ? undefinedTag : nullTag;
19879
+ useEffect(() => {
19880
+ (async () => {
19881
+ setError(null);
19882
+ if (file) {
19883
+ if (file.size >= 5242880) {
19884
+ setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
19885
+ } else {
19886
+ try {
19887
+ var _response$data, _response$data$files;
19888
+ const response = await Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId());
19889
+ if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
19890
+ var _response$data2, _response$data2$files;
19891
+ setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
19892
+ } else {
19893
+ setError(t("CS_FILE_UPLOAD_ERROR"));
19894
+ }
19895
+ } catch (err) {
19896
+ setError(t("CS_FILE_UPLOAD_ERROR"));
19897
+ }
19898
+ }
19899
+ }
19900
+ })();
19901
+ }, [file]);
19902
+ function submit(data) {
19903
+ applicationData = {
19904
+ ...applicationData,
19905
+ action: action === null || action === void 0 ? void 0 : action.action,
19906
+ comment: data === null || data === void 0 ? void 0 : data.comments,
19907
+ assignee: !(selectedApprover !== null && selectedApprover !== void 0 && selectedApprover.uuid) ? null : [selectedApprover === null || selectedApprover === void 0 ? void 0 : selectedApprover.uuid],
19908
+ status: statusToSend,
19909
+ wfDocuments: uploadedFile ? [{
19910
+ documentType: (action === null || action === void 0 ? void 0 : action.action) + " DOC",
19911
+ fileName: file === null || file === void 0 ? void 0 : file.name,
19912
+ fileStoreId: uploadedFile
19913
+ }] : null
19914
+ };
19915
+ submitAction({
19916
+ Licenses: [applicationData]
19917
+ });
19784
19918
  }
19785
- return symToStringTag$1 && symToStringTag$1 in Object(value) ? _getRawTag(value) : _objectToString(value);
19786
- }
19787
- var _baseGetTag = baseGetTag;
19919
+ useEffect(() => {
19920
+ if (workflowActions && workflowActions.length > 0) {
19921
+ const meta = workflowActions.find(w => w.action === (action === null || action === void 0 ? void 0 : action.action));
19922
+ }
19923
+ }, [workflowActions, action]);
19924
+ useEffect(() => {
19925
+ if (action) {
19926
+ setConfig(ModalConfig({
19927
+ t,
19928
+ action,
19929
+ approvers,
19930
+ selectedApprover,
19931
+ setSelectedApprover,
19932
+ selectFile,
19933
+ uploadedFile,
19934
+ setUploadedFile,
19935
+ businessService
19936
+ }));
19937
+ }
19938
+ }, [action, approvers, financialYears, selectedFinancialYear, uploadedFile]);
19939
+ return action && config.form ? /*#__PURE__*/React.createElement(Modal, {
19940
+ headerBarMain: /*#__PURE__*/React.createElement(Heading$1, {
19941
+ label: t(config.label.heading)
19942
+ }),
19943
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$4, {
19944
+ onClick: closeModal
19945
+ }),
19946
+ actionCancelLabel: t(config.label.cancel),
19947
+ actionCancelOnSubmit: closeModal,
19948
+ actionSaveLabel: t(config.label.submit),
19949
+ actionSaveOnSubmit: () => {},
19950
+ formId: "modal-action"
19951
+ }, /*#__PURE__*/React.createElement(FormComposer, {
19952
+ config: config.form,
19953
+ noBoxShadow: true,
19954
+ inline: true,
19955
+ childrenAtTheBottom: true,
19956
+ onSubmit: submit,
19957
+ defaultValues: defaultValues,
19958
+ formId: "modal-action"
19959
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
19960
+ error: showToast.key === "error" ? true : false,
19961
+ label: errors,
19962
+ onClose: closeToast
19963
+ })) : /*#__PURE__*/React.createElement(Loader$1, null);
19964
+ };
19965
+
19966
+ var isArray = Array.isArray;
19967
+ var isArray_1 = isArray;
19968
+
19969
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
19970
+ var _freeGlobal = freeGlobal;
19971
+
19972
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
19973
+ var root = _freeGlobal || freeSelf || Function('return this')();
19974
+ var _root = root;
19975
+
19976
+ var Symbol$1 = _root.Symbol;
19977
+ var _Symbol = Symbol$1;
19978
+
19979
+ var objectProto = Object.prototype;
19980
+ var hasOwnProperty$1 = objectProto.hasOwnProperty;
19981
+ var nativeObjectToString = objectProto.toString;
19982
+ var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
19983
+ function getRawTag(value) {
19984
+ var isOwn = hasOwnProperty$1.call(value, symToStringTag),
19985
+ tag = value[symToStringTag];
19986
+ try {
19987
+ value[symToStringTag] = undefined;
19988
+ var unmasked = true;
19989
+ } catch (e) {}
19990
+ var result = nativeObjectToString.call(value);
19991
+ if (unmasked) {
19992
+ if (isOwn) {
19993
+ value[symToStringTag] = tag;
19994
+ } else {
19995
+ delete value[symToStringTag];
19996
+ }
19997
+ }
19998
+ return result;
19999
+ }
20000
+ var _getRawTag = getRawTag;
20001
+
20002
+ var objectProto$1 = Object.prototype;
20003
+ var nativeObjectToString$1 = objectProto$1.toString;
20004
+ function objectToString(value) {
20005
+ return nativeObjectToString$1.call(value);
20006
+ }
20007
+ var _objectToString = objectToString;
20008
+
20009
+ var nullTag = '[object Null]',
20010
+ undefinedTag = '[object Undefined]';
20011
+ var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
20012
+ function baseGetTag(value) {
20013
+ if (value == null) {
20014
+ return value === undefined ? undefinedTag : nullTag;
20015
+ }
20016
+ return symToStringTag$1 && symToStringTag$1 in Object(value) ? _getRawTag(value) : _objectToString(value);
20017
+ }
20018
+ var _baseGetTag = baseGetTag;
19788
20019
 
19789
20020
  function isObjectLike(value) {
19790
20021
  return value != null && typeof value == 'object';
@@ -21955,10 +22186,12 @@ const ADSCartDetails$1 = ({
21955
22186
  cartDetails,
21956
22187
  t
21957
22188
  }) => {
21958
- const getKey = ad => `${ad === null || ad === void 0 ? void 0 : ad.id}_${ad === null || ad === void 0 ? void 0 : ad.bookingStartDate}_${ad === null || ad === void 0 ? void 0 : ad.bookingEndDate}`;
21959
- const [expanded, setExpanded] = useState(() => cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.map(item => getKey(item === null || item === void 0 ? void 0 : item.ad)));
21960
- const toggleExpand = key => {
21961
- setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(key) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== key) : [...prev, key]);
22189
+ const [expanded, setExpanded] = useState(() => cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.map(item => {
22190
+ var _item$ad;
22191
+ return item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id;
22192
+ }));
22193
+ const toggleExpand = adId => {
22194
+ setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(adId) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== adId) : [...prev, adId]);
21962
22195
  };
21963
22196
  const makeColumns = () => [{
21964
22197
  Header: t("ADS_DATE"),
@@ -21992,9 +22225,8 @@ const ADSCartDetails$1 = ({
21992
22225
  color: "#666"
21993
22226
  }
21994
22227
  }, t("ADS_NO_ADVERTISMENT_DETAILS")) : cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.map((item, idx) => {
21995
- var _item$ad, _item$ad2, _item$ad3, _item$ad4, _item$slots;
21996
- const key = getKey(item === null || item === void 0 ? void 0 : item.ad);
21997
- const isOpen = expanded === null || expanded === void 0 ? void 0 : expanded.includes(key);
22228
+ var _item$ad2, _item$ad4, _item$ad5, _item$ad6, _item$ad7, _item$slots;
22229
+ const isOpen = expanded === null || expanded === void 0 ? void 0 : expanded.includes(item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.id);
21998
22230
  return /*#__PURE__*/React.createElement("div", {
21999
22231
  key: idx,
22000
22232
  style: {
@@ -22004,7 +22236,10 @@ const ADSCartDetails$1 = ({
22004
22236
  overflow: "hidden"
22005
22237
  }
22006
22238
  }, /*#__PURE__*/React.createElement("div", {
22007
- onClick: () => toggleExpand(key),
22239
+ onClick: () => {
22240
+ var _item$ad3;
22241
+ return toggleExpand(item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.id);
22242
+ },
22008
22243
  style: {
22009
22244
  background: "#f9f9f9",
22010
22245
  padding: "10px 14px",
@@ -22016,7 +22251,7 @@ const ADSCartDetails$1 = ({
22016
22251
  justifyContent: "space-between",
22017
22252
  alignItems: "center"
22018
22253
  }
22019
- }, /*#__PURE__*/React.createElement("span", null, t((item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.name) ?? (item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.location)), item !== null && item !== void 0 && (_item$ad3 = item.ad) !== null && _item$ad3 !== void 0 && _item$ad3.amount ? ` — ₹${((item === null || item === void 0 ? void 0 : (_item$ad4 = item.ad) === null || _item$ad4 === void 0 ? void 0 : _item$ad4.amount) * 1.18 * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length)).toFixed(2)}` : ""), /*#__PURE__*/React.createElement("span", {
22254
+ }, /*#__PURE__*/React.createElement("span", null, t((item === null || item === void 0 ? void 0 : (_item$ad4 = item.ad) === null || _item$ad4 === void 0 ? void 0 : _item$ad4.name) ?? (item === null || item === void 0 ? void 0 : (_item$ad5 = item.ad) === null || _item$ad5 === void 0 ? void 0 : _item$ad5.location)), item !== null && item !== void 0 && (_item$ad6 = item.ad) !== null && _item$ad6 !== void 0 && _item$ad6.amount ? ` — ₹${((item === null || item === void 0 ? void 0 : (_item$ad7 = item.ad) === null || _item$ad7 === void 0 ? void 0 : _item$ad7.amount) * 1.18 * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length)).toFixed(2)}` : ""), /*#__PURE__*/React.createElement("span", {
22020
22255
  style: {
22021
22256
  fontSize: "18px"
22022
22257
  }
@@ -22044,7 +22279,7 @@ const ADSCartDetails$1 = ({
22044
22279
  };
22045
22280
 
22046
22281
  const ADSApplicationDetails = () => {
22047
- var _workflowDetails$data, _workflowDetails$data2, _ads_details$addition, _ads_details$applican, _ads_details$applican2, _ads_details$applican3, _ads_details$address, _ads_details$address2, _docs;
22282
+ var _workflowDetails$data, _workflowDetails$data2, _ads_details$addition, _ads_details$cartDeta, _ads_details$applican, _ads_details$applican2, _ads_details$applican3, _ads_details$address, _ads_details$address2, _docs;
22048
22283
  const [wfActionsState, setWfActionsState] = useState([]);
22049
22284
  const {
22050
22285
  t
@@ -22204,6 +22439,32 @@ const ADSApplicationDetails = () => {
22204
22439
  label: t("PTR_PET_DOWNLOAD_ACK_FORM"),
22205
22440
  onClick: () => downloadAcknowledgement(application)
22206
22441
  });
22442
+ const columns = [{
22443
+ Header: `${t("ADS_TYPE")}`,
22444
+ accessor: "addType"
22445
+ }, {
22446
+ Header: t("ADS_FACE_AREA"),
22447
+ accessor: "faceArea",
22448
+ Cell: ({
22449
+ value
22450
+ }) => t((value === null || value === void 0 ? void 0 : value.replaceAll("_", " ")) || "N/A")
22451
+ }, {
22452
+ Header: `${t("ADS_NIGHT_LIGHT")}`,
22453
+ accessor: "nightLight"
22454
+ }, {
22455
+ Header: `${t("CHB_BOOKING_DATE")}`,
22456
+ accessor: "bookingDate"
22457
+ }, {
22458
+ Header: `${t("PT_COMMON_TABLE_COL_STATUS_LABEL")}`,
22459
+ accessor: "bookingStatus"
22460
+ }];
22461
+ const adslistRows = (ads_details === null || ads_details === void 0 ? void 0 : (_ads_details$cartDeta = ads_details.cartDetails) === null || _ads_details$cartDeta === void 0 ? void 0 : _ads_details$cartDeta.map(slot => ({
22462
+ addType: `${t(slot.addType)}`,
22463
+ faceArea: `${t(slot.faceArea)}`,
22464
+ nightLight: `${t(slot.nightLight ? "Yes" : "No")}`,
22465
+ bookingDate: `${t(slot.bookingDate)}`,
22466
+ bookingStatus: `${t(slot.status)}`
22467
+ }))) || [];
22207
22468
  if (reciept_data && (reciept_data === null || reciept_data === void 0 ? void 0 : reciept_data.Payments.length) > 0 && !recieptDataLoading) {
22208
22469
  dowloadOptions.push({
22209
22470
  label: t("CHB_FEE_RECEIPT"),
@@ -22272,7 +22533,7 @@ const ADSApplicationDetails = () => {
22272
22533
  }), /*#__PURE__*/React.createElement(Row, {
22273
22534
  className: "border-none",
22274
22535
  label: t("BOOKING_STATUS"),
22275
- text: t(ads_details === null || ads_details === void 0 ? void 0 : ads_details.bookingStatus)
22536
+ text: ads_details === null || ads_details === void 0 ? void 0 : ads_details.bookingStatus
22276
22537
  }), (ads_details === null || ads_details === void 0 ? void 0 : ads_details.receiptNo) && /*#__PURE__*/React.createElement(Row, {
22277
22538
  className: "border-none",
22278
22539
  label: t("CITIZEN_SUCCESS_ADVT_HOARDINGS_PAYMENT_RECEIPT_NO"),
@@ -22316,258 +22577,6 @@ const ADSApplicationDetails = () => {
22316
22577
  })));
22317
22578
  };
22318
22579
 
22319
- const ModalConfig = ({
22320
- t,
22321
- action,
22322
- approvers,
22323
- selectedApprover,
22324
- setSelectedApprover,
22325
- selectFile,
22326
- uploadedFile,
22327
- setUploadedFile,
22328
- assigneeLabel,
22329
- businessService
22330
- }) => {
22331
- let checkCondtions = true;
22332
- if ((action === null || action === void 0 ? void 0 : action.action) == "SENDBACKTOCITIZEN" || (action === null || action === void 0 ? void 0 : action.action) == "APPROVE" || (action === null || action === void 0 ? void 0 : action.action) == "REJECT" || (action === null || action === void 0 ? void 0 : action.action) == "SENDBACK") checkCondtions = false;
22333
- if (action.isTerminateState) checkCondtions = false;
22334
- return {
22335
- label: {
22336
- heading: `WF_${action === null || action === void 0 ? void 0 : action.action}_APPLICATION`,
22337
- submit: `${action === null || action === void 0 ? void 0 : action.action}`,
22338
- cancel: "WF_EMPLOYEE_NEWTL_CANCEL"
22339
- },
22340
- form: [{
22341
- body: [{
22342
- label: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_LABEL"),
22343
- placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"),
22344
- type: "dropdown",
22345
- populators: !checkCondtions ? null : /*#__PURE__*/React.createElement(Dropdown, {
22346
- option: approvers,
22347
- autoComplete: "off",
22348
- optionKey: "name",
22349
- id: "fieldInspector",
22350
- select: setSelectedApprover,
22351
- selected: selectedApprover
22352
- })
22353
- }, {
22354
- label: t("WF_COMMON_COMMENTS"),
22355
- type: "textarea",
22356
- populators: {
22357
- name: "comments"
22358
- }
22359
- }, {
22360
- label: t("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),
22361
- populators: /*#__PURE__*/React.createElement(UploadFile, {
22362
- id: "workflow-doc",
22363
- onUpload: selectFile,
22364
- onDelete: () => {
22365
- setUploadedFile(null);
22366
- },
22367
- message: uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)
22368
- })
22369
- }]
22370
- }]
22371
- };
22372
- };
22373
-
22374
- const Heading$1 = props => {
22375
- return /*#__PURE__*/React.createElement("h1", {
22376
- className: "heading-m"
22377
- }, props.label);
22378
- };
22379
- const Close$4 = () => /*#__PURE__*/React.createElement("svg", {
22380
- xmlns: "http://www.w3.org/2000/svg",
22381
- viewBox: "0 0 24 24",
22382
- fill: "#FFFFFF"
22383
- }, /*#__PURE__*/React.createElement("path", {
22384
- d: "M0 0h24v24H0V0z",
22385
- fill: "none"
22386
- }), /*#__PURE__*/React.createElement("path", {
22387
- d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
22388
- }));
22389
- const CloseBtn$4 = props => {
22390
- return /*#__PURE__*/React.createElement("div", {
22391
- className: "icon-bg-secondary",
22392
- onClick: props.onClick
22393
- }, /*#__PURE__*/React.createElement(Close$4, null));
22394
- };
22395
- const ADSModal = ({
22396
- t,
22397
- action,
22398
- tenantId,
22399
- state,
22400
- bookingNo,
22401
- closeModal,
22402
- submitAction,
22403
- actionData,
22404
- applicationDetails,
22405
- applicationData,
22406
- businessService,
22407
- moduleCode,
22408
- workflowConfig,
22409
- workflowDetails,
22410
- workflowActions,
22411
- showToast,
22412
- closeToast,
22413
- errors
22414
- }) => {
22415
- var _action$_rawStateObj, _action$assigneeRoles, _action$assigneeRoles2;
22416
- const [config, setConfig] = useState({});
22417
- const [defaultValues, setDefaultValues] = useState({});
22418
- const [approvers, setApprovers] = useState([]);
22419
- const [selectedApprover, setSelectedApprover] = useState({});
22420
- const [file, setFile] = useState(null);
22421
- const [uploadedFile, setUploadedFile] = useState(null);
22422
- const [error, setError] = useState(null);
22423
- const [financialYears, setFinancialYears] = useState([]);
22424
- const [selectedFinancialYear, setSelectedFinancialYear] = useState(null);
22425
- const preferToStateFor = new Set(["SUBMIT", "INITIATE", "PAY"]);
22426
- const fromState = (action === null || action === void 0 ? void 0 : action.fromStateCode) || (action === null || action === void 0 ? void 0 : (_action$_rawStateObj = action._rawStateObj) === null || _action$_rawStateObj === void 0 ? void 0 : _action$_rawStateObj.state) || null;
22427
- const toState = (action === null || action === void 0 ? void 0 : action.toStateCode) || null;
22428
- const statusToSend = (action === null || action === void 0 ? void 0 : action.status) || (preferToStateFor.has(action === null || action === void 0 ? void 0 : action.action) ? toState || fromState || (action === null || action === void 0 ? void 0 : action.nextState) : fromState || toState || (action === null || action === void 0 ? void 0 : action.nextState));
22429
- const {
22430
- data: approverData,
22431
- isLoading: PTALoading
22432
- } = Digit.Hooks.useEmployeeSearch(tenantId, {
22433
- roles: action === null || action === void 0 ? void 0 : (_action$assigneeRoles = action.assigneeRoles) === null || _action$assigneeRoles === void 0 ? void 0 : (_action$assigneeRoles2 = _action$assigneeRoles.map) === null || _action$assigneeRoles2 === void 0 ? void 0 : _action$assigneeRoles2.call(_action$assigneeRoles, e => ({
22434
- code: e
22435
- })),
22436
- isActive: true
22437
- }, {
22438
- enabled: !(action !== null && action !== void 0 && action.isTerminateState)
22439
- });
22440
- const {
22441
- isLoading: financialYearsLoading,
22442
- data: financialYearsData
22443
- } = Digit.Hooks.pt.useMDMS(tenantId, businessService, "FINANCIAL_YEARLS", {}, {
22444
- details: {
22445
- tenantId: Digit.ULBService.getStateId(),
22446
- moduleDetails: [{
22447
- moduleName: "egf-master",
22448
- masterDetails: [{
22449
- name: "FinancialYear",
22450
- filter: "[?(@.module == 'ADV')]"
22451
- }]
22452
- }]
22453
- }
22454
- });
22455
- useEffect(() => {
22456
- if (financialYearsData && financialYearsData["egf-master"]) {
22457
- var _financialYearsData$e;
22458
- setFinancialYears((_financialYearsData$e = financialYearsData["egf-master"]) === null || _financialYearsData$e === void 0 ? void 0 : _financialYearsData$e["FinancialYear"]);
22459
- }
22460
- }, [financialYearsData]);
22461
- const {
22462
- data: EmployeeStatusData
22463
- } = Digit.Hooks.useCustomMDMS(tenantId, "common-masters", [{
22464
- name: "Department"
22465
- }]);
22466
- useEffect(() => {
22467
- if (approverData && EmployeeStatusData) {
22468
- var _approverData$Employe;
22469
- const departments = EmployeeStatusData["common-masters"].Department;
22470
- setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
22471
- var _employee$assignments, _employee$assignments2, _employee$user;
22472
- const deptCode = employee === null || employee === void 0 ? void 0 : (_employee$assignments = employee.assignments) === null || _employee$assignments === void 0 ? void 0 : (_employee$assignments2 = _employee$assignments[0]) === null || _employee$assignments2 === void 0 ? void 0 : _employee$assignments2.department;
22473
- const matchedDept = departments === null || departments === void 0 ? void 0 : departments.find(d => (d === null || d === void 0 ? void 0 : d.code) === deptCode);
22474
- return {
22475
- uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
22476
- name: `${employee === null || employee === void 0 ? void 0 : (_employee$user = employee.user) === null || _employee$user === void 0 ? void 0 : _employee$user.name} - ${matchedDept === null || matchedDept === void 0 ? void 0 : matchedDept.name}`
22477
- };
22478
- }));
22479
- }
22480
- }, [approverData]);
22481
- function selectFile(e) {
22482
- setFile(e.target.files[0]);
22483
- }
22484
- useEffect(() => {
22485
- (async () => {
22486
- setError(null);
22487
- if (file) {
22488
- if (file.size >= 5242880) {
22489
- setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
22490
- } else {
22491
- try {
22492
- var _response$data, _response$data$files;
22493
- const response = await Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId());
22494
- if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
22495
- var _response$data2, _response$data2$files;
22496
- setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
22497
- } else {
22498
- setError(t("CS_FILE_UPLOAD_ERROR"));
22499
- }
22500
- } catch (err) {
22501
- setError(t("CS_FILE_UPLOAD_ERROR"));
22502
- }
22503
- }
22504
- }
22505
- })();
22506
- }, [file]);
22507
- function submit(data) {
22508
- applicationData = {
22509
- ...applicationData,
22510
- action: action === null || action === void 0 ? void 0 : action.action,
22511
- comment: data === null || data === void 0 ? void 0 : data.comments,
22512
- assignee: !(selectedApprover !== null && selectedApprover !== void 0 && selectedApprover.uuid) ? null : [selectedApprover === null || selectedApprover === void 0 ? void 0 : selectedApprover.uuid],
22513
- status: statusToSend,
22514
- wfDocuments: uploadedFile ? [{
22515
- documentType: (action === null || action === void 0 ? void 0 : action.action) + " DOC",
22516
- fileName: file === null || file === void 0 ? void 0 : file.name,
22517
- fileStoreId: uploadedFile
22518
- }] : null
22519
- };
22520
- submitAction({
22521
- Licenses: [applicationData]
22522
- });
22523
- }
22524
- useEffect(() => {
22525
- if (workflowActions && workflowActions.length > 0) {
22526
- const meta = workflowActions.find(w => w.action === (action === null || action === void 0 ? void 0 : action.action));
22527
- }
22528
- }, [workflowActions, action]);
22529
- useEffect(() => {
22530
- if (action) {
22531
- setConfig(ModalConfig({
22532
- t,
22533
- action,
22534
- approvers,
22535
- selectedApprover,
22536
- setSelectedApprover,
22537
- selectFile,
22538
- uploadedFile,
22539
- setUploadedFile,
22540
- businessService
22541
- }));
22542
- }
22543
- }, [action, approvers, financialYears, selectedFinancialYear, uploadedFile]);
22544
- return action && config.form ? /*#__PURE__*/React.createElement(Modal, {
22545
- headerBarMain: /*#__PURE__*/React.createElement(Heading$1, {
22546
- label: t(config.label.heading)
22547
- }),
22548
- headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$4, {
22549
- onClick: closeModal
22550
- }),
22551
- actionCancelLabel: t(config.label.cancel),
22552
- actionCancelOnSubmit: closeModal,
22553
- actionSaveLabel: t(config.label.submit),
22554
- actionSaveOnSubmit: () => {},
22555
- formId: "modal-action"
22556
- }, /*#__PURE__*/React.createElement(FormComposer, {
22557
- config: config.form,
22558
- noBoxShadow: true,
22559
- inline: true,
22560
- childrenAtTheBottom: true,
22561
- onSubmit: submit,
22562
- defaultValues: defaultValues,
22563
- formId: "modal-action"
22564
- }), showToast && /*#__PURE__*/React.createElement(Toast, {
22565
- error: showToast.key === "error" ? true : false,
22566
- label: errors,
22567
- onClose: closeToast
22568
- })) : /*#__PURE__*/React.createElement(Loader$1, null);
22569
- };
22570
-
22571
22580
  var defineProperty = function () {
22572
22581
  try {
22573
22582
  var func = _getNative(Object, 'defineProperty');
@@ -23657,8 +23666,10 @@ const ADSCitizenDetailsNew = ({
23657
23666
  onGoBack,
23658
23667
  onChange: _onChange = () => {}
23659
23668
  }) => {
23660
- var _errors$name, _errors$address, _errors$pincode;
23669
+ var _window$location, _window$location$path, _errors$name, _errors$address, _errors$pincode;
23661
23670
  const dispatch = useDispatch();
23671
+ const isEmployee = typeof window !== "undefined" && ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : (_window$location$path = _window$location.pathname) === null || _window$location$path === void 0 ? void 0 : _window$location$path.includes("/employee"));
23672
+ const formStorageKey = `ads_form_${isEmployee ? "employee" : "citizen"}`;
23662
23673
  const userInfo = Digit.UserService.getUser();
23663
23674
  const isCitizen = window.location.href.includes("citizen");
23664
23675
  const tenantId = isCitizen ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
@@ -23672,6 +23683,7 @@ const ADSCitizenDetailsNew = ({
23672
23683
  control,
23673
23684
  handleSubmit,
23674
23685
  setValue,
23686
+ reset,
23675
23687
  formState: {
23676
23688
  errors
23677
23689
  },
@@ -23679,13 +23691,14 @@ const ADSCitizenDetailsNew = ({
23679
23691
  } = useForm({
23680
23692
  mode: "onChange",
23681
23693
  defaultValues: {
23682
- name: isCitizen ? name || "" : "",
23694
+ name: name || "",
23683
23695
  emailId: isCitizen ? emailId || "" : "",
23684
23696
  mobileNumber: isCitizen ? mobileNumber || "" : "",
23685
23697
  address: "",
23686
23698
  pincode: ""
23687
23699
  }
23688
23700
  });
23701
+ if (typeof window !== "undefined") window.__ADS_FORM_DRAFT = window.__ADS_FORM_DRAFT || {};
23689
23702
  useEffect(() => {
23690
23703
  if (currentStepData !== null && currentStepData !== void 0 && currentStepData.CreatedResponse) {
23691
23704
  const created = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.CreatedResponse;
@@ -23700,6 +23713,19 @@ const ADSCitizenDetailsNew = ({
23700
23713
  }
23701
23714
  }
23702
23715
  }, [currentStepData, setValue]);
23716
+ useEffect(() => {
23717
+ try {
23718
+ var _window$__ADS_FORM_DR;
23719
+ const mem = (_window$__ADS_FORM_DR = window.__ADS_FORM_DRAFT) === null || _window$__ADS_FORM_DR === void 0 ? void 0 : _window$__ADS_FORM_DR[formStorageKey];
23720
+ if (mem && typeof mem === "object") {
23721
+ reset(mem);
23722
+ console.info("[ADS] rehydrated form from in-memory draft");
23723
+ return;
23724
+ }
23725
+ } catch (e) {
23726
+ console.warn("[ADS] failed to rehydrate from in-memory", e);
23727
+ }
23728
+ }, []);
23703
23729
  const onSubmit = async data => {
23704
23730
  var _currentStepData$ads, _currentStepData$Crea;
23705
23731
  const applicationDate = Date.now();
@@ -24061,8 +24087,8 @@ const AvailabilityModal = ({
24061
24087
  });
24062
24088
  const slots = (slotResults === null || slotResults === void 0 ? void 0 : slotResults.advertisementSlotAvailabiltityDetails) || [];
24063
24089
  const existingForAd = (cartSlots === null || cartSlots === void 0 ? void 0 : (_cartSlots$find = cartSlots.find(item => {
24064
- var _item$ad, _item$ad2, _item$ad3;
24065
- return (item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id) === (ad === null || ad === void 0 ? void 0 : ad.id) && (item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.bookingStartDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate) && (item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.bookingEndDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate);
24090
+ var _item$ad;
24091
+ return (item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id) === (ad === null || ad === void 0 ? void 0 : ad.id);
24066
24092
  })) === null || _cartSlots$find === void 0 ? void 0 : _cartSlots$find.slots) || [];
24067
24093
  const allBooked = (slots === null || slots === void 0 ? void 0 : slots.length) > 0 && (slots === null || slots === void 0 ? void 0 : slots.every(s => (s === null || s === void 0 ? void 0 : s.slotStaus) !== "AVAILABLE"));
24068
24094
  const allAvailableSlots = slots === null || slots === void 0 ? void 0 : slots.filter(s => (s === null || s === void 0 ? void 0 : s.slotStaus) === "AVAILABLE");
@@ -24088,9 +24114,9 @@ const AvailabilityModal = ({
24088
24114
  nightLight: (ad === null || ad === void 0 ? void 0 : ad.light) === "With Light",
24089
24115
  bookingStartDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate,
24090
24116
  bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate
24091
- }, dateRange);
24117
+ });
24092
24118
  } else if ((existingForAd === null || existingForAd === void 0 ? void 0 : existingForAd.length) > 0) {
24093
- onRemoveSlot(ad, dateRange);
24119
+ onRemoveSlot(ad);
24094
24120
  }
24095
24121
  setSelectedSlots([]);
24096
24122
  setSelectAll(false);
@@ -24110,7 +24136,7 @@ const AvailabilityModal = ({
24110
24136
  setSelectAll(false);
24111
24137
  setSelectedSlots([]);
24112
24138
  }
24113
- }, [ad, dateRange]);
24139
+ }, [ad]);
24114
24140
  const columns = [{
24115
24141
  Header: () => /*#__PURE__*/React.createElement("input", {
24116
24142
  type: "checkbox",
@@ -24315,10 +24341,12 @@ const CartModal = ({
24315
24341
  onRemoveSlot,
24316
24342
  t
24317
24343
  }) => {
24318
- const getKey = ad => `${ad === null || ad === void 0 ? void 0 : ad.id}_${ad === null || ad === void 0 ? void 0 : ad.bookingStartDate}_${ad === null || ad === void 0 ? void 0 : ad.bookingEndDate}`;
24319
- const [expanded, setExpanded] = useState(() => cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.map(item => getKey(item.ad)));
24320
- const toggleExpand = key => {
24321
- setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(key) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== key) : [...prev, key]);
24344
+ const [expanded, setExpanded] = useState(() => cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.map(item => {
24345
+ var _item$ad;
24346
+ return item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id;
24347
+ }));
24348
+ const toggleExpand = adId => {
24349
+ setExpanded(prev => prev !== null && prev !== void 0 && prev.includes(adId) ? prev === null || prev === void 0 ? void 0 : prev.filter(id => id !== adId) : [...prev, adId]);
24322
24350
  };
24323
24351
  const makeColumns = ad => [{
24324
24352
  Header: t("ADS_DATE"),
@@ -24426,11 +24454,10 @@ const CartModal = ({
24426
24454
  color: "#666"
24427
24455
  }
24428
24456
  }, t("ADS_NO_ITEMS_IN_CART")) : cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.map((item, idx) => {
24429
- var _item$ad, _item$ad2, _item$ad3, _item$slots;
24430
- const key = getKey(item === null || item === void 0 ? void 0 : item.ad);
24431
- const isOpen = expanded === null || expanded === void 0 ? void 0 : expanded.includes(key);
24457
+ var _item$ad3, _item$ad4, _item$ad5, _item$slots;
24458
+ const isOpen = expanded === null || expanded === void 0 ? void 0 : expanded.includes(item.ad.id);
24432
24459
  return /*#__PURE__*/React.createElement("div", {
24433
- key: key,
24460
+ key: idx,
24434
24461
  style: {
24435
24462
  marginBottom: "16px",
24436
24463
  border: "1px solid #ddd",
@@ -24449,24 +24476,21 @@ const CartModal = ({
24449
24476
  alignItems: "center"
24450
24477
  }
24451
24478
  }, /*#__PURE__*/React.createElement("div", {
24452
- onClick: () => toggleExpand(key),
24479
+ onClick: () => {
24480
+ var _item$ad2;
24481
+ return toggleExpand(item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.id);
24482
+ },
24453
24483
  style: {
24454
24484
  cursor: "pointer",
24455
24485
  flex: 1
24456
24486
  }
24457
- }, item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.name, item !== null && item !== void 0 && (_item$ad2 = item.ad) !== null && _item$ad2 !== void 0 && _item$ad2.amount ? ` — ₹${((item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.amount) * 1.18 * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length)).toFixed(2)}` : "", /*#__PURE__*/React.createElement("span", {
24487
+ }, item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.name, item !== null && item !== void 0 && (_item$ad4 = item.ad) !== null && _item$ad4 !== void 0 && _item$ad4.amount ? ` — ₹${((item === null || item === void 0 ? void 0 : (_item$ad5 = item.ad) === null || _item$ad5 === void 0 ? void 0 : _item$ad5.amount) * 1.18 * (item === null || item === void 0 ? void 0 : (_item$slots = item.slots) === null || _item$slots === void 0 ? void 0 : _item$slots.length)).toFixed(2)}` : "", /*#__PURE__*/React.createElement("span", {
24458
24488
  style: {
24459
24489
  fontSize: "18px",
24460
24490
  marginLeft: "8px"
24461
24491
  }
24462
24492
  }, isOpen ? "▾" : "▸")), /*#__PURE__*/React.createElement("button", {
24463
- onClick: () => {
24464
- var _item$ad4, _item$ad5;
24465
- return onRemoveSlot(item === null || item === void 0 ? void 0 : item.ad, {
24466
- startDate: item === null || item === void 0 ? void 0 : (_item$ad4 = item.ad) === null || _item$ad4 === void 0 ? void 0 : _item$ad4.bookingStartDate,
24467
- endDate: item === null || item === void 0 ? void 0 : (_item$ad5 = item.ad) === null || _item$ad5 === void 0 ? void 0 : _item$ad5.bookingEndDate
24468
- });
24469
- },
24493
+ onClick: () => onRemoveSlot(item === null || item === void 0 ? void 0 : item.ad),
24470
24494
  style: {
24471
24495
  padding: "6px 12px",
24472
24496
  borderRadius: "6px",
@@ -24483,7 +24507,7 @@ const CartModal = ({
24483
24507
  }
24484
24508
  }, /*#__PURE__*/React.createElement(Table, {
24485
24509
  t: t,
24486
- data: item === null || item === void 0 ? void 0 : item.slots,
24510
+ data: item.slots,
24487
24511
  columns: makeColumns(),
24488
24512
  disableSort: true,
24489
24513
  isPaginationRequired: false,
@@ -24889,53 +24913,40 @@ const ADSCitizenSecond = ({
24889
24913
  });
24890
24914
  setShowModal(true);
24891
24915
  };
24892
- const handleRemoveFromCart = (ad, dateRange) => {
24893
- setCartSlots(prev => prev.filter(item => {
24894
- var _item$ad, _item$ad2, _item$ad3;
24895
- return !((item === null || item === void 0 ? void 0 : (_item$ad = item.ad) === null || _item$ad === void 0 ? void 0 : _item$ad.id) === (ad === null || ad === void 0 ? void 0 : ad.id) && (item === null || item === void 0 ? void 0 : (_item$ad2 = item.ad) === null || _item$ad2 === void 0 ? void 0 : _item$ad2.bookingStartDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate) && (item === null || item === void 0 ? void 0 : (_item$ad3 = item.ad) === null || _item$ad3 === void 0 ? void 0 : _item$ad3.bookingEndDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate));
24896
- }));
24916
+ const handleRemoveFromCart = ad => {
24917
+ setCartSlots(prev => prev.filter(item => item.ad.id !== ad.id));
24897
24918
  setShowToast({
24898
- label: `Removed slots for ${ad === null || ad === void 0 ? void 0 : ad.name} (${dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate} → ${dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate})`,
24919
+ label: `Removed all slots for ${ad.name}`,
24899
24920
  error: true
24900
24921
  });
24901
24922
  };
24902
- const handleAddToCart = (slots, ad, dateRange) => {
24923
+ const handleAddToCart = (slots, ad) => {
24903
24924
  setCartSlots(prev => {
24904
- const enrichedSlots = slots === null || slots === void 0 ? void 0 : slots.map(s => ({
24925
+ const enrichedSlots = slots.map(s => ({
24905
24926
  ...s,
24906
24927
  bookingStartDate: s === null || s === void 0 ? void 0 : s.bookingDate,
24907
24928
  bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate,
24908
24929
  bookingFromTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startTime,
24909
24930
  bookingToTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endTime
24910
24931
  }));
24911
- const existing = prev.find(item => {
24912
- var _item$ad4, _item$ad5, _item$ad6;
24913
- return (item === null || item === void 0 ? void 0 : (_item$ad4 = item.ad) === null || _item$ad4 === void 0 ? void 0 : _item$ad4.id) === (ad === null || ad === void 0 ? void 0 : ad.id) && (item === null || item === void 0 ? void 0 : (_item$ad5 = item.ad) === null || _item$ad5 === void 0 ? void 0 : _item$ad5.bookingStartDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate) && (item === null || item === void 0 ? void 0 : (_item$ad6 = item.ad) === null || _item$ad6 === void 0 ? void 0 : _item$ad6.bookingEndDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate);
24914
- });
24932
+ const existing = prev.find(item => item.ad.id === ad.id);
24915
24933
  let updated;
24916
24934
  if (existing) {
24917
- updated = prev.map(item => {
24918
- var _item$ad7, _item$ad8, _item$ad9;
24919
- return (item === null || item === void 0 ? void 0 : (_item$ad7 = item.ad) === null || _item$ad7 === void 0 ? void 0 : _item$ad7.id) === (ad === null || ad === void 0 ? void 0 : ad.id) && (item === null || item === void 0 ? void 0 : (_item$ad8 = item.ad) === null || _item$ad8 === void 0 ? void 0 : _item$ad8.bookingStartDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate) && (item === null || item === void 0 ? void 0 : (_item$ad9 = item.ad) === null || _item$ad9 === void 0 ? void 0 : _item$ad9.bookingEndDate) === (dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate) ? {
24920
- ...item,
24921
- slots: enrichedSlots
24922
- } : item;
24923
- });
24935
+ updated = prev.map(item => item.ad.id === ad.id ? {
24936
+ ...item,
24937
+ slots: enrichedSlots
24938
+ } : item);
24924
24939
  setShowToast({
24925
- label: `Updated ${enrichedSlots.length} slot(s) for ${ad === null || ad === void 0 ? void 0 : ad.name} (${dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate} → ${dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate})`,
24940
+ label: `Updated ${enrichedSlots.length} slot(s) for ${ad.name}`,
24926
24941
  error: false
24927
24942
  });
24928
24943
  } else {
24929
24944
  updated = [...prev, {
24930
- ad: {
24931
- ...ad,
24932
- bookingStartDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate,
24933
- bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate
24934
- },
24945
+ ad,
24935
24946
  slots: enrichedSlots
24936
24947
  }];
24937
24948
  setShowToast({
24938
- label: `Added ${enrichedSlots === null || enrichedSlots === void 0 ? void 0 : enrichedSlots.length} slot(s) to ${ad === null || ad === void 0 ? void 0 : ad.name} (${dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate} → ${dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate})`,
24949
+ label: `Added ${enrichedSlots.length} slot(s) to ${ad.name}`,
24939
24950
  error: false
24940
24951
  });
24941
24952
  }
@@ -26939,12 +26950,6 @@ const ADSSelectProofIdentity = ({
26939
26950
  };
26940
26951
  onSelect(config.key, documentStep);
26941
26952
  };
26942
- useEffect(() => {
26943
- if (toastError) {
26944
- const timer = setTimeout(() => setToastError(null), 2000);
26945
- return () => clearTimeout(timer);
26946
- }
26947
- }, [toastError]);
26948
26953
  const onSkip = () => onSelect();
26949
26954
  return /*#__PURE__*/React.createElement("div", null, !isLoading ? /*#__PURE__*/React.createElement(FormStep, {
26950
26955
  t: t,
@@ -26992,7 +26997,6 @@ function ADSSelectDocument$1({
26992
26997
  const [uploadedFile, setUploadedFile] = useState((doc === null || doc === void 0 ? void 0 : doc.fileStoreId) || null);
26993
26998
  const [fieldError, setFieldError] = useState(null);
26994
26999
  const [loading, setLoading] = useState(false);
26995
- const isCitizen = window.location.href.includes("citizen");
26996
27000
  function selectfile(e) {
26997
27001
  const selected = e.target.files && e.target.files[0];
26998
27002
  if (!selected) return;
@@ -27053,15 +27057,11 @@ function ADSSelectDocument$1({
27053
27057
  marginBottom: "24px"
27054
27058
  }
27055
27059
  }, loading && /*#__PURE__*/React.createElement(Loader$1, null), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
27056
- className: "card-label-smaller",
27057
- style: {
27058
- width: "100%"
27059
- }
27060
+ className: "card-label-smaller"
27060
27061
  }, t(doc === null || doc === void 0 ? void 0 : doc.code.replaceAll(".", "_")) + (doc !== null && doc !== void 0 && doc.required ? " *" : ""))), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement("div", {
27061
27062
  className: "field",
27062
27063
  style: {
27063
- width: "100%",
27064
- maxWidth: !isCitizen && "500px"
27064
+ width: "100%"
27065
27065
  }
27066
27066
  }, /*#__PURE__*/React.createElement(UploadFile, {
27067
27067
  onUpload: selectfile,