Compare commits

..

1 Commits

Author SHA1 Message Date
Elias 886c7dd8b3 Back office loan list items:Amount/Filter 2024-05-17 01:09:38 +01:00
5 changed files with 175 additions and 83 deletions
@@ -29,7 +29,7 @@ const HeaderUserMenu: FC = () => {
</div> </div>
</div> </div>
{/* <div className="separator my-2"></div> */} <div className="separator my-2"></div>
{/* <div className='menu-item px-5'> {/* <div className='menu-item px-5'>
<Link to={'/crafted/pages/profile'} className='menu-link px-5'> <Link to={'/crafted/pages/profile'} className='menu-link px-5'>
@@ -46,37 +46,37 @@ const HeaderUserMenu: FC = () => {
</a> </a>
</div> */} </div> */}
{/* <div <div
className="menu-item px-5" className="menu-item px-5"
data-kt-menu-trigger="hover" data-kt-menu-trigger="hover"
data-kt-menu-placement="left-start" data-kt-menu-placement="left-start"
data-kt-menu-flip="bottom" data-kt-menu-flip="bottom"
> >
<a href='#' className='menu-link px-5'> {/* <a href='#' className='menu-link px-5'>
<span className='menu-title'>My Subscription</span> <span className='menu-title'>My Subscription</span>
<span className='menu-arrow'></span> <span className='menu-arrow'></span>
</a> </a> */}
<div className="menu-sub menu-sub-dropdown w-175px py-4"> <div className="menu-sub menu-sub-dropdown w-175px py-4">
<div className='menu-item px-3'> {/* <div className='menu-item px-3'>
<a href='#' className='menu-link px-5'> <a href='#' className='menu-link px-5'>
Referrals Referrals
</a> </a>
</div> </div> */}
<div className='menu-item px-3'> {/* <div className='menu-item px-3'>
<a href='#' className='menu-link px-5'> <a href='#' className='menu-link px-5'>
Billing Billing
</a> </a>
</div> </div> */}
<div className='menu-item px-3'> {/* <div className='menu-item px-3'>
<a href='#' className='menu-link px-5'> <a href='#' className='menu-link px-5'>
Payments Payments
</a> </a>
</div> </div> */}
<div className='menu-item px-3'> {/* <div className='menu-item px-3'>
<a href='#' className='menu-link d-flex flex-stack px-5'> <a href='#' className='menu-link d-flex flex-stack px-5'>
Statements Statements
<i <i
@@ -85,11 +85,11 @@ const HeaderUserMenu: FC = () => {
title='View your statements' title='View your statements'
></i> ></i>
</a> </a>
</div> </div> */}
<div className="separator my-2"></div> <div className="separator my-2"></div>
<div className='menu-item px-3'> {/* <div className='menu-item px-3'>
<div className='menu-content px-3'> <div className='menu-content px-3'>
<label className='form-check form-switch form-check-custom form-check-solid'> <label className='form-check form-switch form-check-custom form-check-solid'>
<input <input
@@ -102,9 +102,9 @@ const HeaderUserMenu: FC = () => {
<span className='form-check-label text-muted fs-7'>Notifications</span> <span className='form-check-label text-muted fs-7'>Notifications</span>
</label> </label>
</div> </div>
</div> </div> */}
</div> </div>
</div> */} </div>
{/* <div className='menu-item px-5'> {/* <div className='menu-item px-5'>
<a href='#' className='menu-link px-5'> <a href='#' className='menu-link px-5'>
@@ -1,6 +1,6 @@
import { KTIcon } from "../../../../../../_digifi/helpers"; import { KTIcon } from '../../../../../../_digifi/helpers';
import { useListView } from "../../core/ListViewProvider"; import { useListView } from '../../core/ListViewProvider';
import { UsersListFilter } from "./UsersListFilter"; import { UsersListFilter } from './UsersListFilter';
const UsersListToolbar = () => { const UsersListToolbar = () => {
const { setItemIdForUpdate } = useListView(); const { setItemIdForUpdate } = useListView();
@@ -13,7 +13,7 @@ const UsersListToolbar = () => {
className="d-flex justify-content-end" className="d-flex justify-content-end"
data-kt-user-table-toolbar="base" data-kt-user-table-toolbar="base"
> >
<UsersListFilter /> {/* <UsersListFilter /> */}
{/* begin::Export */} {/* begin::Export */}
{/* <button type='button' className='btn btn-light-primary me-3'> {/* <button type='button' className='btn btn-light-primary me-3'>
@@ -1,57 +1,103 @@
import {Column} from 'react-table' import { Column } from 'react-table';
import {UserInfoCell} from './UserInfoCell' import { UserInfoCell } from './UserInfoCell';
import { PaymentMonthCell } from './UserLastLoginCell' import { PaymentMonthCell } from './UserLastLoginCell';
import {AgentCell} from './AgentCell' import { AgentCell } from './AgentCell';
import {UserActionsCell} from './UserActionsCell' import { UserActionsCell } from './UserActionsCell';
import {UserSelectionCell} from './UserSelectionCell' import { UserSelectionCell } from './UserSelectionCell';
import {UserCustomHeader} from './UserCustomHeader' import { UserCustomHeader } from './UserCustomHeader';
import {UserSelectionHeader} from './UserSelectionHeader' import { UserSelectionHeader } from './UserSelectionHeader';
import {User} from '../../../core/_models' import { User } from '../../../core/_models';
import { AddedCell } from './AddedCell' import { AddedCell } from './AddedCell';
const formatNumberWithCommas = (number: string): string => {
return number.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
};
const usersColumns: ReadonlyArray<Column<User>> = [ const usersColumns: ReadonlyArray<Column<User>> = [
{ {
Header: (props) => <UserSelectionHeader tableProps={props} />, Header: (props) => <UserSelectionHeader tableProps={props} />,
id: 'selection', id: 'selection',
Cell: ({...props}) => <UserSelectionCell id={props.data[props.row.index].uid} />, Cell: ({ ...props }) => (
}, <UserSelectionCell id={props.data[props.row.index].uid} />
{ ),
Header: (props) => <UserCustomHeader tableProps={props} title='Name' className='min-w-125px' />,
id: 'firstname',
Cell: ({...props}) => <UserInfoCell user={props.data[props.row.index]} />,
},
{
Header: (props) => <UserCustomHeader tableProps={props} title='Amount' className='min-w-125px' />,
accessor: 'loan_amount',
}, },
{ {
Header: (props) => ( Header: (props) => (
<UserCustomHeader tableProps={props} title='Payment Terms' className='min-w-125px' /> <UserCustomHeader
tableProps={props}
title="Name"
className="min-w-125px"
/>
),
id: 'firstname',
Cell: ({ ...props }) => <UserInfoCell user={props.data[props.row.index]} />,
},
{
Header: (props) => (
<UserCustomHeader
tableProps={props}
title="Amount"
className="min-w-125px"
/>
),
accessor: 'loan_amount',
Cell: ({ row, data }) =>
formatNumberWithCommas(data[row.index].loan_amount || '0'),
},
{
Header: (props) => (
<UserCustomHeader
tableProps={props}
title="Payment Terms"
className="min-w-125px"
/>
), ),
id: 'payment_month', id: 'payment_month',
Cell: ({...props}) => <PaymentMonthCell payment_month={props.data[props.row.index].payment_month} />, Cell: ({ ...props }) => (
<PaymentMonthCell
payment_month={props.data[props.row.index].payment_month}
/>
),
}, },
{ {
Header: (props) => ( Header: (props) => (
<UserCustomHeader tableProps={props} title='Agent' className='min-w-125px' /> <UserCustomHeader
tableProps={props}
title="Agent"
className="min-w-125px"
/>
), ),
id: 'sales_agent', id: 'sales_agent',
Cell: ({...props}) => <AgentCell agent={props.data[props.row.index].sales_agent} />, Cell: ({ ...props }) => (
<AgentCell agent={props.data[props.row.index].sales_agent} />
),
}, },
{ {
Header: (props) => ( Header: (props) => (
<UserCustomHeader tableProps={props} title='Added' className='min-w-125px' /> <UserCustomHeader
tableProps={props}
title="Added"
className="min-w-125px"
/>
), ),
id: 'added', id: 'added',
Cell: ({...props}) => <AddedCell added={props.data[props.row.index].added} />, Cell: ({ ...props }) => (
<AddedCell added={props.data[props.row.index].added} />
),
}, },
{ {
Header: (props) => ( Header: (props) => (
<UserCustomHeader tableProps={props} title='Actions' className='text-end min-w-100px' /> <UserCustomHeader
tableProps={props}
title="Actions"
className="text-end min-w-100px"
/>
), ),
id: 'actions', id: 'actions',
Cell: ({...props}) => <UserActionsCell id={props.data[props.row.index].uid} />, Cell: ({ ...props }) => (
<UserActionsCell id={props.data[props.row.index].uid} />
),
}, },
] ];
export {usersColumns} export { usersColumns };
@@ -1,6 +1,6 @@
import { KTIcon } from "../../../../../../_digifi/helpers"; import { KTIcon } from '../../../../../../_digifi/helpers';
import { useListView } from "../../core/ListViewProvider"; import { useListView } from '../../core/ListViewProvider';
import { UsersListFilter } from "./UsersListFilter"; import { UsersListFilter } from './UsersListFilter';
const UsersListToolbar = () => { const UsersListToolbar = () => {
const { setItemIdForUpdate } = useListView(); const { setItemIdForUpdate } = useListView();
@@ -13,7 +13,7 @@ const UsersListToolbar = () => {
className="d-flex justify-content-end" className="d-flex justify-content-end"
data-kt-user-table-toolbar="base" data-kt-user-table-toolbar="base"
> >
<UsersListFilter /> {/* <UsersListFilter /> */}
{/* begin::Export */} {/* begin::Export */}
{/* <button type='button' className='btn btn-light-primary me-3'> {/* <button type='button' className='btn btn-light-primary me-3'>
@@ -1,57 +1,103 @@
import {Column} from 'react-table' import { Column } from 'react-table';
import {UserInfoCell} from './UserInfoCell' import { UserInfoCell } from './UserInfoCell';
import { PaymentMonthCell } from './UserLastLoginCell' import { PaymentMonthCell } from './UserLastLoginCell';
import {AgentCell} from './AgentCell' import { AgentCell } from './AgentCell';
import {UserActionsCell} from './UserActionsCell' import { UserActionsCell } from './UserActionsCell';
import {UserSelectionCell} from './UserSelectionCell' import { UserSelectionCell } from './UserSelectionCell';
import {UserCustomHeader} from './UserCustomHeader' import { UserCustomHeader } from './UserCustomHeader';
import {UserSelectionHeader} from './UserSelectionHeader' import { UserSelectionHeader } from './UserSelectionHeader';
import {User} from '../../../core/_models' import { User } from '../../../core/_models';
import { AddedCell } from './AddedCell' import { AddedCell } from './AddedCell';
const formatNumberWithCommas = (number: string): string => {
return number.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
};
const usersColumns: ReadonlyArray<Column<User>> = [ const usersColumns: ReadonlyArray<Column<User>> = [
{ {
Header: (props) => <UserSelectionHeader tableProps={props} />, Header: (props) => <UserSelectionHeader tableProps={props} />,
id: 'selection', id: 'selection',
Cell: ({...props}) => <UserSelectionCell id={props.data[props.row.index].uid} />, Cell: ({ ...props }) => (
}, <UserSelectionCell id={props.data[props.row.index].uid} />
{ ),
Header: (props) => <UserCustomHeader tableProps={props} title='Name' className='min-w-125px' />,
id: 'firstname',
Cell: ({...props}) => <UserInfoCell user={props.data[props.row.index]} />,
},
{
Header: (props) => <UserCustomHeader tableProps={props} title='Amount' className='min-w-125px' />,
accessor: 'loan_amount',
}, },
{ {
Header: (props) => ( Header: (props) => (
<UserCustomHeader tableProps={props} title='Payment Terms' className='min-w-125px' /> <UserCustomHeader
tableProps={props}
title="Name"
className="min-w-125px"
/>
),
id: 'firstname',
Cell: ({ ...props }) => <UserInfoCell user={props.data[props.row.index]} />,
},
{
Header: (props) => (
<UserCustomHeader
tableProps={props}
title="Amount"
className="min-w-125px"
/>
),
accessor: 'loan_amount',
Cell: ({ row, data }) =>
formatNumberWithCommas(data[row.index].loan_amount || '0'),
},
{
Header: (props) => (
<UserCustomHeader
tableProps={props}
title="Payment Terms"
className="min-w-125px"
/>
), ),
id: 'payment_month', id: 'payment_month',
Cell: ({...props}) => <PaymentMonthCell payment_month={props.data[props.row.index].payment_month} />, Cell: ({ ...props }) => (
<PaymentMonthCell
payment_month={props.data[props.row.index].payment_month}
/>
),
}, },
{ {
Header: (props) => ( Header: (props) => (
<UserCustomHeader tableProps={props} title='Agent' className='min-w-125px' /> <UserCustomHeader
tableProps={props}
title="Agent"
className="min-w-125px"
/>
), ),
id: 'sales_agent', id: 'sales_agent',
Cell: ({...props}) => <AgentCell agent={props.data[props.row.index].sales_agent} />, Cell: ({ ...props }) => (
<AgentCell agent={props.data[props.row.index].sales_agent} />
),
}, },
{ {
Header: (props) => ( Header: (props) => (
<UserCustomHeader tableProps={props} title='Added' className='min-w-125px' /> <UserCustomHeader
tableProps={props}
title="Added"
className="min-w-125px"
/>
), ),
id: 'added', id: 'added',
Cell: ({...props}) => <AddedCell added={props.data[props.row.index].added} />, Cell: ({ ...props }) => (
<AddedCell added={props.data[props.row.index].added} />
),
}, },
{ {
Header: (props) => ( Header: (props) => (
<UserCustomHeader tableProps={props} title='Actions' className='text-end min-w-100px' /> <UserCustomHeader
tableProps={props}
title="Actions"
className="text-end min-w-100px"
/>
), ),
id: 'actions', id: 'actions',
Cell: ({...props}) => <UserActionsCell id={props.data[props.row.index].uid} />, Cell: ({ ...props }) => (
<UserActionsCell id={props.data[props.row.index].uid} />
),
}, },
] ];
export {usersColumns} export { usersColumns };