@mseva/digit-ui-module-ptr 1.0.26 → 1.0.28

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 { LabelFieldPair, CardLabel, Dropdown, CardLabelError, TextInput, Toast, MobileNumber, TickMark, FormStep, Loader, UploadFile, RadioOrSelect, Card, CardHeader, CardText, CardSubHeader, SubmitBar, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, AppContainer, BackButton, PrivateRoute, StatusTable, Row, CheckBox, LinkButton, Banner, KeyNote, Header, MultiLink, Table, PropertyHouse, CloseSvg, Label, LinkLabel, ActionBar, DatePicker, RadioButtons, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, SearchForm, SearchField, BreadCrumb, PTRIcon, EmployeeModuleCard, Localities, RemoveableTag, FormComposer, Modal, PDFSvg, MultiUploadWrapper, Close as Close$a, BreakLine, TextArea, InfoBannerIcon, Menu, ButtonSelector, OTPInput, Rating, CitizenHomeCard } from '@mseva/digit-ui-react-components';
1
+ import { LabelFieldPair, CardLabel, Dropdown, CardLabelError, TextInput, Toast, MobileNumber, TickMark, FormStep, Loader, UploadFile, RadioOrSelect, Card, CardHeader, CardText, CardSubHeader, SubmitBar, TelePhone, DisplayPhotos, CardSectionHeader, CheckPoint, ConnectingCheckPoints, AppContainer, BackButton, PrivateRoute, StatusTable, Row, CheckBox, LinkButton, Banner, KeyNote, Header, MultiLink, Table, PropertyHouse, CloseSvg, Label, LinkLabel, ActionBar, DatePicker, RadioButtons, DetailsCard, SearchAction, FilterAction, PopUp, ShippingTruck, SearchForm, SearchField, BreadCrumb, PTRIcon, EmployeeModuleCard, Localities, RemoveableTag, FormComposer, Modal, PDFSvg, MultiUploadWrapper, Close as Close$b, BreakLine, TextArea, InfoBannerIcon, Menu, ButtonSelector, OTPInput, Rating, CitizenHomeCard } from '@mseva/digit-ui-react-components';
2
2
  import React, { useState, useEffect, useMemo, Fragment, useCallback, useRef } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useLocation, useRouteMatch, useHistory, Switch, Route, Redirect, Link, useParams } from 'react-router-dom';
@@ -18781,6 +18781,48 @@ const configTLDirectRenewApplication = ({
18781
18781
  };
18782
18782
  };
18783
18783
 
