initial commit

This commit is contained in:
victorAnumudu
2024-05-08 18:54:58 +01:00
parent 395fe1a648
commit 2526a5b627
4 changed files with 168 additions and 196 deletions
@@ -1,13 +1,39 @@
import React from 'react' import React from 'react'
import {KTIcon} from '../../../helpers' import { NewDateTimeFormatter } from '../../../lib/NewDateTimeFormatter'
import {Dropdown1} from '../../content/dropdown/Dropdown1' // 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 = { type Props = {
className: string className: string
dashData: dashDataProps
} }
const ListsWidget3: React.FC<Props> = ({className}) => { const ListsWidget3: React.FC<Props> = ({dashData, className}) => {
console.log('dashData', dashData.data)
return ( return (
<div className={`card ${className}`}> <div className={`card ${className}`}>
{/* begin::Header */} {/* begin::Header */}
@@ -31,29 +57,12 @@ const ListsWidget3: React.FC<Props> = ({className}) => {
{/* end::Header */} {/* end::Header */}
{/* begin::Body */} {/* begin::Body */}
<div className='card-body pt-2'> <div className='card-body pt-2'>
{/* begin::Item */} {dashData.loading ?
<div className='d-flex align-items-center mb-8'> null
{/* begin::Bullet */} :
<span className='bullet bullet-vertical h-40px bg-success'></span> dashData?.data?.recent_bvn && dashData?.data?.recent_bvn.length ?
{/* end::Bullet */} dashData?.data?.recent_bvn.map(item => (
{/* begin::Checkbox */} <div key={item?.uid} className='d-flex align-items-center mb-8'>
<div className='form-check form-check-custom form-check-solid mx-5'>
<input className='form-check-input' type='checkbox' value='' />
</div>
{/* end::Checkbox */}
{/* begin::Description */}
<div className='flex-grow-1'>
<a href='#' className='text-gray-800 text-hover-primary fw-bold fs-6'>
Create FireStone Logo
</a>
<span className='text-muted fw-semibold d-block'>Due in 2 Days</span>
</div>
{/* end::Description */}
<span className='badge badge-light-success fs-8 fw-bold'>New</span>
</div>
{/* end:Item */}
{/* begin::Item */}
<div className='d-flex align-items-center mb-8'>
{/* begin::Bullet */} {/* begin::Bullet */}
<span className='bullet bullet-vertical h-40px bg-primary'></span> <span className='bullet bullet-vertical h-40px bg-primary'></span>
{/* end::Bullet */} {/* end::Bullet */}
@@ -65,98 +74,17 @@ const ListsWidget3: React.FC<Props> = ({className}) => {
{/* begin::Description */} {/* begin::Description */}
<div className='flex-grow-1'> <div className='flex-grow-1'>
<a href='#' className='text-gray-800 text-hover-primary fw-bold fs-6'> <a href='#' className='text-gray-800 text-hover-primary fw-bold fs-6'>
Stakeholder Meeting {item?.bvn}
</a> </a>
<span className='text-muted fw-semibold d-block'>Due in 3 Days</span> <span className='text-muted fw-semibold d-block'>{NewDateTimeFormatter(item?.added)}</span>
</div> </div>
{/* end::Description */} {/* end::Description */}
<span className='badge badge-light-primary fs-8 fw-bold'>New</span> <span className='badge badge-light-primary fs-8 fw-bold'>New</span>
</div> </div>
{/* end:Item */} ))
{/* begin::Item */} :
<div className='d-flex align-items-center mb-8'> <p>No list Found!</p>
{/* begin::Bullet */} }
<span className='bullet bullet-vertical h-40px bg-warning'></span>
{/* end::Bullet */}
{/* begin::Checkbox */}
<div className='form-check form-check-custom form-check-solid mx-5'>
<input className='form-check-input' type='checkbox' value='' />
</div>
{/* end::Checkbox */}
{/* begin::Description */}
<div className='flex-grow-1'>
<a href='#' className='text-gray-800 text-hover-primary fw-bold fs-6'>
Scoping &amp; Estimations
</a>
<span className='text-muted fw-semibold d-block'>Due in 5 Days</span>
</div>
{/* end::Description */}
<span className='badge badge-light-warning fs-8 fw-bold'>New</span>
</div>
{/* end:Item */}
{/* begin::Item */}
<div className='d-flex align-items-center mb-8'>
{/* begin::Bullet */}
<span className='bullet bullet-vertical h-40px bg-primary'></span>
{/* end::Bullet */}
{/* begin::Checkbox */}
<div className='form-check form-check-custom form-check-solid mx-5'>
<input className='form-check-input' type='checkbox' value='' />
</div>
{/* end::Checkbox */}
{/* begin::Description */}
<div className='flex-grow-1'>
<a href='#' className='text-gray-800 text-hover-primary fw-bold fs-6'>
KPI App Showcase
</a>
<span className='text-muted fw-semibold d-block'>Due in 2 Days</span>
</div>
{/* end::Description */}
<span className='badge badge-light-primary fs-8 fw-bold'>New</span>
</div>
{/* end:Item */}
{/* begin::Item */}
<div className='d-flex align-items-center mb-8'>
{/* begin::Bullet */}
<span className='bullet bullet-vertical h-40px bg-danger'></span>
{/* end::Bullet */}
{/* begin::Checkbox */}
<div className='form-check form-check-custom form-check-solid mx-5'>
<input className='form-check-input' type='checkbox' value='' />
</div>
{/* end::Checkbox */}
{/* begin::Description */}
<div className='flex-grow-1'>
<a href='#' className='text-gray-800 text-hover-primary fw-bold fs-6'>
Project Meeting
</a>
<span className='text-muted fw-semibold d-block'>Due in 12 Days</span>
</div>
{/* end::Description */}
<span className='badge badge-light-danger fs-8 fw-bold'>New</span>
</div>
{/* end:Item */}
{/* begin::Item */}
<div className='d-flex align-items-center'>
{/* begin::Bullet */}
<span className='bullet bullet-vertical h-40px bg-success'></span>
{/* end::Bullet */}
{/* begin::Checkbox */}
<div className='form-check form-check-custom form-check-solid mx-5'>
<input className='form-check-input' type='checkbox' value='' />
</div>
{/* end::Checkbox */}
{/* begin::Description */}
<div className='flex-grow-1'>
<a href='#' className='text-gray-800 text-hover-primary fw-bold fs-6'>
Customers Update
</a>
<span className='text-muted fw-semibold d-block'>Due in 1 week</span>
</div>
{/* end::Description */}
<span className='badge badge-light-success fs-8 fw-bold'>New</span>
</div>
{/* end:Item */}
</div> </div>
{/* end::Body */} {/* end::Body */}
</div> </div>
@@ -48,3 +48,26 @@ export function postAuxEnd(uri:string, reqData:any):Promise<any> {
} }
export function getAuxEnd(uri: string, reqData?: any): Promise<any> {
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
);
});
}
+6 -1
View File
@@ -1,7 +1,7 @@
import axios from "axios"; import axios from "axios";
import { AuthModel, UserModel } from "./_models"; import { AuthModel, UserModel } from "./_models";
import { postAuxEnd } from "./AxiosCallHelper"; import { postAuxEnd, getAuxEnd } from "./AxiosCallHelper";
const API_URL = import.meta.env.VITE_APP_API_URL; 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 GET_USER_BY_ACCESSTOKEN_URL = '/identity/verify_token'
export const LOGIN_URL = '/identity/token' export const LOGIN_URL = '/identity/token'
export const USER_DASH_DETAILS = `/dash`;
export const REGISTER_URL = `${API_URL}/register`; export const REGISTER_URL = `${API_URL}/register`;
export const REQUEST_PASSWORD_URL = `${API_URL}/forgot_password`; export const REQUEST_PASSWORD_URL = `${API_URL}/forgot_password`;
@@ -55,3 +56,7 @@ export function requestPassword(email: string) {
export function getUserByToken(token: string) { export function getUserByToken(token: string) {
return postAuxEnd(GET_USER_BY_ACCESSTOKEN_URL, {token}) return postAuxEnd(GET_USER_BY_ACCESSTOKEN_URL, {token})
} }
export function getUserDashDetails() {
return getAuxEnd(USER_DASH_DETAILS)
}
+25 -9
View File
@@ -1,15 +1,15 @@
import { FC } from 'react'; import { FC, useEffect, useState } from 'react';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import { toAbsoluteUrl } from '../../../_digifi/helpers'; import { toAbsoluteUrl } from '../../../_digifi/helpers';
import { PageTitle } from '../../../_digifi/layout/core'; import { PageTitle } from '../../../_digifi/layout/core';
import { import {
ListsWidget2, // ListsWidget2,
ListsWidget3, ListsWidget3,
ListsWidget4, // ListsWidget4,
ListsWidget6, // ListsWidget6,
TablesWidget5, // TablesWidget5,
TablesWidget10, TablesWidget10,
MixedWidget8, // MixedWidget8,
CardsWidget7, CardsWidget7,
CardsWidget17, CardsWidget17,
CardsWidget20, CardsWidget20,
@@ -18,8 +18,21 @@ import {
} from '../../../_digifi/partials/widgets'; } from '../../../_digifi/partials/widgets';
import { ToolbarWrapper } from '../../../_digifi/layout/components/toolbar'; import { ToolbarWrapper } from '../../../_digifi/layout/components/toolbar';
import { Content } from '../../../_digifi/layout/components/content'; import { Content } from '../../../_digifi/layout/components/content';
import { getUserDashDetails } from '../../modules/auth/core/_requests';
const DashboardPage: FC = () => ( const DashboardPage: FC = () => {
const [dashDetails, setDashDetails] = useState({loading:true, data:{}})
useEffect(()=>{
getUserDashDetails().then(res => {
setDashDetails({loading:false, data:res.data})
}).catch(err => {
setDashDetails({loading:false, data:{}})
console.log(err)
})
},[])
return (
<> <>
<ToolbarWrapper /> <ToolbarWrapper />
<Content> <Content>
@@ -77,9 +90,11 @@ const DashboardPage: FC = () => (
{/* begin::Row */} {/* begin::Row */}
<div className="row gy-5 gx-xl-8"> <div className="row gy-5 gx-xl-8">
{/* BVN VERIFICATION */}
<div className="col-xxl-4"> <div className="col-xxl-4">
<ListsWidget3 className="card-xxl-stretch mb-xl-3" /> <ListsWidget3 dashData={dashDetails} className="card-xxl-stretch mb-xl-3" />
</div> </div>
{/* RECENT LOAN APPLICATION */}
<div className="col-xl-8"> <div className="col-xl-8">
<TablesWidget10 className="card-xxl-stretch mb-5 mb-xl-8" /> <TablesWidget10 className="card-xxl-stretch mb-5 mb-xl-8" />
</div> </div>
@@ -87,7 +102,8 @@ const DashboardPage: FC = () => (
{/* end::Row */} {/* end::Row */}
</Content> </Content>
</> </>
); )
}
const DashboardWrapper: FC = () => { const DashboardWrapper: FC = () => {
const intl = useIntl(); const intl = useIntl();