@djb25/digit-ui-module-ekyc 1.0.52 → 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;
@@ -3545,7 +3792,7 @@ const Review = () => {
3545
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),
3546
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),
3547
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,
3548
- 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)
3549
3796
  });
3550
3797
  const propertyData = _extends({}, newDataRaw === null || newDataRaw === void 0 ? void 0 : newDataRaw.property, {
3551
3798
  kno: (newDataRaw === null || newDataRaw === void 0 ? void 0 : (_newDataRaw$property = newDataRaw.property) === null || _newDataRaw$property === void 0 ? void 0 : _newDataRaw$property.kno) || activeKno,
@@ -3776,11 +4023,24 @@ const Review = () => {
3776
4023
  return Promise.reject(e);
3777
4024
  }
3778
4025
  };
3779
- const handleViewDocument = fileStoreId => {
3780
- if (!fileStoreId) return;
3781
- const documentUrl = "https://dev-djberp.nitcon.in/filestore/v1/files/id?tenantId=dl.djb&fileStoreId=" + fileStoreId;
3782
- setPreviewUrl(documentUrl);
3783
- 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
+ }
3784
4044
  };
3785
4045
  const handleMenuSelect = option => {
3786
4046
  setShowOptions(false);
@@ -5638,6 +5898,7 @@ const SupervisorDetailsCard = () => {
5638
5898
 
5639
5899
  const AssignEkycModal = _ref => {
5640
5900
  let surveyor = _ref.surveyor,
5901
+ isReassign = _ref.isReassign,
5641
5902
  closeModal = _ref.closeModal,
5642
5903
  refetchDashboard = _ref.refetchDashboard,
5643
5904
  propsTenantId = _ref.tenantId;
@@ -5731,9 +5992,7 @@ const AssignEkycModal = _ref => {
5731
5992
  assemblyOptions: Array.from(assemblies.values()).sort((a, b) => a.name.localeCompare(b.name)),
5732
5993
  wardOptions: Array.from(wards.values()).sort((a, b) => a.name.localeCompare(b.name))
5733
5994
  };
5734
- }, [boundaryData]),
5735
- assemblyOptions = _useMemo.assemblyOptions,
5736
- wardOptions = _useMemo.wardOptions;
5995
+ }, [boundaryData]);
5737
5996
  const structuredLocalityData = React.useMemo(() => {
5738
5997
  let localities = [];
5739
5998
  const boundaries = Array.isArray(boundaryData) ? boundaryData : boundaryData ? [boundaryData] : [];
@@ -5767,7 +6026,7 @@ const AssignEkycModal = _ref => {
5767
6026
  return Array.from(pinSet).sort();
5768
6027
  }, [structuredLocalityData]);
5769
6028
  const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList({
5770
- unassignedOnly: true,
6029
+ unassignedOnly: !isReassign,
5771
6030
  fetchFilterOptions: true
5772
6031
  }, {
5773
6032
  tenantId: tenantId,
@@ -5797,7 +6056,7 @@ const AssignEkycModal = _ref => {
5797
6056
  setCurrentPage(0);
5798
6057
  }, [debouncedFilters, filters.kno]);
5799
6058
  const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
5800
- unassignedOnly: true
6059
+ unassignedOnly: !isReassign
5801
6060
  }, filters.kno && {
5802
6061
  kno: filters.kno
5803
6062
  }, debouncedFilters.ekycStatus && {
@@ -5894,6 +6153,56 @@ const AssignEkycModal = _ref => {
5894
6153
  handleAssignmentError(errMsg, variables);
5895
6154
  }
5896
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;
5897
6206
  const tableData = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.consumerList) || [];
5898
6207
  const getAssignmentPayload = () => {
5899
6208
  if (isBulkSelection) {
@@ -5933,16 +6242,22 @@ const AssignEkycModal = _ref => {
5933
6242
  };
5934
6243
  };
5935
6244
  const handleAssign = () => {
5936
- var _surveyor$owner;
5937
6245
  const _getAssignmentPayload = getAssignmentPayload(),
5938
6246
  assignmentType = _getAssignmentPayload.assignmentType,
5939
6247
  assignmentValue = _getAssignmentPayload.assignmentValue;
5940
- assignmentMutation.mutate({
6248
+ const payload = {
5941
6249
  tenantId: tenantId,
5942
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
5943
6250
  assignmentType,
5944
6251
  assignmentValue
5945
- });
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);
5946
6261
  };
5947
6262
  const handleSelectAll = () => {
5948
6263
  setIsBulkSelection(true);
@@ -6008,13 +6323,13 @@ const AssignEkycModal = _ref => {
6008
6323
  setSelectedKnos(prev => prev.includes(kno) ? prev.filter(item => item !== kno) : [...prev, kno]);
6009
6324
  };
6010
6325
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
6011
- 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),
6012
6327
  headerBarEnd: /*#__PURE__*/React__default.createElement(digitUiReactComponents.Close, {
6013
6328
  onClick: closeModal
6014
6329
  }),
6015
6330
  actionCancelLabel: "Cancel",
6016
6331
  actionCancelOnSubmit: closeModal,
6017
- actionSaveLabel: t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
6332
+ actionSaveLabel: isReassign ? t("EKYC_REASSIGN_KNOS") || "Reassign KNOs" : t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
6018
6333
  actionSaveOnSubmit: handleAssign,
6019
6334
  isDisabled: !(selectedKnos !== null && selectedKnos !== void 0 && selectedKnos.length)
6020
6335
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -6036,30 +6351,6 @@ const AssignEkycModal = _ref => {
6036
6351
  key: pin,
6037
6352
  value: pin
6038
6353
  }, pin))), /*#__PURE__*/React__default.createElement("select", {
6039
- className: "form-control",
6040
- value: filters.ward,
6041
- onChange: e => handleFilterChange("ward", e.target.value)
6042
- }, /*#__PURE__*/React__default.createElement("option", {
6043
- value: ""
6044
- }, "Select Ward"), wardOptions.filter(ward => {
6045
- const stripped = ward.name.replace(/[0-9]/g, "").replace(/^[-\s]+|[-\s]+$/g, "");
6046
- return stripped.trim().length > 0;
6047
- }).map(ward => {
6048
- const displayName = ward.name.replace(/[0-9]/g, "").replace(/^[-\s]+|[-\s]+$/g, "");
6049
- return /*#__PURE__*/React__default.createElement("option", {
6050
- key: ward.code,
6051
- value: ward.name
6052
- }, displayName);
6053
- })), /*#__PURE__*/React__default.createElement("select", {
6054
- className: "form-control",
6055
- value: filters.assembly,
6056
- onChange: e => handleFilterChange("assembly", e.target.value)
6057
- }, /*#__PURE__*/React__default.createElement("option", {
6058
- value: ""
6059
- }, "Select Assembly"), assemblyOptions.map(assembly => /*#__PURE__*/React__default.createElement("option", {
6060
- key: assembly.code,
6061
- value: assembly.name
6062
- }, assembly.name))), /*#__PURE__*/React__default.createElement("select", {
6063
6354
  className: "form-control",
6064
6355
  value: filters.mrkey,
6065
6356
  onChange: e => handleFilterChange("mrkey", e.target.value)
@@ -6113,7 +6404,7 @@ const AssignEkycModal = _ref => {
6113
6404
  const SurveyorDetailsDashboard = () => {
6114
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;
6115
6406
  const tenantId = Digit.ULBService.getCurrentTenantId();
6116
- const _useState = React.useState(false),
6407
+ const _useState = React.useState(null),
6117
6408
  showModal = _useState[0],
6118
6409
  setShowModal = _useState[1];
6119
6410
  const _useState2 = React.useState(false),
@@ -6439,10 +6730,12 @@ const SurveyorDetailsDashboard = () => {
6439
6730
  };
6440
6731
  const options = [{
6441
6732
  action: "Assign"
6733
+ }, {
6734
+ action: "EKYC_REASSIGN"
6442
6735
  }];
6443
6736
  const handleMenuSelect = option => {
6444
6737
  setShowOptions(false);
6445
- setShowModal(true);
6738
+ setShowModal(option.action);
6446
6739
  };
6447
6740
  const handleDownloadEkycData = function () {
6448
6741
  try {
@@ -6523,7 +6816,7 @@ const SurveyorDetailsDashboard = () => {
6523
6816
  };
6524
6817
  const closeModal = function () {
6525
6818
  try {
6526
- setShowModal(false);
6819
+ setShowModal(null);
6527
6820
  return Promise.resolve();
6528
6821
  } catch (e) {
6529
6822
  return Promise.reject(e);
@@ -6750,6 +7043,7 @@ const SurveyorDetailsDashboard = () => {
6750
7043
  }
6751
7044
  })), showModal && /*#__PURE__*/React__default.createElement(AssignEkycModal, {
6752
7045
  surveyor: surveyor,
7046
+ isReassign: showModal === "EKYC_REASSIGN",
6753
7047
  closeModal: closeModal,
6754
7048
  refetchDashboard: refetchDashboard
6755
7049
  }));