@djb25/digit-ui-module-ekyc 1.0.24 → 1.0.26

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,297 @@
1
+ import React from "react";
2
+ import { UploadFile, Dropdown } from "@djb25/digit-ui-react-components";
3
+
4
+ const MeterDetailsConfig = (t, formData = {}, uploadPhoto, meterPhoto, meterPhotoId, setMeterPhoto, setMeterPhotoId) => {
5
+ const meterStatus = formData?.meterStatus?.name || formData?.meterStatus;
6
+ const lastBillReceived = formData?.lastBillReceived?.name || formData?.lastBillReceived;
7
+ const sewerConnection = formData?.sewerConnection?.name || formData?.sewerConnection;
8
+
9
+ const isFrozen = meterStatus === "Can not be identified";
10
+
11
+ // Generate Month-Year Options (1998–2026)
12
+ const monthYearOptions = [];
13
+ for (let y = 1998; y <= 2026; y++) {
14
+ for (let m = 1; m <= 12; m++) {
15
+ monthYearOptions.push({ name: `${m}/${y}` });
16
+ }
17
+ }
18
+
19
+ const yesNo = [{ name: "Yes" }, { name: "No" }];
20
+
21
+ const fields = [
22
+ {
23
+ label: t("Connection Category"),
24
+ isMandatory: true,
25
+ type: "text",
26
+ populators: {
27
+ name: "connectionCategory",
28
+ validation: { required: true },
29
+ },
30
+ },
31
+ {
32
+ label: t("SA Type"),
33
+ isMandatory: false,
34
+ type: "text",
35
+ populators: {
36
+ name: "saType",
37
+ },
38
+ },
39
+ {
40
+ label: t("Status"),
41
+ isMandatory: false,
42
+ type: "text",
43
+ populators: {
44
+ name: "status",
45
+ },
46
+ },
47
+ {
48
+ label: t("MR Code"),
49
+ isMandatory: false,
50
+ type: "text",
51
+ populators: {
52
+ name: "mrCode",
53
+ },
54
+ },
55
+ {
56
+ label: t("Area Code"),
57
+ isMandatory: false,
58
+ type: "text",
59
+ populators: {
60
+ name: "areaCode",
61
+ },
62
+ },
63
+ {
64
+ label: t("MR Key"),
65
+ isMandatory: false,
66
+ type: "text",
67
+ populators: {
68
+ name: "mrKey",
69
+ },
70
+ },
71
+ ];
72
+
73
+ // 🔹 Non-frozen fields
74
+ if (!isFrozen) {
75
+ fields.push(
76
+ {
77
+ label: t("Meter Number"),
78
+ isMandatory: false,
79
+ type: "text",
80
+ populators: {
81
+ name: "meterNumber",
82
+ },
83
+ },
84
+ {
85
+ label: t("Meter Maker"),
86
+ isMandatory: false,
87
+ type: "text",
88
+ populators: {
89
+ name: "meterMaker",
90
+ },
91
+ },
92
+ {
93
+ label: t("Meter Condition"),
94
+ isMandatory: false,
95
+ type: "custom",
96
+ key: "meterCondition",
97
+ populators: {
98
+ name: "meterCondition",
99
+ component: (props) => (
100
+ <Dropdown
101
+ option={[{ name: "Damaged" }, { name: "Not-Damaged" }]}
102
+ optionKey="name"
103
+ selected={props.value}
104
+ select={props.onChange}
105
+ />
106
+ ),
107
+ },
108
+ }
109
+ );
110
+
111
+ if (meterStatus === "Metered") {
112
+ fields.push({
113
+ label: t("Meter Photo *"),
114
+ isMandatory: true,
115
+ type: "custom",
116
+ key: "meterPhoto",
117
+ populators: {
118
+ name: "meterPhoto",
119
+ component: (props) => (
120
+ <div>
121
+ <UploadFile
122
+ onUpload={(e) => uploadPhoto(e, props.onChange)}
123
+ onDelete={() => {
124
+ props.onChange(null);
125
+ setMeterPhoto(null);
126
+ setMeterPhotoId(null);
127
+ }}
128
+ message={meterPhotoId ? t("Uploaded") : t("No file selected")}
129
+ />
130
+ {meterPhoto && (
131
+ <div style={{ marginTop: "10px" }}>
132
+ <img
133
+ src={meterPhoto}
134
+ alt="preview"
135
+ style={{ maxWidth: "100%", maxHeight: "200px", objectFit: "contain" }}
136
+ />
137
+ </div>
138
+ )}
139
+ </div>
140
+ ),
141
+ },
142
+ });
143
+ }
144
+ }
145
+
146
+ // 🔹 Standard fields after the conditional section
147
+ fields.push(
148
+ {
149
+ label: t("Meter Status"),
150
+ isMandatory: true,
151
+ type: "custom",
152
+ key: "meterStatus",
153
+ populators: {
154
+ name: "meterStatus",
155
+ component: (props) => (
156
+ <Dropdown
157
+ option={[{ name: "Metered" }, { name: "Unmetered" }, { name: "Can not be identified" }]}
158
+ optionKey="name"
159
+ selected={props.value}
160
+ select={props.onChange}
161
+ />
162
+ ),
163
+ },
164
+ },
165
+ {
166
+ label: t("Meter Location"),
167
+ isMandatory: true,
168
+ type: "custom",
169
+ key: "meterLocation",
170
+ populators: {
171
+ name: "meterLocation",
172
+ component: (props) => (
173
+ <Dropdown
174
+ option={[{ name: "Inside" }, { name: "Outside" }]}
175
+ optionKey="name"
176
+ selected={props.value}
177
+ select={props.onChange}
178
+ />
179
+ ),
180
+ },
181
+ },
182
+ {
183
+ label: t("Last Bill Received"),
184
+ isMandatory: true,
185
+ type: "custom",
186
+ key: "lastBillReceived",
187
+ populators: {
188
+ name: "lastBillReceived",
189
+ component: (props) => (
190
+ <Dropdown
191
+ option={yesNo}
192
+ optionKey="name"
193
+ selected={props.value}
194
+ select={props.onChange}
195
+ />
196
+ ),
197
+ },
198
+ }
199
+ );
200
+
201
+ // 🔹 Bill-received fields
202
+ if (lastBillReceived === "Yes") {
203
+ fields.push({
204
+ label: t("When was the last bill received *"),
205
+ isMandatory: true,
206
+ type: "custom",
207
+ key: "billMonthYear",
208
+ populators: {
209
+ name: "billMonthYear",
210
+ component: (props) => (
211
+ <Dropdown
212
+ option={monthYearOptions}
213
+ optionKey="name"
214
+ selected={props.value}
215
+ select={props.onChange}
216
+ />
217
+ ),
218
+ },
219
+ });
220
+ } else if (lastBillReceived === "No") {
221
+ fields.push({
222
+ label: t("Reason *"),
223
+ isMandatory: true,
224
+ type: "text",
225
+ populators: {
226
+ name: "reason",
227
+ validation: { required: true },
228
+ },
229
+ });
230
+ }
231
+
232
+ fields.push(
233
+ {
234
+ label: t("Access to Meter"),
235
+ isMandatory: false,
236
+ type: "custom",
237
+ key: "accessToMeter",
238
+ populators: {
239
+ name: "accessToMeter",
240
+ component: (props) => (
241
+ <Dropdown
242
+ option={yesNo}
243
+ optionKey="name"
244
+ selected={props.value}
245
+ select={props.onChange}
246
+ />
247
+ ),
248
+ },
249
+ },
250
+ {
251
+ label: t("Sewer Connection"),
252
+ isMandatory: true,
253
+ type: "custom",
254
+ key: "sewerConnection",
255
+ populators: {
256
+ name: "sewerConnection",
257
+ component: (props) => (
258
+ <Dropdown
259
+ option={yesNo}
260
+ optionKey="name"
261
+ selected={props.value}
262
+ select={props.onChange}
263
+ />
264
+ ),
265
+ },
266
+ }
267
+ );
268
+
269
+ if (sewerConnection === "No") {
270
+ fields.push({
271
+ label: t("Septic Tank"),
272
+ isMandatory: true,
273
+ type: "custom",
274
+ key: "septicTank",
275
+ populators: {
276
+ name: "septicTank",
277
+ component: (props) => (
278
+ <Dropdown
279
+ option={yesNo}
280
+ optionKey="name"
281
+ selected={props.value}
282
+ select={props.onChange}
283
+ />
284
+ ),
285
+ },
286
+ });
287
+ }
288
+
289
+ return [
290
+ {
291
+ head: t("EKYC_METER_DETAILS"),
292
+ body: fields,
293
+ },
294
+ ];
295
+ };
296
+
297
+ export default MeterDetailsConfig;
@@ -0,0 +1,145 @@
1
+ import React from "react";
2
+ import { UploadFile, Dropdown } from "@djb25/digit-ui-react-components";
3
+
4
+ const PropertyInfoConfig = (t, formData = {}, uploadFile, buildingImage, buildingImageId, setBuildingImage, setBuildingImageId) => {
5
+ const propertyType = formData?.propertyType?.name || formData?.propertyType;
6
+ const isHotel = propertyType === "Hotel";
7
+ const isHospitalOrNursing = propertyType === "Hospital" || propertyType === "Nursing Home";
8
+
9
+ const fields = [
10
+ {
11
+ label: t("PID Number"),
12
+ isMandatory: false,
13
+ type: "text",
14
+ populators: {
15
+ name: "pidNumber",
16
+ },
17
+ },
18
+ {
19
+ label: t("Property Type"),
20
+ isMandatory: false,
21
+ type: "custom",
22
+ key: "propertyType",
23
+ populators: {
24
+ name: "propertyType",
25
+ component: (props) => (
26
+ <Dropdown
27
+ option={[
28
+ { name: "Residential" },
29
+ { name: "Commercial" },
30
+ { name: "Hotel" },
31
+ { name: "Hospital" },
32
+ { name: "Nursing Home" },
33
+ ]}
34
+ optionKey="name"
35
+ selected={props.value}
36
+ select={props.onChange}
37
+ />
38
+ ),
39
+ },
40
+ },
41
+ {
42
+ label: t("Sub Property Category"),
43
+ isMandatory: false,
44
+ type: "custom",
45
+ key: "subPropertyCategory",
46
+ populators: {
47
+ name: "subPropertyCategory",
48
+ component: (props) => (
49
+ <Dropdown
50
+ option={[]}
51
+ optionKey="name"
52
+ selected={props.value}
53
+ select={props.onChange}
54
+ />
55
+ ),
56
+ },
57
+ },
58
+ {
59
+ label: t("No. of Floors"),
60
+ isMandatory: true,
61
+ type: "number",
62
+ populators: {
63
+ name: "noOfFloors",
64
+ validation: {
65
+ required: true,
66
+ min: 1,
67
+ },
68
+ },
69
+ },
70
+ {
71
+ label: t("Floor No. of this KNO"),
72
+ isMandatory: false,
73
+ type: "text",
74
+ populators: {
75
+ name: "floorNo",
76
+ },
77
+ },
78
+ {
79
+ label: isHospitalOrNursing ? t("No of Beds") : t("No of Beds"),
80
+ isMandatory: isHospitalOrNursing,
81
+ type: "number",
82
+ populators: {
83
+ name: "noOfBeds",
84
+ validation: isHospitalOrNursing ? { required: true, min: 1 } : {},
85
+ },
86
+ },
87
+ {
88
+ label: isHotel ? t("No. of Rooms") : t("No. of Rooms"),
89
+ isMandatory: isHotel,
90
+ type: "number",
91
+ populators: {
92
+ name: "noOfRooms",
93
+ validation: isHotel ? { required: true, min: 1 } : {},
94
+ },
95
+ },
96
+ {
97
+ label: t("Number of Dwelling Units"),
98
+ isMandatory: false,
99
+ type: "number",
100
+ populators: {
101
+ name: "dwellingUnits",
102
+ },
103
+ },
104
+ {
105
+ label: t("Building Image"),
106
+ isMandatory: true,
107
+ type: "custom",
108
+ key: "buildingImage",
109
+ populators: {
110
+ name: "buildingImage",
111
+ component: (props) => (
112
+ <div>
113
+ <UploadFile
114
+ onUpload={(e) => uploadFile(e, props.onChange)}
115
+ onDelete={() => {
116
+ props.onChange(null);
117
+ setBuildingImage(null);
118
+ setBuildingImageId(null);
119
+ }}
120
+ message={buildingImageId ? t("Uploaded") : t("No file selected")}
121
+ />
122
+ {buildingImage && (
123
+ <div style={{ marginTop: "10px" }}>
124
+ <img
125
+ src={buildingImage}
126
+ alt="preview"
127
+ style={{ maxWidth: "100%", maxHeight: "200px", objectFit: "contain" }}
128
+ />
129
+ </div>
130
+ )}
131
+ </div>
132
+ ),
133
+ },
134
+ },
135
+ ];
136
+
137
+ return [
138
+ {
139
+ head: t("EKYC_PROPERTY_DETAILS"),
140
+ body: fields,
141
+ },
142
+ ];
143
+ };
144
+
145
+ export default PropertyInfoConfig;
@@ -23,6 +23,7 @@ export const ekycConfig = [
23
23
  component: "AddressDetails",
24
24
  key: "addressDetails",
25
25
  doorImage: true,
26
+ showMapActualLocation: false,
26
27
  texts: {
27
28
  header: "EKYC_ADDRESS_DETAILS",
28
29
  submitBarLabel: "COMMON_SAVE_NEXT",
@@ -1,6 +1,6 @@
1
- import React from "react";
2
1
  import { useHistory } from "react-router-dom";
3
2
  import { useTranslation } from "react-i18next";
3
+ import { tableColumnConfig } from "../../../vendor/src/config/tableConfig";
4
4
 
5
5
  const SupervisorInboxTableConfig = ({
6
6
  onPageSizeChange,
@@ -8,7 +8,6 @@ const SupervisorInboxTableConfig = ({
8
8
  totalCount,
9
9
  table,
10
10
  dispatch,
11
- checkPathName,
12
11
  onSortingByData,
13
12
  inboxStyles = {},
14
13
  tableStyle = {},
@@ -25,52 +24,6 @@ const SupervisorInboxTableConfig = ({
25
24
  const limit = formState?.tableForm?.limit || 10;
26
25
  const offset = formState?.tableForm?.offset || 0;
27
26
 
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
27
  return {
75
28
  getCellProps: () => ({
76
29
  style: {
@@ -94,7 +47,6 @@ const SupervisorInboxTableConfig = ({
94
47
  ...formState.tableForm,
95
48
  offset: Number(offset) + Number(limit),
96
49
  },
97
- checkPathName,
98
50
  }),
99
51
 
100
52
  onPrevPage: () =>
@@ -104,7 +56,6 @@ const SupervisorInboxTableConfig = ({
104
56
  ...formState.tableForm,
105
57
  offset: Number(offset) - Number(limit),
106
58
  },
107
- checkPathName,
108
59
  }),
109
60
 
110
61
  onLastPage: () =>
@@ -114,21 +65,19 @@ const SupervisorInboxTableConfig = ({
114
65
  ...formState.tableForm,
115
66
  offset: Math.ceil(totalCount / limit) * limit - Number(limit),
116
67
  },
117
- checkPathName,
118
68
  }),
119
69
 
120
70
  onFirstPage: () =>
121
71
  dispatch({
122
72
  action: "mutateTableForm",
123
73
  data: { ...formState.tableForm, offset: 0 },
124
- checkPathName,
125
74
  }),
126
75
 
127
76
  totalRecords: totalCount,
128
77
  onSort: onSortingByData,
129
78
 
130
79
  data: table,
131
- columns: tableColumnConfig,
80
+ columns: tableColumnConfig(t, handleReview),
132
81
 
133
82
  inboxStyles: { ...inboxStyles },
134
83
  tableStyle: { ...tableStyle },
@@ -70,7 +70,7 @@ const useInboxTableConfig = ({
70
70
  Header: t("EKYC_EKYC_STATUS"),
71
71
  accessor: "ekycStatus",
72
72
  Cell: ({ row }) => {
73
- const ekycStatus = row.original?.ekycstatus || "NA";
73
+ const ekycStatus = row.original?.ekycStatus || row.original?.ekycstatus || "NA";
74
74
  return <span className={`ekyc-status-tag ${ekycStatus}`}>{t(`${ekycStatus}`)}</span>;
75
75
  },
76
76
  },
@@ -106,17 +106,17 @@ const useInboxTableConfig = ({
106
106
  manualPagination: true,
107
107
  initSortId: "applicationDate",
108
108
  onPageSizeChange: onPageSizeChange,
109
- currentPage: Math.floor(offset / limit),
109
+ currentPage: offset,
110
110
  onNextPage: () =>
111
111
  dispatch({
112
112
  action: "mutateTableForm",
113
- data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) + parseInt(formState.tableForm?.limit) },
113
+ data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) + 10 },
114
114
  checkPathName,
115
115
  }),
116
116
  onPrevPage: () =>
117
117
  dispatch({
118
118
  action: "mutateTableForm",
119
- data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) - parseInt(formState.tableForm?.limit) },
119
+ data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) - 10 },
120
120
  checkPathName,
121
121
  }),
122
122
  pageSizeLimit: limit,
@@ -127,7 +127,7 @@ const useInboxTableConfig = ({
127
127
  onLastPage: () =>
128
128
  dispatch({
129
129
  action: "mutateTableForm",
130
- data: { ...formState.tableForm, offset: Math.ceil(totalCount / 10) * 10 - parseInt(formState.tableForm?.limit) },
130
+ data: { ...formState.tableForm, offset: Math.max(0, Math.ceil(totalCount / limit) - 10) },
131
131
  checkPathName,
132
132
  }),
133
133
  onFirstPage: () => dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, offset: 0 }, checkPathName }),
@@ -32,7 +32,15 @@ const Inbox = ({ parentRoute }) => {
32
32
  };
33
33
  }, [tenantId, formState?.tableForm?.offset, formState?.tableForm?.limit, formState?.searchForm]);
34
34
 
35
- const { isLoading, data: dashboardData = {} } = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, queryParams, {
35
+ const filters = useMemo(() => {
36
+ const searchForm = formState?.searchForm || {};
37
+ return {
38
+ ...searchForm,
39
+ ...(searchForm.kNumber && { kno: searchForm.kNumber }),
40
+ };
41
+ }, [formState?.searchForm]);
42
+
43
+ const { isLoading, data: dashboardData = {} } = Digit.Hooks.ekyc.useEkycApplicationList(filters, queryParams, {
36
44
  enabled: !!tenantId,
37
45
  keepPreviousData: true,
38
46
  });
@@ -64,7 +72,7 @@ const Inbox = ({ parentRoute }) => {
64
72
  return [searchData];
65
73
  }
66
74
 
67
- return dashboardData?.dashboardInfo?.consumerList || [];
75
+ return dashboardData?.consumerList || [];
68
76
  }, [isSearchActive, searchData, dashboardData]);
