@mseva/upyog-ui-module-chb 1.1.63 → 1.1.64

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.
@@ -17655,13 +17655,20 @@ const CommunityHallSearch = ({
17655
17655
  }));
17656
17656
  };
17657
17657
 
17658
- const getTimelineAcknowledgementData = (workflowDetails, tenantInfo, t) => {
17658
+ const getTimelineAcknowledgementData = (workflowDetails, tenantInfo, pdfFiles = {}, t) => {
17659
17659
  var _workflowDetails$data, _workflowDetails$data2, _processInstances$, _processInstances$2, _processInstances$3, _timeline$, _timeline$2, _timeline$3, _timeline$4;
17660
+ console.log('pdfFiles', pdfFiles);
17660
17661
  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) || [];
17661
17662
  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) || [];
17662
17663
  const businessId = (processInstances === null || processInstances === void 0 ? void 0 : (_processInstances$ = processInstances[0]) === null || _processInstances$ === void 0 ? void 0 : _processInstances$.businessId) || "N/A";
17663
17664
  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";
17664
17665
  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";
17666
+ const pdfDownloadLink = (documents, fileStoreId) => {
17667
+ var _downloadLink$split;
17668
+ const downloadLink = (documents === null || documents === void 0 ? void 0 : documents[fileStoreId]) || "";
17669
+ const formats = (downloadLink === null || downloadLink === void 0 ? void 0 : (_downloadLink$split = downloadLink.split(",")) === null || _downloadLink$split === void 0 ? void 0 : _downloadLink$split.filter(Boolean)) || [];
17670
+ 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]) || "";
17671
+ };
17665
17672
  const timelineRows = timeline.map((item, index) => {
17666
17673
  var _item$auditDetails, _item$auditDetails2, _item$assigner, _item$assigner2, _item$assigner3, _item$wfComment;
17667
17674
  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";
@@ -17688,7 +17695,8 @@ const getTimelineAcknowledgementData = (workflowDetails, tenantInfo, t) => {
17688
17695
  documents: documents.map(doc => ({
17689
17696
  name: (doc === null || doc === void 0 ? void 0 : doc.fileName) || (doc === null || doc === void 0 ? void 0 : doc.documentType) || "Document",
17690
17697
  type: (doc === null || doc === void 0 ? void 0 : doc.documentType) || "Document",
17691
- fileStoreId: doc === null || doc === void 0 ? void 0 : doc.fileStoreId
17698
+ fileStoreId: doc === null || doc === void 0 ? void 0 : doc.fileStoreId,
17699
+ link: pdfDownloadLink(pdfFiles, doc === null || doc === void 0 ? void 0 : doc.fileStoreId)
17692
17700
  })),
17693
17701
  hasDocuments: documents.length > 0
17694
17702
  };
@@ -17872,18 +17880,30 @@ const ApplicationTimeline = ({
17872
17880
  workflowDetails,
17873
17881
  t
17874
17882
  }) => {
17875
- var _workflowDetails$data2, _workflowDetails$data3, _workflowDetails$data4, _timeline$;
17883
+ var _workflowDetails$data2, _workflowDetails$data3, _workflowDetails$data4, _workflowDetails$data5, _workflowDetails$data6, _workflowDetails$data7, _workflowDetails$data8, _timeline$;
17876
17884
  const details = (workflowDetails === null || workflowDetails === void 0 ? void 0 : workflowDetails.data) || workflowDetails;
17877
17885
  const timeline = useMemo(() => normalizeTimeline({
17878
17886
  data: details
17879
17887
  }), [details]);
17880
17888
  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;
17889
+ const {
17890
+ isLoading,
17891
+ data
17892
+ } = Digit.Hooks.ads.useADSDocumentSearch({
17893
+ value: (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data5 = workflowDetails.data) === null || _workflowDetails$data5 === void 0 ? void 0 : (_workflowDetails$data6 = _workflowDetails$data5.timeline) === null || _workflowDetails$data6 === void 0 ? void 0 : _workflowDetails$data6.flatMap(item => item === null || item === void 0 ? void 0 : item.wfDocuments)) || []
17894
+ }, {
17895
+ value: (workflowDetails === null || workflowDetails === void 0 ? void 0 : (_workflowDetails$data7 = workflowDetails.data) === null || _workflowDetails$data7 === void 0 ? void 0 : (_workflowDetails$data8 = _workflowDetails$data7.timeline) === null || _workflowDetails$data8 === void 0 ? void 0 : _workflowDetails$data8.flatMap(item => item === null || item === void 0 ? void 0 : item.wfDocuments)) || []
17896
+ }, null, 0);
17897
+ console.log('data of doc hook', data);
17881
17898
  const handleDownloadPDF = useCallback(() => {
17882
- const tenantInfo = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY") || {};
17883
- const acknowledgementData = getTimelineAcknowledgementData(workflowDetails, tenantInfo, t);
17884
- Digit.Utils.pdf.generateTimelinePDF(acknowledgementData);
17885
- }, [workflowDetails, t]);
17899
+ if (!isLoading) {
17900
+ const tenantInfo = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY") || {};
17901
+ const acknowledgementData = getTimelineAcknowledgementData(workflowDetails, tenantInfo, (data === null || data === void 0 ? void 0 : data.pdfFiles) || {}, t);
17902
+ Digit.Utils.pdf.generateTimelinePDF(acknowledgementData);
17903
+ }
17904
+ }, [workflowDetails, data, t]);
17886
17905
  if (!(timeline !== null && timeline !== void 0 && timeline.length)) return null;
