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();