69
77
 
70
78
  const filteredData = useMemo(() => {
@@ -80,6 +88,7 @@ const Inbox = ({ parentRoute }) => {
80
88
  applicationNumber: item.propertyInfo?.kno || "",
81
89
  citizenName: item.connectionDetails?.consumerName || "",
82
90
  status: item.connectionDetails?.statusflag || "",
91
+ ekycStatus: item.connectionDetails?.ekycStatus || item.connectionDetails?.ekycstatus || item.ekycStatus || item.ekycstatus || "NA",
83
92
  sla: 0,
84
93
  };
85
94
  }
@@ -93,6 +102,7 @@ const Inbox = ({ parentRoute }) => {
93
102
  applicationNumber: item.kno || item.applicationNumber || "",
94
103
  citizenName: item.consumerName || item.citizenName || "",
95
104
  status: item.status || "",
105
+ ekycStatus: item.ekycStatus || item.ekycstatus || "NA",
96
106
  sla: item.sla ?? 0,
97
107
  };
98
108
  });
@@ -102,7 +112,7 @@ const Inbox = ({ parentRoute }) => {
102
112
 
103
113
  const checkPathName = location.pathname.includes("ekyc/inbox");
104
114
  const PropsForInboxLinks = {
105
- headerText: checkPathName ? "MODULE_WATER" : "MODULE_SW",
115
+ headerText: "EKYC_MODULE",
106
116
  };
107
117
 
108
118
  const SearchFormFields = useCallback(
@@ -126,13 +136,13 @@ const Inbox = ({ parentRoute }) => {
126
136
  };
127
137
 
128
138
  const searchFormDefaultValues = {
129
- mobileNumber: "",
139
+ kNumber: "",
130
140
  applicationNumber: "",
131
141
  consumerNo: "",
132
142
  };
133
143
 
134
144
  const onSearchFormReset = (setSearchFormValue) => {
135
- setSearchFormValue("mobileNumber", null);
145
+ setSearchFormValue("kNumber", null);
136
146
  setSearchFormValue("applicationNumber", null);
137
147
  setSearchFormValue("consumerNo", null);
138
148
  dispatch({ action: "mutateSearchForm", data: searchFormDefaultValues });
@@ -154,10 +164,10 @@ const Inbox = ({ parentRoute }) => {
154
164
 
155
165
  const propsForFilterForm = {
156
166
  FilterFormFields,
157
- onFilterFormSubmit: () => {},
167
+ onFilterFormSubmit: () => { },
158
168
  filterFormDefaultValues: "",
159
169
  resetFilterFormDefaultValues: "",
160
- onFilterFormReset: () => {},
170
+ onFilterFormReset: () => { },
161
171
  };
162
172
 
163
173
  function formReducer(state, payload) {
@@ -239,9 +249,9 @@ const Inbox = ({ parentRoute }) => {
239
249
  <InboxComposer
240
250
  {...{
241
251
  isInboxLoading,
242
- PropsForInboxLinks,
252
+ // PropsForInboxLinks,
243
253
  ...propsForSearchForm,
244
- ...propsForFilterForm,
254
+ // ...propsForFilterForm,
245
255
  // ...propsForMobileSortForm,
246
256
  propsForInboxTable,
247
257
  // propsForInboxMobileCards,