@djb25/digit-ui-module-ekyc 1.0.20 → 1.0.22

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.
@@ -1626,7 +1626,6 @@ const VendorDetails = () => {
1626
1626
  pending: row.pending,
1627
1627
  rejected: row.rejected
1628
1628
  }));
1629
- console.log(dashboardData);
1630
1629
  return /*#__PURE__*/React.createElement("div", {
1631
1630
  className: "ekyc-dashboard-wrapper"
1632
1631
  }, /*#__PURE__*/React.createElement("div", {
@@ -2193,8 +2192,8 @@ const SearchFormFieldsComponents = ({
2193
2192
  className: "mobile-input"
2194
2193
  }, /*#__PURE__*/React.createElement(Label, {
2195
2194
  className: "flex-roww flex-gap-2"
2196
- }, t("EKYC_K_NUMBER") || "K Number", /*#__PURE__*/React.createElement(CustomTooltip, {
2197
- message: t("EKYC_K_NUMBER_MESSAGE")
2195
+ }, t("EKYC_MOBILE_NUMBER") || "Mobile Number", /*#__PURE__*/React.createElement(CustomTooltip, {
2196
+ message: t("EKYC_MOBILE_NUMBER_MESSAGE")
2198
2197
  })), /*#__PURE__*/React.createElement(Controller, {
2199
2198
  name: "kNumber",
2200
2199
  control: controlSearchForm,
@@ -4426,31 +4425,23 @@ const AssignEkycModal = ({
4426
4425
  closeModal
4427
4426
  }) => {
4428
4427
  const [selectedKnos, setSelectedKnos] = useState([]);
4429
- const [assignmentType, setAssignmentType] = useState("KNO");
4428
+ const [isBulkSelection, setIsBulkSelection] = useState(false);
4430
4429
  const [currentPage, setCurrentPage] = useState(0);
4431
4430
  const [pageSize, setPageSize] = useState(10);
4431
+ const [showToast, setShowToast] = useState(false);
4432
+ const [toastData, setToastData] = useState({
4433
+ error: false,
4434
+ label: ""
4435
+ });
4432
4436
  const [filters, setFilters] = useState({
4433
4437
  kno: "",
4434
- ekycStatus: "",
4438
+ pincode: "",
4435
4439
  zoneName: "",
4436
- assembly: "",
4437
4440
  ward: "",
4441
+ assembly: "",
4438
4442
  mrkey: "",
4439
- pincode: ""
4443
+ ekycStatus: ""
4440
4444
  });
4441
- const getAssignmentValue = () => {
4442
- switch (assignmentType) {
4443
- case "MRKEY":
4444
- return filters.mrkey;
4445
- case "ASSEMBLY":
4446
- return filters.assembly;
4447
- case "WARD":
4448
- return filters.ward;
4449
- case "KNO":
4450
- default:
4451
- return selectedKnos.join(",");
4452
- }
4453
- };
4454
4445
  const [debouncedFilters, setDebouncedFilters] = useState(filters);
4455
4446
  useEffect(() => {
4456
4447
  const timer = setTimeout(() => {
@@ -4463,7 +4454,7 @@ const AssignEkycModal = ({
4463
4454
  }, [debouncedFilters]);
4464
4455
  const {
4465
4456
  data: applicationData,
4466
- isLoading
4457
+ isFetching: isLoading
4467
4458
  } = Digit.Hooks.ekyc.useEkycApplicationList({
4468
4459
  ...(debouncedFilters.kno && {
4469
4460
  kno: debouncedFilters.kno
@@ -4495,23 +4486,91 @@ const AssignEkycModal = ({
4495
4486
  });
4496
4487
  const assignmentMutation = Digit.Hooks.ekyc.useEkycAssignmentCreate({
4497
4488
  onSuccess: response => {
4498
- console.log("Assignment successful", response);
4499
- closeModal();
4489
+ if (response !== null && response !== void 0 && response.error) {
4490
+ var _response$data;
4491
+ setToastData({
4492
+ error: true,
4493
+ label: (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.message) || "Something went wrong"
4494
+ });
4495
+ setShowToast(true);
4496
+ return;
4497
+ }
4498
+ setToastData({
4499
+ error: false,
4500
+ label: "Assignment successful"
4501
+ });
4502
+ setShowToast(true);
4503
+ setTimeout(() => {
4504
+ closeModal();
4505
+ }, 1000);
4500
4506
  },
4501
4507
  onError: error => {
4502
- console.error("Assignment failed", error);
4508
+ var _error$data, _error$response, _error$response$data;
4509
+ setToastData({
4510
+ error: true,
4511
+ label: (error === null || error === void 0 ? void 0 : (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message) || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) || "Something went wrong"
4512
+ });
4513
+ setShowToast(true);
4503
4514
  }
4504
4515
  });
4505
4516
  const tableData = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.consumerList) || [];
4517
+ const getAssignmentPayload = () => {
4518
+ if (isBulkSelection) {
4519
+ const filterMappings = [{
4520
+ key: "ekycStatus",
4521
+ type: "EKYCSTATUS"
4522
+ }, {
4523
+ key: "zoneName",
4524
+ type: "ZONENAME"
4525
+ }, {
4526
+ key: "assembly",
4527
+ type: "ASSEMBLY"
4528
+ }, {
4529
+ key: "ward",
4530
+ type: "WARD"
4531
+ }, {
4532
+ key: "mrkey",
4533
+ type: "MRKEY"
4534
+ }, {
4535
+ key: "pincode",
4536
+ type: "PINCODE"
4537
+ }];
4538
+ const appliedFilter = filterMappings.find(({
4539
+ key
4540
+ }) => debouncedFilters[key]);
4541
+ if (appliedFilter) {
4542
+ return {
4543
+ assignmentType: appliedFilter.type,
4544
+ assignmentValue: debouncedFilters[appliedFilter.key]
4545
+ };
4546
+ }
4547
+ }
4548
+ console.log("=-=-==-=-=-=-", {
4549
+ assignmentType: "KNO",
4550
+ assignmentValues: selectedKnos
4551
+ });
4552
+ return {
4553
+ assignmentType: "KNO",
4554
+ assignmentValues: selectedKnos
4555
+ };
4556
+ };
4506
4557
  const handleAssign = () => {
4558
+ var _surveyor$owner;
4559
+ const {
4560
+ assignmentType,
4561
+ assignmentValue,
4562
+ assignmentValues
4563
+ } = getAssignmentPayload();
4507
4564
  assignmentMutation.mutate({
4508
4565
  tenantId: "dl.djb",
4509
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : surveyor.uuid,
4510
- assignmentType: "KNO",
4511
- assignmentValue: getAssignmentValue()
4566
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
4567
+ assignmentType,
4568
+ assignmentValue,
4569
+ assignmentValues
4512
4570
  });
4513
4571
  };
4514
4572
  const handleSelectAll = () => {
4573
+ setIsBulkSelection(true);
4515
4574
  const pageKnos = tableData.map(item => item.kno);
4516
4575
  const allSelected = pageKnos.length > 0 && pageKnos.every(kno => selectedKnos.includes(kno));
4517
4576
  setSelectedKnos(prev => allSelected ? prev.filter(kno => !pageKnos.includes(kno)) : [...new Set([...prev, ...pageKnos])]);
@@ -4625,19 +4684,7 @@ const AssignEkycModal = ({
4625
4684
  value: "APPROVED"
4626
4685
  }, "Approved"), /*#__PURE__*/React.createElement("option", {
4627
4686
  value: "REJECTED"
4628
- }, "Rejected")), /*#__PURE__*/React.createElement("select", {
4629
- className: "form-control",
4630
- value: assignmentType,
4631
- onChange: e => setAssignmentType(e.target.value)
4632
- }, /*#__PURE__*/React.createElement("option", {
4633
- value: "KNO"
4634
- }, "KNO"), /*#__PURE__*/React.createElement("option", {
4635
- value: "MRKEY"
4636
- }, "MR Key"), /*#__PURE__*/React.createElement("option", {
4637
- value: "WARD"
4638
- }, "Ward"), /*#__PURE__*/React.createElement("option", {
4639
- value: "ASSEMBLY"
4640
- }, "Assembly"))), /*#__PURE__*/React.createElement(Table, {
4687
+ }, "Rejected"))), /*#__PURE__*/React.createElement(Table, {
4641
4688
  tableTitle: "eKYC Applications",
4642
4689
  tableClass: "ekycTable",
4643
4690
  data: tableData,
@@ -4668,11 +4715,15 @@ const AssignEkycModal = ({
4668
4715
  setPageSize(Number(e.target.value));
4669
4716
  setCurrentPage(0);
4670
4717
  }
4671
- })));
4718
+ })), showToast && /*#__PURE__*/React.createElement(Toast, {
4719
+ error: toastData.error,
4720
+ label: toastData.label,
4721
+ onClose: () => setShowToast(false)
4722
+ }));
4672
4723
  };
4673
4724
 
4674
4725
  const SurveyorDetailsDashboard = () => {
4675
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _fullName$charAt, _surveyor$owner3, _surveyor$owner4, _surveyor$owner5, _surveyor$additionalD;
4726
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner4, _surveyor$owner5, _surveyor$owner6, _surveyor$additionalD, _dashboardData$dashbo5, _dashboardData$dashbo6;
4676
4727
  const tenantId = Digit.ULBService.getCurrentTenantId();
4677
4728
  const [showModal, setShowModal] = useState(false);
4678
4729
  const [showOptions, setShowOptions] = useState(false);
@@ -4699,30 +4750,49 @@ const SurveyorDetailsDashboard = () => {
4699
4750
  var _surveyorSearchRespon;
4700
4751
  return (surveyorSearchResponse === null || surveyorSearchResponse === void 0 ? void 0 : (_surveyorSearchRespon = surveyorSearchResponse.surveyors) === null || _surveyorSearchRespon === void 0 ? void 0 : _surveyorSearchRespon[0]) || null;
4701
4752
  }, [surveyorSearchResponse]);
4702
- const knoColumns = React.useMemo(() => [{
4703
- Header: t("KNO"),
4753
+ const [currentPage, setCurrentPage] = useState(0);
4754
+ const [pageSize, setPageSize] = useState(20);
4755
+ const queryParams = {
4756
+ tenantId: "dl.djb",
4757
+ offset: currentPage * pageSize,
4758
+ limit: pageSize,
4759
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid
4760
+ };
4761
+ const {
4762
+ isFetching: isDashboardLoading,
4763
+ data: dashboardData = {}
4764
+ } = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, queryParams, {
4765
+ enabled: !!queryParams.tenantId && !!queryParams.surveyorId,
4766
+ keepPreviousData: true
4767
+ });
4768
+ const knoColumns = useMemo(() => [{
4769
+ Header: "KNO",
4704
4770
  accessor: "kno"
4705
4771
  }, {
4706
- Header: t("CONSUMER_NAME"),
4707
- accessor: "consumerName"
4772
+ Header: "Consumer Name",
4773
+ accessor: row => `${row.firstName || ""} ${row.middleName || ""} ${row.lastName || ""}`.trim(),
4774
+ id: "consumerName"
4708
4775
  }, {
4709
- Header: t("MOBILE_NO"),
4710
- accessor: "mobileNumber"
4776
+ Header: "Zone",
4777
+ accessor: "zoneName"
4711
4778
  }, {
4712
- Header: t("STATUS"),
4779
+ Header: "Pincode",
4780
+ accessor: "pincode"
4781
+ }, {
4782
+ Header: "Status",
4713
4783
  accessor: "status",
4714
4784
  Cell: ({
4715
4785
  value
4716
4786
  }) => /*#__PURE__*/React.createElement("span", {
4717
- className: `status-badge ${(value === null || value === void 0 ? void 0 : value.toLowerCase()) || ""}`
4787
+ className: `status-badge ${value === "ACTIVE" ? "verified" : value === "PENDING" ? "pending" : "assigned"}`
4718
4788
  }, value)
4719
4789
  }, {
4720
- Header: t("ASSIGNED_DATE"),
4721
- accessor: "assignedDate"
4722
- }, {
4723
- Header: t("COMPLETED_DATE"),
4724
- accessor: "completedDate"
4725
- }], [t]);
4790
+ Header: "eKYC Status",
4791
+ accessor: "ekycStatus",
4792
+ Cell: ({
4793
+ value
4794
+ }) => value || "-"
4795
+ }], []);
4726
4796
  if (isLoading) {
4727
4797
  return /*#__PURE__*/React.createElement(Loader, null);
4728
4798
  }
@@ -4733,21 +4803,6 @@ const SurveyorDetailsDashboard = () => {
4733
4803
  }
4734
4804
  }, t("NO_SURVEYOR_FOUND")));
4735
4805
  }
4736
- const assignedKnos = [{
4737
- kno: "123456789",
4738
- consumerName: "Rahul Sharma",
4739
- mobileNumber: "9876543210",
4740
- status: "Completed",
4741
- assignedDate: "01-06-2026",
4742
- completedDate: "02-06-2026"
4743
- }, {
4744
- kno: "123456790",
4745
- consumerName: "Amit Kumar",
4746
- mobileNumber: "9876543211",
4747
- status: "Pending",
4748
- assignedDate: "03-06-2026",
4749
- completedDate: "-"
4750
- }];
4751
4806
  const weeklyData = [{
4752
4807
  day: "Mon",
4753
4808
  completed: 4
@@ -4786,19 +4841,24 @@ const SurveyorDetailsDashboard = () => {
4786
4841
  const StatCard = ({
4787
4842
  title,
4788
4843
  value,
4789
- type
4844
+ type,
4845
+ isLoading
4790
4846
  }) => /*#__PURE__*/React.createElement("div", {
4791
4847
  className: `stat-card ${type}`
4792
- }, /*#__PURE__*/React.createElement("div", {
4848
+ }, isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4849
+ className: "stat-title skeleton skeleton-text"
4850
+ }), /*#__PURE__*/React.createElement("div", {
4851
+ className: "stat-value skeleton skeleton-number"
4852
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4793
4853
  className: "stat-title"
4794
4854
  }, title), /*#__PURE__*/React.createElement("div", {
4795
4855
  className: "stat-value"
4796
- }, value));
4856
+ }, value)));
4797
4857
  const options = [{
4798
4858
  action: "Assign"
4799
4859
  }];
