@mseva/upyog-ui-module-ads 1.0.7 → 1.0.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 { AppContainer, BackButton, PrivateRoute, Loader, Table, Card, KeyNote, Modal, SubmitBar, DeleteIcon, CardSubHeader, FormStep, CardHeader, CardLabel, Dropdown, TextInput, RadioButtons, Toast, TickMark, CardLabelDesc, CardText, MobileNumber, TextArea, LabelFieldPair, UploadFile, StatusTable, Row, CheckBox, LinkButton, Banner, EmployeeModuleCard, Header, SearchForm, SearchField, CardLabelError, DatePicker, MultiLink, FormComposer, PDFSvg, MultiUploadWrapper, CardSectionHeader, Close as Close$f, BreakLine, TelePhone, DisplayPhotos, InfoBannerIcon, CheckPoint, ConnectingCheckPoints, ActionBar, Menu, ButtonSelector, CitizenHomeCard } from '@mseva/digit-ui-react-components';
1
+ import { AppContainer, BackButton, PrivateRoute, Loader, Table, Card, KeyNote, Modal, SubmitBar, DeleteIcon, CardSubHeader, FormStep, CardHeader, CardLabel, Dropdown, TextInput, RadioButtons, Toast, TickMark, CardLabelDesc, CardText, MobileNumber, TextArea, LabelFieldPair, UploadFile, StatusTable, Row, CheckBox, LinkButton, Banner, EmployeeModuleCard, Header, SearchForm, SearchField, CardLabelError, DatePicker, MultiLink, FormComposer, PDFSvg, MultiUploadWrapper, CardSectionHeader, Close as Close$g, BreakLine, TelePhone, DisplayPhotos, InfoBannerIcon, CheckPoint, ConnectingCheckPoints, ActionBar, Menu, ButtonSelector, CitizenHomeCard } from '@mseva/digit-ui-react-components';
2
2
  import React, { useState, useEffect, useMemo, useRef, useCallback, Fragment } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useRouteMatch, Switch, useLocation, useHistory, Route, Redirect, Link, useParams } from 'react-router-dom';
@@ -17863,6 +17863,30 @@ const configCHBApproverApplication = ({
17863
17863
  };
17864
17864
  };
17865
17865
 
