@djb25/digit-ui-module-ekyc 1.0.45 → 1.0.47

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.
@@ -4,7 +4,6 @@ import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route,
4
4
  import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, SearchField, RadioButtons, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, Menu, LinkButton, UploadFile, FormComposer, VerticalTimeline, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, CitizenHomeCard, DocumentIcon } from '@djb25/digit-ui-react-components';
5
5
  import * as Chartjs from 'chart.js/auto';
6
6
  import Chartjs__default, { Chart } from 'chart.js/auto';
7
- import 'three/tsl';
8
7
  import { FaUsers, FaCheckCircle, FaClock, FaExclamationTriangle, FaUserTie, FaChartLine, FaSearch, FaArrowRight, FaMapMarkedAlt } from 'react-icons/fa';
9
8
  import { ResponsiveContainer, LineChart, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Line, BarChart, Bar, PieChart, Pie, Cell } from 'recharts';
10
9
 
@@ -141,13 +140,14 @@ const StatusCards = _ref => {
141
140
  }
142
141
  const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
143
142
  const fullName = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "Admin";
143
+ const hasExternalData = countData && typeof countData.total === "number" && typeof countData.submittedCount === "number";
144
144
  const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, {
145
145
  tenantId,
146
146
  offset: 0,
147
147
  limit: 10,
148
148
  ekycStatus: "submitted"
149
149
  }, {
150
- enabled: !!tenantId
150
+ enabled: !!tenantId && !hasExternalData
151
151
  }),
152
152
  dashboardData = _Digit$Hooks$ekyc$use.data;
153
153
  const apiCountData = React.useMemo(() => {
@@ -244,12 +244,12 @@ const StatusCards = _ref => {
244
244
  };
245
245
  const chartRef1 = useRef(null);
246
246
  const chartInstance1 = useRef(null);
247
- const total = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.total) || (countData === null || countData === void 0 ? void 0 : countData.total) || (countData === null || countData === void 0 ? void 0 : countData.totalCount) || 0;
248
- const pending = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
249
- const active = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
250
- const completed = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.completed) || (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
251
- const inprocess = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.inProgressCount) || (countData === null || countData === void 0 ? void 0 : countData.inProgressCount) || 0;
252
- const submitted = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.submittedCount) || (countData === null || countData === void 0 ? void 0 : countData.submittedCount) || 0;
247
+ const total = hasExternalData ? countData.total : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.total) || (countData === null || countData === void 0 ? void 0 : countData.total) || (countData === null || countData === void 0 ? void 0 : countData.totalCount) || 0;
248
+ const pending = hasExternalData ? countData.pending : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
249
+ const active = hasExternalData ? countData.active : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
250
+ const completed = hasExternalData ? countData.completed : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.completed) || (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
251
+ const inprocess = hasExternalData ? countData.inProgressCount : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.inProgressCount) || (countData === null || countData === void 0 ? void 0 : countData.inProgressCount) || 0;
252
+ const submitted = hasExternalData ? countData.submittedCount : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.submittedCount) || (countData === null || countData === void 0 ? void 0 : countData.submittedCount) || 0;
253
253
  const actualCompleted = completed;
254
254
  const approved = actualCompleted;
255
255
  const efficiency = total > 0 ? Math.round((submitted + completed) / total * 100) : 0;
@@ -437,7 +437,9 @@ const Dashboard = () => {
437
437
  completed: info.completed || 0,
438
438
  pending: info.pending || 0,
439
439
  rejected: info.rejected || 0,
440
- active: info.active || 0
440
+ active: info.active || 0,
441
+ submittedCount: info.submittedCount || 0,
442
+ inProgressCount: info.inProgressCount || 0
441
443
  };
442
444
  }, [dashboardData]);
443
445
  return isLoading ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, {
@@ -2140,14 +2142,16 @@ const VendorDetailsCard = () => {
2140
2142
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
2141
2143
  status: "ACTIVE"
2142
2144
  }, {
2143
- enabled: !!tenantId
2145
+ enabled: !!tenantId,
2146
+ staleTime: 300000
2144
2147
  }),
2145
2148
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
2146
2149
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
2147
2150
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
2148
2151
  status: "ACTIVE"
2149
2152
  }, {
2150
- enabled: !!tenantId
2153
+ enabled: !!tenantId,
2154
+ staleTime: 300000
2151
2155
  }),
2152
2156
  supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
2153
2157
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
@@ -2235,7 +2239,7 @@ const VendorDetailsCard = () => {
2235
2239
  }, [vendor]);
2236
2240
  const zoneIds = useMemo(() => {
2237
2241
  var _vendor$zoneIds;
2238
- return vendor !== null && vendor !== void 0 && (_vendor$zoneIds = vendor.zoneIds) !== null && _vendor$zoneIds !== void 0 && _vendor$zoneIds.length ? vendor.zoneIds.map(zone => zone.toUpperCase().replace("", " ")).join(", ") : "N/A";
2242
+ return vendor !== null && vendor !== void 0 && (_vendor$zoneIds = vendor.zoneIds) !== null && _vendor$zoneIds !== void 0 && _vendor$zoneIds.length ? vendor.zoneIds.filter(Boolean).map(zone => String(zone).toUpperCase().replace("", " ")).join(", ") : "N/A";
2239
2243
  }, [vendor]);
