@mseva/upyog-ui-module-ads 1.1.53 → 1.1.55

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.
@@ -16763,6 +16763,72 @@ const GIS = ({
16763
16763
  }))));
16764
16764
  };
16765
16765
 
16766
+ const getTimelineAcknowledgementData = (workflowDetails, tenantInfo, t) => {
16767
+ var _workflowDetails$data, _workflowDetails$data2, _processInstances$, _processInstances$2, _processInstances$3, _timeline$, _timeline$2, _timeline$3, _timeline$4;
16768
+ const timeline = (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data = workflowDetails.data) === null || _workflowDetails$data === void 0 ? void 0 : _workflowDetails$data.timeline) || (workflowDetails === null || workflowDetails === void 0 ? void 0 : workflowDetails.timeline) || [];
16769
+ const processInstances = (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data2 = workflowDetails.data) === null || _workflowDetails$data2 === void 0 ? void 0 : _workflowDetails$data2.processInstances) || (workflowDetails === null || workflowDetails === void 0 ? void 0 : workflowDetails.processInstances) || [];
16770
+ const businessId = (processInstances === null || processInstances === void 0 ? void 0 : (_processInstances$ = processInstances[0]) === null || _processInstances$ === void 0 ? void 0 : _processInstances$.businessId) || "N/A";
16771
+ const businessService = (processInstances === null || processInstances === void 0 ? void 0 : (_processInstances$2 = processInstances[0]) === null || _processInstances$2 === void 0 ? void 0 : _processInstances$2.businessService) || "N/A";
16772
+ const moduleName = (processInstances === null || processInstances === void 0 ? void 0 : (_processInstances$3 = processInstances[0]) === null || _processInstances$3 === void 0 ? void 0 : _processInstances$3.moduleName) || "N/A";
16773
+ const timelineRows = timeline.map((item, index) => {
16774
+ var _item$auditDetails, _item$auditDetails2, _item$assigner, _item$assigner2, _item$assigner3, _item$wfComment;
16775
+ const createdDate = (item === null || item === void 0 ? void 0 : (_item$auditDetails = item.auditDetails) === null || _item$auditDetails === void 0 ? void 0 : _item$auditDetails.created) || "N/A";
16776
+ const timing = (item === null || item === void 0 ? void 0 : (_item$auditDetails2 = item.auditDetails) === null || _item$auditDetails2 === void 0 ? void 0 : _item$auditDetails2.timing) || "N/A";
16777
+ const assignerName = (item === null || item === void 0 ? void 0 : (_item$assigner = item.assigner) === null || _item$assigner === void 0 ? void 0 : _item$assigner.name) || "N/A";
16778
+ const assignerType = (item === null || item === void 0 ? void 0 : (_item$assigner2 = item.assigner) === null || _item$assigner2 === void 0 ? void 0 : _item$assigner2.type) || "N/A";
16779
+ const mobileNumber = (item === null || item === void 0 ? void 0 : (_item$assigner3 = item.assigner) === null || _item$assigner3 === void 0 ? void 0 : _item$assigner3.mobileNumber) || "N/A";
16780
+ const action = (item === null || item === void 0 ? void 0 : item.performedAction) || "N/A";
16781
+ const status = (item === null || item === void 0 ? void 0 : item.status) || (item === null || item === void 0 ? void 0 : item.state) || "N/A";
16782
+ const comment = (item === null || item === void 0 ? void 0 : (_item$wfComment = item.wfComment) === null || _item$wfComment === void 0 ? void 0 : _item$wfComment[0]) || "-";
16783
+ const documents = (item === null || item === void 0 ? void 0 : item.wfDocuments) || [];
16784
+ return {
16785
+ sNo: index + 1,
16786
+ action: t ? t(action) : action,
16787
+ status: t ? t(status) : status,
16788
+ assignerName,
16789
+ assignerType,
16790
+ mobileNumber,
16791
+ designation: assignerType,
16792
+ date: createdDate,
16793
+ time: timing,
16794
+ dateTime: `${createdDate} ${timing !== "N/A" ? timing : ""}`.trim(),
16795
+ comment,
16796
+ documents: documents.map(doc => ({
16797
+ name: (doc === null || doc === void 0 ? void 0 : doc.fileName) || (doc === null || doc === void 0 ? void 0 : doc.documentType) || "Document",
16798
+ type: (doc === null || doc === void 0 ? void 0 : doc.documentType) || "Document",
16799
+ fileStoreId: doc === null || doc === void 0 ? void 0 : doc.fileStoreId
16800
+ })),
16801
+ hasDocuments: documents.length > 0
16802
+ };
16803
+ });
16804
+ return {
16805
+ t,
16806
+ tenantId: (tenantInfo === null || tenantInfo === void 0 ? void 0 : tenantInfo.code) || "",
16807
+ tenantName: (tenantInfo === null || tenantInfo === void 0 ? void 0 : tenantInfo.name) || (tenantInfo === null || tenantInfo === void 0 ? void 0 : tenantInfo.i18nKey) || "Government Department",
16808
+ name: t ? t("TIMELINE_PDF_TITLE") : "Application Timeline",
16809
+ heading: t ? t("TIMELINE_PDF_HEADING") : "File Movement Report",
16810
+ businessId,
16811
+ businessService: t ? t(`CS_COMMON_${businessService === null || businessService === void 0 ? void 0 : businessService.toUpperCase()}`) : businessService,
16812
+ moduleName,
16813
+ currentStatus: t ? t((timeline === null || timeline === void 0 ? void 0 : (_timeline$ = timeline[0]) === null || _timeline$ === void 0 ? void 0 : _timeline$.status) || (timeline === null || timeline === void 0 ? void 0 : (_timeline$2 = timeline[0]) === null || _timeline$2 === void 0 ? void 0 : _timeline$2.state) || "N/A") : (timeline === null || timeline === void 0 ? void 0 : (_timeline$3 = timeline[0]) === null || _timeline$3 === void 0 ? void 0 : _timeline$3.status) || (timeline === null || timeline === void 0 ? void 0 : (_timeline$4 = timeline[0]) === null || _timeline$4 === void 0 ? void 0 : _timeline$4.state) || "N/A",
16814
+ generatedDate: new Date().toLocaleDateString("en-IN", {
16815
+ day: "2-digit",
16816
+ month: "long",
16817
+ year: "numeric"
16818
+ }),
16819
+ generatedDateTime: new Date().toLocaleString("en-IN", {
16820
+ day: "2-digit",
16821
+ month: "2-digit",
16822
+ year: "numeric",
16823
+ hour: "2-digit",
16824
+ minute: "2-digit",
16825
+ hour12: true
16826
+ }),
16827
+ timelineRows,
16828
+ totalSteps: timelineRows.length
16829
+ };
16830
+ };
16831
+
16766
16832
  const parseDate = dateStr => {
16767
16833
  if (!dateStr || dateStr === "N/A") return null;
16768
16834
  if (typeof dateStr === "string" && dateStr !== null && dateStr !== void 0 && dateStr.includes("/")) {
@@ -16821,12 +16887,7 @@ const TimelineDocument = React.memo(({
16821
16887
  }, [value, Code]);
16822
16888
  if (isLoading) return /*#__PURE__*/React.createElement(Loader$2, null);
16823
16889
  return /*#__PURE__*/React.createElement("div", {
16824
- style: {
16825
- marginTop: "10px",
16826
- display: "flex",
16827
- flexWrap: "wrap",
16828
- gap: "10px"
16829
- }
16890
+ className: "timeline-docs-wrapper"
16830
16891
  }, documents === null || documents === void 0 ? void 0 : documents.map((document, idx) => {
16831
16892
  const documentLink = pdfDownloadLink$1(data === null || data === void 0 ? void 0 : data.pdfFiles, document === null || document === void 0 ? void 0 : document.fileStoreId);
16832
16893
  if (!documentLink) return null;
@@ -16835,14 +16896,9 @@ const TimelineDocument = React.memo(({
16835
16896
  target: "_blank",
16836
16897
  rel: "noopener noreferrer",
16837
16898
  href: documentLink,
16838
- style: {
16839
- minWidth: "100px"
16840
- }
16899
+ className: "timeline-doc-link"
16841
16900
  }, /*#__PURE__*/React.createElement(PDFSvg, {
16842
- style: {
16843
- background: "#f6f6f6",
16844
- padding: "8px"
16845
- }
16901
+ className: "timeline-doc-icon"
16846
16902
  }));
16847
16903
  }));
16848
16904
  });
@@ -16885,7 +16941,8 @@ const HEADER_FIELDS = [{
16885
16941
  }];
16886
16942
  const TimelineCaption = React.memo(({
16887
16943
  checkpoint,
16888
- t
16944
+ t,
16945
+ onDownloadPDF
16889
16946
  }) => {
16890
16947
  var _checkpoint$documents, _checkpoint$documents2;
16891
16948
  return /*#__PURE__*/React.createElement("div", {
@@ -16929,15 +16986,28 @@ const ApplicationTimeline = ({
16929
16986
  data: details
16930
16987
  }), [details]);
16931
16988
  const currentState = workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data2 = workflowDetails.data) === null || _workflowDetails$data2 === void 0 ? void 0 : (_workflowDetails$data3 = _workflowDetails$data2.timeline) === null || _workflowDetails$data3 === void 0 ? void 0 : (_workflowDetails$data4 = _workflowDetails$data3[0]) === null || _workflowDetails$data4 === void 0 ? void 0 : _workflowDetails$data4.state;
16989
+ const handleDownloadPDF = useCallback(() => {
16990
+ const tenantInfo = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY") || {};
16991
+ const acknowledgementData = getTimelineAcknowledgementData(workflowDetails, tenantInfo, t);
16992
+ Digit.Utils.pdf.generateTimelinePDF(acknowledgementData);
16993
+ }, [workflowDetails, t]);
16932
16994
  if (!(timeline !== null && timeline !== void 0 && timeline.length)) return null;
16933
16995
  return /*#__PURE__*/React.createElement("div", {
16934
16996
  className: "timeline-hoc-container"
16935
- }, (timeline === null || timeline === void 0 ? void 0 : timeline.length) === 1 ? /*#__PURE__*/React.createElement(CheckPoint, {
16997
+ }, /*#__PURE__*/React.createElement("div", {
16998
+ className: "timeline-header-wrapper"
16999
+ }, /*#__PURE__*/React.createElement(CardSubHeader, {
17000
+ className: "timeline-subheader"
17001
+ }, t("CS_APPLICATION_DETAILS_APPLICATION_TIMELINE")), /*#__PURE__*/React.createElement("span", {
17002
+ onClick: handleDownloadPDF,
17003
+ className: "download-button"
17004
+ }, t("CS_COMMON_DOWNLOAD"))), (timeline === null || timeline === void 0 ? void 0 : timeline.length) === 1 ? /*#__PURE__*/React.createElement(CheckPoint, {
16936
17005
  isCompleted: true,
16937
17006
  label: t(timeline === null || timeline === void 0 ? void 0 : (_timeline$ = timeline[0]) === null || _timeline$ === void 0 ? void 0 : _timeline$.state),
16938
17007
  customChild: /*#__PURE__*/React.createElement(TimelineCaption, {
16939
17008
  checkpoint: timeline === null || timeline === void 0 ? void 0 : timeline[0],
16940
- t: t
17009
+ t: t,
17010
+ onDownloadPDF: handleDownloadPDF
16941
17011
  })
16942
17012
  }) : /*#__PURE__*/React.createElement(ConnectingCheckPoints, null, timeline === null || timeline === void 0 ? void 0 : timeline.map(checkpoint => /*#__PURE__*/React.createElement(CheckPoint, {
16943
17013
  key: checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint.id,
@@ -16946,7 +17016,8 @@ const ApplicationTimeline = ({
16946
17016
  label: t(checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint.state),
16947
17017
  customChild: /*#__PURE__*/React.createElement(TimelineCaption, {
16948
17018
  checkpoint: checkpoint,
16949
- t: t
17019
+ t: t,
17020
+ onDownloadPDF: handleDownloadPDF
16950
17021
  })
16951
17022
  }))));
16952
17023
  };
@@ -25301,7 +25372,7 @@ const ADSCitizenSecond = ({
25301
25372
  t: t
25302
25373
  }), showToast && /*#__PURE__*/React.createElement(Toast, {
25303
25374
  error: showToast.error,
25304
- label: t ? t(showToast.label) : showToast.label,
25375
+ label: t(showToast.label),
25305
25376
  onClose: () => setShowToast(null),
25306
25377
  isDleteBtn: true
25307
25378
  })));