@djb25/digit-ui-module-ekyc 1.0.8 → 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.
@@ -0,0 +1,55 @@
1
+ import React from "react";
2
+ import { Controller } from "react-hook-form";
3
+ import { CardLabelError, TextInput, Tooltip, Label } from "@djb25/digit-ui-react-components";
4
+ import { useTranslation } from "react-i18next";
5
+
6
+ const SearchFormFieldsComponents = ({ searchFormState, controlSearchForm }) => {
7
+ const { t } = useTranslation();
8
+ const { errors } = searchFormState;
9
+
10
+ return (
11
+ <React.Fragment>
12
+ {/* K NUMBER */}
13
+ <span className="mobile-input">
14
+ <Label className="flex-roww flex-gap-2">
15
+ {t("EKYC_K_NUMBER") || "K Number"}
16
+ <Tooltip message={t("EKYC_K_NUMBER_MESSAGE")} />
17
+ </Label>
18
+
19
+ <Controller
20
+ name="kNumber"
21
+ control={controlSearchForm}
22
+ defaultValue=""
23
+ rules={{
24
+ pattern: {
25
+ value: /^[a-zA-Z0-9-_/]*$/,
26
+ message: t("ERR_INVALID_APPLICATION_NO"),
27
+ },
28
+ }}
29
+ render={({ onChange, value }) => <TextInput value={value || ""} onChange={(e) => onChange(e.target.value)} />}
30
+ />
31
+
32
+ {errors?.kNumber && <CardLabelError>{errors.kNumber.message}</CardLabelError>}
33
+ </span>
34
+
35
+ {/* K NAME */}
36
+ {/* <span className="mobile-input">
37
+ <Label className="flex-roww flex-gap-2">
38
+ {t("EKYC_K_NAME") || "K Name"}
39
+ <Tooltip message={t("EKYC_K_NAME_MESSAGE")} />
40
+ </Label>
41
+
42
+ <Controller
43
+ name="kName"
44
+ control={controlSearchForm}
45
+ defaultValue=""
46
+ render={({ onChange, value }) => <TextInput value={value || ""} onChange={(e) => onChange(e.target.value)} />}
47
+ />
48
+
49
+ {errors?.kName && <CardLabelError>{errors.kName.message}</CardLabelError>}
50
+ </span> */}
51
+ </React.Fragment>
52
+ );
53
+ };
54
+
55
+ export default SearchFormFieldsComponents;
@@ -1,8 +1,11 @@
1
1
  import React, { useEffect, useRef } from "react";
2
2
  import { useTranslation } from "react-i18next";
3
- import { Chart, registerables } from "chart.js";
3
+ import * as Chartjs from "chart.js/auto";
4
4
 
5
- Chart.register(...registerables);
5
+ const getChartConstructor = () => {
6
+ const C = Chartjs.Chart || Chartjs.default || Chartjs;
7
+ return C;
8
+ };
6
9
 