2240
2244
  const cards = useMemo(() => {
2241
2245
  const hasRealData = vendorSupervisors.some(s => s.totalKnos > 0);
@@ -6331,21 +6335,24 @@ const SupervisorDetailsCard = () => {
6331
6335
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
6332
6336
  status: "ACTIVE"
6333
6337
  }, {
6334
- enabled: !!tenantId
6338
+ enabled: !!tenantId,
6339
+ staleTime: 300000
6335
6340
  }),
6336
6341
  supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
6337
6342
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
6338
6343
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
6339
6344
  status: "ACTIVE"
6340
6345
  }, {
6341
- enabled: !!tenantId
6346
+ enabled: !!tenantId,
6347
+ staleTime: 300000
6342
6348
  }),
6343
6349
  surveyorSearchResponse = _Digit$Hooks$fsm$useS2.data,
6344
6350
  isSurveyorSearchLoading = _Digit$Hooks$fsm$useS2.isLoading;
6345
6351
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
6346
6352
  status: "ACTIVE"
6347
6353
  }, {
6348
- enabled: !!tenantId
6354
+ enabled: !!tenantId,
6355
+ staleTime: 300000
6349
6356
  }),
6350
6357
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
6351
6358
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
@@ -7381,7 +7388,7 @@ const AssignEkycModal = _ref => {
7381
7388
  };
7382
7389
 
7383
7390
  const SurveyorDetailsDashboard = () => {
7384
- var _Digit$SessionStorage, _Digit$SessionStorage2, _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;
7391
+ 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;
7385
7392
  const tenantId = Digit.ULBService.getCurrentTenantId();
7386
7393
  const _useState = useState(false),
7387
7394
  showModal = _useState[0],
@@ -7405,24 +7412,24 @@ const SurveyorDetailsDashboard = () => {
7405
7412
  }),
7406
7413
  surveyorSearchById = _Digit$Hooks$fsm$useS.data,
7407
7414
  isLoadingId = _Digit$Hooks$fsm$useS.isLoading;
7415
+ const hasFoundById = !!(surveyorSearchById !== null && surveyorSearchById !== void 0 && (_surveyorSearchById$s = surveyorSearchById.surveyors) !== null && _surveyorSearchById$s !== void 0 && _surveyorSearchById$s.length);
7408
7416
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, surveyorId ? {
7409
7417
  ownerIds: surveyorId
7410
7418
  } : {
7411
7419
  ownerIds
7412
7420
  }, {
7413
- enabled: true,
7421
+ enabled: !surveyorId || !isLoadingId && !hasFoundById,
7414
7422
  staleTime: Infinity
7415
7423
  }),
7416
7424
  surveyorSearchByOwner = _Digit$Hooks$fsm$useS2.data,
7417
7425
  isLoadingOwner = _Digit$Hooks$fsm$useS2.isLoading;
7418
7426
  const surveyorSearchResponse = useMemo(() => {
7419
- if (surveyorId) {
7420
- var _surveyorSearchById$s;
7421
- return surveyorSearchById !== null && surveyorSearchById !== void 0 && (_surveyorSearchById$s = surveyorSearchById.surveyors) !== null && _surveyorSearchById$s !== void 0 && _surveyorSearchById$s.length ? surveyorSearchById : surveyorSearchByOwner;
7427
+ if (surveyorId && hasFoundById) {
7428
+ return surveyorSearchById;
7422
7429
  }
7423
7430
  return surveyorSearchByOwner;
7424
- }, [surveyorId, surveyorSearchById, surveyorSearchByOwner]);
7425
- const isLoading = surveyorId ? isLoadingId || isLoadingOwner : isLoadingOwner;
7431
+ }, [surveyorId, hasFoundById, surveyorSearchById, surveyorSearchByOwner]);
7432
+ const isLoading = surveyorId ? isLoadingId || isLoadingOwner && !hasFoundById : isLoadingOwner;
7426
7433
  const roles = (_Digit$SessionStorage3 = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage3 === void 0 ? void 0 : (_Digit$SessionStorage4 = _Digit$SessionStorage3.info) === null || _Digit$SessionStorage4 === void 0 ? void 0 : _Digit$SessionStorage4.roles.map(ele => ele.code);
7427
7434
  const surveyor = useMemo(() => {
7428
7435
  var _surveyorSearchRespon;
@@ -7431,14 +7438,16 @@ const SurveyorDetailsDashboard = () => {
7431
7438
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
7432
7439
  status: "ACTIVE"
7433
7440
  }, {
7434
- enabled: !!tenantId
7441
+ enabled: !!tenantId,
7442
+ staleTime: 300000
7435
7443
  }),
7436
7444
  vendorData = _Digit$Hooks$fsm$useD.data,
7437
7445
  isVendorLoading = _Digit$Hooks$fsm$useD.isLoading;
7438
7446
  const _Digit$Hooks$fsm$useS3 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
7439
7447
  status: "ACTIVE"
7440
7448
  }, {
7441
- enabled: !!tenantId
7449
+ enabled: !!tenantId,
7450
+ staleTime: 300000
7442
7451
  }),
7443
7452
  supervisorSearchResponse = _Digit$Hooks$fsm$useS3.data,
7444
7453
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS3.isLoading;