@djb25/digit-ui-module-ekyc 1.0.51 → 1.0.53

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 CHANGED
@@ -99,6 +99,25 @@ const EKYCCard = () => {
99
99
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.EmployeeModuleCard, propsForModuleCard);
100
100
  };
101
101
 
102
+ function _extends() {
103
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
104
+ for (var e = 1; e < arguments.length; e++) {
105
+ var t = arguments[e];
106
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
107
+ }
108
+ return n;
109
+ }, _extends.apply(null, arguments);
110
+ }
111
+ function _objectWithoutPropertiesLoose(r, e) {
112
+ if (null == r) return {};
113
+ var t = {};
114
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
115
+ if (-1 !== e.indexOf(n)) continue;
116
+ t[n] = r[n];
117
+ }
118
+ return t;
119
+ }
120
+
102
121
  const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
103
122
  const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
104
123
  function _catch(body, recover) {
@@ -136,6 +155,29 @@ const StatusCards = _ref => {
136
155
  const _useState = React.useState(false),
137
156
  ekycDownloadLoading = _useState[0],
138
157
  setEkycDownloadLoading = _useState[1];
158
+ const _useState2 = React.useState(false),
159
+ showReportMenu = _useState2[0],
160
+ setShowReportMenu = _useState2[1];
161
+ const _useState3 = React.useState({
162
+ from: "",
163
+ to: ""
164
+ }),
165
+ customDate = _useState3[0],
166
+ setCustomDate = _useState3[1];
167
+ const _useState4 = React.useState(false),
168
+ showCustomPicker = _useState4[0],
169
+ setShowCustomPicker = _useState4[1];
170
+ const reportMenuRef = React.useRef(null);
171
+ React.useEffect(() => {
172
+ const handler = e => {
173
+ if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
174
+ setShowReportMenu(false);
175
+ setShowCustomPicker(false);
176
+ }
177
+ };
178
+ document.addEventListener("mousedown", handler);
179
+ return () => document.removeEventListener("mousedown", handler);
180
+ }, []);
139
181
  let tenantId = Digit.ULBService.getCurrentTenantId();
140
182
  if (!tenantId || tenantId === "dl") {
141
183
  tenantId = "dl.djb";
@@ -164,50 +206,149 @@ const StatusCards = _ref => {
164
206
  active: info.active || 0
165
207
  };
166
208
  }, [dashboardData]);
