@mseva/upyog-ui-module-asset 1.1.10 → 1.1.11

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 { SubmitBar, Header, Card, SearchForm, SearchField, Dropdown, TextInput, DatePicker, Table, Loader, Toast, PropertyHouse, CloseSvg, Label, LinkLabel, ActionBar, MobileNumber, RadioButtons, DetailsCard, SearchAction, FilterAction, PopUp, AppContainer, BackButton, PrivateRoute, BreadCrumb, EmployeeModuleCard, CheckBox, Localities, RemoveableTag, UploadFile, ArrowDown, Modal, FormComposer, CardSubHeader, PDFSvg, LabelFieldPair, CardLabel, MultiUploadWrapper, CardHeader, CardSectionHeader, StatusTable, Row, LinkButton, Close as Close$c, BreakLine, TelePhone, DisplayPhotos, CheckPoint, ConnectingCheckPoints, Menu, ButtonSelector, Banner, TickMark, CardLabelError, FormStep, RadioOrSelect, CardText, InfoBannerIcon, TextArea, CardCaption, LocationIcon, CardLabelDesc } from '@mseva/digit-ui-react-components';
1
+ import { SubmitBar, Header, Card, SearchForm, SearchField, Dropdown, TextInput, DatePicker, Table, Loader, Toast, PropertyHouse, CloseSvg, Label, LinkLabel, ActionBar, MobileNumber, RadioButtons, DetailsCard, SearchAction, FilterAction, PopUp, AppContainer, BackButton, PrivateRoute, BreadCrumb, EmployeeModuleCard, CheckBox, Localities, RemoveableTag, UploadFile, ArrowDown, Modal, FormComposer, CardSubHeader, PDFSvg as PDFSvg$1, LabelFieldPair, CardLabel, MultiUploadWrapper, CardHeader, CardSectionHeader, StatusTable, Row, LinkButton, Close as Close$c, BreakLine, TelePhone, DisplayPhotos, CheckPoint, ConnectingCheckPoints, Menu, ButtonSelector, Banner, TickMark, CardLabelError, FormStep, RadioOrSelect, CardText, InfoBannerIcon, TextArea, CardCaption, LocationIcon, CardLabelDesc } from '@mseva/digit-ui-react-components';
2
2
  import React, { useEffect, useMemo, useState, useRef, useCallback, Fragment } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useHistory, Link, useParams, useLocation, Switch, useRouteMatch, Route, Redirect } from 'react-router-dom';
