@djb25/digit-ui-module-ekyc 1.0.13 → 1.0.15

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,138 @@
1
+ import React from "react";
2
+ import { useHistory } from "react-router-dom";
3
+ import { useTranslation } from "react-i18next";
4
+
5
+ const SupervisorInboxTableConfig = ({
6
+ onPageSizeChange,
7
+ formState,
8
+ totalCount,
9
+ table,
10
+ dispatch,
11
+ checkPathName,
12
+ onSortingByData,
13
+ inboxStyles = {},
14
+ tableStyle = {},
15
+ }) => {
16
+ const { t } = useTranslation();
17
+ const history = useHistory();
18
+
19
+ const userType = Digit.SessionStorage.get("User")?.info?.type?.toLowerCase() || "citizen";
20
+
21
+ const handleReview = (id) => {
22
+ history.push(`/digit-ui/${userType}/ekyc/assign/surveyor-details/${id}`);
23
+ };
24
+
25
+ const limit = formState?.tableForm?.limit || 10;
26
+ const offset = formState?.tableForm?.offset || 0;
27
+
28
+ const tableColumnConfig = [
29
+ {
30
+ Header: t("SURVEYOR_ID"),
31
+ accessor: "id",
32
+ Cell: ({ row }) => {
33
+ const id = row.original?.id;
34
+ return (
35
+ <span
36
+ className="ekyc-application-link"
37
+ style={{ color: "#add8f7", cursor: "pointer", fontWeight: "bold" }}
38
+ onClick={() => handleReview(id)}
39
+ >
40
+ {id || "NA"}
41
+ </span>
42
+ );
43
+ },
44
+ },
45
+
46
+ {
47
+ Header: t("SURVEYOR_NAME"),
48
+ accessor: "surveyorName",
49
+ Cell: ({ row }) => <span>{row.original?.surveyorName || row.original?.name || "NA"}</span>,
50
+ },
51
+
52
+ {
53
+ Header: t("MOBILE_NUMBER"),
54
+ accessor: "mobileNo",
55
+ Cell: ({ row }) => <span>{row.original?.mobileNo || row.original?.owner?.mobileNumber || "NA"}</span>,
56
+ },
57
+
58
+ {
59
+ Header: t("STATUS"),
60
+ accessor: "status",
61
+ Cell: ({ row }) => {
62
+ const status = row.original?.status || "DEFAULT";
63
+ return <span className={`ekyc-status-tag ${status}`}>{t(status)}</span>;
64
+ },
65
+ },
66
+
67
+ {
68
+ Header: t("SERVICE_TYPE"),
69
+ accessor: "serviceType",
70
+ Cell: ({ row }) => <span>{row.original?.serviceType || "NA"}</span>,
71
+ },
72
+ ];
73
+
74
+ return {
75
+ getCellProps: () => ({
76
+ style: {
77
+ padding: "8px",
78
+ fontSize: "12px",
79
+ },
80
+ }),
81
+
82
+ disableSort: false,
83
+ autoSort: false,
84
+ manualPagination: true,
85
+
86
+ currentPage: Math.floor(offset / limit),
87
+
88
+ onPageSizeChange,
89
+
90
+ onNextPage: () =>
91
+ dispatch({
92
+ action: "mutateTableForm",
93
+ data: {
94
+ ...formState.tableForm,
95
+ offset: Number(offset) + Number(limit),
96
+ },
97
+ checkPathName,
98
+ }),
99
+
100
+ onPrevPage: () =>
101
+ dispatch({
102
+ action: "mutateTableForm",
103
+ data: {
104
+ ...formState.tableForm,
105
+ offset: Number(offset) - Number(limit),
106
+ },
107
+ checkPathName,
108
+ }),
109
+
110
+ onLastPage: () =>
111
+ dispatch({
112
+ action: "mutateTableForm",
113
+ data: {
114
+ ...formState.tableForm,
115
+ offset: Math.ceil(totalCount / limit) * limit - Number(limit),
116
+ },
117
+ checkPathName,
118
+ }),
119
+
120
+ onFirstPage: () =>
121
+ dispatch({
122
+ action: "mutateTableForm",
123
+ data: { ...formState.tableForm, offset: 0 },
124
+ checkPathName,
125
+ }),
126
+
127
+ totalRecords: totalCount,
128
+ onSort: onSortingByData,
129
+
130
+ data: table,
131
+ columns: tableColumnConfig,
132
+
133
+ inboxStyles: { ...inboxStyles },
134
+ tableStyle: { ...tableStyle },
135
+ };
136
+ };
137
+
138
+ export default SupervisorInboxTableConfig;
@@ -26,10 +26,11 @@ const useInboxTableConfig = ({
26
26
 
27
27
  const limit = formState?.tableForm?.limit || 10;
28
28
  const offset = formState?.tableForm?.offset || 0;
29
+ const userType = Digit.SessionStorage.get("User")?.info?.type?.toLowerCase() || "citizen";
29
30
 
30
31
  React.useEffect(() => {
31
32
  if (reviewData) {
32
- history.push("/digit-ui/employee/ekyc/review", { kNumber: selectedKno, aadhaarData: reviewData?.aadhaarData, reviewData });
33
+ history.push(`/digit-ui/${userType}/ekyc/review/${selectedKno}`, { aadhaarData: reviewData?.aadhaarData, reviewData });
33
34
  }
34
35
  // eslint-disable-next-line react-hooks/exhaustive-deps
35
36
  }, [reviewData]);
@@ -66,8 +67,16 @@ const useInboxTableConfig = ({
66
67
  },
67
68
  },
68
69
  {
69
- Header: t("EKYC_ACTION"),
70
- accessor: "status",
70
+ Header: t("EKYC_EKYC_STATUS"),
71
+ accessor: "ekycStatus",
72
+ Cell: ({ row }) => {
73
+ const ekycStatus = row.original?.ekycstatus || "NA";
74
+ return <span className={`ekyc-status-tag ${ekycStatus}`}>{t(`${ekycStatus}`)}</span>;
75
+ },
76
+ },
77
+ {
78
+ Header: t("EKYC_REVIEW"),
79
+ accessor: "review",
71
80
  Cell: ({ row }) => {
72
81
  const kno = row.original?.kno || row.original?.applicationNumber || "NA";
73
82
  return (
@@ -12,7 +12,20 @@ const Home = () => {
12
12
  link: `/digit-ui/citizen/ekyc/dashboard`,
13
13
  },
14
14
  ],
15
- links: [
15
+ links: [],
16
+ };
17
+ const citizenInfo = Digit.SessionStorage.get("User")?.info?.roles;
18
+ const roles = citizenInfo.map((ele) => ele.code);
19
+
20
+ if (roles.includes("EKYC_SURVEYOR")) {
21
+ propsForModuleCard.links.push({
22
+ label: t("SURVEYOR_DASHBOARD"),
23
+ link: `/digit-ui/citizen/ekyc/surveyor-dashboard`,
24
+ });
25
+ }
26
+
27
+ if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
28
+ propsForModuleCard.links.push(
16
29
  {
17
30
  label: t("EKYC_DASHBOARD"),
18
31
  link: `/digit-ui/citizen/ekyc/dashboard`,
@@ -21,20 +34,20 @@ const Home = () => {
21
34
  label: t("EKYC_INBOX"),
22
35
  link: `/digit-ui/citizen/ekyc/inbox`,
23
36
  },
24
- // {
25
- // label: t("EKYC_CREATE_KYC"),
26
- // link: `/digit-ui/citizen/ekyc/create-kyc`
27
- // },
28
- // {
29
- // label: t("EKYC_UPDATE_KYC"),
30
- // link: `/digit-ui/citizen/ekyc/update-kyc`
31
- // },
32
37
  {
33
- label: t("EKYC_MAPPING"),
34
- link: `/digit-ui/citizen/ekyc/mapping`,
35
- },
36
- ],
37
- };
38
+ label: t("EKYC_ASSIGN"),
39
+ link: `/digit-ui/citizen/ekyc/assign`,
40
+ }
41
+ );
42
+ }
43
+
44
+ if (roles.length === 1 && roles.includes("CITIZEN")) {
45
+ propsForModuleCard.links.push({
46
+ label: t("EKYC_STATUS"),
47
+ link: `/digit-ui/citizen/ekyc/:id`,
48
+ });
49
+ }
50
+
38
51
  return <ModuleLinksView links={propsForModuleCard.links} />;
39
52
  };