4800
- const fullName = (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.name) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.name) || "N/A";
4801
- const employeeId = (surveyor === null || surveyor === void 0 ? void 0 : surveyor.employeeId) || (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner2 = surveyor.owner) === null || _surveyor$owner2 === void 0 ? void 0 : _surveyor$owner2.uuid) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.id);
4860
+ const fullName = (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner2 = surveyor.owner) === null || _surveyor$owner2 === void 0 ? void 0 : _surveyor$owner2.name) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.name) || "N/A";
4861
+ const employeeId = (surveyor === null || surveyor === void 0 ? void 0 : surveyor.employeeId) || (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner3 = surveyor.owner) === null || _surveyor$owner3 === void 0 ? void 0 : _surveyor$owner3.uuid) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.id);
4802
4862
  const handleMenuSelect = option => {
4803
4863
  setShowOptions(false);
4804
4864
  setShowModal(true);
@@ -4822,21 +4882,25 @@ const SurveyorDetailsDashboard = () => {
4822
4882
  }, t("EMPLOYEE_ID"), ": ", employeeId)))), /*#__PURE__*/React.createElement("div", {
4823
4883
  className: "stats-wrapper"
4824
4884
  }, /*#__PURE__*/React.createElement(StatCard, {
4825
- title: t("TODAYS_EKYC"),
4826
- value: (surveyor === null || surveyor === void 0 ? void 0 : surveyor.todayCompleted) || 0,
4827
- type: "today"
4885
+ title: t("TOTAL_ASSIGNED"),
4886
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.total) || 0,
4887
+ type: "today",
4888
+ isLoading: isDashboardLoading
4828
4889
  }), /*#__PURE__*/React.createElement(StatCard, {
4829
- title: t("THIS_WEEK"),
4830
- value: (surveyor === null || surveyor === void 0 ? void 0 : surveyor.weekCompleted) || 0,
4831
- type: "week"
4890
+ title: t("COMPLETED"),
4891
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.completed) || 0,
4892
+ type: "week",
4893
+ isLoading: isDashboardLoading
4832
4894
  }), /*#__PURE__*/React.createElement(StatCard, {
4833
- title: t("THIS_MONTH"),
4834
- value: (surveyor === null || surveyor === void 0 ? void 0 : surveyor.monthCompleted) || 0,
4835
- type: "month"
4895
+ title: t("PENDING"),
4896
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.pending) || 0,
4897
+ type: "pending",
4898
+ isLoading: isDashboardLoading
4836
4899
  }), /*#__PURE__*/React.createElement(StatCard, {
4837
- title: t("PENDING_CASES"),
4838
- value: (surveyor === null || surveyor === void 0 ? void 0 : surveyor.pendingCases) || 0,
4839
- type: "pending"
4900
+ title: t("SUBMITTED"),
4901
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.submittedCount) || 0,
4902
+ type: "month",
4903
+ isLoading: isDashboardLoading
4840
4904
  })), /*#__PURE__*/React.createElement("div", {
4841
4905
  className: "charts-wrapper"
4842
4906
  }, /*#__PURE__*/React.createElement("div", {
@@ -4882,19 +4946,19 @@ const SurveyorDetailsDashboard = () => {
4882
4946
  className: "label"
4883
4947
  }, t("MOBILE"), ":"), /*#__PURE__*/React.createElement("span", {
4884
4948
  className: "value"
4885
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner3 = surveyor.owner) === null || _surveyor$owner3 === void 0 ? void 0 : _surveyor$owner3.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A")), /*#__PURE__*/React.createElement("div", {
4949
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner4 = surveyor.owner) === null || _surveyor$owner4 === void 0 ? void 0 : _surveyor$owner4.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A")), /*#__PURE__*/React.createElement("div", {
4886
4950
  className: "detail-item"
4887
4951
  }, /*#__PURE__*/React.createElement("span", {
4888
4952
  className: "label"
4889
4953
  }, t("EMAIL"), ":"), /*#__PURE__*/React.createElement("span", {
4890
4954
  className: "value"
4891
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner4 = surveyor.owner) === null || _surveyor$owner4 === void 0 ? void 0 : _surveyor$owner4.emailId) || "N/A")), /*#__PURE__*/React.createElement("div", {
4955
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner5 = surveyor.owner) === null || _surveyor$owner5 === void 0 ? void 0 : _surveyor$owner5.emailId) || "N/A")), /*#__PURE__*/React.createElement("div", {
4892
4956
  className: "detail-item"
4893
4957
  }, /*#__PURE__*/React.createElement("span", {
4894
4958
  className: "label"
4895
4959
  }, t("GENDER"), ":"), /*#__PURE__*/React.createElement("span", {
4896
4960
  className: "value"
4897
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner5 = surveyor.owner) === null || _surveyor$owner5 === void 0 ? void 0 : _surveyor$owner5.gender) || "N/A")), /*#__PURE__*/React.createElement("div", {
4961
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner6 = surveyor.owner) === null || _surveyor$owner6 === void 0 ? void 0 : _surveyor$owner6.gender) || "N/A")), /*#__PURE__*/React.createElement("div", {
4898
4962
  className: "detail-item"
4899
4963
  }, /*#__PURE__*/React.createElement("span", {
4900
4964
  className: "label"
@@ -4912,16 +4976,42 @@ const SurveyorDetailsDashboard = () => {
4912
4976
  className: "label"
4913
4977
  }, t("VENDOR_ID"), ":"), /*#__PURE__*/React.createElement("span", {
4914
4978
  className: "value"
4915
- }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorId) || "N/A")))), /*#__PURE__*/React.createElement(Table, {
4979
+ }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorId) || "N/A")))), /*#__PURE__*/React.createElement(Card, {
4980
+ className: "dashboard-card"
4981
+ }, /*#__PURE__*/React.createElement(Table, {
4916
4982
  t: t,
4917
4983
  tableTitle: t("ASSIGNED_KNOS"),
4918
- data: assignedKnos,
4984
+ tableClass: "ekycTable",
4985
+ data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.consumerList) || [],
4919
4986
  columns: knoColumns,
4920
- totalRecords: assignedKnos === null || assignedKnos === void 0 ? void 0 : assignedKnos.length,
4987
+ isLoading: isDashboardLoading,
4988
+ totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.total,
4989
+ currentPage: currentPage,
4990
+ pageSizeLimit: pageSize,
4921
4991
  isPaginationRequired: true,
4922
- pageSizeLimit: 10,
4923
- manualPagination: false
4924
- }), (!roles.includes("EKYC_SURVEYOR") || roles.includes("EMPLOYEE")) && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
4992
+ onNextPage: () => {
4993
+ var _dashboardData$dashbo7;
4994
+ if (currentPage < ((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo7 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo7 === void 0 ? void 0 : _dashboardData$dashbo7.totalPages) || 1) - 1) {
4995
+ setCurrentPage(prev => prev + 1);
4996
+ }
4997
+ },
4998
+ onPrevPage: () => {
4999
+ if (currentPage > 0) {
5000
+ setCurrentPage(prev => prev - 1);
5001
+ }
5002
+ },
5003
+ onFirstPage: () => {
5004
+ setCurrentPage(0);
5005
+ },
5006
+ onLastPage: () => {
5007
+ var _dashboardData$dashbo8;
5008
+ setCurrentPage(Math.max(((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo8 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo8 === void 0 ? void 0 : _dashboardData$dashbo8.totalPages) || 1) - 1, 0));
5009
+ },
5010
+ onPageSizeChange: e => {
5011
+ setPageSize(Number(e.target.value));
5012
+ setCurrentPage(0);
5013
+ }
5014
+ })), (!roles.includes("EKYC_SURVEYOR") || roles.includes("EMPLOYEE")) && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
4925
5015
  label: t("EKYC_ASSIGN_KNOS"),