17906
+ if (isLoading) return /*#__PURE__*/React.createElement(Loader$1, null);
17887
17907
  return /*#__PURE__*/React.createElement("div", {
17888
17908
  className: "timeline-hoc-container"
17889
17909
  }, /*#__PURE__*/React.createElement("div", {
@@ -41885,13 +41905,20 @@ const CHBApplicationDetails = () => {
41885
41905
  return /*#__PURE__*/React.createElement(Loader$1, null);
41886
41906
  }
41887
41907
  const getChbAcknowledgement = async () => {
41888
- const applications = application || {};
41889
- console.log('applications for chbb', applications);
41890
- const tenantInfo = tenants.find(tenant => tenant.code === applications.tenantId);
41891
- const acknowldgementDataAPI = await getChbAcknowledgementData({
41892
- ...applications
41893
- }, tenantInfo, t);
41894
- Digit.Utils.pdf.generate(acknowldgementDataAPI);
41908
+ try {
41909
+ setLoading(true);
41910
+ const applications = application || {};
41911
+ console.log("applications for chbb", applications);
41912
+ const tenantInfo = tenants.find(tenant => tenant.code === applications.tenantId);
41913
+ const acknowldgementDataAPI = await getChbAcknowledgementData({
41914
+ ...applications
41915
+ }, tenantInfo, t);
41916
+ Digit.Utils.pdf.generate(acknowldgementDataAPI);
41917
+ } catch (err) {
41918
+ console.error(err);
41919
+ } finally {
41920
+ setLoading(false);
41921
+ }
41895
41922
  };
41896
41923
  let documentDate = t("CS_NA");
41897
41924
  if (chb_details !== null && chb_details !== void 0 && (_chb_details$addition = chb_details.additionalDetails) !== null && _chb_details$addition !== void 0 && _chb_details$addition.documentDate) {
@@ -41905,64 +41932,78 @@ const CHBApplicationDetails = () => {
41905
41932
  payments,
41906
41933
  ...params
41907
41934
  }) {
41908
- var _data$hallsBookingApp;
41909
- let application = data === null || data === void 0 ? void 0 : (_data$hallsBookingApp = data.hallsBookingApplication) === null || _data$hallsBookingApp === void 0 ? void 0 : _data$hallsBookingApp[0];
41910
- let fileStoreId = application === null || application === void 0 ? void 0 : application.paymentReceiptFilestoreId;
41911
- if (!fileStoreId) {
41912
- var _response, _response2;
41913
- let response = {
41914
- filestoreIds: [payments === null || payments === void 0 ? void 0 : payments.fileStoreId]
41915
- };
41916
- response = await Digit.PaymentService.generatePdf(tenantId, {
41917
- Payments: [{
41918
- ...payments,
41919
- ...application
41920
- }]
41921
- }, "chbservice-receipt");
41922
- const updatedApplication = {
41923
- ...application,
41924
- paymentReceiptFilestoreId: (_response = response) === null || _response === void 0 ? void 0 : _response.filestoreIds[0]
41925
- };
41926
- await mutation.mutateAsync({
41927
- hallsBookingApplication: updatedApplication
41935
+ try {
41936
+ var _data$hallsBookingApp;
41937
+ setLoading(true);
41938
+ let application = data === null || data === void 0 ? void 0 : (_data$hallsBookingApp = data.hallsBookingApplication) === null || _data$hallsBookingApp === void 0 ? void 0 : _data$hallsBookingApp[0];
41939
+ let fileStoreId = application === null || application === void 0 ? void 0 : application.paymentReceiptFilestoreId;
41940
+ if (!fileStoreId) {
41941
+ var _response, _response2;
41942
+ let response = {
41943
+ filestoreIds: [payments === null || payments === void 0 ? void 0 : payments.fileStoreId]
41944
+ };
41945
+ response = await Digit.PaymentService.generatePdf(tenantId, {
41946
+ Payments: [{
41947
+ ...payments,
41948
+ ...application
41949
+ }]
41950
+ }, "chbservice-receipt");
41951
+ const updatedApplication = {
41952
+ ...application,
41953
+ paymentReceiptFilestoreId: (_response = response) === null || _response === void 0 ? void 0 : _response.filestoreIds[0]
41954
+ };
41955
+ await mutation.mutateAsync({
41956
+ hallsBookingApplication: updatedApplication
41957
+ });
41958
+ fileStoreId = (_response2 = response) === null || _response2 === void 0 ? void 0 : _response2.filestoreIds[0];
41959
+ refetch();
41960
+ }
41961
+ const fileStore = await Digit.PaymentService.printReciept(tenantId, {
41962
+ fileStoreIds: fileStoreId
41928
41963
  });
41929
- fileStoreId = (_response2 = response) === null || _response2 === void 0 ? void 0 : _response2.filestoreIds[0];
41930
- refetch();
41964
+ window.open(fileStore[fileStoreId], "_blank");
41965
+ } catch (error) {
41966
+ console.error("Sanction Letter download error:", error);
41967
+ } finally {
41968
+ setLoading(false);
41931
41969
  }
41932
- const fileStore = await Digit.PaymentService.printReciept(tenantId, {
41933
- fileStoreIds: fileStoreId
41934
- });
41935
- window.open(fileStore[fileStoreId], "_blank");
41936
41970
  }
41937
41971
  async function getPermissionLetter({
41938
41972
  tenantId,
41939
41973
  payments,
41940
41974
  ...params
41941
41975
  }) {
41942
- let application = {
41943
- hallsBookingApplication: ((data === null || data === void 0 ? void 0 : data.hallsBookingApplication) || []).map(app => {
41944
- return {
41945
- ...app,
41946
- bookingSlotDetails: [...(app.bookingSlotDetails || [])].sort((a, b) => {
41947
- return new Date(a.bookingDate) - new Date(b.bookingDate);
41948
- })
41949
- };
41950
- })
41951
- };
41952
- let fileStoreId = application === null || application === void 0 ? void 0 : application.permissionLetterFilestoreId;
41953
- if (!fileStoreId) {
41954
- const response = await Digit.PaymentService.generatePdf(tenantId, {
41955
- Payments: [{
41956
- ...payments,
41957
- ...application
41958
- }]
41959
- }, "chb-permissionletter");
41960
- fileStoreId = response === null || response === void 0 ? void 0 : response.filestoreIds[0];
41976
+ try {
41977
+ setLoading(true);
41978
+ let application = {
41979
+ hallsBookingApplication: ((data === null || data === void 0 ? void 0 : data.hallsBookingApplication) || []).map(app => {
41980
+ return {
41981
+ ...app,
41982
+ bookingSlotDetails: [...(app.bookingSlotDetails || [])].sort((a, b) => {
41983
+ return new Date(a.bookingDate) - new Date(b.bookingDate);
41984
+ })
41985
+ };
41986
+ })
41987
+ };
41988
+ let fileStoreId = payments === null || payments === void 0 ? void 0 : payments.fileStoreId;
41989
+ if (!fileStoreId) {
41990
+ const response = await Digit.PaymentService.generatePdf(tenantId, {
41991
+ Payments: [{
41992
+ ...payments,
41993
+ ...application
41994
+ }]
41995
+ }, "chb-permissionletter");
41996
+ fileStoreId = response === null || response === void 0 ? void 0 : response.filestoreIds[0];
41997
+ }
41998
+ const fileStore = await Digit.PaymentService.printReciept(tenantId, {
41999
+ fileStoreIds: fileStoreId
42000
+ });
42001
+ window.open(fileStore[fileStoreId], "_blank");
42002
+ } catch (error) {
42003
+ console.error("Sanction Letter download error:", error);
42004
+ } finally {
42005
+ setLoading(false);
41961
42006
  }
41962
- const fileStore = await Digit.PaymentService.printReciept(tenantId, {
41963
- fileStoreIds: fileStoreId
41964
- });
41965
- window.open(fileStore[fileStoreId], "_blank");
41966
42007
  }
41967
42008
  let dowloadOptions = [];
41968
42009
  dowloadOptions.push({
@@ -42024,7 +42065,7 @@ const CHBApplicationDetails = () => {
42024
42065
  styles: {
42025
42066
  fontSize: "32px"
42026
42067
  }
42027
- }, t("CHB_BOOKING_DETAILS")), dowloadOptions && dowloadOptions.length > 0 && /*#__PURE__*/React.createElement(MultiLink, {
42068
+ }, t("CHB_BOOKING_DETAILS")), loading && /*#__PURE__*/React.createElement(Loader$1, null), dowloadOptions && dowloadOptions.length > 0 && /*#__PURE__*/React.createElement(MultiLink, {
42028
42069
  className: "multilinkWrapper",
42029
42070
  onHeadClick: () => setShowOptions(!showOptions),
42030
42071
  displayOptions: showOptions,