@@ -12224,7 +12224,7 @@ function DocumentsPreview({
12224
12224
  display: "flex",
12225
12225
  justifyContent: "flex-start"
12226
12226
  }
12227
- }, /*#__PURE__*/React.createElement(PDFSvg, null)), /*#__PURE__*/React.createElement("p", {
12227
+ }, /*#__PURE__*/React.createElement(PDFSvg$1, null)), /*#__PURE__*/React.createElement("p", {
12228
12228
  style: {
12229
12229
  marginTop: "8px",
12230
12230
  fontWeight: "bold",
@@ -12265,7 +12265,7 @@ function DocumentsPreview({
12265
12265
  display: "flex",
12266
12266
  justifyContent: "flex-start"
12267
12267
  }
12268
- }, /*#__PURE__*/React.createElement(PDFSvg, null)), /*#__PURE__*/React.createElement("p", {
12268
+ }, /*#__PURE__*/React.createElement(PDFSvg$1, null)), /*#__PURE__*/React.createElement("p", {
12269
12269
  style: {
12270
12270
  marginTop: "8px",
12271
12271
  fontWeight: "bold",
@@ -12330,7 +12330,7 @@ function DocumentsPreview({
12330
12330
  lineHeight: "15px",
12331
12331
  marginBottom: "10px"
12332
12332
  }
12333
- }, `${t(value === null || value === void 0 ? void 0 : value.docInfo)}`) : null, /*#__PURE__*/React.createElement(PDFSvg, null), /*#__PURE__*/React.createElement("p", {
12333
+ }, `${t(value === null || value === void 0 ? void 0 : value.docInfo)}`) : null, /*#__PURE__*/React.createElement(PDFSvg$1, null), /*#__PURE__*/React.createElement("p", {
12334
12334
  style: {
12335
12335
  marginTop: "8px",
12336
12336
  fontSize: "16px",
@@ -15016,6 +15016,194 @@ const PaymentHistory = ({
15016
15016
  }, "Total Payments: ", payments.length))));
15017
15017
  };
15018
15018
 
15019
+ const parseDate = dateStr => {
15020
+ if (!dateStr || dateStr === "N/A") return null;
15021
+ if (typeof dateStr === "string" && dateStr !== null && dateStr !== void 0 && dateStr.includes("/")) {
15022
+ const [day, month, year] = dateStr === null || dateStr === void 0 ? void 0 : dateStr.split("/");
15023
+ return new Date(year, month - 1, day);
15024
+ }
15025
+ return new Date(dateStr);
15026
+ };
15027
+ const calculateDays = (start, end) => {
15028
+ if (!start || !end) return "N/A";
15029
+ const startDate = parseDate(start);
15030
+ const endDate = parseDate(end);
15031
+ if (!startDate || !endDate || isNaN(startDate === null || startDate === void 0 ? void 0 : startDate.getTime()) || isNaN(endDate === null || endDate === void 0 ? void 0 : endDate.getTime())) {
15032
+ return "N/A";
15033
+ }
15034
+ const diffDays = Math.floor((endDate - startDate) / 86400000);
15035
+ return diffDays < 0 ? "N/A" : diffDays === 0 ? "0 Days" : `${diffDays} Days`;
15036
+ };
15037
+ const PDFSvg = React.memo(({
15038
+ width: _width = 85,
15039
+ height: _height = 100,
15040
+ style
15041
+ }) => /*#__PURE__*/React.createElement("svg", {
15042
+ style: style,
15043
+ xmlns: "http://www.w3.org/2000/svg",
15044
+ width: _width,
15045
+ height: _height,
15046
+ viewBox: "0 0 20 20",
15047
+ fill: "gray"
15048
+ }, /*#__PURE__*/React.createElement("path", {
15049
+ d: "M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"
15050
+ })));
15051
+ const pdfDownloadLink = (documents, fileStoreId) => {
15052
+ var _downloadLink$split;
15053
+ const downloadLink = (documents === null || documents === void 0 ? void 0 : documents[fileStoreId]) || "";
15054
+ const formats = (downloadLink === null || downloadLink === void 0 ? void 0 : (_downloadLink$split = downloadLink.split(",")) === null || _downloadLink$split === void 0 ? void 0 : _downloadLink$split.filter(Boolean)) || [];
15055
+ return (formats === null || formats === void 0 ? void 0 : formats.find(link => !(link !== null && link !== void 0 && link.includes("large")) && !(link !== null && link !== void 0 && link.includes("medium")) && !(link !== null && link !== void 0 && link.includes("small")))) || (formats === null || formats === void 0 ? void 0 : formats[0]) || "";
15056
+ };
15057
+ const TimelineDocument = React.memo(({
15058
+ value,
15059
+ Code,
15060
+ index
15061
+ }) => {
15062
+ const {
15063
+ isLoading,
15064
+ data
15065
+ } = Digit.Hooks.ads.useADSDocumentSearch({
15066
+ value
15067
+ }, {
15068
+ value
15069
+ }, Code, index);
15070
+ const documents = useMemo(() => {
15071
+ var _value$documents;
15072
+ const docs = value !== null && value !== void 0 && value.documents ? value === null || value === void 0 ? void 0 : (_value$documents = value.documents) === null || _value$documents === void 0 ? void 0 : _value$documents.documents : value;
15073
+ return (docs === null || docs === void 0 ? void 0 : docs.filter(doc => (doc === null || doc === void 0 ? void 0 : doc.documentType) === Code)) || [];
15074
+ }, [value, Code]);
15075
+ if (isLoading) return /*#__PURE__*/React.createElement(Loader, null);
15076
+ return /*#__PURE__*/React.createElement("div", {
15077
+ style: {
15078
+ marginTop: "10px",
15079
+ display: "flex",
15080
+ flexWrap: "wrap",
15081
+ gap: "10px"
15082
+ }
15083
+ }, documents === null || documents === void 0 ? void 0 : documents.map((document, idx) => {
15084
+ const documentLink = pdfDownloadLink(data === null || data === void 0 ? void 0 : data.pdfFiles, document === null || document === void 0 ? void 0 : document.fileStoreId);
15085
+ if (!documentLink) return null;
15086
+ return /*#__PURE__*/React.createElement("a", {
15087
+ key: idx,
15088
+ target: "_blank",
15089
+ rel: "noopener noreferrer",
15090
+ href: documentLink,
15091
+ style: {
15092
+ minWidth: "100px"
15093
+ }
15094
+ }, /*#__PURE__*/React.createElement(PDFSvg, {
15095
+ style: {
15096
+ background: "#f6f6f6",
15097
+ padding: "8px"
15098
+ }
15099
+ }));
15100
+ }));
15101
+ });
15102
+ const normalizeTimeline = workflowDetails => {
15103
+ var _workflowDetails$data;
15104
+ const rawTimeline = workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data = workflowDetails.data) === null || _workflowDetails$data === void 0 ? void 0 : _workflowDetails$data.timeline;
15105
+ if (!rawTimeline || !Array.isArray(rawTimeline)) return [];
15106
+ return rawTimeline === null || rawTimeline === void 0 ? void 0 : rawTimeline.map((item, index) => {
15107
+ var _item$auditDetails, _item$auditDetails2, _item$assigner, _item$wfComment;
15108
+ 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";
15109
+ const lastModified = (item === null || item === void 0 ? void 0 : (_item$auditDetails2 = item.auditDetails) === null || _item$auditDetails2 === void 0 ? void 0 : _item$auditDetails2.lastModified) || "N/A";
15110
+ return {
15111
+ id: index,
15112
+ state: item === null || item === void 0 ? void 0 : item.state,
15113
+ assignerName: (item === null || item === void 0 ? void 0 : (_item$assigner = item.assigner) === null || _item$assigner === void 0 ? void 0 : _item$assigner.name) || "N/A",
15114
+ performedAction: item === null || item === void 0 ? void 0 : item.performedAction,
15115
+ comment: (item === null || item === void 0 ? void 0 : (_item$wfComment = item.wfComment) === null || _item$wfComment === void 0 ? void 0 : _item$wfComment[0]) || "",
15116
+ documents: (item === null || item === void 0 ? void 0 : item.wfDocuments) || [],
15117
+ createdDate,
15118
+ lastModified,
15119
+ noOfDays: calculateDays(createdDate, lastModified)
15120
+ };
15121
+ });
15122
+ };
15123
+ const HEADER_FIELDS = [{
15124
+ label: "CM_TIMELINE_NAME",
15125
+ key: "assignerName"
15126
+ }, {
15127
+ label: "CM_TIMELINE_ACTION_TAKEN",
15128
+ key: "performedAction"
15129
+ }, {
15130
+ label: "CM_TIMELINE_ACTION_TAKEN_ON",
15131
+ key: "lastModified"
15132
+ }, {
15133
+ label: "CM_TIMELINE_DATE_RECEIVED",
15134
+ key: "createdDate"
15135
+ }, {
15136
+ label: "CM_TIMELINE_NO_OF_DAYS",
15137
+ key: "noOfDays"
15138
+ }];
15139
+ const TimelineCaption = React.memo(({
15140
+ checkpoint,
15141
+ t
15142
+ }) => {
15143
+ var _checkpoint$documents, _checkpoint$documents2;
15144
+ return /*#__PURE__*/React.createElement("div", {
15145
+ className: "timeline-card"
15146
+ }, /*#__PURE__*/React.createElement("div", {
15147
+ className: "timeline-header"
15148
+ }, HEADER_FIELDS === null || HEADER_FIELDS === void 0 ? void 0 : HEADER_FIELDS.map(({
15149
+ label,
15150
+ key
15151
+ }) => /*#__PURE__*/React.createElement("div", {
15152
+ key: key,
15153
+ className: "timeline-header-item"
15154
+ }, /*#__PURE__*/React.createElement("span", {
15155
+ className: "timeline-label"
15156
+ }, t(label), ":"), /*#__PURE__*/React.createElement("span", {
15157
+ className: "timeline-value"
15158
+ }, (checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint[key]) || "N/A")))), /*#__PURE__*/React.createElement("div", {
15159
+ className: "timeline-note"
15160
+ }, /*#__PURE__*/React.createElement("span", {
15161
+ className: "timeline-label"
15162
+ }, t("CM_TIMELINE_NOTE"), ":"), /*#__PURE__*/React.createElement("div", {
15163
+ className: "note-box"
15164
+ }, (checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint.comment) || t("CM_TIMELINE_NO_COMMENTS"))), (checkpoint === null || checkpoint === void 0 ? void 0 : (_checkpoint$documents = checkpoint.documents) === null || _checkpoint$documents === void 0 ? void 0 : _checkpoint$documents.length) > 0 && /*#__PURE__*/React.createElement("div", {
15165
+ className: "timeline-docs"
15166
+ }, /*#__PURE__*/React.createElement("span", {
15167
+ className: "timeline-label"
15168
+ }, t("CM_TIMELINE_DOCUMENT_ATTACHED"), ":"), checkpoint === null || checkpoint === void 0 ? void 0 : (_checkpoint$documents2 = checkpoint.documents) === null || _checkpoint$documents2 === void 0 ? void 0 : _checkpoint$documents2.map((doc, index) => /*#__PURE__*/React.createElement(TimelineDocument, {
15169
+ key: `${doc === null || doc === void 0 ? void 0 : doc.documentType}-${index}`,
15170
+ value: checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint.documents,
15171
+ Code: doc === null || doc === void 0 ? void 0 : doc.documentType,
15172
+ index: index
15173
+ }))));
15174
+ });
15175
+ const ApplicationTimeline = ({
15176
+ workflowDetails,
15177
+ t
15178
+ }) => {
15179
+ var _workflowDetails$data2, _workflowDetails$data3, _workflowDetails$data4, _timeline$;
15180
+ const details = (workflowDetails === null || workflowDetails === void 0 ? void 0 : workflowDetails.data) || workflowDetails;
15181
+ const timeline = useMemo(() => normalizeTimeline({
15182
+ data: details
15183
+ }), [details]);
15184
+ 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;
15185
+ if (!(timeline !== null && timeline !== void 0 && timeline.length)) return null;
15186
+ return /*#__PURE__*/React.createElement("div", {
15187
+ className: "timeline-hoc-container"
15188
+ }, (timeline === null || timeline === void 0 ? void 0 : timeline.length) === 1 ? /*#__PURE__*/React.createElement(CheckPoint, {
15189
+ isCompleted: true,
15190
+ label: t(timeline === null || timeline === void 0 ? void 0 : (_timeline$ = timeline[0]) === null || _timeline$ === void 0 ? void 0 : _timeline$.state),
15191
+ customChild: /*#__PURE__*/React.createElement(TimelineCaption, {
15192
+ checkpoint: timeline === null || timeline === void 0 ? void 0 : timeline[0],
15193
+ t: t
15194
+ })
15195
+ }) : /*#__PURE__*/React.createElement(ConnectingCheckPoints, null, timeline === null || timeline === void 0 ? void 0 : timeline.map(checkpoint => /*#__PURE__*/React.createElement(CheckPoint, {
15196
+ key: checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint.id,
15197
+ keyValue: checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint.id,
15198
+ isCompleted: (checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint.state) === currentState,
15199
+ label: t(checkpoint === null || checkpoint === void 0 ? void 0 : checkpoint.state),
15200
+ customChild: /*#__PURE__*/React.createElement(TimelineCaption, {
15201
+ checkpoint: checkpoint,
15202
+ t: t
15203
+ })
15204
+ }))));
15205
+ };
15206
+
15019
15207
  function ApplicationDetailsContent({
15020
15208
  applicationDetails,
15021
15209
  demandData,
@@ -15067,7 +15255,7 @@ function ApplicationDetailsContent({
15067
15255
  onClick: () => routeTo(value)
15068
15256
  }) : t("CS_NA")
15069
15257
  }];
15070
- console.log("TIMELINE", applicationDetails);
15258
+ console.log("TIMELINE", applicationDetails, moduleCode);
15071
15259
  useEffect(() => {
15072
15260
  const fetchPaymentHistory = async () => {
15073
15261
  if (window.location.href.includes("employee/ws") && applicationData !== null && applicationData !== void 0 && applicationData.connectionNo) {
@@ -15668,7 +15856,7 @@ function ApplicationDetailsContent({
15668
15856
  payments: payments
15669
15857
  }), moduleCode !== "WS" && moduleCode !== "SW" && moduleCode !== "OBPS" && moduleCode !== "BPAStakeholder" && moduleCode !== "BPAREG" && /*#__PURE__*/React.createElement(ApplicationHistory, {
15670
15858
  applicationData: applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.applicationData
15671
- }), showTimeLine && (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data3 = workflowDetails.data) === null || _workflowDetails$data3 === void 0 ? void 0 : (_workflowDetails$data4 = _workflowDetails$data3.timeline) === null || _workflowDetails$data4 === void 0 ? void 0 : _workflowDetails$data4.length) > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BreakLine, null), ((workflowDetails === null || workflowDetails === void 0 ? void 0 : workflowDetails.isLoading) || isDataLoading) && /*#__PURE__*/React.createElement(Loader, null), !(workflowDetails !== null && workflowDetails !== void 0 && workflowDetails.isLoading) && !isDataLoading && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
15859
+ }), showTimeLine && (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data3 = workflowDetails.data) === null || _workflowDetails$data3 === void 0 ? void 0 : (_workflowDetails$data4 = _workflowDetails$data3.timeline) === null || _workflowDetails$data4 === void 0 ? void 0 : _workflowDetails$data4.length) > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BreakLine, null), ((workflowDetails === null || workflowDetails === void 0 ? void 0 : workflowDetails.isLoading) || isDataLoading) && /*#__PURE__*/React.createElement(Loader, null), !(workflowDetails !== null && workflowDetails !== void 0 && workflowDetails.isLoading) && !isDataLoading && moduleCode !== "BPAREG" && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
15672
15860
  id: "timeline"
