@mseva/digit-ui-module-sv 1.0.5 → 1.0.7

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, TickMark, FormStep, CardLabel, LinkButton, TextInput, Dropdown, MobileNumber, RadioButtons, CheckBox, Toast, LocationSearchCard, Table, Card, CardHeader, CardText, CardSubHeader, Loader, SubmitBar, TextArea, LabelFieldPair, UploadFile, StatusTable, Row, EditIcon, PropertyHouse, EmployeeModuleCard, CloseSvg, Label, LinkLabel, ActionBar, DatePicker, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, Header, SearchForm, SearchField, CardLabelError, Banner, Modal, FormComposer, PDFSvg, MultiUploadWrapper, CardSectionHeader, Close as Close$b, BreakLine, TelePhone, DisplayPhotos, InfoBannerIcon, CheckPoint, ConnectingCheckPoints, Menu, ButtonSelector, MultiLink, KeyNote, CitizenHomeCard, PTIcon } from '@mseva/digit-ui-react-components';
1
+ import { AppContainer, BackButton, PrivateRoute, TickMark, FormStep, CardLabel, LinkButton, TextInput, Dropdown, MobileNumber, RadioButtons, CheckBox, Toast, LocationSearchCard, Table, Card, CardHeader, CardText, CardSubHeader, Loader, SubmitBar, TextArea, LabelFieldPair, UploadFile, StatusTable, Row, EditIcon, PropertyHouse, EmployeeModuleCard, CloseSvg, Label, LinkLabel, ActionBar, DatePicker, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, Header, SearchForm, SearchField, CardLabelError, Banner, Modal, FormComposer, PDFSvg, MultiUploadWrapper, CardSectionHeader, Close as Close$c, BreakLine, TelePhone, DisplayPhotos, InfoBannerIcon, CheckPoint, ConnectingCheckPoints, Menu, ButtonSelector, MultiLink, KeyNote, CitizenHomeCard, PTIcon } from '@mseva/digit-ui-react-components';
2
2
  import React, { useState, useEffect, useCallback, useMemo, Fragment, useRef } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useRouteMatch, useLocation, useHistory, Switch, Route, Redirect, Link, useParams } from 'react-router-dom';
@@ -12943,6 +12943,30 @@ const configCHBApproverApplication = ({
12943
12943
  };
12944
12944
  };
12945
12945
 
