@mseva/upyog-ui-module-chb 1.0.1 → 1.0.3

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 { TickMark, CardSubHeader, Modal, CardLabelDesc, CardLabel, CardText, Card, FormStep, Dropdown, TextArea, Loader, TextInput, MobileNumber, Toast, LabelFieldPair, UploadFile, Table, KeyNote, SubmitBar, CardHeader, InfoIcon, Calender, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, AppContainer, BackButton, PrivateRoute, PDFSvg, StatusTable, Row, CheckBox, LinkButton, Banner, Header, MultiLink, PropertyHouse, CloseSvg, Label, LinkLabel, ActionBar, DatePicker, RadioButtons, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, SearchForm, SearchField, CardLabelError, CHBIcon, EmployeeModuleCard, Localities, RemoveableTag, FormComposer, MultiUploadWrapper, Close as Close$f, BreakLine, InfoBannerIcon, Menu, ButtonSelector, OTPInput, Rating, CitizenHomeCard } from '@mseva/digit-ui-react-components';
1
+ import { TickMark, CardSubHeader, Modal, CardLabelDesc, CardLabel, CardText, Card, FormStep, Dropdown, TextArea, Loader, TextInput, MobileNumber, Toast, LabelFieldPair, UploadFile, Table, KeyNote, SubmitBar, CardHeader, InfoIcon, Calender, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, AppContainer, BackButton, PrivateRoute, PDFSvg, StatusTable, Row, CheckBox, LinkButton, Banner, Header, MultiLink, PropertyHouse, CloseSvg, Label, LinkLabel, ActionBar, DatePicker, RadioButtons, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, SearchForm, SearchField, CardLabelError, CHBIcon, EmployeeModuleCard, Localities, RemoveableTag, FormComposer, MultiUploadWrapper, Close as Close$g, BreakLine, InfoBannerIcon, Menu, ButtonSelector, OTPInput, Rating, CitizenHomeCard } from '@mseva/digit-ui-react-components';
2
2
  import React, { useState, useEffect, useRef, Fragment as Fragment$1, useCallback, useMemo } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useLocation, useRouteMatch, useHistory, Switch, Route, Redirect, Link, useParams } from 'react-router-dom';
@@ -539,6 +539,10 @@ function createCommonjsModule(fn, module) {
539
539
  return module = { exports: {} }, fn(module, module.exports), module.exports;
540
540
  }
541
541
 
