@djb25/digit-ui-module-ekyc 1.0.48 → 1.0.49
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.
- package/dist/index.js +218 -0
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +219 -1
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect, useMemo, createContext, useContext, isValidElement, cloneElement, createElement, useCallback, useReducer, Fragment } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { useHistory, Link, useParams, useLocation, useRouteMatch, Switch, Route, Redirect } from 'react-router-dom';
|
|
4
|
-
import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, SearchField, RadioButtons, InboxComposer, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, ActionBar, Menu, LinkButton, Toast, EditIcon, UploadFile, FormComposer, VerticalTimeline, Modal, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, CardHeader, CardText, CitizenHomeCard, DocumentIcon } from '@djb25/digit-ui-react-components';
|
|
4
|
+
import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, SearchField, RadioButtons, InboxComposer, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, ActionBar, Menu, LinkButton, Toast, EditIcon, UploadFile, FormComposer, VerticalTimeline, Modal, Close, CollapsibleCardPage, DatePicker, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, CardHeader, CardText, CitizenHomeCard, DocumentIcon } from '@djb25/digit-ui-react-components';
|
|
5
5
|
import * as Chartjs from 'chart.js/auto';
|
|
6
6
|
import Chartjs__default, { Chart } from 'chart.js/auto';
|
|
7
7
|
import { FaUsers, FaCheckCircle, FaClock, FaChartLine } from 'react-icons/fa';
|
|
@@ -75,6 +75,9 @@ const EKYCCard = () => {
|
|
|
75
75
|
count: totalCount,
|
|
76
76
|
label: t("EKYC_INBOX"),
|
|
77
77
|
link: prefix + "/inbox"
|
|
78
|
+
}, {
|
|
79
|
+
label: t("EKYC_WORK_ORDER"),
|
|
80
|
+
link: prefix + "/work-order"
|
|
78
81
|
}, ...(!roles.includes("EMPLOYEE") ? [{
|
|
79
82
|
label: t("EKYC_ASSIGN"),
|
|
80
83
|
link: prefix + "/assign"
|
|
@@ -6655,6 +6658,211 @@ const SurveyorDetailsDashboard = () => {
|
|
|
6655
6658
|
}));
|
|
6656
6659
|
};
|
|
6657
6660
|
|
|
6661
|
+
const WorkOrder = () => {
|
|
6662
|
+
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
6663
|
+
const _useTranslation = useTranslation(),
|
|
6664
|
+
t = _useTranslation.t;
|
|
6665
|
+
const history = useHistory();
|
|
6666
|
+
const _useState = useState(null),
|
|
6667
|
+
showToast = _useState[0],
|
|
6668
|
+
setShowToast = _useState[1];
|
|
6669
|
+
const _useState2 = useState(null),
|
|
6670
|
+
vendor = _useState2[0],
|
|
6671
|
+
setVendor = _useState2[1];
|
|
6672
|
+
const _useState3 = useState(""),
|
|
6673
|
+
validFrom = _useState3[0],
|
|
6674
|
+
setValidFrom = _useState3[1];
|
|
6675
|
+
const _useState4 = useState(""),
|
|
6676
|
+
validTo = _useState4[0],
|
|
6677
|
+
setValidTo = _useState4[1];
|
|
6678
|
+
const _useState5 = useState(null),
|
|
6679
|
+
uploadedFile = _useState5[0],
|
|
6680
|
+
setUploadedFile = _useState5[1];
|
|
6681
|
+
const _useState6 = useState(null),
|
|
6682
|
+
file = _useState6[0],
|
|
6683
|
+
setFile = _useState6[1];
|
|
6684
|
+
const _useState7 = useState(null),
|
|
6685
|
+
error = _useState7[0],
|
|
6686
|
+
setError = _useState7[1];
|
|
6687
|
+
const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVendorSearch({
|
|
6688
|
+
tenantId,
|
|
6689
|
+
filters: {
|
|
6690
|
+
status: "ACTIVE"
|
|
6691
|
+
},
|
|
6692
|
+
config: {
|
|
6693
|
+
select: data => (data === null || data === void 0 ? void 0 : data.vendor) || []
|
|
6694
|
+
}
|
|
6695
|
+
}),
|
|
6696
|
+
vendorOptions = _Digit$Hooks$fsm$useV.data;
|
|
6697
|
+
const _Digit$Hooks$wt$useVe = Digit.Hooks.wt.useVendorWorkOrderCreate(tenantId),
|
|
6698
|
+
createWorkOrder = _Digit$Hooks$wt$useVe.mutate;
|
|
6699
|
+
useEffect(() => {
|
|
6700
|
+
(function () {
|
|
6701
|
+
try {
|
|
6702
|
+
setError(null);
|
|
6703
|
+
const _temp3 = function () {
|
|
6704
|
+
if (file) {
|
|
6705
|
+
const _temp2 = function () {
|
|
6706
|
+
if (file.size >= 10000000) {
|
|
6707
|
+
setError(t("EKYC_MAXIMUM_UPLOAD_SIZE_EXCEEDED") || "File size exceeds 10MB");
|
|
6708
|
+
} else {
|
|
6709
|
+
const _temp = _catch(function () {
|
|
6710
|
+
return Promise.resolve(Digit.UploadServices.Filestorage("EKYC", file, Digit.ULBService.getStateId())).then(function (response) {
|
|
6711
|
+
var _response$data, _response$data$files;
|
|
6712
|
+
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) {
|
|
6713
|
+
var _response$data2, _response$data2$files;
|
|
6714
|
+
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);
|
|
6715
|
+
} else {
|
|
6716
|
+
setError(t("EKYC_FILE_UPLOAD_ERROR"));
|
|
6717
|
+
}
|
|
6718
|
+
});
|
|
6719
|
+
}, function () {
|
|
6720
|
+
setError(t("EKYC_FILE_UPLOAD_ERROR"));
|
|
6721
|
+
});
|
|
6722
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
6723
|
+
}
|
|
6724
|
+
}();
|
|
6725
|
+
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
6726
|
+
}
|
|
6727
|
+
}();
|
|
6728
|
+
return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
|
|
6729
|
+
} catch (e) {
|
|
6730
|
+
Promise.reject(e);
|
|
6731
|
+
}
|
|
6732
|
+
})();
|
|
6733
|
+
}, [file]);
|
|
6734
|
+
const handleSubmit = () => {
|
|
6735
|
+
var _vendor$owner, _vendor$owner2;
|
|
6736
|
+
const payload = {
|
|
6737
|
+
vendorWorkOrder: {
|
|
6738
|
+
tenantId,
|
|
6739
|
+
name: vendor === null || vendor === void 0 ? void 0 : vendor.name,
|
|
6740
|
+
mobileNumber: vendor === null || vendor === void 0 ? void 0 : (_vendor$owner = vendor.owner) === null || _vendor$owner === void 0 ? void 0 : _vendor$owner.mobileNumber,
|
|
6741
|
+
emailId: vendor === null || vendor === void 0 ? void 0 : (_vendor$owner2 = vendor.owner) === null || _vendor$owner2 === void 0 ? void 0 : _vendor$owner2.emailId,
|
|
6742
|
+
vendorId: (vendor === null || vendor === void 0 ? void 0 : vendor.code) || (vendor === null || vendor === void 0 ? void 0 : vendor.id),
|
|
6743
|
+
validFrom: new Date(validFrom).getTime(),
|
|
6744
|
+
validTo: new Date(validTo).getTime(),
|
|
6745
|
+
serviceType: "EKYC",
|
|
6746
|
+
fileStoreId: uploadedFile
|
|
6747
|
+
}
|
|
6748
|
+
};
|
|
6749
|
+
createWorkOrder(payload, {
|
|
6750
|
+
onSuccess: result => {
|
|
6751
|
+
setShowToast({
|
|
6752
|
+
isError: false,
|
|
6753
|
+
label: t("EKYC_WORK_ORDER_SAVE_SUCCESS")
|
|
6754
|
+
});
|
|
6755
|
+
setTimeout(() => {
|
|
6756
|
+
history.push("/digit-ui/employee/module/details");
|
|
6757
|
+
}, 3000);
|
|
6758
|
+
},
|
|
6759
|
+
onError: err => {
|
|
6760
|
+
var _err$response, _err$response$data, _err$response$data$Er, _err$response$data$Er2;
|
|
6761
|
+
setShowToast({
|
|
6762
|
+
isError: true,
|
|
6763
|
+
label: (err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : (_err$response$data$Er = _err$response$data.Errors) === null || _err$response$data$Er === void 0 ? void 0 : (_err$response$data$Er2 = _err$response$data$Er[0]) === null || _err$response$data$Er2 === void 0 ? void 0 : _err$response$data$Er2.message) || t("EKYC_WORK_ORDER_SAVE_ERROR")
|
|
6764
|
+
});
|
|
6765
|
+
}
|
|
6766
|
+
});
|
|
6767
|
+
};
|
|
6768
|
+
function selectfile(e) {
|
|
6769
|
+
setUploadedFile(null);
|
|
6770
|
+
setFile(e.target.files[0]);
|
|
6771
|
+
}
|
|
6772
|
+
const isFormDisabled = !vendor || !validFrom || !validTo || !uploadedFile;
|
|
6773
|
+
const isMobile = window.Digit.Utils.browser.isMobile();
|
|
6774
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6775
|
+
className: "employee-form-section-wrapper"
|
|
6776
|
+
}, /*#__PURE__*/React.createElement(VerticalTimeline, {
|
|
6777
|
+
config: [{
|
|
6778
|
+
timeLine: [{
|
|
6779
|
+
actions: t("EKYC_WORK_ORDER_ASSIGN"),
|
|
6780
|
+
currentStep: 1
|
|
6781
|
+
}]
|
|
6782
|
+
}],
|
|
6783
|
+
showFinalStep: false
|
|
6784
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
6785
|
+
style: {
|
|
6786
|
+
flex: 1
|
|
6787
|
+
}
|
|
6788
|
+
}, /*#__PURE__*/React.createElement(CollapsibleCardPage, {
|
|
6789
|
+
title: t("EKYC_UPLOAD_WORK_ORDER"),
|
|
6790
|
+
defaultOpen: true
|
|
6791
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
6792
|
+
className: "formcomposer-section-grid"
|
|
6793
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
6794
|
+
style: {
|
|
6795
|
+
display: "flex",
|
|
6796
|
+
flexDirection: "column"
|
|
6797
|
+
}
|
|
6798
|
+
}, /*#__PURE__*/React.createElement(Label, null, "" + t("EKYC_VENDOR_NAME"), " ", /*#__PURE__*/React.createElement("span", {
|
|
6799
|
+
className: "check-page-link-button"
|
|
6800
|
+
}, "*")), /*#__PURE__*/React.createElement(Dropdown, {
|
|
6801
|
+
t: t,
|
|
6802
|
+
option: vendorOptions,
|
|
6803
|
+
optionKey: "name",
|
|
6804
|
+
select: setVendor,
|
|
6805
|
+
selected: vendor,
|
|
6806
|
+
placeholder: t("EKYC_SELECT_VENDOR")
|
|
6807
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
6808
|
+
style: {
|
|
6809
|
+
display: "flex",
|
|
6810
|
+
flexDirection: "column"
|
|
6811
|
+
}
|
|
6812
|
+
}, /*#__PURE__*/React.createElement(Label, null, "" + t("COMMON_VALID_FROM_DATE"), " ", /*#__PURE__*/React.createElement("span", {
|
|
6813
|
+
className: "check-page-link-button"
|
|
6814
|
+
}, "*")), /*#__PURE__*/React.createElement(DatePicker, {
|
|
6815
|
+
date: validFrom,
|
|
6816
|
+
onChange: date => setValidFrom(date),
|
|
6817
|
+
style: {
|
|
6818
|
+
width: "100%"
|
|
6819
|
+
}
|
|
6820
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
6821
|
+
style: {
|
|
6822
|
+
display: "flex",
|
|
6823
|
+
flexDirection: "column"
|
|
6824
|
+
}
|
|
6825
|
+
}, /*#__PURE__*/React.createElement(Label, null, "" + t("COMMON_VALID_TO_DATE"), " ", /*#__PURE__*/React.createElement("span", {
|
|
6826
|
+
className: "check-page-link-button"
|
|
6827
|
+
}, "*")), /*#__PURE__*/React.createElement(DatePicker, {
|
|
6828
|
+
date: validTo,
|
|
6829
|
+
min: validFrom,
|
|
6830
|
+
onChange: date => setValidTo(date),
|
|
6831
|
+
style: {
|
|
6832
|
+
width: "100%"
|
|
6833
|
+
}
|
|
6834
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
6835
|
+
style: {
|
|
6836
|
+
display: "flex",
|
|
6837
|
+
flexDirection: "column"
|
|
6838
|
+
}
|
|
6839
|
+
}, /*#__PURE__*/React.createElement(Label, null, "" + t("EKYC_UPLOAD_DOCUMENT"), " ", /*#__PURE__*/React.createElement("span", {
|
|
6840
|
+
className: "check-page-link-button"
|
|
6841
|
+
}, "*")), /*#__PURE__*/React.createElement(UploadFile, {
|
|
6842
|
+
id: "ekyc-doc",
|
|
6843
|
+
extraStyleName: "propertyCreate",
|
|
6844
|
+
accept: "image/*, .pdf, .png, .jpeg, .jpg",
|
|
6845
|
+
onUpload: selectfile,
|
|
6846
|
+
onDelete: () => setUploadedFile(null),
|
|
6847
|
+
message: uploadedFile ? "1 " + t("EKYC_ACTION_FILEUPLOADED") : t("EKYC_ACTION_NO_FILEUPLOADED"),
|
|
6848
|
+
error: error
|
|
6849
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
6850
|
+
style: {
|
|
6851
|
+
display: "flex",
|
|
6852
|
+
marginTop: "24px",
|
|
6853
|
+
justifyContent: isMobile ? "center" : "flex-end"
|
|
6854
|
+
}
|
|
6855
|
+
}, /*#__PURE__*/React.createElement(SubmitBar, {
|
|
6856
|
+
label: t("ES_COMMON_SAVE"),
|
|
6857
|
+
onSubmit: isFormDisabled ? null : handleSubmit,
|
|
6858
|
+
disabled: isFormDisabled
|
|
6859
|
+
}))), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
6860
|
+
error: showToast.isError,
|
|
6861
|
+
label: showToast.label,
|
|
6862
|
+
onClose: () => setShowToast(null)
|
|
6863
|
+
}));
|
|
6864
|
+
};
|
|
6865
|
+
|
|
6658
6866
|
function formReducer(state, payload) {
|
|
6659
6867
|
const storageKey = "EKYC.SW.INBOX";
|
|
6660
6868
|
switch (payload.action) {
|
|
@@ -7017,6 +7225,11 @@ const getEkycRoutes = userType => [{
|
|
|
7017
7225
|
component: AdminDashboard,
|
|
7018
7226
|
layout: "normal",
|
|
7019
7227
|
breadcrumb: "EKYC_ADMIN_DASHBOARD"
|
|
7228
|
+
}, {
|
|
7229
|
+
path: "/work-order",
|
|
7230
|
+
component: WorkOrder,
|
|
7231
|
+
layout: "normal",
|
|
7232
|
+
breadcrumb: "EKYC_WORK_ORDER"
|
|
7020
7233
|
}, {
|
|
7021
7234
|
path: "/consumer-details",
|
|
7022
7235
|
component: EKYCForm,
|
|
@@ -7187,6 +7400,11 @@ const EmployeeApp = _ref => {
|
|
|
7187
7400
|
component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
7188
7401
|
layoutClass: "normal"
|
|
7189
7402
|
}, /*#__PURE__*/React.createElement(SurveyorDetailsDashboard, null))
|
|
7403
|
+
}), /*#__PURE__*/React.createElement(PrivateRoute, {
|
|
7404
|
+
path: path + "/work-order",
|
|
7405
|
+
component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
|
|
7406
|
+
layoutClass: "normal"
|
|
7407
|
+
}, /*#__PURE__*/React.createElement(WorkOrder, null))
|
|
7190
7408
|
})))));
|
|
7191
7409
|
};
|
|
7192
7410
|
|