@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.
@@ -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;
@@ -3542,7 +3789,7 @@ const Review = () => {
3542
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),
3543
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),
3544
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,
3545
- 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)
3546
3793
  });
3547
3794
  const propertyData = _extends({}, newDataRaw === null || newDataRaw === void 0 ? void 0 : newDataRaw.property, {
3548
3795
  kno: (newDataRaw === null || newDataRaw === void 0 ? void 0 : (_newDataRaw$property = newDataRaw.property) === null || _newDataRaw$property === void 0 ? void 0 : _newDataRaw$property.kno) || activeKno,
@@ -3773,11 +4020,24 @@ const Review = () => {
3773
4020
  return Promise.reject(e);
3774
4021
  }
3775
4022
  };
3776
- const handleViewDocument = fileStoreId => {
3777
- if (!fileStoreId) return;
3778
- const documentUrl = "https://dev-djberp.nitcon.in/filestore/v1/files/id?tenantId=dl.djb&fileStoreId=" + fileStoreId;
3779
- setPreviewUrl(documentUrl);
3780
- 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
+ }
3781
4041
  };
3782
4042
  const handleMenuSelect = option => {
3783
4043
  setShowOptions(false);
@@ -5635,6 +5895,7 @@ const SupervisorDetailsCard = () => {
5635
5895
 
5636
5896
  const AssignEkycModal = _ref => {
5637
5897
  let surveyor = _ref.surveyor,
5898
+ isReassign = _ref.isReassign,
5638
5899
  closeModal = _ref.closeModal,
5639
5900
  refetchDashboard = _ref.refetchDashboard,
5640
5901
  propsTenantId = _ref.tenantId;
@@ -5728,9 +5989,7 @@ const AssignEkycModal = _ref => {
5728
5989
  assemblyOptions: Array.from(assemblies.values()).sort((a, b) => a.name.localeCompare(b.name)),
5729
5990
  wardOptions: Array.from(wards.values()).sort((a, b) => a.name.localeCompare(b.name))
5730
5991
  };
5731
- }, [boundaryData]),
5732
- assemblyOptions = _useMemo.assemblyOptions,
5733
- wardOptions = _useMemo.wardOptions;
5992
+ }, [boundaryData]);
5734
5993
  const structuredLocalityData = useMemo(() => {
5735
5994
  let localities = [];
5736
5995
  const boundaries = Array.isArray(boundaryData) ? boundaryData : boundaryData ? [boundaryData] : [];
@@ -5764,7 +6023,7 @@ const AssignEkycModal = _ref => {
5764
6023
  return Array.from(pinSet).sort();
5765
6024
  }, [structuredLocalityData]);
5766
6025
  const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList({
5767
- unassignedOnly: true,
6026
+ unassignedOnly: !isReassign,
5768
6027
  fetchFilterOptions: true
5769
6028
  }, {
5770
6029
  tenantId: tenantId,
@@ -5794,7 +6053,7 @@ const AssignEkycModal = _ref => {
5794
6053
  setCurrentPage(0);
5795
6054
  }, [debouncedFilters, filters.kno]);
5796
6055
  const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
5797
- unassignedOnly: true
6056
+ unassignedOnly: !isReassign
5798
6057
  }, filters.kno && {
5799
6058
  kno: filters.kno
5800
6059
  }, debouncedFilters.ekycStatus && {
@@ -5891,6 +6150,56 @@ const AssignEkycModal = _ref => {
5891
6150
  handleAssignmentError(errMsg, variables);
5892
6151
  }
5893
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;
5894
6203
  const tableData = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.consumerList) || [];
5895
6204
  const getAssignmentPayload = () => {
5896
6205
  if (isBulkSelection) {
@@ -5930,16 +6239,22 @@ const AssignEkycModal = _ref => {
5930
6239
  };
5931
6240
  };
5932
6241
  const handleAssign = () => {
5933
- var _surveyor$owner;
5934
6242
  const _getAssignmentPayload = getAssignmentPayload(),
5935
6243
  assignmentType = _getAssignmentPayload.assignmentType,
5936
6244
  assignmentValue = _getAssignmentPayload.assignmentValue;
5937
- assignmentMutation.mutate({
6245
+ const payload = {
5938
6246
  tenantId: tenantId,
5939
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
5940
6247
  assignmentType,
5941
6248
  assignmentValue
5942
- });
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);
5943
6258
  };
5944
6259
  const handleSelectAll = () => {
5945
6260
  setIsBulkSelection(true);
@@ -6005,13 +6320,13 @@ const AssignEkycModal = _ref => {
6005
6320
  setSelectedKnos(prev => prev.includes(kno) ? prev.filter(item => item !== kno) : [...prev, kno]);
6006
6321
  };
6007
6322
  return /*#__PURE__*/React.createElement(Modal, {
6008
- 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),
6009
6324
  headerBarEnd: /*#__PURE__*/React.createElement(Close, {
6010
6325
  onClick: closeModal
6011
6326
  }),
6012
6327
  actionCancelLabel: "Cancel",
6013
6328
  actionCancelOnSubmit: closeModal,
6014
- actionSaveLabel: t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
6329
+ actionSaveLabel: isReassign ? t("EKYC_REASSIGN_KNOS") || "Reassign KNOs" : t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
6015
6330
  actionSaveOnSubmit: handleAssign,
6016
6331
  isDisabled: !(selectedKnos !== null && selectedKnos !== void 0 && selectedKnos.length)
6017
6332
  }, /*#__PURE__*/React.createElement("div", {
@@ -6033,30 +6348,6 @@ const AssignEkycModal = _ref => {
6033
6348
  key: pin,
6034
6349
  value: pin
6035
6350
  }, pin))), /*#__PURE__*/React.createElement("select", {
6036
- className: "form-control",
6037
- value: filters.ward,
6038
- onChange: e => handleFilterChange("ward", e.target.value)
6039
- }, /*#__PURE__*/React.createElement("option", {
6040
- value: ""
6041
- }, "Select Ward"), wardOptions.filter(ward => {
6042
- const stripped = ward.name.replace(/[0-9]/g, "").replace(/^[-\s]+|[-\s]+$/g, "");
6043
- return stripped.trim().length > 0;
6044
- }).map(ward => {
6045
- const displayName = ward.name.replace(/[0-9]/g, "").replace(/^[-\s]+|[-\s]+$/g, "");
6046
- return /*#__PURE__*/React.createElement("option", {
6047
- key: ward.code,
6048
- value: ward.name
6049
- }, displayName);
6050
- })), /*#__PURE__*/React.createElement("select", {
6051
- className: "form-control",
6052
- value: filters.assembly,
6053
- onChange: e => handleFilterChange("assembly", e.target.value)
6054
- }, /*#__PURE__*/React.createElement("option", {
6055
- value: ""
6056
- }, "Select Assembly"), assemblyOptions.map(assembly => /*#__PURE__*/React.createElement("option", {
6057
- key: assembly.code,
6058
- value: assembly.name
6059
- }, assembly.name))), /*#__PURE__*/React.createElement("select", {
6060
6351
  className: "form-control",
6061
6352
  value: filters.mrkey,
6062
6353
  onChange: e => handleFilterChange("mrkey", e.target.value)
@@ -6110,7 +6401,7 @@ const AssignEkycModal = _ref => {
6110
6401
  const SurveyorDetailsDashboard = () => {
6111
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;
6112
6403
  const tenantId = Digit.ULBService.getCurrentTenantId();
6113
- const _useState = useState(false),
6404
+ const _useState = useState(null),
6114
6405
  showModal = _useState[0],
6115
6406
  setShowModal = _useState[1];
6116
6407
  const _useState2 = useState(false),
@@ -6436,10 +6727,12 @@ const SurveyorDetailsDashboard = () => {
6436
6727
  };
6437
6728
  const options = [{
6438
6729
  action: "Assign"
6730
+ }, {
6731
+ action: "EKYC_REASSIGN"
6439
6732
  }];
6440
6733
  const handleMenuSelect = option => {
6441
6734
  setShowOptions(false);
6442
- setShowModal(true);
6735
+ setShowModal(option.action);
6443
6736
  };
6444
6737
  const handleDownloadEkycData = function () {
6445
6738
  try {
@@ -6520,7 +6813,7 @@ const SurveyorDetailsDashboard = () => {
6520
6813
  };
6521
6814
  const closeModal = function () {
6522
6815
  try {
6523
- setShowModal(false);
6816
+ setShowModal(null);
6524
6817
  return Promise.resolve();
6525
6818
  } catch (e) {
6526
6819
  return Promise.reject(e);
@@ -6747,6 +7040,7 @@ const SurveyorDetailsDashboard = () => {
6747
7040
  }
6748
7041
  })), showModal && /*#__PURE__*/React.createElement(AssignEkycModal, {
6749
7042
  surveyor: surveyor,
7043
+ isReassign: showModal === "EKYC_REASSIGN",
6750
7044
  closeModal: closeModal,
6751
7045
  refetchDashboard: refetchDashboard
6752
7046
  }));