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

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, FormComposer, MultiLink, 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, 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';
@@ -238,6 +238,27 @@ 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
+ };
241
262
  const areSlotsEqual = (a = [], b = []) => {
242
263
  if ((a === null || a === void 0 ? void 0 : a.length) !== (b === null || b === void 0 ? void 0 : b.length)) return false;
243
264
  const key = s => s === null || s === void 0 ? void 0 : s.bookingDate;
@@ -6911,12 +6932,12 @@ const TableConfig = t => ({
6911
6932
  Cell: ({
6912
6933
  row
6913
6934
  }) => {
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"]}`));
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"]}`));
6916
6937
  },
6917
6938
  mobileCell: original => {
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"]}`));
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"])}`));
6920
6941
  }
6921
6942
  }, {
6922
6943
  Header: t("ADS_DATE"),
@@ -6929,8 +6950,8 @@ const TableConfig = t => ({
6929
6950
  return GetCell(dateStr);
6930
6951
  },
6931
6952
  mobileCell: original => {
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"];
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"];
6934
6955
  const dateStr = createdTime ? new Date(createdTime).toLocaleDateString("en-GB") : "";
6935
6956
  return GetMobCell(dateStr);
6936
6957
  }
@@ -19711,307 +19732,55 @@ const ADSMyApplications = () => {
19711
19732
  }, t("ADS_NEW_BOOKING") + " +"))));
19712
19733
  };
19713
19734
 
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
- };
19735
+ var isArray = Array.isArray;
19736
+ var isArray_1 = isArray;
19768
19737
 
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
- }));
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;
19747
+
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];
19874
19765
  }
19875
- }, [approverData]);
19876
- function selectFile(e) {
19877
- setFile(e.target.files[0]);
19878
19766
  }
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
- });
19918
- }
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;
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;
20015
19784
  }
20016
19785
  return symToStringTag$1 && symToStringTag$1 in Object(value) ? _getRawTag(value) : _objectToString(value);
20017
19786
  }
@@ -22186,12 +21955,10 @@ const ADSCartDetails$1 = ({
22186
21955
  cartDetails,
22187
21956
  t
22188
21957
  }) => {
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]);
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]);
22195
21962
  };