12946
+ const configASSETApproverApplication = ({
12947
+ t,
12948
+ action,
12949
+ businessService
12950
+ }) => {
12951
+ console.log("njhsegfdhjsbedwfdwe", action);
12952
+ return {
12953
+ label: {
12954
+ heading: `WF_${action === null || action === void 0 ? void 0 : action.action}_APPLICATION`,
12955
+ submit: `WF_${businessService}_${action === null || action === void 0 ? void 0 : action.action}`,
12956
+ cancel: "ES_AST_COMMON_CANCEL"
12957
+ },
12958
+ form: [{
12959
+ body: [{
12960
+ label: t("AST_ACTION_COMMENTS"),
12961
+ type: "textarea",
12962
+ populators: {
12963
+ name: "comments"
12964
+ }
12965
+ }]
12966
+ }]
12967
+ };
12968
+ };
12969
+
12946
12970
  const Heading = props => {
12947
12971
  return /*#__PURE__*/React.createElement("h1", {
12948
12972
  className: "heading-m"
@@ -16021,7 +16045,123 @@ const ActionModal$9 = ({
16021
16045
  })) : /*#__PURE__*/React.createElement(Loader, null);
16022
16046
  };
16023
16047
 
16024
- const ActionModal$a = props => {
16048
+ const Heading$a = props => {
16049
+ return /*#__PURE__*/React.createElement("h1", {
16050
+ className: "heading-m"
16051
+ }, props.label);
16052
+ };
16053
+ const Close$a = () => /*#__PURE__*/React.createElement("svg", {
16054
+ xmlns: "http://www.w3.org/2000/svg",
16055
+ viewBox: "0 0 24 24",
16056
+ fill: "#FFFFFF"
16057
+ }, /*#__PURE__*/React.createElement("path", {
16058
+ d: "M0 0h24v24H0V0z",
16059
+ fill: "none"
16060
+ }), /*#__PURE__*/React.createElement("path", {
16061
+ 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"
16062
+ }));
16063
+ const CloseBtn$a = props => {
16064
+ return /*#__PURE__*/React.createElement("div", {
16065
+ className: "icon-bg-secondary",
16066
+ onClick: props.onClick
16067
+ }, /*#__PURE__*/React.createElement(Close$a, null));
16068
+ };
16069
+ const ActionModal$a = ({
16070
+ t,
16071
+ action,
16072
+ tenantId,
16073
+ state,
16074
+ id,
16075
+ closeModal,
16076
+ submitAction,
16077
+ actionData,
16078
+ applicationData,
16079
+ businessService,
16080
+ moduleCode
16081
+ }) => {
16082
+ var _action$roles, _action$roles$, _action$roles$$map;
16083
+ const {
16084
+ data: approverData,
16085
+ isLoading: PTALoading
16086
+ } = Digit.Hooks.useEmployeeSearch(tenantId, {
16087
+ 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 => ({
16088
+ code: e
16089
+ })),
16090
+ isActive: true
16091
+ }, {
16092
+ enabled: !(action !== null && action !== void 0 && action.isTerminateState)
16093
+ });
16094
+ const history = useHistory();
16095
+ const [config, setConfig] = useState({});
16096
+ const [defaultValues, setDefaultValues] = useState({});
16097
+ const [approvers, setApprovers] = useState([]);
16098
+ const [selectedApprover, setSelectedApprover] = useState(null);
16099
+ const [uploadedFile, setUploadedFile] = useState(null);
16100
+ useEffect(() => {
16101
+ var _approverData$Employe;
16102
+ setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
16103
+ var _employee$user;
16104
+ return {
16105
+ uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
16106
+ name: employee === null || employee === void 0 ? void 0 : (_employee$user = employee.user) === null || _employee$user === void 0 ? void 0 : _employee$user.name
16107
+ };
16108
+ }));
16109
+ }, [approverData]);
16110
+ function submit(data) {
16111
+ let workflow = {
16112
+ action: action === null || action === void 0 ? void 0 : action.action,
16113
+ comment: data === null || data === void 0 ? void 0 : data.comments,
16114
+ businessService,
16115
+ moduleName: moduleCode
16116
+ };
16117
+ if (uploadedFile) workflow["documents"] = [];
16118
+ submitAction({
16119
+ Asset: {
16120
+ ...applicationData,
16121
+ workflow
16122
+ }
16123
+ });
16124
+ }
16125
+ useEffect(() => {
16126
+ if ((action === null || action === void 0 ? void 0 : action.state) === "INITIATED") {
16127
+ history.push(`/digit-ui/employee/asset/assetservice/edit/` + `${applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationNo}`);
16128
+ } else {
16129
+ setConfig(configASSETApproverApplication({
16130
+ t,
16131
+ action,
16132
+ approvers,
16133
+ selectedApprover,
16134
+ setSelectedApprover,
16135
+ uploadedFile,
16136
+ setUploadedFile,
16137
+ businessService
16138
+ }));
16139
+ }
16140
+ }, [action, approvers, uploadedFile]);
16141
+ return action && config.form ? /*#__PURE__*/React.createElement(Modal, {
16142
+ headerBarMain: /*#__PURE__*/React.createElement(Heading$a, {
16143
+ label: t(config.label.heading)
16144
+ }),
16145
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$a, {
16146
+ onClick: closeModal
16147
+ }),
16148
+ actionCancelLabel: t(config.label.cancel),
16149
+ actionCancelOnSubmit: closeModal,
16150
+ actionSaveLabel: t(config.label.submit),
16151
+ actionSaveOnSubmit: () => {},
16152
+ formId: "modal-action"
16153
+ }, /*#__PURE__*/React.createElement(FormComposer, {
16154
+ config: config.form,
16155
+ noBoxShadow: true,
16156
+ inline: true,
16157
+ childrenAtTheBottom: true,
16158
+ onSubmit: submit,
16159
+ defaultValues: defaultValues,
16160
+ formId: "modal-action"
16161
+ })) : /*#__PURE__*/React.createElement(Loader, null);
16162
+ };
16163
+
16164
+ const ActionModal$b = props => {
16025
16165
  if (props !== null && props !== void 0 && props.businessService.includes("PT")) {
16026
16166
  return /*#__PURE__*/React.createElement(ActionModal, props);
16027
16167
  }
@@ -16052,6 +16192,9 @@ const ActionModal$a = props => {
16052
16192
  if (props !== null && props !== void 0 && props.businessService.includes("chb")) {
16053
16193
  return /*#__PURE__*/React.createElement(ActionModal$9, props);
16054
16194
  }
16195
+ if (props !== null && props !== void 0 && props.businessService.includes("asset-create")) {
16196
+ return /*#__PURE__*/React.createElement(ActionModal$a, props);
16197
+ }
16055
16198
  };
16056
16199
 
16057
16200
  function DocumentsPreview({
@@ -16916,7 +17059,7 @@ const PermissionCheck = ({
16916
17059
  } : {},
16917
17060
  placeholder: t("BPA_ENTER_PERMIT_CONDITIONS_LABEL")
16918
17061
  }), /*#__PURE__*/React.createElement(LinkButton, {
16919
- label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Close$b, {
17062
+ label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Close$c, {
16920
17063
  style: {
16921
17064
  float: "right",
16922
17065
  position: "relative",
@@ -19839,7 +19982,7 @@ function ApplicationDetailsActionBar({
19839
19982
  }, 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}`))));
19840
19983
  }
19841
19984
 
19842
- const Close$a = () => /*#__PURE__*/React.createElement("svg", {
19985
+ const Close$b = () => /*#__PURE__*/React.createElement("svg", {
19843
19986
  xmlns: "http://www.w3.org/2000/svg",
19844
19987
  viewBox: "0 0 24 24",
19845
19988
  fill: "#FFFFFF"
@@ -19849,11 +19992,11 @@ const Close$a = () => /*#__PURE__*/React.createElement("svg", {
19849
19992
  }), /*#__PURE__*/React.createElement("path", {
19850
19993
  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"
19851
19994
  }));
19852
- const CloseBtn$a = props => {
19995
+ const CloseBtn$b = props => {
19853
19996
  return /*#__PURE__*/React.createElement("div", {
19854
19997
  className: "icon-bg-secondary",
19855
19998
  onClick: props.onClick
19856
- }, /*#__PURE__*/React.createElement(Close$a, null));
19999
+ }, /*#__PURE__*/React.createElement(Close$b, null));
19857
20000
  };
19858
20001
  function ApplicationDetailsWarningPopup({
19859
20002
  action,
@@ -19870,7 +20013,7 @@ function ApplicationDetailsWarningPopup({
19870
20013
  headerBarMain: /*#__PURE__*/React.createElement("h1", {
19871
20014
  className: "heading-m"
19872
20015
  }, t("PT_DUES_ARE_PENDING")),
19873
- headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$a, {
20016
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$b, {
19874
20017
  onClick: () => {
19875
20018
  closeWarningPopup();
19876
20019
  }
@@ -20215,7 +20358,7 @@ const ApplicationDetails = props => {
20215
20358
  showTimeLine: showTimeLine,
20216
20359
  oldValue: oldValue,
20217
20360
  isInfoLabel: isInfoLabel
20218
- }), showModal ? /*#__PURE__*/React.createElement(ActionModal$a, {
20361
+ }), showModal ? /*#__PURE__*/React.createElement(ActionModal$b, {
20219
20362
  t: t,
20220
20363
  action: selectedAction,
20221
20364
  tenantId: tenantId,