From 2526a5b6277f4f162b5485ff82e1178e63aa79cc Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 8 May 2024 18:54:58 +0100 Subject: [PATCH 1/3] initial commit --- .../partials/widgets/lists/ListsWidget3.tsx | 184 ++++++------------ src/app/modules/auth/core/AxiosCallHelper.ts | 23 +++ src/app/modules/auth/core/_requests.ts | 7 +- src/app/pages/dashboard/DashboardWrapper.tsx | 150 +++++++------- 4 files changed, 168 insertions(+), 196 deletions(-) diff --git a/src/_digifi/partials/widgets/lists/ListsWidget3.tsx b/src/_digifi/partials/widgets/lists/ListsWidget3.tsx index 92035b0..d80711a 100644 --- a/src/_digifi/partials/widgets/lists/ListsWidget3.tsx +++ b/src/_digifi/partials/widgets/lists/ListsWidget3.tsx @@ -1,13 +1,39 @@ import React from 'react' -import {KTIcon} from '../../../helpers' -import {Dropdown1} from '../../content/dropdown/Dropdown1' +import { NewDateTimeFormatter } from '../../../lib/NewDateTimeFormatter' +// import {KTIcon} from '../../../helpers' +// import {Dropdown1} from '../../content/dropdown/Dropdown1' + +type dashDataProps = { + loading: boolean, + data: { + call_return?: string + recent_applications? : {}[] + recent_bvn?: { + id?: string + uid?: string + bvn?: string + status?: string + added?: string + updated?: string + firstname?: string | null + lastname?: string | null + middlename?: string | null + gender?: string | null + birthdate?: string | null + phone?: string | null + nationality?: string | null + }[] + } +} type Props = { className: string + dashData: dashDataProps } -const ListsWidget3: React.FC = ({className}) => { +const ListsWidget3: React.FC = ({dashData, className}) => { + console.log('dashData', dashData.data) return (
{/* begin::Header */} @@ -31,132 +57,34 @@ const ListsWidget3: React.FC = ({className}) => { {/* end::Header */} {/* begin::Body */}
- {/* begin::Item */} -
- {/* begin::Bullet */} - - {/* end::Bullet */} - {/* begin::Checkbox */} -
- + {dashData.loading ? + null + : + dashData?.data?.recent_bvn && dashData?.data?.recent_bvn.length ? + dashData?.data?.recent_bvn.map(item => ( +
+ {/* begin::Bullet */} + + {/* end::Bullet */} + {/* begin::Checkbox */} +
+ +
+ {/* end::Checkbox */} + {/* begin::Description */} +
+ + {item?.bvn} + + {NewDateTimeFormatter(item?.added)} +
+ {/* end::Description */} + New
- {/* end::Checkbox */} - {/* begin::Description */} -
- - Create FireStone Logo - - Due in 2 Days -
- {/* end::Description */} - New -
- {/* end:Item */} - {/* begin::Item */} -
- {/* begin::Bullet */} - - {/* end::Bullet */} - {/* begin::Checkbox */} -
- -
- {/* end::Checkbox */} - {/* begin::Description */} -
- - Stakeholder Meeting - - Due in 3 Days -
- {/* end::Description */} - New -
- {/* end:Item */} - {/* begin::Item */} -
- {/* begin::Bullet */} - - {/* end::Bullet */} - {/* begin::Checkbox */} -
- -
- {/* end::Checkbox */} - {/* begin::Description */} -
- - Scoping & Estimations - - Due in 5 Days -
- {/* end::Description */} - New -
- {/* end:Item */} - {/* begin::Item */} -
- {/* begin::Bullet */} - - {/* end::Bullet */} - {/* begin::Checkbox */} -
- -
- {/* end::Checkbox */} - {/* begin::Description */} -
- - KPI App Showcase - - Due in 2 Days -
- {/* end::Description */} - New -
- {/* end:Item */} - {/* begin::Item */} -
- {/* begin::Bullet */} - - {/* end::Bullet */} - {/* begin::Checkbox */} -
- -
- {/* end::Checkbox */} - {/* begin::Description */} -
- - Project Meeting - - Due in 12 Days -
- {/* end::Description */} - New -
- {/* end:Item */} - {/* begin::Item */} -
- {/* begin::Bullet */} - - {/* end::Bullet */} - {/* begin::Checkbox */} -
- -
- {/* end::Checkbox */} - {/* begin::Description */} -
- - Customers Update - - Due in 1 week -
- {/* end::Description */} - New -
- {/* end:Item */} + )) + : +

No list Found!

+ }
{/* end::Body */}
diff --git a/src/app/modules/auth/core/AxiosCallHelper.ts b/src/app/modules/auth/core/AxiosCallHelper.ts index b25e2cf..2413696 100644 --- a/src/app/modules/auth/core/AxiosCallHelper.ts +++ b/src/app/modules/auth/core/AxiosCallHelper.ts @@ -45,6 +45,29 @@ export function postAuxEnd(uri:string, reqData:any):Promise { ); } }); +} + + +export function getAuxEnd(uri: string, reqData?: any): Promise { + const endPoint = import.meta.env.VITE_APP_USER_ENDPOINT + uri; + const formData = new FormData(); + for (let value in reqData) { + formData.append(value, reqData[value]); } + return axios + .get(endPoint, reqData) + .then((response: {}) => { + // if (response.data.internal_return == "-9999") { + // localStorage.clear(); + // window.location.href = `/login?sessionExpired=true`; + // } + return response; + }) + .catch((error: any) => { + console.log( + "ERROR3-------------------------------------------------------", error + ); + }); +} diff --git a/src/app/modules/auth/core/_requests.ts b/src/app/modules/auth/core/_requests.ts index 724b653..88eeb94 100644 --- a/src/app/modules/auth/core/_requests.ts +++ b/src/app/modules/auth/core/_requests.ts @@ -1,7 +1,7 @@ import axios from "axios"; import { AuthModel, UserModel } from "./_models"; -import { postAuxEnd } from "./AxiosCallHelper"; +import { postAuxEnd, getAuxEnd } from "./AxiosCallHelper"; const API_URL = import.meta.env.VITE_APP_API_URL; @@ -10,6 +10,7 @@ const API_URL = import.meta.env.VITE_APP_API_URL; export const GET_USER_BY_ACCESSTOKEN_URL = '/identity/verify_token' export const LOGIN_URL = '/identity/token' +export const USER_DASH_DETAILS = `/dash`; export const REGISTER_URL = `${API_URL}/register`; export const REQUEST_PASSWORD_URL = `${API_URL}/forgot_password`; @@ -55,3 +56,7 @@ export function requestPassword(email: string) { export function getUserByToken(token: string) { return postAuxEnd(GET_USER_BY_ACCESSTOKEN_URL, {token}) } + +export function getUserDashDetails() { + return getAuxEnd(USER_DASH_DETAILS) +} diff --git a/src/app/pages/dashboard/DashboardWrapper.tsx b/src/app/pages/dashboard/DashboardWrapper.tsx index 5b51b99..07a6a50 100644 --- a/src/app/pages/dashboard/DashboardWrapper.tsx +++ b/src/app/pages/dashboard/DashboardWrapper.tsx @@ -1,15 +1,15 @@ -import { FC } from 'react'; +import { FC, useEffect, useState } from 'react'; import { useIntl } from 'react-intl'; import { toAbsoluteUrl } from '../../../_digifi/helpers'; import { PageTitle } from '../../../_digifi/layout/core'; import { - ListsWidget2, + // ListsWidget2, ListsWidget3, - ListsWidget4, - ListsWidget6, - TablesWidget5, + // ListsWidget4, + // ListsWidget6, + // TablesWidget5, TablesWidget10, - MixedWidget8, + // MixedWidget8, CardsWidget7, CardsWidget17, CardsWidget20, @@ -18,76 +18,92 @@ import { } from '../../../_digifi/partials/widgets'; import { ToolbarWrapper } from '../../../_digifi/layout/components/toolbar'; import { Content } from '../../../_digifi/layout/components/content'; +import { getUserDashDetails } from '../../modules/auth/core/_requests'; -const DashboardPage: FC = () => ( - <> - - - {/* begin::Row */} -
- {/* begin::Col */} -
- - -
- {/* end::Col */} +const DashboardPage: FC = () => { + const [dashDetails, setDashDetails] = useState({loading:true, data:{}}) - {/* begin::Col */} -
- - -
- {/* end::Col */} + useEffect(()=>{ + getUserDashDetails().then(res => { + setDashDetails({loading:false, data:res.data}) + }).catch(err => { + setDashDetails({loading:false, data:{}}) + console.log(err) + }) + },[]) - {/* begin::Col */} -
- -
- {/* end::Col */} -
- {/* end::Row */} + return ( + <> + + + {/* begin::Row */} +
+ {/* begin::Col */} +
+ + +
+ {/* end::Col */} - {/* begin::Row */} -
- {/* begin::Col */} -
- {/* */} -
- {/* end::Col */} + {/* begin::Col */} +
+ + +
+ {/* end::Col */} - {/* begin::Col */} -
- {/* */} + {/* begin::Col */} +
+ +
+ {/* end::Col */}
- {/* end::Col */} -
- {/* end::Row */} + {/* end::Row */} - {/* begin::Row */} -
-
- + {/* begin::Row */} +
+ {/* begin::Col */} +
+ {/* */} +
+ {/* end::Col */} + + {/* begin::Col */} +
+ {/* */} +
+ {/* end::Col */}
-
- + {/* end::Row */} + + {/* begin::Row */} +
+ {/* BVN VERIFICATION */} +
+ +
+ {/* RECENT LOAN APPLICATION */} +
+ +
-
- {/* end::Row */} - - -); + {/* end::Row */} + + + ) +} const DashboardWrapper: FC = () => { const intl = useIntl(); From 7cf4f9dbbebe017f0ba70a32112667f1a6f80431 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 8 May 2024 19:30:34 +0100 Subject: [PATCH 2/3] BVN verification table updated --- .../partials/widgets/lists/ListsWidget3.tsx | 29 +- .../widgets/tables/TablesWidget10.tsx | 402 ++++-------------- src/app/pages/dashboard/DashboardWrapper.tsx | 2 +- src/app/pages/dashboard/model.ts | 38 ++ 4 files changed, 122 insertions(+), 349 deletions(-) create mode 100644 src/app/pages/dashboard/model.ts diff --git a/src/_digifi/partials/widgets/lists/ListsWidget3.tsx b/src/_digifi/partials/widgets/lists/ListsWidget3.tsx index d80711a..ef2edf2 100644 --- a/src/_digifi/partials/widgets/lists/ListsWidget3.tsx +++ b/src/_digifi/partials/widgets/lists/ListsWidget3.tsx @@ -3,37 +3,14 @@ import React from 'react' import { NewDateTimeFormatter } from '../../../lib/NewDateTimeFormatter' // import {KTIcon} from '../../../helpers' // import {Dropdown1} from '../../content/dropdown/Dropdown1' - -type dashDataProps = { - loading: boolean, - data: { - call_return?: string - recent_applications? : {}[] - recent_bvn?: { - id?: string - uid?: string - bvn?: string - status?: string - added?: string - updated?: string - firstname?: string | null - lastname?: string | null - middlename?: string | null - gender?: string | null - birthdate?: string | null - phone?: string | null - nationality?: string | null - }[] - } -} +import { dashDataProps } from '../../../../app/pages/dashboard/model' type Props = { className: string - dashData: dashDataProps + dashData?: dashDataProps } const ListsWidget3: React.FC = ({dashData, className}) => { - console.log('dashData', dashData.data) return (
{/* begin::Header */} @@ -57,7 +34,7 @@ const ListsWidget3: React.FC = ({dashData, className}) => { {/* end::Header */} {/* begin::Body */}
- {dashData.loading ? + {dashData?.loading ? null : dashData?.data?.recent_bvn && dashData?.data?.recent_bvn.length ? diff --git a/src/_digifi/partials/widgets/tables/TablesWidget10.tsx b/src/_digifi/partials/widgets/tables/TablesWidget10.tsx index df9d329..b764410 100644 --- a/src/_digifi/partials/widgets/tables/TablesWidget10.tsx +++ b/src/_digifi/partials/widgets/tables/TablesWidget10.tsx @@ -1,12 +1,18 @@ import { FC } from 'react' import {KTIcon, toAbsoluteUrl} from '../../../helpers' +import { dashDataProps } from '../../../../app/pages/dashboard/model' +import { NewDateTimeFormatter } from '../../../lib/NewDateTimeFormatter' + + type Props = { className: string + dashData?: dashDataProps } -const TablesWidget10: FC = ({className}) => { +const TablesWidget10: FC = ({className, dashData}) => { + console.log('dashData', dashData?.data?.recent_applications) return (
{/* begin::Header */} @@ -32,7 +38,11 @@ const TablesWidget10: FC = ({className}) => {
*/}
{/* end::Header */} + {/* begin::Body */} + {dashData?.loading ? + null + :
{/* begin::Table container */}
@@ -61,334 +71,80 @@ const TablesWidget10: FC = ({className}) => { {/* end::Table head */} {/* begin::Table body */} - - -
- -
- - -
-
- + {dashData?.data.recent_applications && dashData?.data.recent_applications.length ? + dashData?.data.recent_applications.map(item => ( + + +
+
-
- - Ana Simmons + + +
+
+ +
+
+ + {item?.firstname} {item?.lastname} + + + {NewDateTimeFormatter(item?.added)} + +
+
+ + + + Intertico + + + Web, UI/UX Design + + + +
+
+ 50% +
+
+
+
+
+ + +
+ + - - HTML, JS, ReactJS - -
-
- - - - Intertico - - - Web, UI/UX Design - - - -
-
- 50% -
-
-
-
-
- - - - - - - -
- -
- - -
-
- -
-
- - Jessie Clarcson + + - - C#, ASP.NET, MS SQL - -
-
- - - - Agoda - - - Houses & Hotels - - - -
-
- 70% -
-
-
-
-
- - - - - - - -
- -
- - -
-
- -
-
- - Lebron Wayde + + - - PHP, Laravel, VueJS -
-
- - - - RoadGee - - - Transportation - - - -
-
- 60% -
-
-
-
-
- - - - - + + + )) + : - -
- -
- - -
-
- -
-
- - Natali Goodwin - - - Python, PostgreSQL, ReactJS - -
-
- - - - The Hill - - Insurance - - -
-
- 50% -
-
-
-
-
- - - - - - - -
- -
- - -
-
- -
-
- - Kevin Leonard - - - HTML, JS, ReactJS - -
-
- - - - RoadGee - - - Art Director - - - -
-
- 90% -
-
-
-
-
- - - - + No data found! + } {/* end::Table body */} @@ -396,7 +152,9 @@ const TablesWidget10: FC = ({className}) => {
{/* end::Table container */}
+ } {/* begin::Body */} +
) } diff --git a/src/app/pages/dashboard/DashboardWrapper.tsx b/src/app/pages/dashboard/DashboardWrapper.tsx index 07a6a50..5d889fd 100644 --- a/src/app/pages/dashboard/DashboardWrapper.tsx +++ b/src/app/pages/dashboard/DashboardWrapper.tsx @@ -96,7 +96,7 @@ const DashboardPage: FC = () => {
{/* RECENT LOAN APPLICATION */}
- +
{/* end::Row */} diff --git a/src/app/pages/dashboard/model.ts b/src/app/pages/dashboard/model.ts new file mode 100644 index 0000000..8ff8fd2 --- /dev/null +++ b/src/app/pages/dashboard/model.ts @@ -0,0 +1,38 @@ +export type dashDataProps = { + loading: boolean, + data: { + call_return?: string + recent_applications? : { + firstname?: string + lastname?: string + uid?: string + loan_amount?: string + payment_month?: string + sales_agent?: string + gender?: string | null + marital_status?: string + email?: string + address?: string + state?: string + country?: string + status?: string + added?: string + updated?: string + }[] + recent_bvn?: { + id?: string + uid?: string + bvn?: string + status?: string + added?: string + updated?: string + firstname?: string | null + lastname?: string | null + middlename?: string | null + gender?: string | null + birthdate?: string | null + phone?: string | null + nationality?: string | null + }[] + } + } \ No newline at end of file From 3839962e33588d1e70c617a0d562556e3994fd3c Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Thu, 9 May 2024 07:25:29 +0100 Subject: [PATCH 3/3] aplication and bvn list added --- .../paginatedListing/RecentBVNList.tsx | 137 ++++++++++ .../paginatedListing/RecentLoanAppList.tsx | 137 ++++++++++ .../partials/widgets/lists/ListsWidget3.tsx | 56 +++-- .../widgets/tables/TablesWidget10.tsx | 236 +++++++++--------- src/app/pages/dashboard/DashboardWrapper.tsx | 3 +- src/app/pages/dashboard/model.ts | 71 +++--- 6 files changed, 470 insertions(+), 170 deletions(-) create mode 100644 src/_digifi/layout/components/paginatedListing/RecentBVNList.tsx create mode 100644 src/_digifi/layout/components/paginatedListing/RecentLoanAppList.tsx diff --git a/src/_digifi/layout/components/paginatedListing/RecentBVNList.tsx b/src/_digifi/layout/components/paginatedListing/RecentBVNList.tsx new file mode 100644 index 0000000..2c49f2c --- /dev/null +++ b/src/_digifi/layout/components/paginatedListing/RecentBVNList.tsx @@ -0,0 +1,137 @@ +import { ReactNode, useEffect, useState } from "react"; +import { RecentBVNProps } from "../../../../app/pages/dashboard/model"; + +type PaginatedListProps = { + data: RecentBVNProps, + itemsPerPage?: number, + filterItem?: string[], + tableTitle?: string, + titleClass?:string, + children: (data:RecentBVNProps) => ReactNode; +} + +export default function RecentBVNList({ + data, + itemsPerPage = 5, + filterItem, + tableTitle, + titleClass, + children, +}:PaginatedListProps) { + const [searchTerm, setSearchTerm] = useState(""); + const [filteredData, setFilteredData] = useState(data); + + const [currentPage, setCurrentPage] = useState(0); + const [newData, setNewData] = useState([]); + + const numberOfSelection = itemsPerPage; + + const handlePrev = () => { + if (currentPage != 0) { + setCurrentPage((prev) => prev - numberOfSelection); + } + }; + const handleNext = () => { + if (currentPage < data.length) { + setCurrentPage((prev) => prev + numberOfSelection); + } + }; + + const handleSearch = ({ target: { value } }:{target: {value:string}}, name:string) => { + setSearchTerm(value); + let newFilteredData:any = data.filter((item:any) => + item[name].toLowerCase().startsWith(value.toLowerCase()) + ); + setFilteredData(newFilteredData); + setCurrentPage(0); + }; + + useEffect(() => { + setNewData( + filteredData?.slice(currentPage, numberOfSelection + currentPage) + ); + }, [currentPage, filteredData]); + + useEffect(()=>{ + setCurrentPage(0) + },[itemsPerPage]) + + return ( +
+

{tableTitle}

+ + {data.length > 0 && filterItem && ( +
+ {filterItem.map((item, index) => ( + + ))} +
+ )} + + {children(newData)} + + {/* show prev and next button if data exist */} + {(data.length > 0 && data.length > itemsPerPage) && ( +
+ + + {data.length && data.map((item, index)=>{ + item = item + if(index%itemsPerPage == 0 && index >= currentPage && index <= currentPage+itemsPerPage){ + return ( + + ) + } + })} + + +
+ )} +
+ ); +} diff --git a/src/_digifi/layout/components/paginatedListing/RecentLoanAppList.tsx b/src/_digifi/layout/components/paginatedListing/RecentLoanAppList.tsx new file mode 100644 index 0000000..271dbea --- /dev/null +++ b/src/_digifi/layout/components/paginatedListing/RecentLoanAppList.tsx @@ -0,0 +1,137 @@ +import { ReactNode, useEffect, useState } from "react"; +import { RecentApplicationsProps } from "../../../../app/pages/dashboard/model"; + +type PaginatedListProps = { + data: RecentApplicationsProps, + itemsPerPage?: number, + filterItem?: string[], + tableTitle?: string, + titleClass?:string, + children: (data:RecentApplicationsProps) => ReactNode; +} + +export default function RecentLoanAppList({ + data, + itemsPerPage = 5, + filterItem, + tableTitle, + titleClass, + children, +}:PaginatedListProps) { + const [searchTerm, setSearchTerm] = useState(""); + const [filteredData, setFilteredData] = useState(data); + + const [currentPage, setCurrentPage] = useState(0); + const [newData, setNewData] = useState([]); + + const numberOfSelection = itemsPerPage; + + const handlePrev = () => { + if (currentPage != 0) { + setCurrentPage((prev) => prev - numberOfSelection); + } + }; + const handleNext = () => { + if (currentPage < data.length) { + setCurrentPage((prev) => prev + numberOfSelection); + } + }; + + const handleSearch = ({ target: { value } }:{target: {value:string}}, name:string) => { + setSearchTerm(value); + let newFilteredData:any = data.filter((item:any) => + item[name].toLowerCase().startsWith(value.toLowerCase()) + ); + setFilteredData(newFilteredData); + setCurrentPage(0); + }; + + useEffect(() => { + setNewData( + filteredData?.slice(currentPage, numberOfSelection + currentPage) + ); + }, [currentPage, filteredData]); + + useEffect(()=>{ + setCurrentPage(0) + },[itemsPerPage]) + + return ( +
+

{tableTitle}

+ + {data.length > 0 && filterItem && ( +
+ {filterItem.map((item, index) => ( + + ))} +
+ )} + + {children(newData)} + + {/* show prev and next button if data exist */} + {(data.length > 0 && data.length > itemsPerPage) && ( +
+ + + {data.length && data.map((item, index)=>{ + item = item + if(index%itemsPerPage == 0 && index >= currentPage && index <= currentPage+itemsPerPage){ + return ( + + ) + } + })} + + +
+ )} +
+ ); +} diff --git a/src/_digifi/partials/widgets/lists/ListsWidget3.tsx b/src/_digifi/partials/widgets/lists/ListsWidget3.tsx index ef2edf2..8f1e0ea 100644 --- a/src/_digifi/partials/widgets/lists/ListsWidget3.tsx +++ b/src/_digifi/partials/widgets/lists/ListsWidget3.tsx @@ -3,11 +3,12 @@ import React from 'react' import { NewDateTimeFormatter } from '../../../lib/NewDateTimeFormatter' // import {KTIcon} from '../../../helpers' // import {Dropdown1} from '../../content/dropdown/Dropdown1' -import { dashDataProps } from '../../../../app/pages/dashboard/model' +import { DashDataProps, RecentBVNProps } from '../../../../app/pages/dashboard/model' +import RecentBVNList from '../../../layout/components/paginatedListing/RecentBVNList' type Props = { className: string - dashData?: dashDataProps + dashData?: DashDataProps } const ListsWidget3: React.FC = ({dashData, className}) => { @@ -38,27 +39,36 @@ const ListsWidget3: React.FC = ({dashData, className}) => { null : dashData?.data?.recent_bvn && dashData?.data?.recent_bvn.length ? - dashData?.data?.recent_bvn.map(item => ( -
- {/* begin::Bullet */} - - {/* end::Bullet */} - {/* begin::Checkbox */} -
- -
- {/* end::Checkbox */} - {/* begin::Description */} -
- - {item?.bvn} - - {NewDateTimeFormatter(item?.added)} -
- {/* end::Description */} - New -
- )) + + {(data:RecentBVNProps) => ( + <> + {data?.map(item => ( +
+ {/* begin::Bullet */} + + {/* end::Bullet */} + {/* begin::Checkbox */} +
+ +
+ {/* end::Checkbox */} + {/* begin::Description */} +
+ + {item?.bvn} + + {NewDateTimeFormatter(item?.added)} +
+ {/* end::Description */} + New +
+ ))} + + )} +
:

No list Found!

} diff --git a/src/_digifi/partials/widgets/tables/TablesWidget10.tsx b/src/_digifi/partials/widgets/tables/TablesWidget10.tsx index b764410..03188af 100644 --- a/src/_digifi/partials/widgets/tables/TablesWidget10.tsx +++ b/src/_digifi/partials/widgets/tables/TablesWidget10.tsx @@ -1,18 +1,17 @@ import { FC } from 'react' import {KTIcon, toAbsoluteUrl} from '../../../helpers' -import { dashDataProps } from '../../../../app/pages/dashboard/model' +import { DashDataProps, RecentApplicationsProps } from '../../../../app/pages/dashboard/model' import { NewDateTimeFormatter } from '../../../lib/NewDateTimeFormatter' - +import RecentLoanAppList from '../../../layout/components/paginatedListing/RecentLoanAppList' type Props = { className: string - dashData?: dashDataProps + dashData?: DashDataProps } const TablesWidget10: FC = ({className, dashData}) => { - console.log('dashData', dashData?.data?.recent_applications) return (
{/* begin::Header */} @@ -42,116 +41,127 @@ const TablesWidget10: FC = ({className, dashData}) => { {/* begin::Body */} {dashData?.loading ? null + : dashData?.data?.recent_applications ? + + {(data:RecentApplicationsProps)=>( + <> +
+ {/* begin::Table container */} +
+ {/* begin::Table */} + + {/* begin::Table head */} + + + + + + + + + + {/* end::Table head */} + {/* begin::Table body */} + + {data && data.length ? + data.map(item => ( + + + + + + + + )) + : + + + + } + + {/* end::Table body */} +
+
+ +
+
AuthorsAmountProgressActions
+
+ +
+
+
+
+ +
+
+ + {item?.firstname} {item?.lastname} + + + {NewDateTimeFormatter(item?.added)} + +
+
+
+ + {item.loan_amount} + + + {item?.sales_agent? `Agent: ${item?.sales_agent}` : ``} + + +
+
+ 50% +
+
+
+
+
+
+ +
No data found!
+ {/* end::Table */} +
+ {/* end::Table container */} +
+ + )} +
: -
- {/* begin::Table container */} -
- {/* begin::Table */} - - {/* begin::Table head */} - - - - - - - - - - {/* end::Table head */} - {/* begin::Table body */} - - {dashData?.data.recent_applications && dashData?.data.recent_applications.length ? - dashData?.data.recent_applications.map(item => ( - - - - - - - - )) - : - - - - } - - {/* end::Table body */} -
-
- -
-
AuthorsCompanyProgressActions
-
- -
-
-
-
- -
-
- - {item?.firstname} {item?.lastname} - - - {NewDateTimeFormatter(item?.added)} - -
-
-
- - Intertico - - - Web, UI/UX Design - - -
-
- 50% -
-
-
-
-
-
- -
No data found!
- {/* end::Table */} -
- {/* end::Table container */} -
+ null } {/* begin::Body */} diff --git a/src/app/pages/dashboard/DashboardWrapper.tsx b/src/app/pages/dashboard/DashboardWrapper.tsx index 5d889fd..e888ab1 100644 --- a/src/app/pages/dashboard/DashboardWrapper.tsx +++ b/src/app/pages/dashboard/DashboardWrapper.tsx @@ -19,9 +19,10 @@ import { import { ToolbarWrapper } from '../../../_digifi/layout/components/toolbar'; import { Content } from '../../../_digifi/layout/components/content'; import { getUserDashDetails } from '../../modules/auth/core/_requests'; +import { DashDataProps } from './model'; const DashboardPage: FC = () => { - const [dashDetails, setDashDetails] = useState({loading:true, data:{}}) + const [dashDetails, setDashDetails] = useState({loading:true, data:{}}) useEffect(()=>{ getUserDashDetails().then(res => { diff --git a/src/app/pages/dashboard/model.ts b/src/app/pages/dashboard/model.ts index 8ff8fd2..fa2dcf8 100644 --- a/src/app/pages/dashboard/model.ts +++ b/src/app/pages/dashboard/model.ts @@ -1,38 +1,43 @@ -export type dashDataProps = { +export type RecentApplicationsProps = { + firstname?: string + lastname?: string + uid?: string + loan_amount?: string + payment_month?: string + sales_agent?: string + gender?: string | null + marital_status?: string + email?: string + address?: string + state?: string + country?: string + status?: string + added?: string + updated?: string +}[] + +export type RecentBVNProps = { + id?: string + uid?: string + bvn?: string + status?: string + added?: string + updated?: string + firstname?: string | null + lastname?: string | null + middlename?: string | null + gender?: string | null + birthdate?: string | null + phone?: string | null + nationality?: string | null +}[] + + +export type DashDataProps = { loading: boolean, data: { call_return?: string - recent_applications? : { - firstname?: string - lastname?: string - uid?: string - loan_amount?: string - payment_month?: string - sales_agent?: string - gender?: string | null - marital_status?: string - email?: string - address?: string - state?: string - country?: string - status?: string - added?: string - updated?: string - }[] - recent_bvn?: { - id?: string - uid?: string - bvn?: string - status?: string - added?: string - updated?: string - firstname?: string | null - lastname?: string | null - middlename?: string | null - gender?: string | null - birthdate?: string | null - phone?: string | null - nationality?: string | null - }[] + recent_applications? : RecentApplicationsProps + recent_bvn?: RecentBVNProps } } \ No newline at end of file