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