7
10
  const StatusCards = ({ countData }) => {
8
11
  const { t } = useTranslation();
@@ -27,7 +30,8 @@ const StatusCards = ({ countData }) => {
27
30
  if (chartRef1.current) {
28
31
  if (chartInstance1.current) chartInstance1.current.destroy();
29
32
  const ctx1 = chartRef1.current.getContext("2d");
30
- chartInstance1.current = new Chart(ctx1, {
33
+ const ChartConstructor = getChartConstructor();
34
+ chartInstance1.current = new ChartConstructor(ctx1, {
31
35
  type: "doughnut",
32
36
  data: {
33
37
  labels: [t("EKYC_ACTIVE"), t("EKYC_PENDING"), t("EKYC_COMPLETED")],
@@ -0,0 +1,69 @@
1
+ import AadhaarVerification from "../pages/employee/AadhaarVerification";
2
+
3
+ export const ekycConfig = [
4
+ {
5
+ body: [
6
+ {
7
+ route: "consumer-details",
8
+ component: AadhaarVerification,
9
+ key: "aadhaarVerification",
10
+ texts: {
11
+ header: "EKYC_CONSUMER_CONNECTION",
12
+ submitBarLabel: "COMMON_SAVE_NEXT",
13
+ },
14
+ timeLine: [
15
+ {
16
+ currentStep: 1,
17
+ actions: "EKYC_CONSUMER_CONNECTION",
18
+ },
19
+ ],
20
+ },
21
+ {
22
+ route: "address-details",
23
+ component: "AddressDetails",
24
+ key: "addressDetails",
25
+ doorImage: true,
26
+ texts: {
27
+ header: "EKYC_ADDRESS_DETAILS",
28
+ submitBarLabel: "COMMON_SAVE_NEXT",
29
+ },
30
+ timeLine: [
31
+ {
32
+ currentStep: 2,
33
+ actions: "EKYC_ADDRESS_DETAILS",
34
+ },
35
+ ],
36
+ },
37
+ {
38
+ route: "property-info",
39
+ component: "PropertyInfo",
40
+ key: "propertyDetails",
41
+ texts: {
42
+ header: "EKYC_PROPERTY_INFO",
43
+ submitBarLabel: "COMMON_SAVE_NEXT",
44
+ },
45
+ timeLine: [
46
+ {
47
+ currentStep: 3,
48
+ actions: "EKYC_PROPERTY_INFO",
49
+ },
50
+ ],
51
+ },
52
+ {
53
+ route: "meter-details",
54
+ component: "MeterDetails",
55
+ key: "meterDetails",
56
+ texts: {
57
+ header: "EKYC_METER_DETAILS",
58
+ submitBarLabel: "COMMON_SAVE_NEXT",
59
+ },
60
+ timeLine: [
61
+ {
62
+ currentStep: 4,
63
+ actions: "EKYC_METER_DETAILS",
64
+ },
65
+ ],
66
+ },
67
+ ],
68
+ },
69
+ ];
@@ -0,0 +1,134 @@
1
+ import React, { useState } from "react";
2
+ import { useHistory } from "react-router-dom";
3
+ import { useTranslation } from "react-i18next";
4
+
5
+ const useInboxTableConfig = ({
6
+ parentRoute,
7
+ onPageSizeChange,
8
+ formState,
9
+ totalCount,
10
+ table,
11
+ dispatch,
12
+ checkPathName,
13
+ onSortingByData,
14
+ tenantId,
15
+ inboxStyles = {},
16
+ tableStyle = {},
17
+ }) => {
18
+ const { t } = useTranslation();
19
+ const history = useHistory();
20
+ const [selectedKno, setSelectedKno] = useState("");
21
+ const { data: reviewData, getReview } = Digit.Hooks.ekyc.useEkycAPI("review", tenantId);
22
+ const handleReview = (kno) => {
23
+ setSelectedKno(kno);
24
+ getReview({ kno });
25
+ };
26
+
27
+ const limit = formState?.tableForm?.limit || 10;
28
+ const offset = formState?.tableForm?.offset || 0;
29
+
30
+ React.useEffect(() => {
31
+ if (reviewData) {
32
+ history.push("/digit-ui/employee/ekyc/review", { kNumber: selectedKno, aadhaarData: reviewData?.aadhaarData, reviewData });
33
+ }
34
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35
+ }, [reviewData]);
36
+
37
+ const tableColumnConfig = [
38
+ {
39
+ Header: t("EKYC_APPLICATION_NO"),
40
+ accessor: "applicationNumber",
41
+ disableSortBy: true,
42
+ Cell: ({ row }) => {
43
+ const kno = row.original?.kno || row.original?.applicationNumber || "NA";
44
+ return (
45
+ <span
46
+ className="ekyc-application-link"
47
+ style={{ color: "#add8f7", cursor: "pointer", fontWeight: "bold" }}
48
+ onClick={() => handleReview(kno)}
49
+ >
50
+ {kno}
51
+ </span>
52
+ );
53
+ },
54
+ },
55
+ {
56
+ Header: t("EKYC_CITIZEN_NAME"),
57
+ accessor: "citizenName",
58
+ Cell: ({ row }) => <span>{row.original?.citizenName || "NA"}</span>,
59
+ },
60
+ {
61
+ Header: t("EKYC_STATUS"),
62
+ accessor: "actionStatus",
63
+ Cell: ({ row }) => {
64
+ const status = row.original?.status || "DEFAULT";
65
+ return <span className={`ekyc-status-tag ${status}`}>{t(`${status}`)}</span>;
66
+ },
67
+ },
68
+ {
69
+ Header: t("EKYC_ACTION"),
70
+ accessor: "status",
71
+ Cell: ({ row }) => {
72
+ const kno = row.original?.kno || row.original?.applicationNumber || "NA";
73
+ return (
74
+ <span
75
+ className="ekyc-application-link"
76
+ style={{ color: "#add8f7", cursor: "pointer", fontWeight: "bold" }}
77
+ onClick={() => handleReview(kno)}
78
+ >
79
+ {t("EKYC_REVIEW")}
80
+ </span>
81
+ );
82
+ },
83
+ },
84
+ ];
85
+
86
+ return {
87
+ getCellProps: (cellInfo) => {
88
+ return {
89
+ style: {
90
+ padding: "8px",
91
+ fontSize: "12px",
92
+ },
93
+ };
94
+ },
95
+ disableSort: false,
96
+ autoSort: false,
97
+ manualPagination: true,
98
+ initSortId: "applicationDate",
99
+ onPageSizeChange: onPageSizeChange,
100
+ currentPage: Math.floor(offset / limit),
101
+ onNextPage: () =>
102
+ dispatch({
103
+ action: "mutateTableForm",
104
+ data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) + parseInt(formState.tableForm?.limit) },
105
+ checkPathName,
106
+ }),
107
+ onPrevPage: () =>
108
+ dispatch({
109
+ action: "mutateTableForm",
110
+ data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) - parseInt(formState.tableForm?.limit) },
111
+ checkPathName,
112
+ }),
113
+ pageSizeLimit: limit,
114
+ onSort: onSortingByData,
115
+ // sortParams: [{id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false}],
116
+ totalRecords: totalCount,
117
+ onSearch: formState?.searchForm?.message,
118
+ onLastPage: () =>
119
+ dispatch({
120
+ action: "mutateTableForm",
121
+ data: { ...formState.tableForm, offset: Math.ceil(totalCount / 10) * 10 - parseInt(formState.tableForm?.limit) },
122
+ checkPathName,
123
+ }),
124
+ onFirstPage: () => dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, offset: 0 }, checkPathName }),
125
+ // globalSearch: {searchForItemsInTable},
126
+ // searchQueryForTable,
127
+ data: table,
128
+ columns: tableColumnConfig,
129
+ inboxStyles: { ...inboxStyles },
130
+ tableStyle: { ...tableStyle },
131
+ };
132
+ };
133
+
134
+ export default useInboxTableConfig;
@@ -71,7 +71,7 @@ const CitizenApp = () => {
71
71
  path={`${path}/meter-details`}
72
72
  component={() => <MeterDetails />}
73
73
  />
74
-
74
+
75
75
  <PrivateRoute
76
76
  path={`${path}/review`}
77
77
  component={() => <Review />}