15673
15861
  }, /*#__PURE__*/React.createElement(CardSectionHeader, {
15674
15862
  style: {
@@ -15698,7 +15886,10 @@ function ApplicationDetailsContent({
15698
15886
  }))), (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data19 = workflowDetails.data) === null || _workflowDetails$data19 === void 0 ? void 0 : (_workflowDetails$data20 = _workflowDetails$data19.timeline) === null || _workflowDetails$data20 === void 0 ? void 0 : _workflowDetails$data20.length) > 2 && /*#__PURE__*/React.createElement(LinkButton, {
15699
15887
  label: showAllTimeline ? t("COLLAPSE") : t("VIEW_TIMELINE"),
15700
15888
  onClick: toggleTimeline
15701
- })))), window.location.href.includes("/pt/") ? /*#__PURE__*/React.createElement(ActionBar, {
15889
+ }))), !(workflowDetails !== null && workflowDetails !== void 0 && workflowDetails.isLoading) && !isDataLoading && moduleCode === "BPAREG" && /*#__PURE__*/React.createElement(ApplicationTimeline, {
15890
+ workflowDetails: workflowDetails,
15891
+ t: t
15892
+ })), window.location.href.includes("/pt/") ? /*#__PURE__*/React.createElement(ActionBar, {
15702
15893
  className: "clear-search-container",
15703
15894
  style: {
15704
15895
  display: "block"