18784
+ const configCHBApproverApplication = ({
18785
+ t,
18786
+ action,
18787
+ approvers,
18788
+ selectedApprover,
18789
+ setSelectedApprover,
18790
+ selectFile,
18791
+ uploadedFile,
18792
+ setUploadedFile,
18793
+ assigneeLabel,
18794
+ businessService
18795
+ }) => {
18796
+ return {
18797
+ label: {
18798
+ heading: `WF_${action === null || action === void 0 ? void 0 : action.action}_APPLICATION`,
18799
+ submit: `WF_${businessService}_${action === null || action === void 0 ? void 0 : action.action}`,
18800
+ cancel: "ES_CHB_COMMON_CANCEL"
18801
+ },
18802
+ form: [{
18803
+ body: [{
18804
+ label: t("ES_CHB_ACTION_COMMENTS"),
18805
+ type: "textarea",
18806
+ populators: {
18807
+ name: "comments"
18808
+ }
18809
+ }, {
18810
+ label: `${t("ES_CHB_ATTACH_FILE")}${action.docUploadRequired ? " *" : ""}`,
18811
+ populators: /*#__PURE__*/React.createElement(UploadFile, {
18812
+ id: "workflow-doc",
18813
+ onUpload: selectFile,
18814
+ onDelete: () => {
18815
+ setUploadedFile(null);
18816
+ },
18817
+ showHint: true,
18818
+ hintText: t("CHB_ATTACH_RESTRICTIONS_SIZE"),
18819
+ message: uploadedFile ? `1 ${t(`ES_CHB_ACTION_FILEUPLOADED`)}` : t(`ES_CHB_ACTION_NO_FILEUPLOADED`)
18820
+ })
18821
+ }]
18822
+ }]
18823
+ };
18824
+ };
18825
+
18784
18826
  const Heading = props => {
18785
18827
  return /*#__PURE__*/React.createElement("h1", {
18786
18828
  className: "heading-m"
@@ -21368,7 +21410,155 @@ const ActionModal$8 = ({
21368
21410
  })) : /*#__PURE__*/React.createElement(Loader, null);
21369
21411
  };
21370
21412
 
21371
- const ActionModal$9 = props => {
21413
+ const Heading$9 = props => {
21414
+ return /*#__PURE__*/React.createElement("h1", {
21415
+ className: "heading-m"
21416
+ }, props.label);
21417
+ };
21418
+ const Close$9 = () => /*#__PURE__*/React.createElement("svg", {
21419
+ xmlns: "http://www.w3.org/2000/svg",
21420
+ viewBox: "0 0 24 24",
21421
+ fill: "#FFFFFF"
21422
+ }, /*#__PURE__*/React.createElement("path", {
21423
+ d: "M0 0h24v24H0V0z",
21424
+ fill: "none"
21425
+ }), /*#__PURE__*/React.createElement("path", {
21426
+ 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"
21427
+ }));
21428
+ const CloseBtn$9 = props => {
21429
+ return /*#__PURE__*/React.createElement("div", {
21430
+ className: "icon-bg-secondary",
21431
+ onClick: props.onClick
21432
+ }, /*#__PURE__*/React.createElement(Close$9, null));
21433
+ };
21434
+ const ActionModal$9 = ({
21435
+ t,
21436
+ action,
21437
+ tenantId,
21438
+ state,
21439
+ id,
21440
+ closeModal,
21441
+ submitAction,
21442
+ actionData,
21443
+ applicationData,
21444
+ businessService,
21445
+ moduleCode
21446
+ }) => {
21447
+ var _action$assigneeRoles, _action$assigneeRoles2;
21448
+ console.log("applicationData", applicationData);
21449
+ const {
21450
+ data: approverData,
21451
+ isLoading: PTALoading
21452
+ } = Digit.Hooks.useEmployeeSearch(tenantId, {
21453
+ roles: action === null || action === void 0 ? void 0 : (_action$assigneeRoles = action.assigneeRoles) === null || _action$assigneeRoles === void 0 ? void 0 : (_action$assigneeRoles2 = _action$assigneeRoles.map) === null || _action$assigneeRoles2 === void 0 ? void 0 : _action$assigneeRoles2.call(_action$assigneeRoles, e => ({
21454
+ code: e
21455
+ })),
21456
+ isActive: true
21457
+ }, {
21458
+ enabled: !(action !== null && action !== void 0 && action.isTerminateState)
21459
+ });
21460
+ const [config, setConfig] = useState({});
21461
+ const [defaultValues, setDefaultValues] = useState({});
21462
+ const [approvers, setApprovers] = useState([]);
21463
+ const [selectedApprover, setSelectedApprover] = useState(null);
21464
+ const [file, setFile] = useState(null);
21465
+ const [uploadedFile, setUploadedFile] = useState(null);
21466
+ const [error, setError] = useState(null);
21467
+ const [disableActionSubmit, setDisableActionSubmit] = useState(false);
21468
+ useEffect(() => {
21469
+ var _approverData$Employe;
21470
+ setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
21471
+ var _employee$user;
21472
+ return {
21473
+ uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
21474
+ name: employee === null || employee === void 0 ? void 0 : (_employee$user = employee.user) === null || _employee$user === void 0 ? void 0 : _employee$user.name
21475
+ };
21476
+ }));
21477
+ }, [approverData]);
21478
+ function selectFile(e) {
21479
+ setFile(e.target.files[0]);
21480
+ }
21481
+ useEffect(() => {
21482
+ (async () => {
21483
+ setError(null);
21484
+ if (file) {
21485
+ if (file.size >= 5242880) {
21486
+ setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
21487
+ } else {
21488
+ try {
21489
+ var _response$data, _response$data$files;
21490
+ const response = await Digit.UploadServices.Filestorage("CHB", file, Digit.ULBService.getStateId());
21491
+ if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
21492
+ var _response$data2, _response$data2$files;
21493
+ setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
21494
+ } else {
21495
+ setError(t("CS_FILE_UPLOAD_ERROR"));
21496
+ }
21497
+ } catch (err) {
21498
+ setError(t("CS_FILE_UPLOAD_ERROR"));
21499
+ }
21500
+ }
21501
+ }
21502
+ })();
21503
+ }, [file]);
21504
+ function submit(data) {
21505
+ let workflow = {
21506
+ action: action === null || action === void 0 ? void 0 : action.action,
21507
+ comments: data === null || data === void 0 ? void 0 : data.comments,
21508
+ businessService,
21509
+ moduleName: moduleCode
21510
+ };
21511
+ if (uploadedFile) workflow["documents"] = [{
21512
+ documentType: (action === null || action === void 0 ? void 0 : action.action) + " DOC",
21513
+ fileName: file === null || file === void 0 ? void 0 : file.name,
21514
+ filestoreId: uploadedFile
21515
+ }];
21516
+ submitAction({
21517
+ hallsBookingApplication: [{
21518
+ ...applicationData,
21519
+ workflow
21520
+ }]
21521
+ });
21522
+ }
21523
+ useEffect(() => {
21524
+ if (action) {
21525
+ setConfig(configCHBApproverApplication({
21526
+ t,
21527
+ action,
21528
+ approvers,
21529
+ selectedApprover,
21530
+ setSelectedApprover,
21531
+ selectFile,
21532
+ uploadedFile,
21533
+ setUploadedFile,
21534
+ businessService
21535
+ }));
21536
+ }
21537
+ }, [action, approvers, uploadedFile]);
21538
+ return action && config.form ? /*#__PURE__*/React.createElement(Modal, {
21539
+ headerBarMain: /*#__PURE__*/React.createElement(Heading$9, {
21540
+ label: t(config.label.heading)
21541
+ }),
21542
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$9, {
21543
+ onClick: closeModal
21544
+ }),
21545
+ actionCancelLabel: t(config.label.cancel),
21546
+ actionCancelOnSubmit: closeModal,
21547
+ actionSaveLabel: t(config.label.submit),
21548
+ actionSaveOnSubmit: () => {},
21549
+ formId: "modal-action"
21550
+ }, /*#__PURE__*/React.createElement(FormComposer, {
21551
+ config: config.form,
21552
+ noBoxShadow: true,
21553
+ inline: true,
21554
+ childrenAtTheBottom: true,
21555
+ onSubmit: submit,
21556
+ defaultValues: defaultValues,
21557
+ formId: "modal-action"
21558
+ })) : /*#__PURE__*/React.createElement(Loader, null);
21559
+ };
21560
+
21561
+ const ActionModal$a = props => {
21372
21562
  if (props !== null && props !== void 0 && props.businessService.includes("PT")) {
21373
21563
  return /*#__PURE__*/React.createElement(ActionModal, props);
21374
21564
  }
@@ -21396,6 +21586,9 @@ const ActionModal$9 = props => {
21396
21586
  if (props !== null && props !== void 0 && props.businessService.includes("street-vending")) {
21397
21587
  return /*#__PURE__*/React.createElement(ActionModal$8, props);
21398
21588
  }
21589
+ if (props !== null && props !== void 0 && props.businessService.includes("chb")) {
21590
+ return /*#__PURE__*/React.createElement(ActionModal$9, props);
21591
+ }
21399
21592
  };
21400
21593
 
21401
21594
  function DocumentsPreview({
@@ -22260,7 +22453,7 @@ const PermissionCheck = ({
22260
22453
  } : {},
22261
22454
  placeholder: t("BPA_ENTER_PERMIT_CONDITIONS_LABEL")
22262
22455
  }), /*#__PURE__*/React.createElement(LinkButton, {
22263
- label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Close$a, {
22456
+ label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Close$b, {
22264
22457
  style: {
22265
22458
  float: "right",
22266
22459
  position: "relative",
@@ -25183,7 +25376,7 @@ function ApplicationDetailsActionBar({
25183
25376
  }, 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}`))));
25184
25377
  }
25185
25378
 
25186
- const Close$9 = () => /*#__PURE__*/React.createElement("svg", {
25379
+ const Close$a = () => /*#__PURE__*/React.createElement("svg", {
25187
25380
  xmlns: "http://www.w3.org/2000/svg",
25188
25381
  viewBox: "0 0 24 24",
25189
25382
  fill: "#FFFFFF"
@@ -25193,11 +25386,11 @@ const Close$9 = () => /*#__PURE__*/React.createElement("svg", {
25193
25386
  }), /*#__PURE__*/React.createElement("path", {
25194
25387
  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"
25195
25388
  }));
25196
- const CloseBtn$9 = props => {
25389
+ const CloseBtn$a = props => {
25197
25390
  return /*#__PURE__*/React.createElement("div", {
25198
25391
  className: "icon-bg-secondary",
25199
25392
  onClick: props.onClick
25200
- }, /*#__PURE__*/React.createElement(Close$9, null));
25393
+ }, /*#__PURE__*/React.createElement(Close$a, null));
25201
25394
  };
25202
25395
  function ApplicationDetailsWarningPopup({
25203
25396
  action,
@@ -25214,7 +25407,7 @@ function ApplicationDetailsWarningPopup({
25214
25407
  headerBarMain: /*#__PURE__*/React.createElement("h1", {
25215
25408
  className: "heading-m"
25216
25409
  }, t("PT_DUES_ARE_PENDING")),
25217
- headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$9, {
25410
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn$a, {
25218
25411
  onClick: () => {
25219
25412
  closeWarningPopup();
25220
25413
  }
@@ -25559,7 +25752,7 @@ const ApplicationDetails = props => {
25559
25752
  showTimeLine: showTimeLine,
25560
25753
  oldValue: oldValue,
25561
25754
  isInfoLabel: isInfoLabel
25562
- }), showModal ? /*#__PURE__*/React.createElement(ActionModal$9, {
25755
+ }), showModal ? /*#__PURE__*/React.createElement(ActionModal$a, {
25563
25756
  t: t,
25564
25757
  action: selectedAction,
25565
25758
  tenantId: tenantId,