@djb25/digit-ui-module-ekyc 1.0.54 → 1.0.55

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
@@ -2088,57 +2088,174 @@ const VendorDetailsCard = () => {
2088
2088
  const _useState3 = React.useState(false),
2089
2089
  ekycDownloadLoading = _useState3[0],
2090
2090
  setEkycDownloadLoading = _useState3[1];
2091
- const handleDownloadEkycData = function () {
2091
+ const handleDownloadEkycData = function (fromDate, toDate) {
2092
2092
  try {
2093
2093
  setEkycDownloadLoading(true);
2094
2094
  return Promise.resolve(_finallyRethrows(function () {
2095
2095
  return _catch(function () {
2096
- return Promise.resolve(Digit.EkycService.application_list({
2096
+ return Promise.resolve(Digit.EkycService.application_list(_extends({
2097
2097
  tenantId: tenantId,
2098
2098
  offset: 0,
2099
2099
  limit: 10000,
2100
2100
  reportDownload: true
2101
- })).then(function (response) {
2101
+ }, fromDate && {
2102
+ fromDate
2103
+ }, toDate && {
2104
+ toDate
2105
+ }))).then(function (response) {
2102
2106
  const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
2103
2107
  if (!consumerList || consumerList.length === 0) {
2104
2108
  alert(t("NO_EKYC_DATA_FOUND") || "No eKYC data found to download.");
2105
2109
  return;
2106
2110
  }
2107
- const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
2111
+ 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"];
2108
2112
  const headerMapping = {
2109
- kno: t("KNO") || "KNO",
2110
- firstName: t("FIRST_NAME") || "First Name",
2111
- middleName: t("MIDDLE_NAME") || "Middle Name",
2112
- lastName: t("LAST_NAME") || "Last Name",
2113
- gender: t("GENDER") || "Gender",
2114
- mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
2115
- emailId: t("EMAIL_ID") || "Email ID",
2116
- fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
2117
- relationship: t("RELATIONSHIP") || "Relationship",
2118
- dob: t("DOB") || "Date of Birth",
2119
- ekycStatus: t("EKYC_STATUS") || "eKYC Status",
2120
- zoneName: t("ZONE") || "Zone",
2121
- assembly: t("ASSEMBLY") || "Assembly",
2122
- ward: t("WARD") || "Ward",
2123
- pincode: t("PINCODE") || "Pincode",
2124
- mrkey: t("MR_KEY") || "MR Key",
2125
- createdTime: t("CREATED_TIME") || "Created Time",
2126
- lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
2113
+ kno: t("KNO"),
2114
+ firstName: t("FIRST_NAME"),
2115
+ middleName: t("MIDDLE_NAME"),
2116
+ lastName: t("LAST_NAME"),
2117
+ status: t("STATUS"),
2118
+ ekycStatus: t("EKYC_STATUS"),
2119
+ zoneName: t("ZONE"),
2120
+ zoneCode: t("ZONE_CODE"),
2121
+ assembly: t("EKYC_ASSEMBLY"),
2122
+ ward: t("WARD"),
2123
+ pincode: t("EKYC_PINCODE"),
2124
+ addressRaw: t("ADDRESS_RAW"),
2125
+ locality: t("EKYC_LOCALITY"),
2126
+ subLocality: t("SUB_LOCALITY"),
2127
+ flatHouseNumber: t("FLAT_HOUSE_NUMBER"),
2128
+ streetName: t("STREET_NAME"),
2129
+ landmark: t("EKYC_LANDMARK"),
2130
+ city: t("CITY"),
2131
+ state: t("STATE"),
2132
+ addressType: t("ADDRESS_TYPE"),
2133
+ addressProofType: t("ADDRESS_PROOF_TYPE"),
2134
+ mobileNo: t("MOBILE_NUMBER"),
2135
+ alternateMobileNo: t("ALTERNATE_MOBILE_NUMBER"),
2136
+ whatsappNo: t("WHATSAPP_NO"),
2137
+ email: t("EMAIL"),
2138
+ landlineNo: t("LANDLINE_NO"),
2139
+ mrkey: t("MR_KEY"),
2140
+ mrcode: t("MR_CODE"),
2141
+ areacode: t("AREA_CODE"),
2142
+ source: t("SOURCE"),
2143
+ submittedAt: t("SUBMITTED_AT"),
2144
+ assignedAt: t("ASSIGNED_AT"),
2145
+ connectionType: t("CONNECTION_TYPE"),
2146
+ Type: t("CONSUMER_TYPE"),
2147
+ occupantType: t("OCCUPANT_TYPE"),
2148
+ knoCategory: t("KNO_CATEGORY"),
2149
+ approvedAt: t("APPROVED_AT"),
2150
+ gender: t("GENDER"),
2151
+ parentSpouse: t("PARENT_SPOUSE"),
2152
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME"),
2153
+ relationship: t("RELATIONSHIP"),
2154
+ informantName: t("INFORMANT_NAME"),
2155
+ informantRelation: t("INFORMANT_RELATION"),
2156
+ informantIs: t("INFORMANT_IS"),
2157
+ contactPerson: t("CONTACT_PERSON"),
2158
+ relation: t("RELATION"),
2159
+ entityName: t("ENTITY_NAME"),
2160
+ designation: t("DESIGNATION"),
2161
+ department: t("DEPARTMENT"),
2162
+ employeeId: t("EMPLOYEE_ID"),
2163
+ ownerMobile: t("OWNER_MOBILE"),
2164
+ ownerVerificationDone: t("OWNER_VERIFICATION_DONE"),
2165
+ consentGiven: t("CONSENT_GIVEN"),
2166
+ proofOfIdentityType: t("PROOF_OF_IDENTITY_TYPE"),
2167
+ documentNumber: t("DOCUMENT_NUMBER"),
2168
+ noOfPerson: t("NUMBER_OF_PERSON"),
2169
+ latitude: t("LATITUDE"),
2170
+ longitude: t("LONGITUDE"),
2171
+ gpsValid: t("GPS_VALID"),
2172
+ meterNumber: t("METER_NUMBER"),
2173
+ meterMake: t("METER_MAKE"),
2174
+ meterStatus: t("METER_STATUS"),
2175
+ meterCondition: t("METER_CONDITION"),
2176
+ meterLocation: t("METER_LOCATION"),
2177
+ meterLocationAddress: t("METER_LOCATION_ADDRESS"),
2178
+ workingStatus: t("WORKING_STATUS"),
2179
+ sewerConnection: t("SEWER_CONNECTION"),
2180
+ septicTank: t("SEPTIC_TANK"),
2181
+ lastBillRaised: t("LAST_BILL_RAISED"),
2182
+ lastBillReceivedDate: t("LAST_BILL_RECEIVED_DATE"),
2183
+ accessToMeter: t("ACCESS_TO_METER"),
2184
+ systemMeterId: t("SYSTEM_METER_ID"),
2185
+ lastBillNotRaisedReason: t("LAST_BILL_NOT_RAISED_REASON"),
2186
+ waterConnectionYears: t("WATER_CONNECTION_YEARS"),
2187
+ sewerConnectionYears: t("SEWER_CONNECTION_YEARS"),
2188
+ pidNumber: t("PID_NUMBER"),
2189
+ propertyType: t("PROPERTY_TYPE"),
2190
+ subPropertyCategory: t("SUB_PROPERTY_CATEGORY"),
2191
+ noOfFloor: t("NO_OF_FLOOR"),
2192
+ noOfRooms: t("NO_OF_ROOMS"),
2193
+ noOfBeds: t("NO_OF_BEDS"),
2194
+ numberOfDwellingUnits: t("NUMBER_OF_DWELLING_UNITS"),
2195
+ floorNo: t("FLOOR_NO"),
2196
+ userType: t("USER_TYPE"),
2197
+ tenantName: t("TENANT_NAME"),
2198
+ tenantMobile: t("TENANT_MOBILE"),
2199
+ verificationStatus: t("VERIFICATION_STATUS"),
2200
+ houseBuiltDuration: t("HOUSE_BUILT_DURATION"),
2201
+ surveyorId: t("SURVEYOR_ID"),
2202
+ supervisorId: t("SUPERVISOR_ID"),
2203
+ vendorId: t("VENDOR_ID"),
2204
+ assignmentType: t("ASSIGNMENT_TYPE"),
2205
+ assignmentValue: t("ASSIGNMENT_VALUE"),
2206
+ assignedTime: t("ASSIGNED_TIME"),
2207
+ isSelfAssigned: t("IS_SELF_ASSIGNED"),
2208
+ doorPhotoFilestoreId: t("DOOR_PHOTO_FILESTORE_ID"),
2209
+ panFilestoreId: t("PAN_FILESTORE_ID"),
2210
+ documentProofFilestoreId: t("DOCUMENT_PROOF_FILESTORE_ID"),
2211
+ buildingImageFileStoreId: t("BUILDING_IMAGE_FILESTORE_ID"),
2212
+ propertyDocumentFileStoreId: t("PROPERTY_DOCUMENT_FILESTORE_ID"),
2213
+ meterPhotoFileStoreId: t("METER_PHOTO_FILESTORE_ID"),
2214
+ modifiedBy: t("MODIFIED_BY"),
2215
+ emailId: t("EMAIL_ID"),
2216
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME"),
2217
+ dob: t("DOB"),
2218
+ consumerType: t("CONSUMER_TYPE"),
2219
+ createdTime: t("CREATED_TIME"),
2220
+ lastModifiedTime: t("LAST_MODIFIED_TIME"),
2221
+ meterLatitude: t("EKYC_METER_LATITUDE1"),
2222
+ meterLongitude: t("EKYC_METER_LONGITUDE1")
2223
+ };
2224
+ const toTitleCase = str => {
2225
+ if (!str) return "";
2226
+ let cleanStr = String(str);
2227
+ if (cleanStr.includes(".") && !cleanStr.includes("@") && isNaN(Number(cleanStr))) {
2228
+ cleanStr = cleanStr.split(".").pop();
2229
+ }
2230
+ return cleanStr.toLowerCase().replace(/_/g, " ").replace(/\b\w/g, c => c.toUpperCase());
2127
2231
  };
2232
+ const skipTitleCase = ["kno", "mobileNumber", "emailId", "email", "pincode", "mrkey", "dob", "createdTime", "lastModifiedTime", "meterLatitude", "meterLongitude"];
2233
+ const translatedFields = ["meterMake", "meterLocation"];
2128
2234
  const excelData = consumerList.map(item => {
2129
2235
  const cleanObj = {};
2130
2236
  const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
2131
2237
  if (fullName) {
2132
- cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = fullName;
2238
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = toTitleCase(fullName);
2133
2239
  }
2134
2240
  Object.keys(item).forEach(key => {
2135
2241
  if (excludedKeys.includes(key)) return;
2136
- const val = item[key];
2242
+ let val = item[key];
2137
2243
  if (typeof val === "object" && val !== null) {
2138
2244
  return;
2139
2245
  }
2246
+ if (String(val).toLowerCase() === "true") {
2247
+ val = t("CS_YES");
2248
+ } else if (String(val).toLowerCase() === "false") {
2249
+ val = t("CS_NO");
2250
+ }
2140
2251
  const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
2141
- cleanObj[friendlyHeader] = val;
2252
+ if (typeof val === "string" && translatedFields.includes(key)) {
2253
+ cleanObj[friendlyHeader] = t(val);
2254
+ } else if (typeof val === "string" && !skipTitleCase.includes(key)) {
2255
+ cleanObj[friendlyHeader] = toTitleCase(val);
2256
+ } else {
2257
+ cleanObj[friendlyHeader] = val;
2258
+ }
2142
2259
  });
2143
2260
  return cleanObj;
2144
2261
  });
@@ -2158,6 +2275,34 @@ const VendorDetailsCard = () => {
2158
2275
  return Promise.reject(e);
2159
2276
  }
2160
2277
  };
2278
+ const getDateRange = filter => {
2279
+ const now = new Date();
2280
+ const start = new Date(now);
2281
+ if (filter === "today") {
2282
+ start.setHours(0, 0, 0, 0);
2283
+ return {
2284
+ from: start,
2285
+ to: now
2286
+ };
2287
+ }
2288
+ if (filter === "week") {
2289
+ start.setDate(now.getDate() - now.getDay());
2290
+ start.setHours(0, 0, 0, 0);
2291
+ return {
2292
+ from: start,
2293
+ to: now
2294
+ };
2295
+ }
2296
+ if (filter === "month") {
2297
+ start.setDate(1);
2298
+ start.setHours(0, 0, 0, 0);
2299
+ return {
2300
+ from: start,
2301
+ to: now
2302
+ };
2303
+ }
2304
+ return null;
2305
+ };
2161
2306
  const paginatedSupervisors = React.useMemo(() => {
2162
2307
  const start = currentPage * pageSize;
2163
2308
  const end = start + pageSize;
@@ -2272,19 +2417,35 @@ const VendorDetailsCard = () => {
2272
2417
  console.error("Failed to generate report:", err);
2273
2418
  } finally {
2274
2419
  setReportLoading(false);
2420
+ }
2421
+ };
2422
+ const handlePresetDownload = function (filter) {
2423
+ try {
2424
+ const range = getDateRange(filter);
2425
+ if (!range) return Promise.resolve();
2275
2426
  setShowReportMenu(false);
2276
2427
  setShowCustomPicker(false);
2428
+ return Promise.resolve(handleDownloadEkycData(range.from.getTime(), range.to.getTime())).then(function () {});
2429
+ } catch (e) {
2430
+ return Promise.reject(e);
2277
2431
  }
2278
2432
  };
2279
- const handlePresetDownload = filter => {
2280
- handleDownload();
2281
- };
2282
- const handleCustomDownload = () => {
2283
- if (!customDate.from || !customDate.to) {
2284
- alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
2285
- return;
2433
+ const handleCustomDownload = function () {
2434
+ try {
2435
+ if (!customDate.from || !customDate.to) {
2436
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
2437
+ return Promise.resolve();
2438
+ }
2439
+ const from = new Date(customDate.from);
2440
+ from.setHours(0, 0, 0, 0);
2441
+ const to = new Date(customDate.to);
2442
+ to.setHours(23, 59, 59, 999);
2443
+ setShowReportMenu(false);
2444
+ setShowCustomPicker(false);
2445
+ return Promise.resolve(handleDownloadEkycData(from.getTime(), to.getTime())).then(function () {});
2446
+ } catch (e) {
2447
+ return Promise.reject(e);
2286
2448
  }
2287
- handleDownload();
2288
2449
  };
2289
2450
  const StatCard = _ref3 => {
2290
2451
  let title = _ref3.title,
@@ -2332,65 +2493,12 @@ const VendorDetailsCard = () => {
2332
2493
  }, vendorName), /*#__PURE__*/React__default.createElement("div", {
2333
2494
  className: "designation"
2334
2495
  }, t("VENDOR_AGENCY") || "Agency / Vendor"))), /*#__PURE__*/React__default.createElement("div", {
2335
- className: "report-download",
2336
- ref: reportMenuRef
2496
+ className: "report-download"
2337
2497
  }, /*#__PURE__*/React__default.createElement("button", {
2338
2498
  className: "download-btn",
2339
2499
  disabled: reportLoading,
2340
- onClick: () => {
2341
- setShowReportMenu(p => !p);
2342
- setShowCustomPicker(false);
2343
- }
2344
- }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React__default.createElement("div", {
2345
- className: "report-menu"
2346
- }, [{
2347
- label: t("TODAY") || "Today",
2348
- key: "today"
2349
- }, {
2350
- label: t("THIS_WEEK") || "This Week",
2351
- key: "week"
2352
- }, {
2353
- label: t("THIS_MONTH") || "This Month",
2354
- key: "month"
2355
- }].map(_ref4 => {
2356
- let label = _ref4.label,
2357
- key = _ref4.key;
2358
- return /*#__PURE__*/React__default.createElement("div", {
2359
- key: key,
2360
- className: "menu-item",
2361
- onClick: () => handlePresetDownload()
2362
- }, label);
2363
- }), /*#__PURE__*/React__default.createElement("div", {
2364
- className: "custom-date-trigger",
2365
- onClick: () => setShowCustomPicker(p => !p)
2366
- }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React__default.createElement("div", {
2367
- className: "custom-picker"
2368
- }, /*#__PURE__*/React__default.createElement("div", {
2369
- className: "date-field"
2370
- }, /*#__PURE__*/React__default.createElement("label", {
2371
- className: "date-label"
2372
- }, t("FROM_DATE") || "From"), /*#__PURE__*/React__default.createElement("input", {
2373
- type: "date",
2374
- className: "date-input",
2375
- value: customDate.from,
2376
- onChange: e => setCustomDate(d => _extends({}, d, {
2377
- from: e.target.value
2378
- }))
2379
- })), /*#__PURE__*/React__default.createElement("div", {
2380
- className: "date-field"
2381
- }, /*#__PURE__*/React__default.createElement("label", {
2382
- className: "date-label"
2383
- }, t("TO_DATE") || "To"), /*#__PURE__*/React__default.createElement("input", {
2384
- type: "date",
2385
- className: "date-input",
2386
- value: customDate.to,
2387
- onChange: e => setCustomDate(d => _extends({}, d, {
2388
- to: e.target.value
2389
- }))
2390
- })), /*#__PURE__*/React__default.createElement("button", {
2391
- className: "download-action-btn",
2392
- onClick: handleCustomDownload
2393
- }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React__default.createElement("div", {
2500
+ onClick: handleDownload
2501
+ }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"))), /*#__PURE__*/React__default.createElement("div", {
2394
2502
  className: "stats-wrapper"
2395
2503
  }, cards.map((card, idx) => /*#__PURE__*/React__default.createElement(StatCard, {
2396
2504
  key: idx,
@@ -2441,10 +2549,16 @@ const VendorDetailsCard = () => {
2441
2549
  className: "details-right"
2442
2550
  }, /*#__PURE__*/React__default.createElement("div", {
2443
2551
  className: "download-card"
2444
- }, /*#__PURE__*/React__default.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React__default.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React__default.createElement("button", {
2552
+ }, /*#__PURE__*/React__default.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React__default.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React__default.createElement("div", {
2553
+ className: "report-download",
2554
+ ref: reportMenuRef
2555
+ }, /*#__PURE__*/React__default.createElement("button", {
2445
2556
  className: "download-excel-btn",
2446
2557
  disabled: ekycDownloadLoading,
2447
- onClick: handleDownloadEkycData
2558
+ onClick: () => {
2559
+ setShowReportMenu(p => !p);
2560
+ setShowCustomPicker(false);
2561
+ }
2448
2562
  }, /*#__PURE__*/React__default.createElement("svg", {
2449
2563
  width: "16",
2450
2564
  height: "16",
@@ -2463,20 +2577,76 @@ const VendorDetailsCard = () => {
2463
2577
  y1: "15",
2464
2578
  x2: "12",
2465
2579
  y2: "3"
2466
- })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
2467
- className: "dashboard-card"
2468
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
2469
- t: t,
2470
- tableTitle: t("CONNECTED_SUPERVISORS") || "Connected Supervisors",
2471
- tableClass: "ekycTable",
2472
- data: paginatedSupervisors,
2473
- columns: supervisorColumns,
2474
- isLoading: isPageLoading,
2475
- totalRecords: vendorSupervisors.length,
2476
- currentPage: currentPage,
2477
- pageSizeLimit: pageSize,
2478
- isPaginationRequired: true,
2479
- onNextPage: () => {
2580
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"), showReportMenu && /*#__PURE__*/React__default.createElement("div", {
2581
+ className: "report-menu"
2582
+ }, [{
2583
+ label: t("TODAY") || "Today",
2584
+ key: "today"
2585
+ }, {
2586
+ label: t("THIS_WEEK") || "This Week",
2587
+ key: "week"
2588
+ }, {
2589
+ label: t("THIS_MONTH") || "This Month",
2590
+ key: "month"
2591
+ }].map(_ref4 => {
2592
+ let label = _ref4.label,
2593
+ key = _ref4.key;
2594
+ return /*#__PURE__*/React__default.createElement("div", {
2595
+ key: key,
2596
+ className: "menu-item",
2597
+ onClick: () => handlePresetDownload(key)
2598
+ }, label);
2599
+ }), /*#__PURE__*/React__default.createElement("div", {
2600
+ className: "custom-date-trigger",
2601
+ onClick: () => setShowCustomPicker(p => !p)
2602
+ }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React__default.createElement("div", {
2603
+ className: "custom-picker"
2604
+ }, /*#__PURE__*/React__default.createElement("div", {
2605
+ className: "date-inputs"
2606
+ }, /*#__PURE__*/React__default.createElement("label", null, /*#__PURE__*/React__default.createElement("span", null, "From"), /*#__PURE__*/React__default.createElement("input", {
2607
+ type: "date",
2608
+ value: customDate.from,
2609
+ onChange: e => setCustomDate(_extends({}, customDate, {
2610
+ from: e.target.value
2611
+ }))
2612
+ })), /*#__PURE__*/React__default.createElement("label", null, /*#__PURE__*/React__default.createElement("span", null, "To"), /*#__PURE__*/React__default.createElement("input", {
2613
+ type: "date",
2614
+ value: customDate.to,
2615
+ onChange: e => setCustomDate(_extends({}, customDate, {
2616
+ to: e.target.value
2617
+ }))
2618
+ }))), /*#__PURE__*/React__default.createElement("div", {
2619
+ style: {
2620
+ display: "flex",
2621
+ gap: "10px",
2622
+ marginTop: "10px"
2623
+ }
2624
+ }, /*#__PURE__*/React__default.createElement("button", {
2625
+ className: "picker-cancel-btn",
2626
+ onClick: () => {
2627
+ setShowCustomPicker(false);
2628
+ setCustomDate({
2629
+ from: "",
2630
+ to: ""
2631
+ });
2632
+ }
2633
+ }, t("CANCEL") || "Cancel"), /*#__PURE__*/React__default.createElement("button", {
2634
+ className: "picker-apply-btn",
2635
+ onClick: handleCustomDownload
2636
+ }, t("APPLY") || "Apply"))))))))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
2637
+ className: "dashboard-card"
2638
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
2639
+ t: t,
2640
+ tableTitle: t("CONNECTED_SUPERVISORS") || "Connected Supervisors",
2641
+ tableClass: "ekycTable",
2642
+ data: paginatedSupervisors,
2643
+ columns: supervisorColumns,
2644
+ isLoading: isPageLoading,
2645
+ totalRecords: vendorSupervisors.length,
2646
+ currentPage: currentPage,
2647
+ pageSizeLimit: pageSize,
2648
+ isPaginationRequired: true,
2649
+ onNextPage: () => {
2480
2650
  if (currentPage < Math.ceil(vendorSupervisors.length / pageSize) - 1) {
2481
2651
  setCurrentPage(prev => prev + 1);
2482
2652
  }
@@ -5687,21 +5857,37 @@ const SupervisorDetailsCard = () => {
5687
5857
  console.error("Failed to generate supervisor report:", err);
5688
5858
  } finally {
5689
5859
  setReportLoading(false);
5860
+ }
5861
+ };
5862
+ const handlePresetDownload = function (filter) {
5863
+ try {
5864
+ const range = getDateRange(filter);
5865
+ if (!range) return Promise.resolve();
5690
5866
  setShowReportMenu(false);
5691
5867
  setShowCustomPicker(false);
5868
+ return Promise.resolve(handleDownloadEkycData(range.from.getTime(), range.to.getTime())).then(function () {});
5869
+ } catch (e) {
5870
+ return Promise.reject(e);
5692
5871
  }
5693
5872
  };
5694
- const handlePresetDownload = filter => {
5695
- handleDownload();
5696
- };
5697
- const handleCustomDownload = () => {
5698
- if (!customDate.from || !customDate.to) {
5699
- alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
5700
- return;
5873
+ const handleCustomDownload = function () {
5874
+ try {
5875
+ if (!customDate.from || !customDate.to) {
5876
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
5877
+ return Promise.resolve();
5878
+ }
5879
+ const from = new Date(customDate.from);
5880
+ from.setHours(0, 0, 0, 0);
5881
+ const to = new Date(customDate.to);
5882
+ to.setHours(23, 59, 59, 999);
5883
+ setShowReportMenu(false);
5884
+ setShowCustomPicker(false);
5885
+ return Promise.resolve(handleDownloadEkycData(from.getTime(), to.getTime())).then(function () {});
5886
+ } catch (e) {
5887
+ return Promise.reject(e);
5701
5888
  }
5702
- handleDownload();
5703
5889
  };
5704
- const handleDownloadEkycData = function () {
5890
+ const handleDownloadEkycData = function (fromDate, toDate) {
5705
5891
  try {
5706
5892
  if (!surveyors || surveyors.length === 0) {
5707
5893
  alert(t("NO_SURVEYORS_ASSIGNED") || "No surveyors assigned to this supervisor.");
@@ -5710,45 +5896,144 @@ const SupervisorDetailsCard = () => {
5710
5896
  setEkycDownloadLoading(true);
5711
5897
  return Promise.resolve(_finallyRethrows(function () {
5712
5898
  return _catch(function () {
5713
- return Promise.resolve(Digit.EkycService.application_list({
5899
+ return Promise.resolve(Digit.EkycService.application_list(_extends({
5714
5900
  tenantId: tenantId || "dl.djb",
5715
5901
  offset: 0,
5716
5902
  limit: 10000,
5717
5903
  reportDownload: true
5718
- })).then(function (response) {
5904
+ }, fromDate && {
5905
+ fromDate
5906
+ }, toDate && {
5907
+ toDate
5908
+ }))).then(function (response) {
5719
5909
  const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
5720
5910
  if (consumerList.length === 0) {
5721
5911
  alert(t("NO_DATA_FOUND") || "No data found for download.");
5722
5912
  return;
5723
5913
  }
5724
- 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"];
5914
+ 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"];
5725
5915
  const headerMapping = {
5726
- kno: t("KNO") || "KNO",
5727
- firstName: t("FIRST_NAME") || "First Name",
5728
- middleName: t("MIDDLE_NAME") || "Middle Name",
5729
- lastName: t("LAST_NAME") || "Last Name",
5730
- gender: t("GENDER") || "Gender",
5731
- mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
5732
- emailId: t("EMAIL_ID") || "Email ID",
5733
- fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
5734
- relationship: t("RELATIONSHIP") || "Relationship",
5735
- dob: t("DOB") || "Date of Birth",
5736
- ekycStatus: t("EKYC_STATUS") || "eKYC Status",
5737
- zoneName: t("ZONE") || "Zone",
5738
- assembly: t("ASSEMBLY") || "Assembly",
5739
- ward: t("WARD") || "Ward",
5740
- pincode: t("PINCODE") || "Pincode",
5741
- mrkey: t("MR_KEY") || "MR Key",
5742
- consumerType: t("CONSUMER_TYPE") || "Consumer Type",
5743
- createdTime: t("CREATED_TIME") || "Created Time",
5744
- lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
5916
+ kno: t("KNO"),
5917
+ firstName: t("FIRST_NAME"),
5918
+ middleName: t("MIDDLE_NAME"),
5919
+ lastName: t("LAST_NAME"),
5920
+ status: t("STATUS"),
5921
+ ekycStatus: t("EKYC_STATUS"),
5922
+ zoneName: t("ZONE"),
5923
+ zoneCode: t("ZONE_CODE"),
5924
+ assembly: t("EKYC_ASSEMBLY"),
5925
+ ward: t("WARD"),
5926
+ pincode: t("EKYC_PINCODE"),
5927
+ addressRaw: t("ADDRESS_RAW"),
5928
+ locality: t("EKYC_LOCALITY"),
5929
+ subLocality: t("SUB_LOCALITY"),
5930
+ flatHouseNumber: t("FLAT_HOUSE_NUMBER"),
5931
+ streetName: t("STREET_NAME"),
5932
+ landmark: t("EKYC_LANDMARK"),
5933
+ city: t("CITY"),
5934
+ state: t("STATE"),
5935
+ addressType: t("ADDRESS_TYPE"),
5936
+ addressProofType: t("ADDRESS_PROOF_TYPE"),
5937
+ mobileNo: t("MOBILE_NUMBER"),
5938
+ alternateMobileNo: t("ALTERNATE_MOBILE_NUMBER"),
5939
+ whatsappNo: t("WHATSAPP_NO"),
5940
+ email: t("EMAIL"),
5941
+ landlineNo: t("LANDLINE_NO"),
5942
+ mrkey: t("MR_KEY"),
5943
+ mrcode: t("MR_CODE"),
5944
+ areacode: t("AREA_CODE"),
5945
+ source: t("SOURCE"),
5946
+ submittedAt: t("SUBMITTED_AT"),
5947
+ assignedAt: t("ASSIGNED_AT"),
5948
+ connectionType: t("CONNECTION_TYPE"),
5949
+ Type: t("CONSUMER_TYPE"),
5950
+ occupantType: t("OCCUPANT_TYPE"),
5951
+ knoCategory: t("KNO_CATEGORY"),
5952
+ approvedAt: t("APPROVED_AT"),
5953
+ gender: t("GENDER"),
5954
+ parentSpouse: t("PARENT_SPOUSE"),
5955
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME"),
5956
+ relationship: t("RELATIONSHIP"),
5957
+ informantName: t("INFORMANT_NAME"),
5958
+ informantRelation: t("INFORMANT_RELATION"),
5959
+ informantIs: t("INFORMANT_IS"),
5960
+ contactPerson: t("CONTACT_PERSON"),
5961
+ relation: t("RELATION"),
5962
+ entityName: t("ENTITY_NAME"),
5963
+ designation: t("DESIGNATION"),
5964
+ department: t("DEPARTMENT"),
5965
+ employeeId: t("EMPLOYEE_ID"),
5966
+ ownerMobile: t("OWNER_MOBILE"),
5967
+ ownerVerificationDone: t("OWNER_VERIFICATION_DONE"),
5968
+ consentGiven: t("CONSENT_GIVEN"),
5969
+ proofOfIdentityType: t("PROOF_OF_IDENTITY_TYPE"),
5970
+ documentNumber: t("DOCUMENT_NUMBER"),
5971
+ noOfPerson: t("NUMBER_OF_PERSON"),
5972
+ latitude: t("LATITUDE"),
5973
+ longitude: t("LONGITUDE"),
5974
+ gpsValid: t("GPS_VALID"),
5975
+ meterNumber: t("METER_NUMBER"),
5976
+ meterMake: t("METER_MAKE"),
5977
+ meterStatus: t("METER_STATUS"),
5978
+ meterCondition: t("METER_CONDITION"),
5979
+ meterLocation: t("METER_LOCATION"),
5980
+ meterLocationAddress: t("METER_LOCATION_ADDRESS"),
5981
+ workingStatus: t("WORKING_STATUS"),
5982
+ sewerConnection: t("SEWER_CONNECTION"),
5983
+ septicTank: t("SEPTIC_TANK"),
5984
+ lastBillRaised: t("LAST_BILL_RAISED"),
5985
+ lastBillReceivedDate: t("LAST_BILL_RECEIVED_DATE"),
5986
+ accessToMeter: t("ACCESS_TO_METER"),
5987
+ systemMeterId: t("SYSTEM_METER_ID"),
5988
+ lastBillNotRaisedReason: t("LAST_BILL_NOT_RAISED_REASON"),
5989
+ waterConnectionYears: t("WATER_CONNECTION_YEARS"),
5990
+ sewerConnectionYears: t("SEWER_CONNECTION_YEARS"),
5991
+ pidNumber: t("PID_NUMBER"),
5992
+ propertyType: t("PROPERTY_TYPE"),
5993
+ subPropertyCategory: t("SUB_PROPERTY_CATEGORY"),
5994
+ noOfFloor: t("NO_OF_FLOOR"),
5995
+ noOfRooms: t("NO_OF_ROOMS"),
5996
+ noOfBeds: t("NO_OF_BEDS"),
5997
+ numberOfDwellingUnits: t("NUMBER_OF_DWELLING_UNITS"),
5998
+ floorNo: t("FLOOR_NO"),
5999
+ userType: t("USER_TYPE"),
6000
+ tenantName: t("TENANT_NAME"),
6001
+ tenantMobile: t("TENANT_MOBILE"),
6002
+ verificationStatus: t("VERIFICATION_STATUS"),
6003
+ houseBuiltDuration: t("HOUSE_BUILT_DURATION"),
6004
+ surveyorId: t("SURVEYOR_ID"),
6005
+ supervisorId: t("SUPERVISOR_ID"),
6006
+ vendorId: t("VENDOR_ID"),
6007
+ assignmentType: t("ASSIGNMENT_TYPE"),
6008
+ assignmentValue: t("ASSIGNMENT_VALUE"),
6009
+ assignedTime: t("ASSIGNED_TIME"),
6010
+ isSelfAssigned: t("IS_SELF_ASSIGNED"),
6011
+ doorPhotoFilestoreId: t("DOOR_PHOTO_FILESTORE_ID"),
6012
+ panFilestoreId: t("PAN_FILESTORE_ID"),
6013
+ documentProofFilestoreId: t("DOCUMENT_PROOF_FILESTORE_ID"),
6014
+ buildingImageFileStoreId: t("BUILDING_IMAGE_FILESTORE_ID"),
6015
+ propertyDocumentFileStoreId: t("PROPERTY_DOCUMENT_FILESTORE_ID"),
6016
+ meterPhotoFileStoreId: t("METER_PHOTO_FILESTORE_ID"),
6017
+ modifiedBy: t("MODIFIED_BY"),
6018
+ emailId: t("EMAIL_ID"),
6019
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME"),
6020
+ dob: t("DOB"),
6021
+ consumerType: t("CONSUMER_TYPE"),
6022
+ createdTime: t("CREATED_TIME"),
6023
+ lastModifiedTime: t("LAST_MODIFIED_TIME"),
6024
+ meterLatitude: t("EKYC_METER_LATITUDE1"),
6025
+ meterLongitude: t("EKYC_METER_LONGITUDE1")
5745
6026
  };
5746
6027
  const toTitleCase = str => {
5747
6028
  if (!str) return "";
5748
- const cleanStr = String(str).includes(".") ? String(str).split(".").pop() : String(str);
6029
+ let cleanStr = String(str);
6030
+ if (cleanStr.includes(".") && !cleanStr.includes("@") && isNaN(Number(cleanStr))) {
6031
+ cleanStr = cleanStr.split(".").pop();
6032
+ }
5749
6033
  return cleanStr.toLowerCase().replace(/_/g, " ").replace(/\b\w/g, c => c.toUpperCase());
5750
6034
  };
5751
- const titleCaseFields = ["ekycStatus", "zoneName", "gender", "relationship", "assembly", "ward", "consumerType"];
6035
+ const skipTitleCase = ["kno", "mobileNumber", "emailId", "email", "pincode", "mrkey", "dob", "createdTime", "lastModifiedTime", "meterLatitude", "meterLongitude"];
6036
+ const translatedFields = ["meterMake", "meterLocation"];
5752
6037
  const excelData = consumerList.map(item => {
5753
6038
  const cleanObj = {};
5754
6039
  const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
@@ -5757,12 +6042,19 @@ const SupervisorDetailsCard = () => {
5757
6042
  }
5758
6043
  Object.keys(item).forEach(key => {
5759
6044
  if (excludedKeys.includes(key)) return;
5760
- const val = item[key];
6045
+ let val = item[key];
5761
6046
  if (typeof val === "object" && val !== null) {
5762
6047
  return;
5763
6048
  }
6049
+ if (String(val).toLowerCase() === "true") {
6050
+ val = t("CS_YES");
6051
+ } else if (String(val).toLowerCase() === "false") {
6052
+ val = t("CS_NO");
6053
+ }
5764
6054
  const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
5765
- if (typeof val === "string" && titleCaseFields.includes(key)) {
6055
+ if (typeof val === "string" && translatedFields.includes(key)) {
6056
+ cleanObj[friendlyHeader] = t(val);
6057
+ } else if (typeof val === "string" && !skipTitleCase.includes(key)) {
5766
6058
  cleanObj[friendlyHeader] = toTitleCase(val);
5767
6059
  } else {
5768
6060
  cleanObj[friendlyHeader] = val;
@@ -5785,33 +6077,61 @@ const SupervisorDetailsCard = () => {
5785
6077
  return Promise.reject(e);
5786
6078
  }
5787
6079
  };
5788
- const StatCard = _ref3 => {
5789
- let title = _ref3.title,
5790
- value = _ref3.value,
5791
- type = _ref3.type,
5792
- isLoading = _ref3.isLoading,
5793
- icon = _ref3.icon;
5794
- return /*#__PURE__*/React__default.createElement("div", {
5795
- className: "stat-card " + type
5796
- }, isLoading ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
5797
- className: "stat-title skeleton skeleton-text"
5798
- }), /*#__PURE__*/React__default.createElement("div", {
5799
- className: "stat-value skeleton skeleton-number"
5800
- })) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
5801
- className: "stat-title"
5802
- }, title), /*#__PURE__*/React__default.createElement("div", {
5803
- className: "stat-value"
5804
- }, value), icon && /*#__PURE__*/React__default.createElement("div", {
5805
- className: "stat-icon"
5806
- }, icon)));
5807
- };
5808
- const isPageLoading = isProgressLoading || isSupervisorSearchLoading || isSurveyorSearchLoading || isVendorSearchLoading;
5809
- if (isPageLoading && !supervisor) {
5810
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
5811
- }
5812
- if (!supervisor) {
5813
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement("div", {
5814
- style: {
6080
+ const getDateRange = filter => {
6081
+ const now = new Date();
6082
+ const start = new Date(now);
6083
+ if (filter === "today") {
6084
+ start.setHours(0, 0, 0, 0);
6085
+ return {
6086
+ from: start,
6087
+ to: now
6088
+ };
6089
+ }
6090
+ if (filter === "week") {
6091
+ start.setDate(now.getDate() - now.getDay());
6092
+ start.setHours(0, 0, 0, 0);
6093
+ return {
6094
+ from: start,
6095
+ to: now
6096
+ };
6097
+ }
6098
+ if (filter === "month") {
6099
+ start.setDate(1);
6100
+ start.setHours(0, 0, 0, 0);
6101
+ return {
6102
+ from: start,
6103
+ to: now
6104
+ };
6105
+ }
6106
+ return null;
6107
+ };
6108
+ const StatCard = _ref3 => {
6109
+ let title = _ref3.title,
6110
+ value = _ref3.value,
6111
+ type = _ref3.type,
6112
+ isLoading = _ref3.isLoading,
6113
+ icon = _ref3.icon;
6114
+ return /*#__PURE__*/React__default.createElement("div", {
6115
+ className: "stat-card " + type
6116
+ }, isLoading ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
6117
+ className: "stat-title skeleton skeleton-text"
6118
+ }), /*#__PURE__*/React__default.createElement("div", {
6119
+ className: "stat-value skeleton skeleton-number"
6120
+ })) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
6121
+ className: "stat-title"
6122
+ }, title), /*#__PURE__*/React__default.createElement("div", {
6123
+ className: "stat-value"
6124
+ }, value), icon && /*#__PURE__*/React__default.createElement("div", {
6125
+ className: "stat-icon"
6126
+ }, icon)));
6127
+ };
6128
+ const isPageLoading = isProgressLoading || isSupervisorSearchLoading || isSurveyorSearchLoading || isVendorSearchLoading;
6129
+ if (isPageLoading && !supervisor) {
6130
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
6131
+ }
6132
+ if (!supervisor) {
6133
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement("div", {
6134
+ style: {
5815
6135
  padding: "24px"
5816
6136
  }
5817
6137
  }, t("NO_SUPERVISOR_FOUND")));
@@ -5831,65 +6151,12 @@ const SupervisorDetailsCard = () => {
5831
6151
  }, fullName), /*#__PURE__*/React__default.createElement("div", {
5832
6152
  className: "designation"
5833
6153
  }, t("FIELD_SUPERVISOR") || "Field Supervisor"))), /*#__PURE__*/React__default.createElement("div", {
5834
- className: "report-download",
5835
- ref: reportMenuRef
6154
+ className: "report-download"
5836
6155
  }, /*#__PURE__*/React__default.createElement("button", {
5837
6156
  className: "download-btn",
5838
6157
  disabled: reportLoading,
5839
- onClick: () => {
5840
- setShowReportMenu(p => !p);
5841
- setShowCustomPicker(false);
5842
- }
5843
- }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React__default.createElement("div", {
5844
- className: "report-menu"
5845
- }, [{
5846
- label: t("TODAY") || "Today",
5847
- key: "today"
5848
- }, {
5849
- label: t("THIS_WEEK") || "This Week",
5850
- key: "week"
5851
- }, {
5852
- label: t("THIS_MONTH") || "This Month",
5853
- key: "month"
5854
- }].map(_ref4 => {
5855
- let label = _ref4.label,
5856
- key = _ref4.key;
5857
- return /*#__PURE__*/React__default.createElement("div", {
5858
- key: key,
5859
- className: "menu-item",
5860
- onClick: () => handlePresetDownload()
5861
- }, label);
5862
- }), /*#__PURE__*/React__default.createElement("div", {
5863
- className: "custom-date-trigger",
5864
- onClick: () => setShowCustomPicker(p => !p)
5865
- }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React__default.createElement("div", {
5866
- className: "custom-picker"
5867
- }, /*#__PURE__*/React__default.createElement("div", {
5868
- className: "date-field"
5869
- }, /*#__PURE__*/React__default.createElement("label", {
5870
- className: "date-label"
5871
- }, t("FROM_DATE") || "From"), /*#__PURE__*/React__default.createElement("input", {
5872
- type: "date",
5873
- className: "date-input",
5874
- value: customDate.from,
5875
- onChange: e => setCustomDate(d => _extends({}, d, {
5876
- from: e.target.value
5877
- }))
5878
- })), /*#__PURE__*/React__default.createElement("div", {
5879
- className: "date-field"
5880
- }, /*#__PURE__*/React__default.createElement("label", {
5881
- className: "date-label"
5882
- }, t("TO_DATE") || "To"), /*#__PURE__*/React__default.createElement("input", {
5883
- type: "date",
5884
- className: "date-input",
5885
- value: customDate.to,
5886
- onChange: e => setCustomDate(d => _extends({}, d, {
5887
- to: e.target.value
5888
- }))
5889
- })), /*#__PURE__*/React__default.createElement("button", {
5890
- className: "download-action-btn",
5891
- onClick: handleCustomDownload
5892
- }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React__default.createElement("div", {
6158
+ onClick: handleDownload
6159
+ }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"))), /*#__PURE__*/React__default.createElement("div", {
5893
6160
  className: "stats-wrapper"
5894
6161
  }, cards.map((card, idx) => /*#__PURE__*/React__default.createElement(StatCard, {
5895
6162
  key: idx,
@@ -5953,10 +6220,16 @@ const SupervisorDetailsCard = () => {
5953
6220
  className: "details-right"
5954
6221
  }, /*#__PURE__*/React__default.createElement("div", {
5955
6222
  className: "download-card"
5956
- }, /*#__PURE__*/React__default.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React__default.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React__default.createElement("button", {
6223
+ }, /*#__PURE__*/React__default.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React__default.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React__default.createElement("div", {
6224
+ className: "report-download",
6225
+ ref: reportMenuRef
6226
+ }, /*#__PURE__*/React__default.createElement("button", {
5957
6227
  className: "download-excel-btn",
5958
6228
  disabled: ekycDownloadLoading,
5959
- onClick: handleDownloadEkycData
6229
+ onClick: () => {
6230
+ setShowReportMenu(p => !p);
6231
+ setShowCustomPicker(false);
6232
+ }
5960
6233
  }, /*#__PURE__*/React__default.createElement("svg", {
5961
6234
  width: "16",
5962
6235
  height: "16",
@@ -5975,7 +6248,63 @@ const SupervisorDetailsCard = () => {
5975
6248
  y1: "15",
5976
6249
  x2: "12",
5977
6250
  y2: "3"
5978
- })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
6251
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"), showReportMenu && /*#__PURE__*/React__default.createElement("div", {
6252
+ className: "report-menu"
6253
+ }, [{
6254
+ label: t("TODAY") || "Today",
6255
+ key: "today"
6256
+ }, {
6257
+ label: t("THIS_WEEK") || "This Week",
6258
+ key: "week"
6259
+ }, {
6260
+ label: t("THIS_MONTH") || "This Month",
6261
+ key: "month"
6262
+ }].map(_ref4 => {
6263
+ let label = _ref4.label,
6264
+ key = _ref4.key;
6265
+ return /*#__PURE__*/React__default.createElement("div", {
6266
+ key: key,
6267
+ className: "menu-item",
6268
+ onClick: () => handlePresetDownload(key)
6269
+ }, label);
6270
+ }), /*#__PURE__*/React__default.createElement("div", {
6271
+ className: "custom-date-trigger",
6272
+ onClick: () => setShowCustomPicker(p => !p)
6273
+ }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React__default.createElement("div", {
6274
+ className: "custom-picker"
6275
+ }, /*#__PURE__*/React__default.createElement("div", {
6276
+ className: "date-inputs"
6277
+ }, /*#__PURE__*/React__default.createElement("label", null, /*#__PURE__*/React__default.createElement("span", null, "From"), /*#__PURE__*/React__default.createElement("input", {
6278
+ type: "date",
6279
+ value: customDate.from,
6280
+ onChange: e => setCustomDate(_extends({}, customDate, {
6281
+ from: e.target.value
6282
+ }))
6283
+ })), /*#__PURE__*/React__default.createElement("label", null, /*#__PURE__*/React__default.createElement("span", null, "To"), /*#__PURE__*/React__default.createElement("input", {
6284
+ type: "date",
6285
+ value: customDate.to,
6286
+ onChange: e => setCustomDate(_extends({}, customDate, {
6287
+ to: e.target.value
6288
+ }))
6289
+ }))), /*#__PURE__*/React__default.createElement("div", {
6290
+ style: {
6291
+ display: "flex",
6292
+ gap: "10px",
6293
+ marginTop: "10px"
6294
+ }
6295
+ }, /*#__PURE__*/React__default.createElement("button", {
6296
+ className: "picker-cancel-btn",
6297
+ onClick: () => {
6298
+ setShowCustomPicker(false);
6299
+ setCustomDate({
6300
+ from: "",
6301
+ to: ""
6302
+ });
6303
+ }
6304
+ }, t("CANCEL") || "Cancel"), /*#__PURE__*/React__default.createElement("button", {
6305
+ className: "picker-apply-btn",
6306
+ onClick: handleCustomDownload
6307
+ }, t("APPLY") || "Apply"))))))))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
5979
6308
  className: "dashboard-card"
5980
6309
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
5981
6310
  t: t,
@@ -6517,7 +6846,7 @@ const AssignEkycModal = _ref => {
6517
6846
  };
6518
6847
 
6519
6848
  const SurveyorDetailsDashboard = () => {
6520
- 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;
6849
+ 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$owner7, _surveyor$owner8, _surveyor$owner9, _dashboardData$dashbo5, _dashboardData$dashbo6;
6521
6850
  const tenantId = Digit.ULBService.getCurrentTenantId();
6522
6851
  const _useState = React.useState(null),
6523
6852
  showModal = _useState[0],
@@ -6729,10 +7058,8 @@ const SurveyorDetailsDashboard = () => {
6729
7058
  }
6730
7059
  return null;
6731
7060
  };
6732
- const handlePresetDownload = function (filter) {
7061
+ const handleDownload = function () {
6733
7062
  try {
6734
- const range = getDateRange(filter);
6735
- if (!range) return Promise.resolve();
6736
7063
  setReportLoading(true);
6737
7064
  const _temp = _finallyRethrows(function () {
6738
7065
  return _catch(function () {
@@ -6741,9 +7068,7 @@ const SurveyorDetailsDashboard = () => {
6741
7068
  tenantId: "dl.djb",
6742
7069
  offset: 0,
6743
7070
  limit: 1000,
6744
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner5 = surveyor.owner) === null || _surveyor$owner5 === void 0 ? void 0 : _surveyor$owner5.uuid,
6745
- fromDate: range.from.getTime(),
6746
- toDate: range.to.getTime()
7071
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner5 = surveyor.owner) === null || _surveyor$owner5 === void 0 ? void 0 : _surveyor$owner5.uuid
6747
7072
  })).then(function (response) {
6748
7073
  var _response$dashboardIn;
6749
7074
  const rows = (response === null || response === void 0 ? void 0 : (_response$dashboardIn = response.dashboardInfo) === null || _response$dashboardIn === void 0 ? void 0 : _response$dashboardIn.consumerList) || [];
@@ -6763,8 +7088,6 @@ const SurveyorDetailsDashboard = () => {
6763
7088
  });
6764
7089
  }, function (_wasThrown, _result) {
6765
7090
  setReportLoading(false);
6766
- setShowReportMenu(false);
6767
- setShowCustomPicker(false);
6768
7091
  if (_wasThrown) throw _result;
6769
7092
  return _result;
6770
7093
  });
@@ -6773,6 +7096,17 @@ const SurveyorDetailsDashboard = () => {
6773
7096
  return Promise.reject(e);
6774
7097
  }
6775
7098
  };
7099
+ const handlePresetDownload = function (filter) {
7100
+ try {
7101
+ const range = getDateRange(filter);
7102
+ if (!range) return Promise.resolve();
7103
+ setShowReportMenu(false);
7104
+ setShowCustomPicker(false);
7105
+ return Promise.resolve(handleDownloadEkycData(range.from.getTime(), range.to.getTime())).then(function () {});
7106
+ } catch (e) {
7107
+ return Promise.reject(e);
7108
+ }
7109
+ };
6776
7110
  const handleCustomDownload = function () {
6777
7111
  try {
6778
7112
  if (!customDate.from || !customDate.to) {
@@ -6783,42 +7117,9 @@ const SurveyorDetailsDashboard = () => {
6783
7117
  from.setHours(0, 0, 0, 0);
6784
7118
  const to = new Date(customDate.to);
6785
7119
  to.setHours(23, 59, 59, 999);
6786
- setReportLoading(true);
6787
- const _temp2 = _finallyRethrows(function () {
6788
- return _catch(function () {
6789
- var _surveyor$owner6;
6790
- return Promise.resolve(Digit.EkycService.dashboard({}, {
6791
- tenantId: "dl.djb",
6792
- offset: 0,
6793
- limit: 1000,
6794
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner6 = surveyor.owner) === null || _surveyor$owner6 === void 0 ? void 0 : _surveyor$owner6.uuid,
6795
- fromDate: from.getTime(),
6796
- toDate: to.getTime()
6797
- })).then(function (response) {
6798
- var _response$dashboardIn2;
6799
- const rows = (response === null || response === void 0 ? void 0 : (_response$dashboardIn2 = response.dashboardInfo) === null || _response$dashboardIn2 === void 0 ? void 0 : _response$dashboardIn2.consumerList) || [];
6800
- downloadSurveyorPDF({
6801
- rows: rows,
6802
- surveyorName: fullName,
6803
- vendorName,
6804
- supervisorName,
6805
- employeeId,
6806
- mobileNumber,
6807
- dashboardInfo: (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {},
6808
- t
6809
- });
6810
- });
6811
- }, function (err) {
6812
- console.error("Failed to fetch custom dashboard data for report download:", err);
6813
- });
6814
- }, function (_wasThrown2, _result2) {
6815
- setReportLoading(false);
6816
- setShowReportMenu(false);
6817
- setShowCustomPicker(false);
6818
- if (_wasThrown2) throw _result2;
6819
- return _result2;
6820
- });
6821
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
7120
+ setShowReportMenu(false);
7121
+ setShowCustomPicker(false);
7122
+ return Promise.resolve(handleDownloadEkycData(from.getTime(), to.getTime())).then(function () {});
6822
7123
  } catch (e) {
6823
7124
  return Promise.reject(e);
6824
7125
  }
@@ -6852,61 +7153,164 @@ const SurveyorDetailsDashboard = () => {
6852
7153
  setShowOptions(false);
6853
7154
  setShowModal(option.action);
6854
7155
  };
6855
- const handleDownloadEkycData = function () {
7156
+ const handleDownloadEkycData = function (fromDate, toDate) {
6856
7157
  try {
6857
7158
  setEkycDownloadLoading(true);
6858
7159
  return Promise.resolve(_finallyRethrows(function () {
6859
7160
  return _catch(function () {
6860
- var _surveyor$owner7;
6861
- return Promise.resolve(Digit.EkycService.application_list({
7161
+ var _surveyor$owner6;
7162
+ return Promise.resolve(Digit.EkycService.application_list(_extends({
6862
7163
  tenantId: tenantId || "dl.djb",
6863
7164
  offset: 0,
6864
7165
  limit: 10000,
6865
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner7 = surveyor.owner) === null || _surveyor$owner7 === void 0 ? void 0 : _surveyor$owner7.uuid,
7166
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner6 = surveyor.owner) === null || _surveyor$owner6 === void 0 ? void 0 : _surveyor$owner6.uuid,
6866
7167
  reportDownload: true
6867
- })).then(function (response) {
7168
+ }, fromDate && {
7169
+ fromDate
7170
+ }, toDate && {
7171
+ toDate
7172
+ }))).then(function (response) {
6868
7173
  const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
6869
7174
  if (consumerList.length === 0) {
6870
7175
  alert(t("NO_DATA_FOUND") || "No data found for download.");
6871
7176
  return;
6872
7177
  }
6873
- 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"];
7178
+ 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"];
6874
7179
  const headerMapping = {
6875
- kno: t("KNO") || "KNO",
6876
- firstName: t("FIRST_NAME") || "First Name",
6877
- middleName: t("MIDDLE_NAME") || "Middle Name",
6878
- lastName: t("LAST_NAME") || "Last Name",
6879
- gender: t("GENDER") || "Gender",
6880
- mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
6881
- emailId: t("EMAIL_ID") || "Email ID",
6882
- fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
6883
- relationship: t("RELATIONSHIP") || "Relationship",
6884
- dob: t("DOB") || "Date of Birth",
6885
- ekycStatus: t("EKYC_STATUS") || "eKYC Status",
6886
- zoneName: t("ZONE") || "Zone",
6887
- assembly: t("ASSEMBLY") || "Assembly",
6888
- ward: t("WARD") || "Ward",
6889
- pincode: t("PINCODE") || "Pincode",
6890
- mrkey: t("MR_KEY") || "MR Key",
6891
- consumerType: t("CONSUMER_TYPE") || "Consumer Type",
6892
- createdTime: t("CREATED_TIME") || "Created Time",
6893
- lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
7180
+ kno: t("KNO"),
7181
+ firstName: t("FIRST_NAME"),
7182
+ middleName: t("MIDDLE_NAME"),
7183
+ lastName: t("LAST_NAME"),
7184
+ status: t("STATUS"),
7185
+ ekycStatus: t("EKYC_STATUS"),
7186
+ zoneName: t("ZONE"),
7187
+ zoneCode: t("ZONE_CODE"),
7188
+ assembly: t("EKYC_ASSEMBLY"),
7189
+ ward: t("WARD"),
7190
+ pincode: t("EKYC_PINCODE"),
7191
+ addressRaw: t("ADDRESS_RAW"),
7192
+ locality: t("EKYC_LOCALITY"),
7193
+ subLocality: t("SUB_LOCALITY"),
7194
+ flatHouseNumber: t("FLAT_HOUSE_NUMBER"),
7195
+ streetName: t("STREET_NAME"),
7196
+ landmark: t("EKYC_LANDMARK"),
7197
+ city: t("CITY"),
7198
+ state: t("STATE"),
7199
+ addressType: t("ADDRESS_TYPE"),
7200
+ addressProofType: t("ADDRESS_PROOF_TYPE"),
7201
+ mobileNo: t("MOBILE_NUMBER"),
7202
+ alternateMobileNo: t("ALTERNATE_MOBILE_NUMBER"),
7203
+ whatsappNo: t("WHATSAPP_NO"),
7204
+ email: t("EMAIL"),
7205
+ landlineNo: t("LANDLINE_NO"),
7206
+ mrkey: t("MR_KEY"),
7207
+ mrcode: t("MR_CODE"),
7208
+ areacode: t("AREA_CODE"),
7209
+ source: t("SOURCE"),
7210
+ submittedAt: t("SUBMITTED_AT"),
7211
+ assignedAt: t("ASSIGNED_AT"),
7212
+ connectionType: t("CONNECTION_TYPE"),
7213
+ Type: t("CONSUMER_TYPE"),
7214
+ occupantType: t("OCCUPANT_TYPE"),
7215
+ knoCategory: t("KNO_CATEGORY"),
7216
+ approvedAt: t("APPROVED_AT"),
7217
+ gender: t("GENDER"),
7218
+ parentSpouse: t("PARENT_SPOUSE"),
7219
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME"),
7220
+ relationship: t("RELATIONSHIP"),
7221
+ informantName: t("INFORMANT_NAME"),
7222
+ informantRelation: t("INFORMANT_RELATION"),
7223
+ informantIs: t("INFORMANT_IS"),
7224
+ contactPerson: t("CONTACT_PERSON"),
7225
+ relation: t("RELATION"),
7226
+ entityName: t("ENTITY_NAME"),
7227
+ designation: t("DESIGNATION"),
7228
+ department: t("DEPARTMENT"),
7229
+ employeeId: t("EMPLOYEE_ID"),
7230
+ ownerMobile: t("OWNER_MOBILE"),
7231
+ ownerVerificationDone: t("OWNER_VERIFICATION_DONE"),
7232
+ consentGiven: t("CONSENT_GIVEN"),
7233
+ proofOfIdentityType: t("PROOF_OF_IDENTITY_TYPE"),
7234
+ documentNumber: t("DOCUMENT_NUMBER"),
7235
+ noOfPerson: t("NUMBER_OF_PERSON"),
7236
+ latitude: t("LATITUDE"),
7237
+ longitude: t("LONGITUDE"),
7238
+ gpsValid: t("GPS_VALID"),
7239
+ meterNumber: t("METER_NUMBER"),
7240
+ meterMake: t("METER_MAKE"),
7241
+ meterStatus: t("METER_STATUS"),
7242
+ meterCondition: t("METER_CONDITION"),
7243
+ meterLocation: t("METER_LOCATION"),
7244
+ meterLocationAddress: t("METER_LOCATION_ADDRESS"),
7245
+ workingStatus: t("WORKING_STATUS"),
7246
+ sewerConnection: t("SEWER_CONNECTION"),
7247
+ septicTank: t("SEPTIC_TANK"),
7248
+ lastBillRaised: t("LAST_BILL_RAISED"),
7249
+ lastBillReceivedDate: t("LAST_BILL_RECEIVED_DATE"),
7250
+ accessToMeter: t("ACCESS_TO_METER"),
7251
+ systemMeterId: t("SYSTEM_METER_ID"),
7252
+ lastBillNotRaisedReason: t("LAST_BILL_NOT_RAISED_REASON"),
7253
+ waterConnectionYears: t("WATER_CONNECTION_YEARS"),
7254
+ sewerConnectionYears: t("SEWER_CONNECTION_YEARS"),
7255
+ pidNumber: t("PID_NUMBER"),
7256
+ propertyType: t("PROPERTY_TYPE"),
7257
+ subPropertyCategory: t("SUB_PROPERTY_CATEGORY"),
7258
+ noOfFloor: t("NO_OF_FLOOR"),
7259
+ noOfRooms: t("NO_OF_ROOMS"),
7260
+ noOfBeds: t("NO_OF_BEDS"),
7261
+ numberOfDwellingUnits: t("NUMBER_OF_DWELLING_UNITS"),
7262
+ floorNo: t("FLOOR_NO"),
7263
+ userType: t("USER_TYPE"),
7264
+ tenantName: t("TENANT_NAME"),
7265
+ tenantMobile: t("TENANT_MOBILE"),
7266
+ verificationStatus: t("VERIFICATION_STATUS"),
7267
+ houseBuiltDuration: t("HOUSE_BUILT_DURATION"),
7268
+ surveyorId: t("SURVEYOR_ID"),
7269
+ supervisorId: t("SUPERVISOR_ID"),
7270
+ vendorId: t("VENDOR_ID"),
7271
+ assignmentType: t("ASSIGNMENT_TYPE"),
7272
+ assignmentValue: t("ASSIGNMENT_VALUE"),
7273
+ assignedTime: t("ASSIGNED_TIME"),
7274
+ isSelfAssigned: t("IS_SELF_ASSIGNED"),
7275
+ doorPhotoFilestoreId: t("DOOR_PHOTO_FILESTORE_ID"),
7276
+ panFilestoreId: t("PAN_FILESTORE_ID"),
7277
+ documentProofFilestoreId: t("DOCUMENT_PROOF_FILESTORE_ID"),
7278
+ buildingImageFileStoreId: t("BUILDING_IMAGE_FILESTORE_ID"),
7279
+ propertyDocumentFileStoreId: t("PROPERTY_DOCUMENT_FILESTORE_ID"),
7280
+ meterPhotoFileStoreId: t("METER_PHOTO_FILESTORE_ID"),
7281
+ modifiedBy: t("MODIFIED_BY"),
7282
+ emailId: t("EMAIL_ID"),
7283
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME"),
7284
+ dob: t("DOB"),
7285
+ consumerType: t("CONSUMER_TYPE"),
7286
+ createdTime: t("CREATED_TIME"),
7287
+ lastModifiedTime: t("LAST_MODIFIED_TIME"),
7288
+ meterLatitude: t("EKYC_METER_LATITUDE1"),
7289
+ meterLongitude: t("EKYC_METER_LONGITUDE1")
6894
7290
  };
7291
+ const skipTitleCase = ["kno", "mobileNumber", "emailId", "email", "pincode", "mrkey", "dob", "createdTime", "lastModifiedTime", "meterLatitude", "meterLongitude"];
7292
+ const translatedFields = ["meterMake", "meterLocation"];
6895
7293
  const excelData = consumerList.map(item => {
6896
7294
  const cleanObj = {};
6897
7295
  const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
6898
7296
  if (fullName) {
6899
7297
  cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = toTitleCase(fullName);
6900
7298
  }
6901
- const titleCaseFields = ["ekycStatus", "zoneName", "gender", "relationship", "assembly", "ward", "consumerType"];
6902
7299
  Object.keys(item).forEach(key => {
6903
7300
  if (excludedKeys.includes(key)) return;
6904
- const val = item[key];
7301
+ let val = item[key];
6905
7302
  if (typeof val === "object" && val !== null) {
6906
7303
  return;
6907
7304
  }
7305
+ if (String(val).toLowerCase() === "true") {
7306
+ val = t("CS_YES");
7307
+ } else if (String(val).toLowerCase() === "false") {
7308
+ val = t("CS_NO");
7309
+ }
6908
7310
  const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
6909
- if (typeof val === "string" && titleCaseFields.includes(key)) {
7311
+ if (typeof val === "string" && translatedFields.includes(key)) {
7312
+ cleanObj[friendlyHeader] = t(val);
7313
+ } else if (typeof val === "string" && !skipTitleCase.includes(key)) {
6910
7314
  cleanObj[friendlyHeader] = toTitleCase(val);
6911
7315
  } else {
6912
7316
  cleanObj[friendlyHeader] = val;
@@ -6920,10 +7324,10 @@ const SurveyorDetailsDashboard = () => {
6920
7324
  }, function (error) {
6921
7325
  console.error("Error downloading eKYC Excel:", error);
6922
7326
  });
6923
- }, function (_wasThrown3, _result3) {
7327
+ }, function (_wasThrown2, _result2) {
6924
7328
  setEkycDownloadLoading(false);
6925
- if (_wasThrown3) throw _result3;
6926
- return _result3;
7329
+ if (_wasThrown2) throw _result2;
7330
+ return _result2;
6927
7331
  }));
6928
7332
  } catch (e) {
6929
7333
  return Promise.reject(e);
@@ -6952,65 +7356,12 @@ const SurveyorDetailsDashboard = () => {
6952
7356
  }, fullName), /*#__PURE__*/React__default.createElement("div", {
6953
7357
  className: "designation"
6954
7358
  }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.description) || t("FIELD_SURVEYOR")))), /*#__PURE__*/React__default.createElement("div", {
6955
- className: "report-download",
6956
- ref: reportMenuRef
7359
+ className: "report-download"
6957
7360
  }, /*#__PURE__*/React__default.createElement("button", {
6958
7361
  className: "download-btn",
6959
7362
  disabled: reportLoading,
6960
- onClick: () => {
6961
- setShowReportMenu(p => !p);
6962
- setShowCustomPicker(false);
6963
- }
6964
- }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React__default.createElement("div", {
6965
- className: "report-menu"
6966
- }, [{
6967
- label: t("TODAY") || "Today",
6968
- key: "today"
6969
- }, {
6970
- label: t("THIS_WEEK") || "This Week",
6971
- key: "week"
6972
- }, {
6973
- label: t("THIS_MONTH") || "This Month",
6974
- key: "month"
6975
- }].map(_ref5 => {
6976
- let label = _ref5.label,
6977
- key = _ref5.key;
6978
- return /*#__PURE__*/React__default.createElement("div", {
6979
- key: key,
6980
- className: "menu-item",
6981
- onClick: () => handlePresetDownload(key)
6982
- }, label);
6983
- }), /*#__PURE__*/React__default.createElement("div", {
6984
- className: "custom-date-trigger",
6985
- onClick: () => setShowCustomPicker(p => !p)
6986
- }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React__default.createElement("div", {
6987
- className: "custom-picker"
6988
- }, /*#__PURE__*/React__default.createElement("div", {
6989
- className: "date-field"
6990
- }, /*#__PURE__*/React__default.createElement("label", {
6991
- className: "date-label"
6992
- }, t("FROM_DATE") || "From"), /*#__PURE__*/React__default.createElement("input", {
6993
- type: "date",
6994
- className: "date-input",
6995
- value: customDate.from,
6996
- onChange: e => setCustomDate(d => _extends({}, d, {
6997
- from: e.target.value
6998
- }))
6999
- })), /*#__PURE__*/React__default.createElement("div", {
7000
- className: "date-field"
7001
- }, /*#__PURE__*/React__default.createElement("label", {
7002
- className: "date-label"
7003
- }, t("TO_DATE") || "To"), /*#__PURE__*/React__default.createElement("input", {
7004
- type: "date",
7005
- className: "date-input",
7006
- value: customDate.to,
7007
- onChange: e => setCustomDate(d => _extends({}, d, {
7008
- to: e.target.value
7009
- }))
7010
- })), /*#__PURE__*/React__default.createElement("button", {
7011
- className: "download-action-btn",
7012
- onClick: handleCustomDownload
7013
- }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React__default.createElement("div", {
7363
+ onClick: handleDownload
7364
+ }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"))), /*#__PURE__*/React__default.createElement("div", {
7014
7365
  className: "stats-wrapper"
7015
7366
  }, /*#__PURE__*/React__default.createElement(StatCard, {
7016
7367
  title: t("TOTAL_ASSIGNED"),
@@ -7052,19 +7403,19 @@ const SurveyorDetailsDashboard = () => {
7052
7403
  className: "label"
7053
7404
  }, t("MOBILE")), /*#__PURE__*/React__default.createElement("span", {
7054
7405
  className: "value"
7055
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner8 = surveyor.owner) === null || _surveyor$owner8 === void 0 ? void 0 : _surveyor$owner8.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A")), /*#__PURE__*/React__default.createElement("div", {
7406
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner7 = surveyor.owner) === null || _surveyor$owner7 === void 0 ? void 0 : _surveyor$owner7.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A")), /*#__PURE__*/React__default.createElement("div", {
7056
7407
  className: "detail-item"
7057
7408
  }, /*#__PURE__*/React__default.createElement("span", {
7058
7409
  className: "label"
7059
7410
  }, t("EMAIL")), /*#__PURE__*/React__default.createElement("span", {
7060
7411
  className: "value"
7061
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner9 = surveyor.owner) === null || _surveyor$owner9 === void 0 ? void 0 : _surveyor$owner9.emailId) || "N/A")), /*#__PURE__*/React__default.createElement("div", {
7412
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner8 = surveyor.owner) === null || _surveyor$owner8 === void 0 ? void 0 : _surveyor$owner8.emailId) || "N/A")), /*#__PURE__*/React__default.createElement("div", {
7062
7413
  className: "detail-item"
7063
7414
  }, /*#__PURE__*/React__default.createElement("span", {
7064
7415
  className: "label"
7065
7416
  }, t("GENDER")), /*#__PURE__*/React__default.createElement("span", {
7066
7417
  className: "value"
7067
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner0 = surveyor.owner) === null || _surveyor$owner0 === void 0 ? void 0 : _surveyor$owner0.gender) || "N/A")), /*#__PURE__*/React__default.createElement("div", {
7418
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner9 = surveyor.owner) === null || _surveyor$owner9 === void 0 ? void 0 : _surveyor$owner9.gender) || "N/A")), /*#__PURE__*/React__default.createElement("div", {
7068
7419
  className: "detail-item"
7069
7420
  }, /*#__PURE__*/React__default.createElement("span", {
7070
7421
  className: "label"
@@ -7086,10 +7437,16 @@ const SurveyorDetailsDashboard = () => {
7086
7437
  className: "details-right"
7087
7438
  }, /*#__PURE__*/React__default.createElement("div", {
7088
7439
  className: "download-card"
7089
- }, /*#__PURE__*/React__default.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React__default.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React__default.createElement("button", {
7440
+ }, /*#__PURE__*/React__default.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React__default.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React__default.createElement("div", {
7441
+ className: "report-download",
7442
+ ref: reportMenuRef
7443
+ }, /*#__PURE__*/React__default.createElement("button", {
7090
7444
  className: "download-excel-btn",
7091
7445
  disabled: ekycDownloadLoading,
7092
- onClick: handleDownloadEkycData
7446
+ onClick: () => {
7447
+ setShowReportMenu(p => !p);
7448
+ setShowCustomPicker(false);
7449
+ }
7093
7450
  }, /*#__PURE__*/React__default.createElement("svg", {
7094
7451
  width: "16",
7095
7452
  height: "16",
@@ -7108,7 +7465,63 @@ const SurveyorDetailsDashboard = () => {
7108
7465
  y1: "15",
7109
7466
  x2: "12",
7110
7467
  y2: "3"
7111
- })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
7468
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"), showReportMenu && /*#__PURE__*/React__default.createElement("div", {
7469
+ className: "report-menu"
7470
+ }, [{
7471
+ label: t("TODAY") || "Today",
7472
+ key: "today"
7473
+ }, {
7474
+ label: t("THIS_WEEK") || "This Week",
7475
+ key: "week"
7476
+ }, {
7477
+ label: t("THIS_MONTH") || "This Month",
7478
+ key: "month"
7479
+ }].map(_ref5 => {
7480
+ let label = _ref5.label,
7481
+ key = _ref5.key;
7482
+ return /*#__PURE__*/React__default.createElement("div", {
7483
+ key: key,
7484
+ className: "menu-item",
7485
+ onClick: () => handlePresetDownload(key)
7486
+ }, label);
7487
+ }), /*#__PURE__*/React__default.createElement("div", {
7488
+ className: "custom-date-trigger",
7489
+ onClick: () => setShowCustomPicker(p => !p)
7490
+ }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React__default.createElement("div", {
7491
+ className: "custom-picker"
7492
+ }, /*#__PURE__*/React__default.createElement("div", {
7493
+ className: "date-inputs"
7494
+ }, /*#__PURE__*/React__default.createElement("label", null, /*#__PURE__*/React__default.createElement("span", null, "From"), /*#__PURE__*/React__default.createElement("input", {
7495
+ type: "date",
7496
+ value: customDate.from,
7497
+ onChange: e => setCustomDate(_extends({}, customDate, {
7498
+ from: e.target.value
7499
+ }))
7500
+ })), /*#__PURE__*/React__default.createElement("label", null, /*#__PURE__*/React__default.createElement("span", null, "To"), /*#__PURE__*/React__default.createElement("input", {
7501
+ type: "date",
7502
+ value: customDate.to,
7503
+ onChange: e => setCustomDate(_extends({}, customDate, {
7504
+ to: e.target.value
7505
+ }))
7506
+ }))), /*#__PURE__*/React__default.createElement("div", {
7507
+ style: {
7508
+ display: "flex",
7509
+ gap: "10px",
7510
+ marginTop: "10px"
7511
+ }
7512
+ }, /*#__PURE__*/React__default.createElement("button", {
7513
+ className: "picker-cancel-btn",
7514
+ onClick: () => {
7515
+ setShowCustomPicker(false);
7516
+ setCustomDate({
7517
+ from: "",
7518
+ to: ""
7519
+ });
7520
+ }
7521
+ }, t("CANCEL") || "Cancel"), /*#__PURE__*/React__default.createElement("button", {
7522
+ className: "picker-apply-btn",
7523
+ onClick: handleCustomDownload
7524
+ }, t("APPLY") || "Apply"))))))))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
7112
7525
  className: "dashboard-card"
7113
7526
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
7114
7527
  t: t,