Loan Repayment
This commit is contained in:
@@ -133,6 +133,7 @@ export default function LoansCom() {
|
|||||||
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
|
{/* <div className="text-base font-semibold">{formatNumber(item?.initial_loan_amount)}</div> */}
|
||||||
<div
|
<div
|
||||||
className="font-semibold text-green-500">#{formatNumber(item?.initial_loan_amount)}</div>
|
className="font-semibold text-green-500">#{formatNumber(item?.initial_loan_amount)}</div>
|
||||||
|
<div className="font-normal text-red-500">{item?.status}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {getLoans} from '../../services/siteServices'
|
|||||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||||
import formatNumber from '../../helpers/formatNumber'
|
import formatNumber from '../../helpers/formatNumber'
|
||||||
import getTimeFromDateString from "../../helpers/GetTimeFromDateString";
|
import getTimeFromDateString from "../../helpers/GetTimeFromDateString";
|
||||||
import { initiateDisburseRetrials } from "../../services/siteEventService"
|
import {initiateDisburseRetrials, initiateDisburseVerify} from "../../services/siteEventService"
|
||||||
|
|
||||||
export default function LoanDetails({transactionID}) {
|
export default function LoanDetails({transactionID}) {
|
||||||
|
|
||||||
@@ -30,6 +30,15 @@ export default function LoanDetails({transactionID}) {
|
|||||||
// console.log('Button clicked!');
|
// console.log('Button clicked!');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRetryClick = (transactioID) => {
|
||||||
|
alert(transactioID)
|
||||||
|
const fields = {
|
||||||
|
"transactionId": transactioID
|
||||||
|
}
|
||||||
|
return initiateDisburseVerify(fields)
|
||||||
|
// console.log('Button clicked!');
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isFetching ?
|
{isFetching ?
|
||||||
@@ -43,7 +52,8 @@ export default function LoanDetails({transactionID}) {
|
|||||||
<p className='text-red-500'>{error.message}</p>
|
<p className='text-red-500'>{error.message}</p>
|
||||||
</div>
|
</div>
|
||||||
: (loans && loans.length > 0) ?
|
: (loans && loans.length > 0) ?
|
||||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body' style={{backgroundColor: '#f7d9e3'}}>
|
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'
|
||||||
|
style={{backgroundColor: '#f7d9e3'}}>
|
||||||
<p className='pb-4 font-bold text-base'>Loan</p>
|
<p className='pb-4 font-bold text-base'>Loan</p>
|
||||||
<table className="table-auto py-2 w-full text-sm">
|
<table className="table-auto py-2 w-full text-sm">
|
||||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||||
@@ -150,6 +160,8 @@ export default function LoanDetails({transactionID}) {
|
|||||||
<div className="font-bold text-red-500">Disburse Result
|
<div className="font-bold text-red-500">Disburse Result
|
||||||
: {item?.disburseResult}</div>
|
: {item?.disburseResult}</div>
|
||||||
<div><br/></div>
|
<div><br/></div>
|
||||||
|
<div style={{display: 'flex'}}>
|
||||||
|
<div style={{width: '70%'}}>
|
||||||
<div className="font-bold text-blue-500">Disburse Verify
|
<div className="font-bold text-blue-500">Disburse Verify
|
||||||
Date: {getDateFromDateString(item?.disburseVerify)} {getTimeFromDateString(item?.disburseVerify)} </div>
|
Date: {getDateFromDateString(item?.disburseVerify)} {getTimeFromDateString(item?.disburseVerify)} </div>
|
||||||
<div className="font-bold text-gray-500">Verify Description
|
<div className="font-bold text-gray-500">Verify Description
|
||||||
@@ -157,6 +169,23 @@ export default function LoanDetails({transactionID}) {
|
|||||||
<div className="font-bold text-red-500">Verify Result
|
<div className="font-bold text-red-500">Verify Result
|
||||||
: {item?.verifyResult}</div>
|
: {item?.verifyResult}</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div style={{width: '30%', textAlign: 'right'}}>
|
||||||
|
<button
|
||||||
|
className="bg-blue-500 hover:bg-red-700 text-white font-bold py-2 px-4 roundede"
|
||||||
|
onClick={() => handleRetryClick(item?.transaction_id)}>
|
||||||
|
Retry Verification
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{/*<div className="font-bold text-blue-500">Disburse Verify*/}
|
||||||
|
{/* Date: {getDateFromDateString(item?.disburseVerify)} {getTimeFromDateString(item?.disburseVerify)} </div>*/}
|
||||||
|
{/*<div className="font-bold text-gray-500">Verify Description*/}
|
||||||
|
{/* : {item?.verifyDescription}</div>*/}
|
||||||
|
{/*<div className="font-bold text-red-500">Verify Result*/}
|
||||||
|
{/* : {item?.verifyResult}</div>*/}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { getRepaymentSchedule } from '../../services/siteServices'
|
|||||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||||
import formatNumber from '../../helpers/formatNumber';
|
import formatNumber from '../../helpers/formatNumber';
|
||||||
import localSiteIcons from "../../helpers/localSiteIcons";
|
import localSiteIcons from "../../helpers/localSiteIcons";
|
||||||
|
import {initiateLoanPayment } from "../../services/siteEventService"
|
||||||
export default function RepaymentScheduleDetails({transactionID}) {
|
export default function RepaymentScheduleDetails({transactionID}) {
|
||||||
|
|
||||||
const [page, setPage] = useState(1)
|
const [page, setPage] = useState(1)
|
||||||
@@ -22,6 +23,14 @@ export default function RepaymentScheduleDetails({transactionID}) {
|
|||||||
|
|
||||||
const repaymentSchedule = data?.data?.repayment_schedules // LOAN CHARGES LIST
|
const repaymentSchedule = data?.data?.repayment_schedules // LOAN CHARGES LIST
|
||||||
// const pagination = data?.data?.pagination
|
// const pagination = data?.data?.pagination
|
||||||
|
const handleClick = (transactioID) => {
|
||||||
|
alert(transactioID)
|
||||||
|
const fields = {
|
||||||
|
"transactionId": transactioID
|
||||||
|
}
|
||||||
|
return initiateLoanPayment(fields)
|
||||||
|
// console.log('Button clicked!');
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
@@ -61,6 +70,9 @@ export default function RepaymentScheduleDetails({transactionID}) {
|
|||||||
<th scope="col" className="px-2 text-right">
|
<th scope="col" className="px-2 text-right">
|
||||||
Paid ?
|
Paid ?
|
||||||
</th>
|
</th>
|
||||||
|
<th scope="col" className="px-2 text-right">
|
||||||
|
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -74,22 +86,26 @@ export default function RepaymentScheduleDetails({transactionID}) {
|
|||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<div className="font-normal text-gray-500">{formatNumber(item?.total_repayment_amount)}</div>
|
<div
|
||||||
|
className="font-normal text-gray-500">{formatNumber(item?.total_repayment_amount)}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<div className="font-normal text-gray-500">{formatNumber(item?.installment_amount)}</div>
|
<div
|
||||||
|
className="font-normal text-gray-500">{formatNumber(item?.installment_amount)}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.due_date)}</div>
|
<div
|
||||||
|
className="font-normal text-gray-500">{getDateFromDateString(item?.due_date)}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<div className="font-normal text-gray-500">{item?.paid_at ? getDateFromDateString(item?.paid_at) : 'Not available'}</div>
|
<div
|
||||||
|
className="font-normal text-gray-500">{item?.paid_at ? getDateFromDateString(item?.paid_at) : 'Not available'}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-2">
|
<td className="px-2">
|
||||||
@@ -97,6 +113,16 @@ export default function RepaymentScheduleDetails({transactionID}) {
|
|||||||
<div className="text-base font-semibold">{item?.paid || 'false'}</div>
|
<div className="text-base font-semibold">{item?.paid || 'false'}</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td className="px-2">
|
||||||
|
<div className="text-right">
|
||||||
|
<button
|
||||||
|
className="bg-blue-500 hover:bg-red-700 text-white font-bold py-2 px-4 roundede"
|
||||||
|
onClick={() => handleClick(item?.transaction_id)}>
|
||||||
|
Process Payment
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))
|
))
|
||||||
:
|
:
|
||||||
|
|||||||
@@ -45,3 +45,16 @@ export const initiateDisburseRetrials = (reqData) => {
|
|||||||
}
|
}
|
||||||
return postAuxEnd('/autocall/retry-disbursement', postData, false)
|
return postAuxEnd('/autocall/retry-disbursement', postData, false)
|
||||||
}
|
}
|
||||||
|
export const initiateDisburseVerify = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData
|
||||||
|
}
|
||||||
|
return postAuxEnd('/autocall/verify-disbursement', postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const initiateLoanPayment = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData
|
||||||
|
}
|
||||||
|
return postAuxEnd('/autocall/start-repayment', postData, false)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user