542
+ function getCjsExportFromNamespace (n) {
543
+ return n && n['default'] || n;
544
+ }
545
+
542
546
  var jquery = createCommonjsModule(function (module) {
543
547
  (function (global, factory) {
544
548
 
@@ -14384,6 +14388,8 @@ var accessibility = createCommonjsModule(function (module, exports) {
14384
14388
  });
14385
14389
  unwrapExports(accessibility);
14386
14390
 
14391
+ var _shallowEqual = getCjsExportFromNamespace(index_esm);
14392
+
14387
14393
  var Calendar_1 = createCommonjsModule(function (module, exports) {
14388
14394
 
14389
14395
  function _typeof(obj) {
@@ -15038,7 +15044,7 @@ var Calendar_1 = createCommonjsModule(function (module, exports) {
15038
15044
  monthNames: this.getMonthNames()
15039
15045
  });
15040
15046
  }
15041
- if (!(0, index_esm.shallowEqualObjects)(prevProps.scroll, this.props.scroll)) {
15047
+ if (!(0, _shallowEqual.shallowEqualObjects)(prevProps.scroll, this.props.scroll)) {
15042
15048
  this.setState({
15043
15049
  scrollArea: this.calcScrollArea(this.props)
15044
15050
  });
@@ -27887,6 +27893,30 @@ const configCHBApproverApplication = ({
27887
27893
  };
27888
27894
  };
27889
27895
 
27896
+ const configASSETApproverApplication = ({
27897
+ t,
27898
+ action,
27899
+ businessService
27900
+ }) => {
27901
+ console.log("njhsegfdhjsbedwfdwe", action);
27902
+ return {
27903
+ label: {
27904
+ heading: `WF_${action === null || action === void 0 ? void 0 : action.action}_APPLICATION`,
27905
+ submit: `WF_${businessService}_${action === null || action === void 0 ? void 0 : action.action}`,
27906
+ cancel: "ES_AST_COMMON_CANCEL"
27907
+ },
27908
+ form: [{
27909
+ body: [{
27910
+ label: t("AST_ACTION_COMMENTS"),
27911
+ type: "textarea",
27912
+ populators: {
27913
+ name: "comments"
27914
+ }
27915
+ }]
27916
+ }]
27917
+ };
27918
+ };
27919
+
27890
27920
  const Heading$1 = props => {
27891
27921
  return /*#__PURE__*/React.createElement("h1", {
27892
27922
  className: "heading-m"
@@ -30622,7 +30652,123 @@ const ActionModal$9 = ({
30622
30652
  })) : /*#__PURE__*/React.createElement(Loader, null);
30623
30653
  };
30624
30654
 
30625
- const ActionModal$a = props => {
30655
+ const Heading$b = props => {
30656
+ return /*#__PURE__*/React.createElement("h1", {
30657
+ className: "heading-m"
30658
+ }, props.label);
30659
+ };
30660
+ const Close$e = () => /*#__PURE__*/React.createElement("svg", {
30661
+ xmlns: "http://www.w3.org/2000/svg",
30662
+ viewBox: "0 0 24 24",
30663
+ fill: "#FFFFFF"
30664
+ }, /*#__PURE__*/React.createElement("path", {
30665
+ d: "M0 0h24v24H0V0z",
30666
+ fill: "none"
30667
+ }), /*#__PURE__*/React.createElement("path", {
30668
+ 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"
30669
+ }));
30670
+ const CloseBtn$e = props => {
30671
+ return /*#__PURE__*/React.createElement("div", {
30672
+ className: "icon-bg-secondary",
30673
+ onClick: props.onClick
30674
+ }, /*#__PURE__*/React.createElement(Close$e, null));
30675
+ };
30676
+ const ActionModal$a = ({
30677
+ t,
30678
+ action,
30679
+ tenantId,
30680
+ state,
30681
+ id,
30682
+ closeModal,
30683
+ submitAction,
30684
+ actionData,
30685
+ applicationData,
30686
+ businessService,
30687
+ moduleCode
30688
+ }) => {
30689
+ var _action$roles, _action$roles$, _action$roles$$map;
30690
+ const {
30691
+ data: approverData,
30692
+ isLoading: PTALoading
30693
+ } = Digit.Hooks.useEmployeeSearch(tenantId, {
30694
+ 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 => ({
30695
+ code: e
30696
+ })),
30697
+ isActive: true
30698
+ }, {
30699
+ enabled: !(action !== null && action !== void 0 && action.isTerminateState)
30700
+ });
30701
+ const history = useHistory();
30702
+ const [config, setConfig] = useState({});
30703
+ const [defaultValues, setDefaultValues] = useState({});
30704
+ const [approvers, setApprovers] = useState([]);
30705
+ const [selectedApprover, setSelectedApprover] = useState(null);
30706
+ const [uploadedFile, setUploadedFile] = useState(null);
30707
+ useEffect(() => {
30708
+ var _approverData$Employe;
30709
+ setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
30710
+ var _employee$user;
30711
+ return {
30712
+ uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
30713
+ name: employee === null || employee === void 0 ? void 0 : (_employee$user = employee.user) === null || _employee$user === void 0 ? void 0 : _employee$user.name
30714
+ };
30715
+ }));
30716
+ }, [approverData]);
30717
+ function submit(data) {
30718
+ let workflow = {
30719
+ action: action === null || action === void 0 ? void 0 : action.action,
30720
+ comment: data === null || data === void 0 ? void 0 : data.comments,
30721
+ businessService,
30722
+ moduleName: moduleCode
30723
+ };
30724
+ if (uploadedFile) workflow["documents"] = [];
30725
+ submitAction({
30726
+ Asset: {
30727
+ ...applicationData,
30728
+ workflow
30729
+ }
30730
+ });
30731
+ }
30732
+ useEffect(() => {
30733
+ if ((action === null || action === void 0 ? void 0 : action.state) === "INITIATED") {
30734
+ history.push(`/digit-ui/employee/asset/assetservice/edit/` + `${applicationData === null || applicationData === void 0 ? void 0 : applicationData.applicationNo}`);
30735
+ } else {
30736
+ setConfig(configASSETApproverApplication({
30737
+ t,
30738
+ action,
30739
+ approvers,
30740
+ selectedApprover,
30741
+ setSelectedApprover,
30742
+ uploadedFile,
30743
+ setUploadedFile,
30744
+ businessService
30745
+ }));
30746
+ }
30747
+ }, [action, approvers, uploadedFile]);
30748
+ return action && config.form ? /*#__PURE__*/React.createElement(Modal, {
30749
+ headerBarMain: /*#__PURE__*/React.createElement(Heading$b, {
30750
+ label: t(config.label.heading)
30751
+ }),
30752
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$e, {
30753
+ onClick: closeModal
30754
+ }),
30755
+ actionCancelLabel: t(config.label.cancel),
30756
+ actionCancelOnSubmit: closeModal,
30757
+ actionSaveLabel: t(config.label.submit),
30758
+ actionSaveOnSubmit: () => {},
30759
+ formId: "modal-action"
30760
+ }, /*#__PURE__*/React.createElement(FormComposer, {
30761
+ config: config.form,
30762
+ noBoxShadow: true,
30763
+ inline: true,
30764
+ childrenAtTheBottom: true,
30765
+ onSubmit: submit,
30766
+ defaultValues: defaultValues,
30767
+ formId: "modal-action"
30768
+ })) : /*#__PURE__*/React.createElement(Loader, null);
30769
+ };
30770
+
30771
+ const ActionModal$b = props => {
30626
30772
  if (props !== null && props !== void 0 && props.businessService.includes("PT")) {
30627
30773
  return /*#__PURE__*/React.createElement(ActionModal, props);
30628
30774
  }
@@ -30653,6 +30799,9 @@ const ActionModal$a = props => {
30653
30799
  if (props !== null && props !== void 0 && props.businessService.includes("chb")) {
30654
30800
  return /*#__PURE__*/React.createElement(ActionModal$9, props);
30655
30801
  }
30802
+ if (props !== null && props !== void 0 && props.businessService.includes("asset-create")) {
30803
+ return /*#__PURE__*/React.createElement(ActionModal$a, props);
30804
+ }
30656
30805
  };
30657
30806
 
30658
30807
  function DocumentsPreview({
@@ -31517,7 +31666,7 @@ const PermissionCheck = ({
31517
31666
  } : {},
31518
31667
  placeholder: t("BPA_ENTER_PERMIT_CONDITIONS_LABEL")
31519
31668
  }), /*#__PURE__*/React.createElement(LinkButton, {
31520
- label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Close$f, {
31669
+ label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Close$g, {
31521
31670
  style: {
31522
31671
  float: "right",
31523
31672
  position: "relative",
@@ -34440,7 +34589,7 @@ function ApplicationDetailsActionBar({
34440
34589
  }, 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}`))));
34441
34590
  }
34442
34591
 
34443
- const Close$e = () => /*#__PURE__*/React.createElement("svg", {
34592
+ const Close$f = () => /*#__PURE__*/React.createElement("svg", {
34444
34593
  xmlns: "http://www.w3.org/2000/svg",
34445
34594
  viewBox: "0 0 24 24",
34446
34595
  fill: "#FFFFFF"
@@ -34450,11 +34599,11 @@ const Close$e = () => /*#__PURE__*/React.createElement("svg", {
34450
34599
  }), /*#__PURE__*/React.createElement("path", {
34451
34600
  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"
34452
34601
  }));
34453
- const CloseBtn$e = props => {
34602
+ const CloseBtn$f = props => {
34454
34603
  return /*#__PURE__*/React.createElement("div", {
34455
34604
  className: "icon-bg-secondary",
34456
34605
  onClick: props.onClick
34457
- }, /*#__PURE__*/React.createElement(Close$e, null));
34606
+ }, /*#__PURE__*/React.createElement(Close$f, null));
34458
34607
  };
34459
34608
  function ApplicationDetailsWarningPopup({
34460
34609
  action,
@@ -34471,7 +34620,7 @@ function ApplicationDetailsWarningPopup({
34471
34620
  headerBarMain: /*#__PURE__*/React.createElement("h1", {
34472
34621
  className: "heading-m"
34473
34622
  }, t("PT_DUES_ARE_PENDING")),
34474
- headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$e, {
34623
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$f, {
34475
34624
  onClick: () => {
34476
34625
  closeWarningPopup();
34477
34626
  }
@@ -34816,7 +34965,7 @@ const ApplicationDetails = props => {
34816
34965
  showTimeLine: showTimeLine,
34817
34966
  oldValue: oldValue,
34818
34967
  isInfoLabel: isInfoLabel
34819
- }), showModal ? /*#__PURE__*/React.createElement(ActionModal$a, {
34968
+ }), showModal ? /*#__PURE__*/React.createElement(ActionModal$b, {
34820
34969
  t: t,
34821
34970
  action: selectedAction,
34822
34971
  tenantId: tenantId,