167
- const handleDownloadEkycData = function () {
209
+ const handleDownloadEkycData = function (fromDate, toDate) {
168
210
  try {
169
211
  setEkycDownloadLoading(true);
170
212
  return Promise.resolve(_finallyRethrows(function () {
171
213
  return _catch(function () {
172
- return Promise.resolve(Digit.EkycService.application_list({
214
+ return Promise.resolve(Digit.EkycService.application_list(_extends({
173
215
  tenantId: tenantId,
174
216
  offset: 0,
175
217
  limit: 10000,
176
218
  reportDownload: true
177
- })).then(function (response) {
219
+ }, fromDate && {
220
+ fromDate
221
+ }, toDate && {
222
+ toDate
223
+ }))).then(function (response) {
178
224
  const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
179
225
  if (consumerList.length === 0) {
180
226
  alert(t("NO_DATA_FOUND") || "No data found for download.");
181
227
  return;
182
228
  }
183
- const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
229
+ const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile", "doorPhotoFilestoreId", "panFilestoreId", "documentProofFilestoreId", "buildingImageFileStoreId", "propertyDocumentFileStoreId", "meterPhotoFileStoreId", "modifiedBy", "zoneCode", "propertyType", "subPropertyCategory"];
184
230
  const headerMapping = {
185
- kno: t("KNO") || "KNO",
186
- firstName: t("FIRST_NAME") || "First Name",
187
- middleName: t("MIDDLE_NAME") || "Middle Name",
188
- lastName: t("LAST_NAME") || "Last Name",
189
- gender: t("GENDER") || "Gender",
190
- mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
191
- emailId: t("EMAIL_ID") || "Email ID",
192
- fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
193
- relationship: t("RELATIONSHIP") || "Relationship",
194
- dob: t("DOB") || "Date of Birth",
195
- ekycStatus: t("EKYC_STATUS") || "eKYC Status",
196
- zoneName: t("ZONE") || "Zone",
197
- assembly: t("ASSEMBLY") || "Assembly",
198
- ward: t("WARD") || "Ward",
199
- pincode: t("PINCODE") || "Pincode",
200
- mrkey: t("MR_KEY") || "MR Key",
201
- consumerType: t("CONSUMER_TYPE") || "Consumer Type",
202
- createdTime: t("CREATED_TIME") || "Created Time",
203
- lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
231
+ kno: t("KNO"),
232
+ firstName: t("FIRST_NAME"),
233
+ middleName: t("MIDDLE_NAME"),
234
+ lastName: t("LAST_NAME"),
235
+ status: t("STATUS"),
236
+ ekycStatus: t("EKYC_STATUS"),
237
+ zoneName: t("ZONE"),
238
+ zoneCode: t("ZONE_CODE"),
239
+ assembly: t("EKYC_ASSEMBLY"),
240
+ ward: t("WARD"),
241
+ pincode: t("EKYC_PINCODE"),
242
+ addressRaw: t("ADDRESS_RAW"),
243
+ locality: t("EKYC_LOCALITY"),
244
+ subLocality: t("SUB_LOCALITY"),
245
+ flatHouseNumber: t("FLAT_HOUSE_NUMBER"),
246
+ streetName: t("STREET_NAME"),
247
+ landmark: t("EKYC_LANDMARK"),
248
+ city: t("CITY"),
249
+ state: t("STATE"),
250
+ addressType: t("ADDRESS_TYPE"),
251
+ addressProofType: t("ADDRESS_PROOF_TYPE"),
252
+ mobileNo: t("MOBILE_NUMBER"),
253
+ alternateMobileNo: t("ALTERNATE_MOBILE_NUMBER"),
254
+ whatsappNo: t("WHATSAPP_NO"),
255
+ email: t("EMAIL"),
256
+ landlineNo: t("LANDLINE_NO"),
257
+ mrkey: t("MR_KEY"),
258
+ mrcode: t("MR_CODE"),
259
+ areacode: t("AREA_CODE"),
260
+ source: t("SOURCE"),
261
+ submittedAt: t("SUBMITTED_AT"),
262
+ assignedAt: t("ASSIGNED_AT"),
263
+ connectionType: t("CONNECTION_TYPE"),
264
+ Type: t("CONSUMER_TYPE"),
265
+ occupantType: t("OCCUPANT_TYPE"),
266
+ knoCategory: t("KNO_CATEGORY"),
267
+ approvedAt: t("APPROVED_AT"),
268
+ gender: t("GENDER"),
269
+ parentSpouse: t("PARENT_SPOUSE"),
270
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME"),
271
+ relationship: t("RELATIONSHIP"),
272
+ informantName: t("INFORMANT_NAME"),
273
+ informantRelation: t("INFORMANT_RELATION"),
274
+ informantIs: t("INFORMANT_IS"),
275
+ contactPerson: t("CONTACT_PERSON"),
276
+ relation: t("RELATION"),
277
+ entityName: t("ENTITY_NAME"),
278
+ designation: t("DESIGNATION"),
279
+ department: t("DEPARTMENT"),
280
+ employeeId: t("EMPLOYEE_ID"),
281
+ ownerMobile: t("OWNER_MOBILE"),
282
+ ownerVerificationDone: t("OWNER_VERIFICATION_DONE"),
283
+ consentGiven: t("CONSENT_GIVEN"),
284
+ proofOfIdentityType: t("PROOF_OF_IDENTITY_TYPE"),
285
+ documentNumber: t("DOCUMENT_NUMBER"),
286
+ noOfPerson: t("NUMBER_OF_PERSON"),
287
+ latitude: t("LATITUDE"),
288
+ longitude: t("LONGITUDE"),
289
+ gpsValid: t("GPS_VALID"),
290
+ meterNumber: t("METER_NUMBER"),
291
+ meterMake: t("METER_MAKE"),
292
+ meterStatus: t("METER_STATUS"),
293
+ meterCondition: t("METER_CONDITION"),
294
+ meterLocation: t("METER_LOCATION"),
295
+ meterLocationAddress: t("METER_LOCATION_ADDRESS"),
296
+ workingStatus: t("WORKING_STATUS"),
297
+ sewerConnection: t("SEWER_CONNECTION"),
298
+ septicTank: t("SEPTIC_TANK"),
299
+ lastBillRaised: t("LAST_BILL_RAISED"),
300
+ lastBillReceivedDate: t("LAST_BILL_RECEIVED_DATE"),
301
+ accessToMeter: t("ACCESS_TO_METER"),
302
+ systemMeterId: t("SYSTEM_METER_ID"),
303
+ lastBillNotRaisedReason: t("LAST_BILL_NOT_RAISED_REASON"),
304
+ waterConnectionYears: t("WATER_CONNECTION_YEARS"),
305
+ sewerConnectionYears: t("SEWER_CONNECTION_YEARS"),
306
+ pidNumber: t("PID_NUMBER"),
307
+ propertyType: t("PROPERTY_TYPE"),
308
+ subPropertyCategory: t("SUB_PROPERTY_CATEGORY"),
309
+ noOfFloor: t("NO_OF_FLOOR"),
310
+ noOfRooms: t("NO_OF_ROOMS"),
311
+ noOfBeds: t("NO_OF_BEDS"),
312
+ numberOfDwellingUnits: t("NUMBER_OF_DWELLING_UNITS"),
313
+ floorNo: t("FLOOR_NO"),
314
+ userType: t("USER_TYPE"),
315
+ tenantName: t("TENANT_NAME"),
316
+ tenantMobile: t("TENANT_MOBILE"),
317
+ verificationStatus: t("VERIFICATION_STATUS"),
318
+ houseBuiltDuration: t("HOUSE_BUILT_DURATION"),
319
+ surveyorId: t("SURVEYOR_ID"),
320
+ supervisorId: t("SUPERVISOR_ID"),
321
+ vendorId: t("VENDOR_ID"),
322
+ assignmentType: t("ASSIGNMENT_TYPE"),
323
+ assignmentValue: t("ASSIGNMENT_VALUE"),
324
+ assignedTime: t("ASSIGNED_TIME"),
325
+ isSelfAssigned: t("IS_SELF_ASSIGNED"),
326
+ doorPhotoFilestoreId: t("DOOR_PHOTO_FILESTORE_ID"),
327
+ panFilestoreId: t("PAN_FILESTORE_ID"),
328
+ documentProofFilestoreId: t("DOCUMENT_PROOF_FILESTORE_ID"),
329
+ buildingImageFileStoreId: t("BUILDING_IMAGE_FILESTORE_ID"),
330
+ propertyDocumentFileStoreId: t("PROPERTY_DOCUMENT_FILESTORE_ID"),
331
+ meterPhotoFileStoreId: t("METER_PHOTO_FILESTORE_ID"),
332
+ modifiedBy: t("MODIFIED_BY"),
333
+ emailId: t("EMAIL_ID"),
334
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME"),
335
+ dob: t("DOB"),
336
+ consumerType: t("CONSUMER_TYPE"),
337
+ createdTime: t("CREATED_TIME"),
338
+ lastModifiedTime: t("LAST_MODIFIED_TIME"),
339
+ meterLatitude: t("EKYC_METER_LATITUDE1"),
340
+ meterLongitude: t("EKYC_METER_LONGITUDE1")
204
341
  };
205
342
  const toTitleCase = str => {
206
343
  if (!str) return "";
207
- const cleanStr = String(str).includes(".") ? String(str).split(".").pop() : String(str);
344
+ let cleanStr = String(str);
345
+ if (cleanStr.includes(".") && !cleanStr.includes("@") && isNaN(Number(cleanStr))) {
346
+ cleanStr = cleanStr.split(".").pop();
347
+ }
208
348
  return cleanStr.toLowerCase().replace(/_/g, " ").replace(/\b\w/g, c => c.toUpperCase());
209
349
  };
210
- const skipTitleCase = ["kno", "mobileNumber", "emailId", "pincode", "mrkey", "dob", "createdTime", "lastModifiedTime"];
350
+ const skipTitleCase = ["kno", "mobileNumber", "emailId", "email", "pincode", "mrkey", "dob", "createdTime", "lastModifiedTime", "meterLatitude", "meterLongitude"];
351
+ const translatedFields = ["meterMake", "meterLocation"];
211
352
  const excelData = consumerList.map(item => {
212
353
  const cleanObj = {};
213
354
  const name = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
@@ -216,12 +357,19 @@ const StatusCards = _ref => {
216
357
  }
217
358
  Object.keys(item).forEach(key => {
218
359
  if (excludedKeys.includes(key)) return;
219
- const val = item[key];
360
+ let val = item[key];
220
361
  if (typeof val === "object" && val !== null) {
221
362
  return;
222
363
  }
364
+ if (String(val).toLowerCase() === "true") {
365
+ val = t("CS_YES");
366
+ } else if (String(val).toLowerCase() === "false") {
367
+ val = t("CS_NO");
368
+ }
223
369
  const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
224
- if (typeof val === "string" && !skipTitleCase.includes(key)) {
370
+ if (typeof val === "string" && translatedFields.includes(key)) {
371
+ cleanObj[friendlyHeader] = t(val);
372
+ } else if (typeof val === "string" && !skipTitleCase.includes(key)) {
225
373
  cleanObj[friendlyHeader] = toTitleCase(val);
226
374
  } else {
227
375
  cleanObj[friendlyHeader] = val;
@@ -244,6 +392,62 @@ const StatusCards = _ref => {
244
392
  return Promise.reject(e);
245
393
  }
246
394
  };
395
+ const getDateRange = filter => {
396
+ const now = new Date();
397
+ const start = new Date(now);
398
+ if (filter === "today") {
399
+ start.setHours(0, 0, 0, 0);
400
+ return {
401
+ from: start,
402
+ to: now
403
+ };
404
+ }
405
+ if (filter === "week") {
406
+ start.setDate(now.getDate() - now.getDay());
407
+ start.setHours(0, 0, 0, 0);
408
+ return {
409
+ from: start,
410
+ to: now
411
+ };
412
+ }
413
+ if (filter === "month") {
414
+ start.setDate(1);
415
+ start.setHours(0, 0, 0, 0);
416
+ return {
417
+ from: start,
418
+ to: now
419
+ };
420
+ }
421
+ return null;
422
+ };
423
+ const handlePresetDownload = function (filter) {
424
+ try {
425
+ const range = getDateRange(filter);
426
+ if (!range) return Promise.resolve();
427
+ setShowReportMenu(false);
428
+ setShowCustomPicker(false);
429
+ return Promise.resolve(handleDownloadEkycData(range.from.getTime(), range.to.getTime())).then(function () {});
430
+ } catch (e) {
431
+ return Promise.reject(e);
432
+ }
433
+ };
434
+ const handleCustomDownload = function () {
435
+ try {
436
+ if (!customDate.from || !customDate.to) {
437
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
438
+ return Promise.resolve();
439
+ }
440
+ const from = new Date(customDate.from);
441
+ from.setHours(0, 0, 0, 0);
442
+ const to = new Date(customDate.to);
443
+ to.setHours(23, 59, 59, 999);
444
+ setShowReportMenu(false);
445
+ setShowCustomPicker(false);
446
+ return Promise.resolve(handleDownloadEkycData(from.getTime(), to.getTime())).then(function () {});
447
+ } catch (e) {
448
+ return Promise.reject(e);
449
+ }
450
+ };
247
451
  const chartRef1 = React.useRef(null);
248
452
  const chartInstance1 = React.useRef(null);
249
453
  const total = hasExternalData ? countData.total : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.total) || (countData === null || countData === void 0 ? void 0 : countData.total) || (countData === null || countData === void 0 ? void 0 : countData.totalCount) || 0;
@@ -327,10 +531,16 @@ const StatusCards = _ref => {
327
531
  className: "total-label"
328
532
  }, t("EKYC_TOTAL_APPLICATIONS") || "Total Applications Processed"), /*#__PURE__*/React__default.createElement("div", {
329
533
  className: "total-number"
330
- }, formatNumber(total)), /*#__PURE__*/React__default.createElement("button", {
534
+ }, formatNumber(total)), /*#__PURE__*/React__default.createElement("div", {
535
+ className: "report-download",
536
+ ref: reportMenuRef
537
+ }, /*#__PURE__*/React__default.createElement("button", {
331
538
  className: "download-excel-btn",
332
539
  disabled: ekycDownloadLoading,
333
- onClick: handleDownloadEkycData
540
+ onClick: () => {
541
+ setShowReportMenu(p => !p);
542
+ setShowCustomPicker(false);
543
+ }
334
544
  }, /*#__PURE__*/React__default.createElement("svg", {
335
545
  width: "16",
336
546
  height: "16",
@@ -349,7 +559,63 @@ const StatusCards = _ref => {
349
559
  y1: "15",
350
560
  x2: "12",
351
561
  y2: "3"
352
- })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))), /*#__PURE__*/React__default.createElement("div", {
562
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"), showReportMenu && /*#__PURE__*/React__default.createElement("div", {
563
+ className: "report-menu"
564
+ }, [{
565
+ label: t("TODAY") || "Today",
566
+ key: "today"
567
+ }, {
568
+ label: t("THIS_WEEK") || "This Week",
569
+ key: "week"
570
+ }, {
571
+ label: t("THIS_MONTH") || "This Month",
572
+ key: "month"
573
+ }].map(_ref2 => {
574
+ let label = _ref2.label,
575
+ key = _ref2.key;
576
+ return /*#__PURE__*/React__default.createElement("div", {
577
+ key: key,
578
+ className: "menu-item",
579
+ onClick: () => handlePresetDownload(key)
580
+ }, label);
581
+ }), /*#__PURE__*/React__default.createElement("div", {
582
+ className: "custom-date-trigger",
583
+ onClick: () => setShowCustomPicker(p => !p)
584
+ }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React__default.createElement("div", {
585
+ className: "custom-picker"
586
+ }, /*#__PURE__*/React__default.createElement("div", {
587
+ className: "date-inputs"
588
+ }, /*#__PURE__*/React__default.createElement("label", null, /*#__PURE__*/React__default.createElement("span", null, "From"), /*#__PURE__*/React__default.createElement("input", {
589
+ type: "date",
590
+ value: customDate.from,
591
+ onChange: e => setCustomDate(_extends({}, customDate, {
592
+ from: e.target.value
593
+ }))
594
+ })), /*#__PURE__*/React__default.createElement("label", null, /*#__PURE__*/React__default.createElement("span", null, "To"), /*#__PURE__*/React__default.createElement("input", {
595
+ type: "date",
596
+ value: customDate.to,
597
+ onChange: e => setCustomDate(_extends({}, customDate, {
598
+ to: e.target.value
599
+ }))
600
+ }))), /*#__PURE__*/React__default.createElement("div", {
601
+ style: {
602
+ display: "flex",
603
+ gap: "10px",
604
+ marginTop: "10px"
605
+ }
606
+ }, /*#__PURE__*/React__default.createElement("button", {
607
+ className: "picker-cancel-btn",
608
+ onClick: () => {
609
+ setShowCustomPicker(false);
610
+ setCustomDate({
611
+ from: "",
612
+ to: ""
613
+ });
614
+ }
615
+ }, t("CANCEL") || "Cancel"), /*#__PURE__*/React__default.createElement("button", {
616
+ className: "picker-apply-btn",
617
+ onClick: handleCustomDownload
618
+ }, t("APPLY") || "Apply"))))))), /*#__PURE__*/React__default.createElement("div", {
353
619
  className: "status-panels-grid"
354
620
  }, /*#__PURE__*/React__default.createElement("div", {
355
621
  className: "status-panel"
@@ -451,25 +717,6 @@ const Dashboard = () => {
451
717
  }));
452
718
  };
453
719
 
454
- function _extends() {
455
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
456
- for (var e = 1; e < arguments.length; e++) {
457
- var t = arguments[e];
458
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
459
- }
460
- return n;
461
- }, _extends.apply(null, arguments);
462
- }
463
- function _objectWithoutPropertiesLoose(r, e) {
464
- if (null == r) return {};
465
- var t = {};
466
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
467
- if (-1 !== e.indexOf(n)) continue;
468
- t[n] = r[n];
469
- }
470
- return t;
471
- }
472
-
473
720
  const _excluded = ["tableConfig", "filterComponent"];
474
721
  const DesktopInbox = _ref => {
475
722
  var _Digit$ComponentRegis;
@@ -1790,7 +2037,6 @@ const VendorDetailsCard = () => {
1790
2037
  const vendorName = (vendor === null || vendor === void 0 ? void 0 : vendor.name) || "N/A";
1791
2038
  const mobileNumber = (vendor === null || vendor === void 0 ? void 0 : vendor.mobileNumber) || (vendor === null || vendor === void 0 ? void 0 : (_vendor$owner = vendor.owner) === null || _vendor$owner === void 0 ? void 0 : _vendor$owner.mobileNumber) || "N/A";
1792
2039
  const email = (vendor === null || vendor === void 0 ? void 0 : (_vendor$owner2 = vendor.owner) === null || _vendor$owner2 === void 0 ? void 0 : _vendor$owner2.emailId) || "N/A";
1793
- const status = vendor ? "ACTIVE" : "N/A";
1794
2040
  const jurisdictions = React.useMemo(() => {
1795
2041
  if (Array.isArray(vendor === null || vendor === void 0 ? void 0 : vendor.jurisdictions)) {
1796
2042
  return vendor.jurisdictions.join(", ");
@@ -1799,7 +2045,7 @@ const VendorDetailsCard = () => {
1799
2045
  }, [vendor]);
1800
2046
  const zoneIds = React.useMemo(() => {
1801
2047
  var _vendor$zoneIds;
1802
- return vendor !== null && vendor !== void 0 && (_vendor$zoneIds = vendor.zoneIds) !== null && _vendor$zoneIds !== void 0 && _vendor$zoneIds.length ? vendor.zoneIds.filter(Boolean).map(zone => String(zone).toUpperCase().replace("", " ")).join(", ") : "N/A";
2048
+ return vendor !== null && vendor !== void 0 && (_vendor$zoneIds = vendor.zoneIds) !== null && _vendor$zoneIds !== void 0 && _vendor$zoneIds.length ? vendor.zoneIds.filter(Boolean).map(zone => String(zone).trim().toUpperCase()) : [];
1803
2049
  }, [vendor]);
1804
2050
  const cards = React.useMemo(() => {
1805
2051
  const hasRealData = vendorSupervisors.some(s => s.totalKnos > 0);
@@ -2174,18 +2420,24 @@ const VendorDetailsCard = () => {
2174
2420
  }, t("EMAIL")), /*#__PURE__*/React__default.createElement("span", {
2175
2421
  className: "value"
2176
2422
  }, email)), /*#__PURE__*/React__default.createElement("div", {
2177
- className: "detail-item"
2178
- }, /*#__PURE__*/React__default.createElement("span", {
2179
- className: "label"
2180
- }, t("STATUS")), /*#__PURE__*/React__default.createElement("span", {
2181
- className: "value"
2182
- }, status)), /*#__PURE__*/React__default.createElement("div", {
2183
- className: "detail-item"
2423
+ className: "detail-item",
2424
+ style: {
2425
+ gridColumn: "1 / -1"
2426
+ }
2184
2427
  }, /*#__PURE__*/React__default.createElement("span", {
2185
2428
  className: "label"
2186
2429
  }, t("ASSIGNED_ZONES") || "Assigned Zones"), /*#__PURE__*/React__default.createElement("span", {
2187
2430
  className: "value"
2188
- }, zoneIds)))), /*#__PURE__*/React__default.createElement("div", {
2431
+ }, zoneIds.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
2432
+ className: "selected-zones",
2433
+ style: {
2434
+ marginTop: "4px",
2435
+ width: "100%"
2436
+ }
2437
+ }, zoneIds.map(zone => /*#__PURE__*/React__default.createElement("span", {
2438
+ key: zone,
2439
+ className: "selected-zone-chip"
2440
+ }, t(zone) || zone))) : "N/A")))), /*#__PURE__*/React__default.createElement("div", {
2189
2441
  className: "details-right"
2190
2442
  }, /*#__PURE__*/React__default.createElement("div", {
2191
2443
  className: "download-card"
@@ -3540,7 +3792,7 @@ const Review = () => {
3540
3792
  email: (editedAddress === null || editedAddress === void 0 ? void 0 : editedAddress.email) || (newDataRaw === null || newDataRaw === void 0 ? void 0 : (_newDataRaw$address11 = newDataRaw.address) === null || _newDataRaw$address11 === void 0 ? void 0 : _newDataRaw$address11.email),
3541
3793
  noOfPerson: (editedAddress === null || editedAddress === void 0 ? void 0 : editedAddress.noOfPerson) || (aadhaarData === null || aadhaarData === void 0 ? void 0 : aadhaarData.noOfPersons) || (newDataRaw === null || newDataRaw === void 0 ? void 0 : (_newDataRaw$address12 = newDataRaw.address) === null || _newDataRaw$address12 === void 0 ? void 0 : _newDataRaw$address12.noOfPerson),
3542
3794
  knumber: (editedAddress === null || editedAddress === void 0 ? void 0 : editedAddress.knumber) || (newDataRaw === null || newDataRaw === void 0 ? void 0 : (_newDataRaw$address13 = newDataRaw.address) === null || _newDataRaw$address13 === void 0 ? void 0 : _newDataRaw$address13.knumber) || activeKno,
3543
- doorPhotoFilestoreId: (editedAddress === null || editedAddress === void 0 ? void 0 : editedAddress.doorPhotoFileStoreId) || (newDataRaw === null || newDataRaw === void 0 ? void 0 : (_newDataRaw$address14 = newDataRaw.address) === null || _newDataRaw$address14 === void 0 ? void 0 : _newDataRaw$address14.doorPhotoFilestoreId)
3795
+ doorPhotoFilestoreId: (editedAddress === null || editedAddress === void 0 ? void 0 : editedAddress.doorPhotoFilestoreId) || (newDataRaw === null || newDataRaw === void 0 ? void 0 : (_newDataRaw$address14 = newDataRaw.address) === null || _newDataRaw$address14 === void 0 ? void 0 : _newDataRaw$address14.doorPhotoFilestoreId)
3544
3796
  });
3545
3797
  const propertyData = _extends({}, newDataRaw === null || newDataRaw === void 0 ? void 0 : newDataRaw.property, {
3546
3798
  kno: (newDataRaw === null || newDataRaw === void 0 ? void 0 : (_newDataRaw$property = newDataRaw.property) === null || _newDataRaw$property === void 0 ? void 0 : _newDataRaw$property.kno) || activeKno,
@@ -3771,11 +4023,24 @@ const Review = () => {
3771
4023
  return Promise.reject(e);
3772
4024
  }
3773
4025
  };
3774
- const handleViewDocument = fileStoreId => {
3775
- if (!fileStoreId) return;
3776
- const documentUrl = "https://dev-djberp.nitcon.in/filestore/v1/files/id?tenantId=dl.djb&fileStoreId=" + fileStoreId;
3777
- setPreviewUrl(documentUrl);
3778
- setShowPreview(true);
4026
+ const handleViewDocument = function (fileStoreId) {
4027
+ try {
4028
+ if (!fileStoreId) return Promise.resolve();
4029
+ const _temp4 = _catch(function () {
4030
+ return Promise.resolve(Digit.UploadServices.FileFetchbyid(fileStoreId, tenantId)).then(function (response) {
4031
+ if (response !== null && response !== void 0 && response.data) {
4032
+ const blobUrl = URL.createObjectURL(response.data);
4033
+ setPreviewUrl(blobUrl);
4034
+ setShowPreview(true);
4035
+ }
4036
+ });
4037
+ }, function (error) {
4038
+ console.error("Error fetching document:", error);
4039
+ });
4040
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
4041
+ } catch (e) {
4042
+ return Promise.reject(e);
4043
+ }
3779
4044
  };
3780
4045
  const handleMenuSelect = option => {
3781
4046
  setShowOptions(false);
@@ -5556,7 +5821,14 @@ const SupervisorDetailsCard = () => {
5556
5821
  className: "label"
5557
5822
  }, t("ASSIGNED_ZONE") || "Assigned Zone"), /*#__PURE__*/React__default.createElement("span", {
5558
5823
  className: "value"
5559
- }, assignedZone)), /*#__PURE__*/React__default.createElement("div", {
5824
+ }, assignedZone && assignedZone !== "N/A" ? /*#__PURE__*/React__default.createElement("div", {
5825
+ className: "selected-zones",
5826
+ style: {
5827
+ marginTop: "4px"
5828
+ }
5829
+ }, /*#__PURE__*/React__default.createElement("span", {
5830
+ className: "selected-zone-chip"
5831
+ }, t(assignedZone.trim().toUpperCase()) || assignedZone)) : assignedZone)), /*#__PURE__*/React__default.createElement("div", {
5560
5832
  className: "detail-item"
5561
5833
  }, /*#__PURE__*/React__default.createElement("span", {
5562
5834
  className: "label"
@@ -5626,6 +5898,7 @@ const SupervisorDetailsCard = () => {
5626
5898
 
5627
5899
  const AssignEkycModal = _ref => {
5628
5900
  let surveyor = _ref.surveyor,
5901
+ isReassign = _ref.isReassign,
5629
5902
  closeModal = _ref.closeModal,
5630
5903
  refetchDashboard = _ref.refetchDashboard,
5631
5904
  propsTenantId = _ref.tenantId;
@@ -5719,9 +5992,7 @@ const AssignEkycModal = _ref => {
5719
5992
  assemblyOptions: Array.from(assemblies.values()).sort((a, b) => a.name.localeCompare(b.name)),
5720
5993
  wardOptions: Array.from(wards.values()).sort((a, b) => a.name.localeCompare(b.name))
5721
5994
  };
5722
- }, [boundaryData]),
5723
- assemblyOptions = _useMemo.assemblyOptions,
5724
- wardOptions = _useMemo.wardOptions;
5995
+ }, [boundaryData]);
5725
5996
  const structuredLocalityData = React.useMemo(() => {
5726
5997
  let localities = [];
5727
5998
  const boundaries = Array.isArray(boundaryData) ? boundaryData : boundaryData ? [boundaryData] : [];
@@ -5755,7 +6026,7 @@ const AssignEkycModal = _ref => {
5755
6026
  return Array.from(pinSet).sort();
5756
6027
  }, [structuredLocalityData]);
5757
6028
  const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList({
5758
- unassignedOnly: true,
6029
+ unassignedOnly: !isReassign,
5759
6030
  fetchFilterOptions: true
5760
6031
  }, {
5761
6032
  tenantId: tenantId,
@@ -5785,7 +6056,7 @@ const AssignEkycModal = _ref => {
5785
6056
  setCurrentPage(0);
5786
6057
  }, [debouncedFilters, filters.kno]);
5787
6058
  const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
5788
- unassignedOnly: true
6059
+ unassignedOnly: !isReassign
5789
6060
  }, filters.kno && {
5790
6061
  kno: filters.kno
5791
6062
  }, debouncedFilters.ekycStatus && {
@@ -5882,6 +6153,56 @@ const AssignEkycModal = _ref => {
5882
6153
  handleAssignmentError(errMsg, variables);
5883
6154
  }
5884
6155
  });
6156
+ const reassignMutation = Digit.Hooks.ekyc.useEkycAssignmentReassign({
6157
+ onSuccess: (response, variables) => {
6158
+ if (response !== null && response !== void 0 && response.error) {
6159
+ var _response$data2;
6160
+ const errMsg = (response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.message) || "";
6161
+ handleAssignmentError(errMsg, variables);
6162
+ return;
6163
+ }
6164
+ if (response !== null && response !== void 0 && response.skipped && response.skipped.length > 0) {
6165
+ var _response$skipped$2;
6166
+ const reason = ((_response$skipped$2 = response.skipped[0]) === null || _response$skipped$2 === void 0 ? void 0 : _response$skipped$2.reason) || "";
6167
+ handleAssignmentError(reason, variables);
6168
+ return;
6169
+ }
6170
+ setToastData({
6171
+ error: false,
6172
+ label: t("EKYC_REASSIGNMENT_SUCCESSFUL") || "Reassignment successful"
6173
+ });
6174
+ setShowToast(true);
6175
+ setTimeout(function () {
6176
+ try {
6177
+ function _temp8() {
6178
+ function _temp6() {
6179
+ closeModal();
6180
+ }
6181
+ const _temp5 = function () {
6182
+ if (refetchApplicationList) {
6183
+ return Promise.resolve(refetchApplicationList()).then(function () {});
6184
+ }
6185
+ }();
6186
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
6187
+ }
6188
+ const _temp7 = function () {
6189
+ if (refetchDashboard) {
6190
+ return Promise.resolve(refetchDashboard()).then(function () {});
6191
+ }
6192
+ }();
6193
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
6194
+ } catch (e) {
6195
+ return Promise.reject(e);
6196
+ }
6197
+ }, 1000);
6198
+ },
6199
+ onError: (error, variables) => {
6200
+ var _error$data2, _error$response2, _error$response2$data;
6201
+ const errMsg = (error === null || error === void 0 ? void 0 : (_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.message) || (error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.message) || "";
6202
+ handleAssignmentError(errMsg, variables);
6203
+ }
6204
+ });
6205
+ const activeMutation = isReassign ? reassignMutation : assignmentMutation;
5885
6206
  const tableData = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.consumerList) || [];
5886
6207
  const getAssignmentPayload = () => {
5887
6208
  if (isBulkSelection) {
@@ -5921,16 +6242,22 @@ const AssignEkycModal = _ref => {
5921
6242
  };
5922
6243
  };
5923
6244
  const handleAssign = () => {
5924
- var _surveyor$owner;
5925
6245
  const _getAssignmentPayload = getAssignmentPayload(),
5926
6246
  assignmentType = _getAssignmentPayload.assignmentType,
5927
6247
  assignmentValue = _getAssignmentPayload.assignmentValue;
5928
- assignmentMutation.mutate({
6248
+ const payload = {
5929
6249
  tenantId: tenantId,
5930
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
5931
6250
  assignmentType,
5932
6251
  assignmentValue
5933
- });
6252
+ };
6253
+ if (isReassign) {
6254
+ var _surveyor$owner;
6255
+ payload.newSurveyorId = surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid;
6256
+ } else {
6257
+ var _surveyor$owner2;
6258
+ payload.surveyorId = surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner2 = surveyor.owner) === null || _surveyor$owner2 === void 0 ? void 0 : _surveyor$owner2.uuid;
6259
+ }
6260
+ activeMutation.mutate(payload);
5934
6261
  };
5935
6262
  const handleSelectAll = () => {
5936
6263
  setIsBulkSelection(true);
@@ -5996,13 +6323,13 @@ const AssignEkycModal = _ref => {
5996
6323
  setSelectedKnos(prev => prev.includes(kno) ? prev.filter(item => item !== kno) : [...prev, kno]);
5997
6324
  };
5998
6325
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
5999
- headerBarMain: "Assign KNOs to " + (surveyor === null || surveyor === void 0 ? void 0 : surveyor.name),
6326
+ headerBarMain: isReassign ? "Reassign KNOs to " + (surveyor === null || surveyor === void 0 ? void 0 : surveyor.name) : "Assign KNOs to " + (surveyor === null || surveyor === void 0 ? void 0 : surveyor.name),
6000
6327
  headerBarEnd: /*#__PURE__*/React__default.createElement(digitUiReactComponents.Close, {
6001
6328
  onClick: closeModal
6002
6329
  }),
6003
6330
  actionCancelLabel: "Cancel",
6004
6331
  actionCancelOnSubmit: closeModal,
6005
- actionSaveLabel: t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
6332
+ actionSaveLabel: isReassign ? t("EKYC_REASSIGN_KNOS") || "Reassign KNOs" : t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
6006
6333
  actionSaveOnSubmit: handleAssign,
6007
6334
  isDisabled: !(selectedKnos !== null && selectedKnos !== void 0 && selectedKnos.length)
6008
6335
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -6024,30 +6351,6 @@ const AssignEkycModal = _ref => {
6024
6351
  key: pin,
6025
6352
  value: pin
6026
6353
  }, pin))), /*#__PURE__*/React__default.createElement("select", {
6027
- className: "form-control",
6028
- value: filters.ward,
6029
- onChange: e => handleFilterChange("ward", e.target.value)
6030
- }, /*#__PURE__*/React__default.createElement("option", {
6031
- value: ""
6032
- }, "Select Ward"), wardOptions.filter(ward => {
6033
- const stripped = ward.name.replace(/[0-9]/g, "").replace(/^[-\s]+|[-\s]+$/g, "");
6034
- return stripped.trim().length > 0;
6035
- }).map(ward => {
6036
- const displayName = ward.name.replace(/[0-9]/g, "").replace(/^[-\s]+|[-\s]+$/g, "");
6037
- return /*#__PURE__*/React__default.createElement("option", {
6038
- key: ward.code,
6039
- value: ward.name
6040
- }, displayName);
6041
- })), /*#__PURE__*/React__default.createElement("select", {
6042
- className: "form-control",
6043
- value: filters.assembly,
6044
- onChange: e => handleFilterChange("assembly", e.target.value)
6045
- }, /*#__PURE__*/React__default.createElement("option", {
6046
- value: ""
6047
- }, "Select Assembly"), assemblyOptions.map(assembly => /*#__PURE__*/React__default.createElement("option", {
6048
- key: assembly.code,
6049
- value: assembly.name
6050
- }, assembly.name))), /*#__PURE__*/React__default.createElement("select", {
6051
6354
  className: "form-control",
6052
6355
  value: filters.mrkey,
6053
6356
  onChange: e => handleFilterChange("mrkey", e.target.value)
@@ -6101,7 +6404,7 @@ const AssignEkycModal = _ref => {
6101
6404
  const SurveyorDetailsDashboard = () => {
6102
6405
  var _Digit$SessionStorage, _Digit$SessionStorage2, _surveyorSearchById$s, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _surveyor$owner4, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner8, _surveyor$owner9, _surveyor$owner0, _dashboardData$dashbo5, _dashboardData$dashbo6;
6103
6406
  const tenantId = Digit.ULBService.getCurrentTenantId();
6104
- const _useState = React.useState(false),
6407
+ const _useState = React.useState(null),
6105
6408
  showModal = _useState[0],
6106
6409
  setShowModal = _useState[1];
6107
6410
  const _useState2 = React.useState(false),
@@ -6427,10 +6730,12 @@ const SurveyorDetailsDashboard = () => {
6427
6730
  };
6428
6731
  const options = [{
6429
6732
  action: "Assign"
6733
+ }, {
6734
+ action: "EKYC_REASSIGN"
6430
6735
  }];
6431
6736
  const handleMenuSelect = option => {
6432
6737
  setShowOptions(false);
6433
- setShowModal(true);
6738
+ setShowModal(option.action);
6434
6739
  };
6435
6740
  const handleDownloadEkycData = function () {
6436
6741
  try {
@@ -6511,7 +6816,7 @@ const SurveyorDetailsDashboard = () => {
6511
6816
  };
6512
6817
  const closeModal = function () {
6513
6818
  try {
6514
- setShowModal(false);
6819
+ setShowModal(null);
6515
6820
  return Promise.resolve();
6516
6821
  } catch (e) {
6517
6822
  return Promise.reject(e);
@@ -6738,6 +7043,7 @@ const SurveyorDetailsDashboard = () => {
6738
7043
  }
6739
7044
  })), showModal && /*#__PURE__*/React__default.createElement(AssignEkycModal, {
6740
7045
  surveyor: surveyor,
7046
+ isReassign: showModal === "EKYC_REASSIGN",
6741
7047
  closeModal: closeModal,
6742
7048
  refetchDashboard: refetchDashboard
6743
7049
  }));