17866
+ const configASSETApproverApplication = ({
17867
+ t,
17868
+ action,
17869
+ businessService
17870
+ }) => {
17871
+ console.log("njhsegfdhjsbedwfdwe", action);
17872
+ return {
17873
+ label: {
17874
+ heading: `WF_${action === null || action === void 0 ? void 0 : action.action}_APPLICATION`,
17875
+ submit: `WF_${businessService}_${action === null || action === void 0 ? void 0 : action.action}`,
17876
+ cancel: "ES_AST_COMMON_CANCEL"
17877
+ },
17878
+ form: [{
17879
+ body: [{
17880
+ label: t("AST_ACTION_COMMENTS"),
17881
+ type: "textarea",
17882
+ populators: {
17883
+ name: "comments"
17884
+ }
17885
+ }]
17886
+ }]
17887
+ };
17888
+ };
17889
+
17866
17890
  const Heading$1 = props => {
17867
17891
  return /*#__PURE__*/React.createElement("h1", {
17868
17892
  className: "heading-m"
@@ -20598,7 +20622,123 @@ const ActionModal$9 = ({
20598
20622
  })) : /*#__PURE__*/React.createElement(Loader, null);
20599
20623
  };
20600
20624
 
20601
- const ActionModal$a = props => {
20625
+ const Heading$b = props => {
20626
+ return /*#__PURE__*/React.createElement("h1", {
20627
+ className: "heading-m"
20628
+ }, props.label);
20629
+ };
20630
+ const Close$e = () => /*#__PURE__*/React.createElement("svg", {
20631
+ xmlns: "http://www.w3.org/2000/svg",
20632
+ viewBox: "0 0 24 24",
20633
+ fill: "#FFFFFF"
20634
+ }, /*#__PURE__*/React.createElement("path", {
20635
+ d: "M0 0h24v24H0V0z",
20636
+ fill: "none"
20637
+ }), /*#__PURE__*/React.createElement("path", {
20638
+ 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"
20639
+ }));
20640
+ const CloseBtn$e = props => {
20641
+ return /*#__PURE__*/React.createElement("div", {
20642
+ className: "icon-bg-secondary",
20643
+ onClick: props.onClick
20644
+ }, /*#__PURE__*/React.createElement(Close$e, null));
20645
+ };
20646
+ const ActionModal$a = ({
20647
+ t,
20648
+ action,
20649
+ tenantId,
20650
+ state,
20651
+ id,
20652
+ closeModal,
20653
+ submitAction,
20654
+ actionData,
20655
+ applicationData,
20656
+ businessService,
20657
+ moduleCode
20658
+ }) => {
20659
+ var _action$roles, _action$roles$, _action$roles$$map;
20660
+ const {
20661
+ data: approverData,
20662
+ isLoading: PTALoading
20663
+ } = Digit.Hooks.useEmployeeSearch(tenantId, {
20664
+ roles: action === null || action === void 0 ? void 0 : (_action$roles = action.roles) === null || _action$roles === void 0 ? void 0 : (_action$roles$ = _action$roles[0]) === null || _action$roles$ === void 0 ? void 0 : (_action$roles$$map = _action$roles$.map) === null || _action$roles$$map === void 0 ? void 0 : _action$roles$$map.call(_action$roles$, e => ({
20665
+ code: e
20666
+ })),
20667
+ isActive: true
20668
+ }, {
20669
+ enabled: !(action !== null && action !== void 0 && action.isTerminateState)
20670
+ });
20671
+ const history = useHistory();
20672
+ const [config, setConfig] = useState({});
20673
+ const [defaultValues, setDefaultValues] = useState({});
20674
+ const [approvers, setApprovers] = useState([]);
20675
+ const [selectedApprover, setSelectedApprover] = useState(null);
20676
+ const [uploadedFile, setUploadedFile] = useState(null);
20677
+ useEffect(() => {
20678
+ var _approverData$Employe;
20679
+ setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
20680
+ var _employee$user;
20681
+ return {
20682
+ uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
20683
+ name: employee === null || employee === void 0 ? void 0 : (_employee$user = employee.user) === null || _employee$user === void 0 ? void 0 : _employee$user.name
20684
+ };
20685
+ }));
20686
+ }, [approverData]);
20687
+ function submit(data) {
20688
+ let workflow = {
20689
+ action: action === null || action === void 0 ? void 0 : action.action,
20690
+ comment: data === null || data === void 0 ? void 0 : data.comments,
20691
+ businessService,
20692
+ moduleName: moduleCode
20693
+ };
20694
+ if (uploadedFile) workflow["documents"] = [];
20695
+ submitAction({
20696
+ Asset: {
20697
+ ...applicationData,
20698
+ workflow
20699
+ }
20700
+ });
20701
+ }
20702
+ useEffect(() => {
20703
+ if ((action === null || action === void 0 ? void 0 : action.state) === "INITIATED") {
20704
+ history.push(`/digit-ui/employee/asset/assetservice/edit/` + `${applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationNo}`);
20705
+ } else {
20706
+ setConfig(configASSETApproverApplication({
20707
+ t,
20708
+ action,
20709
+ approvers,
20710
+ selectedApprover,
20711
+ setSelectedApprover,
20712
+ uploadedFile,
20713
+ setUploadedFile,
20714
+ businessService
20715
+ }));
20716
+ }
20717
+ }, [action, approvers, uploadedFile]);
20718
+ return action && config.form ? /*#__PURE__*/React.createElement(Modal, {
20719
+ headerBarMain: /*#__PURE__*/React.createElement(Heading$b, {
20720
+ label: t(config.label.heading)
20721
+ }),
20722
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$e, {
20723
+ onClick: closeModal
20724
+ }),
20725
+ actionCancelLabel: t(config.label.cancel),
20726
+ actionCancelOnSubmit: closeModal,
20727
+ actionSaveLabel: t(config.label.submit),
20728
+ actionSaveOnSubmit: () => {},
20729
+ formId: "modal-action"
20730
+ }, /*#__PURE__*/React.createElement(FormComposer, {
20731
+ config: config.form,
20732
+ noBoxShadow: true,
20733
+ inline: true,
20734
+ childrenAtTheBottom: true,
20735
+ onSubmit: submit,
20736
+ defaultValues: defaultValues,
20737
+ formId: "modal-action"
20738
+ })) : /*#__PURE__*/React.createElement(Loader, null);
20739
+ };
20740
+
20741
+ const ActionModal$b = props => {
20602
20742
  if (props !== null && props !== void 0 && props.businessService.includes("PT")) {
20603
20743
  return /*#__PURE__*/React.createElement(ActionModal, props);
20604
20744
  }
@@ -20629,6 +20769,9 @@ const ActionModal$a = props => {
20629
20769
  if (props !== null && props !== void 0 && props.businessService.includes("chb")) {
20630
20770
  return /*#__PURE__*/React.createElement(ActionModal$9, props);
20631
20771
  }
20772
+ if (props !== null && props !== void 0 && props.businessService.includes("asset-create")) {
20773
+ return /*#__PURE__*/React.createElement(ActionModal$a, props);
20774
+ }
20632
20775
  };
20633
20776
 
20634
20777
  function DocumentsPreview({
@@ -21493,7 +21636,7 @@ const PermissionCheck = ({
21493
21636
  } : {},
21494
21637
  placeholder: t("BPA_ENTER_PERMIT_CONDITIONS_LABEL")
21495
21638
  }), /*#__PURE__*/React.createElement(LinkButton, {
21496
- label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Close$f, {
21639
+ label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Close$g, {
21497
21640
  style: {
21498
21641
  float: "right",
21499
21642
  position: "relative",
@@ -24416,7 +24559,7 @@ function ApplicationDetailsActionBar({
24416
24559
  }, t(`${forcedActionPrefix || `WF_EMPLOYEE_${businessService === null || businessService === void 0 ? void 0 : businessService.toUpperCase()}`}_${actions === null || actions === void 0 ? void 0 : (_actions$4 = actions[0]) === null || _actions$4 === void 0 ? void 0 : _actions$4.action}`))));
24417
24560
  }
24418
24561
 
24419
- const Close$e = () => /*#__PURE__*/React.createElement("svg", {
24562
+ const Close$f = () => /*#__PURE__*/React.createElement("svg", {
24420
24563
  xmlns: "http://www.w3.org/2000/svg",
24421
24564
  viewBox: "0 0 24 24",
24422
24565
  fill: "#FFFFFF"
@@ -24426,11 +24569,11 @@ const Close$e = () => /*#__PURE__*/React.createElement("svg", {
24426
24569
  }), /*#__PURE__*/React.createElement("path", {
24427
24570
  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"
24428
24571
  }));
24429
- const CloseBtn$e = props => {
24572
+ const CloseBtn$f = props => {
24430
24573
  return /*#__PURE__*/React.createElement("div", {
24431
24574
  className: "icon-bg-secondary",
24432
24575
  onClick: props.onClick
24433
- }, /*#__PURE__*/React.createElement(Close$e, null));
24576
+ }, /*#__PURE__*/React.createElement(Close$f, null));
24434
24577
  };
24435
24578
  function ApplicationDetailsWarningPopup({
24436
24579
  action,
@@ -24447,7 +24590,7 @@ function ApplicationDetailsWarningPopup({
24447
24590
  headerBarMain: /*#__PURE__*/React.createElement("h1", {
24448
24591
  className: "heading-m"
24449
24592
  }, t("PT_DUES_ARE_PENDING")),
24450
- headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$e, {
24593
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$f, {
24451
24594
  onClick: () => {
24452
24595
  closeWarningPopup();
24453
24596
  }
@@ -24792,7 +24935,7 @@ const ApplicationDetails = props => {
24792
24935
  showTimeLine: showTimeLine,
24793
24936
  oldValue: oldValue,
24794
24937
  isInfoLabel: isInfoLabel
24795
- }), showModal ? /*#__PURE__*/React.createElement(ActionModal$a, {
24938
+ }), showModal ? /*#__PURE__*/React.createElement(ActionModal$b, {
24796
24939
  t: t,
24797
24940
  action: selectedAction,
24798
24941
  tenantId: tenantId,