40
53
 
@@ -10,6 +10,9 @@ import Home from "./Home";
10
10
  import Dashboard from "../../components/Dashboard";
11
11
  import Inbox from "./Inbox";
12
12
  import AddressDetails from "../../components/AddressDetails";
13
+ import AssignEkyc from "../../components/AssignEkyc";
14
+ import SurveyorDetailsCard from "../../components/SurveyorDetailsCard";
15
+ import VendorDetails from "../../components/VendorDetails";
13
16
 
14
17
  const CitizenApp = () => {
15
18
  const { t } = useTranslation();
@@ -31,6 +34,8 @@ const CitizenApp = () => {
31
34
 
32
35
  const breadcrumbs = [{ icon: HomeIcon, path: "/digit-ui/citizen" }, { label: t(getBreadcrumbLabel()) }];
33
36
 
37
+ const roles = Digit.SessionStorage.get("User")?.info?.roles.map((ele) => ele.code);
38
+ const isEkyAction = (!roles.includes("EKYC_SURVEYOR") || roles.includes("EMPLOYEE"))
34
39
  return (
35
40
  <React.Fragment>
36
41
  <div className="ground-container form-container">
@@ -59,7 +64,7 @@ const CitizenApp = () => {
59
64
  path={`${path}/dashboard`}
60
65
  component={() => (
61
66
  <LayoutWrapper layoutClass="normal">
62
- <Dashboard />
67
+ <VendorDetails />
63
68
  </LayoutWrapper>
64
69
  )}
65
70
  />
@@ -116,6 +121,48 @@ const CitizenApp = () => {
116
121
  </LayoutWrapper>
117
122
  )}
118
123
  />
124
+ <PrivateRoute
125
+ path={`${path}/assign`}
126
+ exact
127
+ component={() => (
128
+ <LayoutWrapper layoutClass="normal">
129
+ <AssignEkyc />
130
+ </LayoutWrapper>
131
+ )}
132
+ />
133
+ <PrivateRoute
134
+ path={`${path}/assign/surveyor-details/:id`}
135
+ exact
136
+ component={() => (
137
+ <LayoutWrapper layoutClass="action">
138
+ <SurveyorDetailsCard />
139
+ </LayoutWrapper>
140
+ )}
141
+ />
142
+ <PrivateRoute
143
+ path={`${path}/surveyor-dashboard/:id`}
144
+ component={() => (
145
+ <LayoutWrapper layoutClass="normal">
146
+ <SurveyorDetailsCard />
147
+ </LayoutWrapper>
148
+ )}
149
+ />
150
+ <PrivateRoute
151
+ path={`${path}/surveyor-dashboard`}
152
+ component={() => (
153
+ <LayoutWrapper layoutClass="normal">
154
+ <SurveyorDetailsCard />
155
+ </LayoutWrapper>
156
+ )}
157
+ />
158
+ <PrivateRoute
159
+ path={`${path}/status/:applicationId`}
160
+ component={() => (
161
+ <LayoutWrapper layoutClass="normal">
162
+ <Review />
163
+ </LayoutWrapper>
164
+ )}
165
+ />
119
166
  </Switch>
120
167
  </div>
121
168
  </React.Fragment>