22196
21963
  const makeColumns = () => [{
22197
21964
  Header: t("ADS_DATE"),
@@ -22225,8 +21992,9 @@ const ADSCartDetails$1 = ({
22225
21992
  color: "#666"
22226
21993
  }
22227
21994
  }, t("ADS_NO_ADVERTISMENT_DETAILS")) : cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.map((item, idx) => {
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);
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);
22230
21998
  return /*#__PURE__*/React.createElement("div", {
22231
21999
  key: idx,
22232
22000
  style: {
@@ -22236,10 +22004,7 @@ const ADSCartDetails$1 = ({
22236
22004
  overflow: "hidden"
22237
22005
  }
22238
22006
  }, /*#__PURE__*/React.createElement("div", {
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
- },
22007
+ onClick: () => toggleExpand(key),
22243
22008
  style: {
22244
22009
  background: "#f9f9f9",
22245
22010
  padding: "10px 14px",
@@ -22251,7 +22016,7 @@ const ADSCartDetails$1 = ({
22251
22016
  justifyContent: "space-between",
22252
22017
  alignItems: "center"
22253
22018
  }
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", {
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", {
22255
22020
  style: {
22256
22021
  fontSize: "18px"
22257
22022
  }
@@ -22279,7 +22044,7 @@ const ADSCartDetails$1 = ({
22279
22044
  };
22280
22045
 
22281
22046
  const ADSApplicationDetails = () => {
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;
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;
22283
22048
  const [wfActionsState, setWfActionsState] = useState([]);
22284
22049
  const {
22285
22050
  t
@@ -22439,32 +22204,6 @@ const ADSApplicationDetails = () => {
22439
22204
  label: t("PTR_PET_DOWNLOAD_ACK_FORM"),
22440
22205
  onClick: () => downloadAcknowledgement(application)
22441
22206
  });
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
- }))) || [];
22468
22207
  if (reciept_data && (reciept_data === null || reciept_data === void 0 ? void 0 : reciept_data.Payments.length) > 0 && !recieptDataLoading) {
22469
22208
  dowloadOptions.push({
22470
22209
  label: t("CHB_FEE_RECEIPT"),
@@ -22533,7 +22272,7 @@ const ADSApplicationDetails = () => {
22533
22272
  }), /*#__PURE__*/React.createElement(Row, {
22534
22273
  className: "border-none",
22535
22274
  label: t("BOOKING_STATUS"),
22536
- text: ads_details === null || ads_details === void 0 ? void 0 : ads_details.bookingStatus
22275
+ text: t(ads_details === null || ads_details === void 0 ? void 0 : ads_details.bookingStatus)
22537
22276
  }), (ads_details === null || ads_details === void 0 ? void 0 : ads_details.receiptNo) && /*#__PURE__*/React.createElement(Row, {
22538
22277
  className: "border-none",
22539
22278
  label: t("CITIZEN_SUCCESS_ADVT_HOARDINGS_PAYMENT_RECEIPT_NO"),
@@ -22577,6 +22316,258 @@ const ADSApplicationDetails = () => {
22577
22316
  })));
22578
22317
  };
22579
22318
 
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
+
22580
22571
  var defineProperty = function () {
22581
22572
  try {
22582
22573
  var func = _getNative(Object, 'defineProperty');
@@ -23666,10 +23657,8 @@ const ADSCitizenDetailsNew = ({
23666
23657
  onGoBack,
23667
23658
  onChange: _onChange = () => {}
23668
23659
  }) => {
23669
- var _window$location, _window$location$path, _errors$name, _errors$address, _errors$pincode;
23660
+ var _errors$name, _errors$address, _errors$pincode;
23670
23661
  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"}`;
23673
23662
  const userInfo = Digit.UserService.getUser();
23674
23663
  const isCitizen = window.location.href.includes("citizen");
23675
23664
  const tenantId = isCitizen ? window.localStorage.getItem("CITIZEN.CITY") : window.localStorage.getItem("Employee.tenant-id");
@@ -23683,7 +23672,6 @@ const ADSCitizenDetailsNew = ({
23683
23672
  control,
23684
23673
  handleSubmit,
23685
23674
  setValue,
23686
- reset,
23687
23675
  formState: {
23688
23676
  errors
23689
23677
  },
@@ -23691,14 +23679,13 @@ const ADSCitizenDetailsNew = ({
23691
23679
  } = useForm({
23692
23680
  mode: "onChange",
23693
23681
  defaultValues: {
23694
- name: name || "",
23682
+ name: isCitizen ? name || "" : "",
23695
23683
  emailId: isCitizen ? emailId || "" : "",
23696
23684
  mobileNumber: isCitizen ? mobileNumber || "" : "",
23697
23685
  address: "",
23698
23686
  pincode: ""
23699
23687
  }
23700
23688
  });
23701
- if (typeof window !== "undefined") window.__ADS_FORM_DRAFT = window.__ADS_FORM_DRAFT || {};
23702
23689
  useEffect(() => {
23703
23690
  if (currentStepData !== null && currentStepData !== void 0 && currentStepData.CreatedResponse) {
23704
23691
  const created = currentStepData === null || currentStepData === void 0 ? void 0 : currentStepData.CreatedResponse;
@@ -23713,19 +23700,6 @@ const ADSCitizenDetailsNew = ({
23713
23700
  }
23714
23701
  }
23715
23702
  }, [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
- }, []);
23729
23703
  const onSubmit = async data => {
23730
23704
  var _currentStepData$ads, _currentStepData$Crea;
23731
23705
  const applicationDate = Date.now();
@@ -24087,8 +24061,8 @@ const AvailabilityModal = ({
24087
24061
  });
24088
24062
  const slots = (slotResults === null || slotResults === void 0 ? void 0 : slotResults.advertisementSlotAvailabiltityDetails) || [];
24089
24063
  const existingForAd = (cartSlots === null || cartSlots === void 0 ? void 0 : (_cartSlots$find = cartSlots.find(item => {
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);
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);
24092
24066
  })) === null || _cartSlots$find === void 0 ? void 0 : _cartSlots$find.slots) || [];
24093
24067
  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"));
24094
24068
  const allAvailableSlots = slots === null || slots === void 0 ? void 0 : slots.filter(s => (s === null || s === void 0 ? void 0 : s.slotStaus) === "AVAILABLE");
@@ -24114,9 +24088,9 @@ const AvailabilityModal = ({
24114
24088
  nightLight: (ad === null || ad === void 0 ? void 0 : ad.light) === "With Light",
24115
24089
  bookingStartDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startDate,
24116
24090
  bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate
24117
- });
24091
+ }, dateRange);
24118
24092
  } else if ((existingForAd === null || existingForAd === void 0 ? void 0 : existingForAd.length) > 0) {
24119
- onRemoveSlot(ad);
24093
+ onRemoveSlot(ad, dateRange);
24120
24094
  }
24121
24095
  setSelectedSlots([]);
24122
24096
  setSelectAll(false);
@@ -24136,7 +24110,7 @@ const AvailabilityModal = ({
24136
24110
  setSelectAll(false);
24137
24111
  setSelectedSlots([]);
24138
24112
  }
24139
- }, [ad]);
24113
+ }, [ad, dateRange]);
24140
24114
  const columns = [{
24141
24115
  Header: () => /*#__PURE__*/React.createElement("input", {
24142
24116
  type: "checkbox",
@@ -24341,12 +24315,10 @@ const CartModal = ({
24341
24315
  onRemoveSlot,
24342
24316
  t
24343
24317
  }) => {
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]);
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]);
24350
24322
  };
24351
24323
  const makeColumns = ad => [{
24352
24324
  Header: t("ADS_DATE"),
@@ -24454,10 +24426,11 @@ const CartModal = ({
24454
24426
  color: "#666"
24455
24427
  }
24456
24428
  }, t("ADS_NO_ITEMS_IN_CART")) : cartSlots === null || cartSlots === void 0 ? void 0 : cartSlots.map((item, idx) => {
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);
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);
24459
24432
  return /*#__PURE__*/React.createElement("div", {
24460
- key: idx,
24433
+ key: key,
24461
24434
  style: {
24462
24435
  marginBottom: "16px",
24463
24436
  border: "1px solid #ddd",
@@ -24476,21 +24449,24 @@ const CartModal = ({
24476
24449
  alignItems: "center"
24477
24450
  }
24478
24451
  }, /*#__PURE__*/React.createElement("div", {
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
- },
24452
+ onClick: () => toggleExpand(key),
24483
24453
  style: {
24484
24454
  cursor: "pointer",
24485
24455
  flex: 1
24486
24456
  }
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", {
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", {
24488
24458
  style: {
24489
24459
  fontSize: "18px",
24490
24460
  marginLeft: "8px"
24491
24461
  }
24492
24462
  }, isOpen ? "▾" : "▸")), /*#__PURE__*/React.createElement("button", {
24493
- onClick: () => onRemoveSlot(item === null || item === void 0 ? void 0 : item.ad),
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
+ },
24494
24470
  style: {
24495
24471
  padding: "6px 12px",
24496
24472
  borderRadius: "6px",
@@ -24507,7 +24483,7 @@ const CartModal = ({
24507
24483
  }
24508
24484
  }, /*#__PURE__*/React.createElement(Table, {
24509
24485
  t: t,
24510
- data: item.slots,
24486
+ data: item === null || item === void 0 ? void 0 : item.slots,
24511
24487
  columns: makeColumns(),
24512
24488
  disableSort: true,
24513
24489
  isPaginationRequired: false,
@@ -24913,40 +24889,53 @@ const ADSCitizenSecond = ({
24913
24889
  });
24914
24890
  setShowModal(true);
24915
24891
  };
24916
- const handleRemoveFromCart = ad => {
24917
- setCartSlots(prev => prev.filter(item => item.ad.id !== ad.id));
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
+ }));
24918
24897
  setShowToast({
24919
- label: `Removed all slots for ${ad.name}`,
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})`,
24920
24899
  error: true
24921
24900
  });
24922
24901
  };
24923
- const handleAddToCart = (slots, ad) => {
24902
+ const handleAddToCart = (slots, ad, dateRange) => {
24924
24903
  setCartSlots(prev => {
24925
- const enrichedSlots = slots.map(s => ({
24904
+ const enrichedSlots = slots === null || slots === void 0 ? void 0 : slots.map(s => ({
24926
24905
  ...s,
24927
24906
  bookingStartDate: s === null || s === void 0 ? void 0 : s.bookingDate,
24928
24907
  bookingEndDate: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endDate,
24929
24908
  bookingFromTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.startTime,
24930
24909
  bookingToTime: dateRange === null || dateRange === void 0 ? void 0 : dateRange.endTime
24931
24910
  }));
24932
- const existing = prev.find(item => item.ad.id === ad.id);
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
+ });
24933
24915
  let updated;
24934
24916
  if (existing) {
24935
- updated = prev.map(item => item.ad.id === ad.id ? {
24936
- ...item,
24937
- slots: enrichedSlots
24938
- } : item);
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
+ });
24939
24924
  setShowToast({
24940
- label: `Updated ${enrichedSlots.length} slot(s) for ${ad.name}`,
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})`,
24941
24926
  error: false
24942
24927
  });
24943
24928
  } else {
24944
24929
  updated = [...prev, {
24945
- ad,
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
+ },
24946
24935
  slots: enrichedSlots
24947
24936
  }];
24948
24937
  setShowToast({
24949
- label: `Added ${enrichedSlots.length} slot(s) to ${ad.name}`,
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})`,
24950
24939
  error: false
24951
24940
  });
24952
24941
  }
@@ -26950,6 +26939,12 @@ const ADSSelectProofIdentity = ({
26950
26939
  };
26951
26940
  onSelect(config.key, documentStep);
26952
26941
  };
26942
+ useEffect(() => {
26943
+ if (toastError) {
26944
+ const timer = setTimeout(() => setToastError(null), 2000);
26945
+ return () => clearTimeout(timer);
26946
+ }
26947
+ }, [toastError]);
26953
26948
  const onSkip = () => onSelect();
26954
26949
  return /*#__PURE__*/React.createElement("div", null, !isLoading ? /*#__PURE__*/React.createElement(FormStep, {
26955
26950
  t: t,
@@ -26997,6 +26992,7 @@ function ADSSelectDocument$1({
26997
26992
  const [uploadedFile, setUploadedFile] = useState((doc === null || doc === void 0 ? void 0 : doc.fileStoreId) || null);
26998
26993
  const [fieldError, setFieldError] = useState(null);
26999
26994
  const [loading, setLoading] = useState(false);
26995
+ const isCitizen = window.location.href.includes("citizen");
27000
26996
  function selectfile(e) {
27001
26997
  const selected = e.target.files && e.target.files[0];
27002
26998
  if (!selected) return;
@@ -27057,11 +27053,15 @@ function ADSSelectDocument$1({
27057
27053
  marginBottom: "24px"
27058
27054
  }
27059
27055
  }, loading && /*#__PURE__*/React.createElement(Loader$1, null), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
27060
- className: "card-label-smaller"
27056
+ className: "card-label-smaller",
27057
+ style: {
27058
+ width: "100%"
27059
+ }
27061
27060
  }, 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", {
27062
27061
  className: "field",
27063
27062
  style: {
27064
- width: "100%"
27063
+ width: "100%",
27064
+ maxWidth: !isCitizen && "500px"
27065
27065
  }
27066
27066
  }, /*#__PURE__*/React.createElement(UploadFile, {
27067
27067
  onUpload: selectfile,