4926
5016
  onSubmit: () => setShowOptions(prev => !prev)
4927
5017
  }), showOptions && /*#__PURE__*/React.createElement(Menu, {
@@ -5077,21 +5167,9 @@ const SupervisorInboxTableConfig = ({
5077
5167
  };
5078
5168
 
5079
5169
  const AssignEkyc = () => {
5080
- var _sortParams$, _sortParams$2, _formState$searchForm3, _formState$searchForm4, _dashboardData$dashbo;
5170
+ var _formState$tableForm, _formState$tableForm2, _formState$tableForm3, _formState$tableForm4, _userDetails$info, _formState$searchForm3, _formState$searchForm4, _dashboardData$dashbo;
5081
5171
  const tenantId = Digit.ULBService.getCurrentTenantId();
5082
5172
  const location = useLocation();
5083
- const [sortParams, setSortParams] = useState([{
5084
- id: "",
5085
- desc: true
5086
- }]);
5087
- const [pageOffset, setPageOffset] = useState(0);
5088
- const [pageSize, setPageSize] = useState(10);
5089
- let paginationParms = {
5090
- limit: pageSize,
5091
- offset: pageOffset,
5092
- sortBy: sortParams === null || sortParams === void 0 ? void 0 : (_sortParams$ = sortParams[0]) === null || _sortParams$ === void 0 ? void 0 : _sortParams$.id,
5093
- sortOrder: sortParams !== null && sortParams !== void 0 && (_sortParams$2 = sortParams[0]) !== null && _sortParams$2 !== void 0 && _sortParams$2.desc ? "DESC" : "ASC"
5094
- };
5095
5173
  const formInitValue = {
5096
5174
  filterForm: {},
5097
5175
  searchForm: {},
@@ -5103,12 +5181,20 @@ const AssignEkyc = () => {
5103
5181
  }
5104
5182
  };
5105
5183
  const [formState, dispatch] = useReducer(formReducer, formInitValue);
5184
+ const userDetails = Digit.SessionStorage.get("User");
5185
+ let paginationParms = {
5186
+ limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
5187
+ offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0,
5188
+ sortBy: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.sortBy) || "createdTime",
5189
+ sortOrder: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.sortOrder) || "DESC"
5190
+ };
5106
5191
  const {
5107
5192
  data: dashboardData,
5108
5193
  isLoading
5109
5194
  } = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
5110
5195
  ...paginationParms,
5111
- status: "ACTIVE,DISABLED"
5196
+ status: "ACTIVE,DISABLED",
5197
+ vendorId: userDetails === null || userDetails === void 0 ? void 0 : (_userDetails$info = userDetails.info) === null || _userDetails$info === void 0 ? void 0 : _userDetails$info.uuid
5112
5198
  }, {
5113
5199
  enabled: !!tenantId,
5114
5200
  keepPreviousData: true
@@ -5131,6 +5217,13 @@ const AssignEkyc = () => {
5131
5217
  enabled: !!tenantId && !!searchDetails.kno,
5132
5218
  keepPreviousData: true
5133
5219
  });
5220
+ const {
5221
+ isLoading: isDataSearchLoading,
5222
+ data
5223
+ } = Digit.Hooks.ekyc.useEkycAssignmentProgress({}, {
5224
+ enabled: !!tenantId && !!searchDetails.kno,
5225
+ keepPreviousData: true
5226
+ });
5134
5227
  const sourceData = useMemo(() => {
5135
5228
  if (isSearchActive) {
5136
5229
  if (!searchData) return [];
@@ -5323,35 +5416,30 @@ const AssignEkyc = () => {
5323
5416
  const isInboxLoading = isLoading || isSearchLoading;
5324
5417
  const cards = [{
5325
5418
  label: "TOTAL_EKYC_APPLICATIONS",
5326
- count: 364,
5419
+ count: (data === null || data === void 0 ? void 0 : data.totalKnos) || 0,
5327
5420
  color: "#0B2559",
5328
5421
  filter: null,
5329
5422
  active: true
5330
5423
  }, {
5331
- label: "UNASSIGNED_APPLICATIONS",
5332
- count: 28,
5333
- color: "#F59E0B",
5334
- filter: ["UNASSIGNED"]
5335
- }, {
5336
- label: "ASSIGNED_TO_SURVEYOR",
5337
- count: 120,
5424
+ label: "TOTAL_ASSIGNMENTS",
5425
+ count: (data === null || data === void 0 ? void 0 : data.totalAssignments) || 0,
5338
5426
  color: "#3B82F6",
5339
5427
  filter: ["ASSIGNED"]
5340
- }, {
5341
- label: "IN_PROGRESS",
5342
- count: 54,
5343
- color: "#A855F7",
5344
- filter: ["IN_PROGRESS"]
5345
5428
  }, {
5346
5429
  label: "EKYC_COMPLETED",
5347
- count: 140,
5430
+ count: (data === null || data === void 0 ? void 0 : data.completedKnos) || 0,
5348
5431
  color: "#10B981",
5349
5432
  filter: ["COMPLETED"]
5350
5433
  }, {
5351
- label: "REJECTED_APPLICATIONS",
5352
- count: 22,
5353
- color: "#EF4444",
5354
- filter: ["REJECTED"]
5434
+ label: "PENDING_APPLICATIONS",
5435
+ count: ((data === null || data === void 0 ? void 0 : data.totalKnos) || 0) - ((data === null || data === void 0 ? void 0 : data.completedKnos) || 0),
5436
+ color: "#F59E0B",
5437
+ filter: ["PENDING"]
5438
+ }, {
5439
+ label: "OVERALL_PROGRESS",
5440
+ count: `${(data === null || data === void 0 ? void 0 : data.overallProgressPercent) || 0}%`,
5441
+ color: "#A855F7",
5442
+ filter: ["IN_PROGRESS"]
5355
5443
  }];
5356
5444
  return /*#__PURE__*/React.createElement("div", {
5357
5445
  className: "app-container"
@@ -5362,7 +5450,8 @@ const AssignEkyc = () => {
5362
5450
  propsForInboxTable,
5363
5451
  formState,
5364
5452
  countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
5365
- cards
5453
+ cards,
5454
+ isCardLoading: isDataSearchLoading
5366
5455
  })));
5367
5456
  };
5368
5457