yasi_follow_loan_design

This commit is contained in:
Yasiu1376
2023-12-20 10:07:51 +03:30
parent 2361cfa8f7
commit e98a63e219
2 changed files with 22 additions and 64 deletions

View File

@@ -24,24 +24,24 @@ const RequestCard = ({item}) => {
}}
>
<Typography variant="h6" sx={{lineHeight: 2 , fontWeight:'bold'}}>
{`${t("LoanFollowUp.loan_unique_code")}: ${item.unique_id}`}
{`${t("LoanFollowUp.loan_unique_code")}: ${item.id}`}
</Typography>
</Box>
<Typography variant="body1" sx={{lineHeight: 2 , paddingLeft: '20px'}}>
{`${t("LoanFollowUp.loan_date")}: ${moment(item.created_at).locale("fa").format("HH:mm | YYYY/MM/DD")}`}
</Typography>
<Typography variant="body1" sx={{lineHeight: 2 , paddingLeft: '20px'}}>
{`${t("LoanFollowUp.loan_bank_branch")}: ${item.banknum === null ? '-' : item.banknum}`}
{`${t("LoanFollowUp.loan_bank_branch")}: ${item.branch_info === null ? '-' : item.branch_info}`}
</Typography>
<Typography variant="body1" sx={{lineHeight: 2 , paddingLeft: '20px'}}>
{`${t("LoanFollowUp.loan_status")}: `}
{item.status}
{item.status === 'Pending' && <AccessTimeFilledIcon sx={{verticalAlign: 'middle', marginLeft: '4px' , color: '#48a4df'}}/>}
{item.status === 'Approved' && <CheckCircleIcon sx={{verticalAlign: 'middle', marginLeft: '4px', color: 'green'}}/>}
{item.status === 'Rejected' && <CancelIcon sx={{verticalAlign: 'middle', marginLeft: '4px', color: 'red'}}/>}
{item.loan_state}
{item.state_id >= 1 && item.state_id <= 6 && <AccessTimeFilledIcon sx={{verticalAlign: 'middle', marginLeft: '4px' , color: '#48a4df'}}/>}
{item.state_id === 8 && <CheckCircleIcon sx={{verticalAlign: 'middle', marginLeft: '4px', color: 'green'}}/>}
{item.state_id === 7 && <CancelIcon sx={{verticalAlign: 'middle', marginLeft: '4px', color: 'red'}}/>}
</Typography>
<Button variant="contained" color="primary" sx={{alignSelf: 'flex-end'}}>
<LinkRouting underline="none" color="inherit" href={`/dashboard/navgan/${item.unique_id}/show`}>
<LinkRouting underline="none" color="inherit" href={`/dashboard/navgan/${item.id}/show`}>
{t("LoanFollowUp.loan_details")}
</LinkRouting>
</Button>

View File

@@ -1,81 +1,39 @@
import {
Grid,
} from "@mui/material";
import { Grid } from "@mui/material";
import {useEffect, useState} from "react";
import {SHOW_LOAN_REQUEST_NAVGAN} from "@/core/data/apiRoutes";
import moment from "jalali-moment";
import RequestCard from "@/components/dashboard/navgan/followUp-loan/RequestCard";
import { FullPageLayout, useLoading, useRequest} from "@witel/webapp-builder";
import {FullPageLayout , useRequest} from "@witel/webapp-builder";
const LoanFollowUpComponent = () => {
const requestServer = useRequest();
const {setLoadingPage} = useLoading();
const [isLoading, setIsLoading] = useState(false)
const [requestsList, setRequestsList] = useState([]);
// get form data
useEffect(() => {
setLoadingPage(true)
requestServer(SHOW_LOAN_REQUEST_NAVGAN, "get", {auth: true, notification: false})
setIsLoading(true)
requestServer(SHOW_LOAN_REQUEST_NAVGAN, "get", {
auth: true,
pending:false,
success:{notification:{show:false}}
})
.then(function ({data}) {
// const items = data.data;
const items=[
{
id:'1',
unique_id: 'id_1',
created_at: '2023-12-11T10:56:48.000000',
status: 'Pending',
banknum: '1234'
},
{
id:'2',
unique_id: 'id_2',
created_at: '2023-12-11T10:56:48.000000',
status: 'Approved',
banknum: '5678'
},
{
id:'3',
unique_id: 'id_3',
created_at: '2023-12-11T10:56:48.000000',
status: 'Rejected',
banknum: '91011'
},
{
id:'4',
unique_id: 'id_3',
created_at: '2023-12-11T10:56:48.000000',
status: 'Rejected',
banknum: '91011'
},
{
id:'5',
unique_id: 'id_3',
created_at: '2023-12-11T10:56:48.000000',
status: 'Rejected',
banknum: null
}
]
// const formattedData = items.map((item, index) => ({
// id: item.id,
// latest_history_created_at: moment(item.latest_history_created_at).locale("fa").format("HH:mm | YYYY/MM/DD"),
// state_id: item.state_id,
// loan_state: item.loan_state,
// }));
const items = data.data;
setRequestsList(items);
setLoadingPage(false)
setIsLoading(false)
})
.catch(function (error) {
})
}, []);
return (
<FullPageLayout>
<Grid
container
columnSpacing={2}
rowSpacing={2}
sx={{alignItems: "start", justifyContent: "center", padding:"24px"}}
sx={{alignItems: "start", justifyContent: "center", padding: "24px"}}
>
{requestsList.map((item) => (
<RequestCard item={item} key={item.id} />
<RequestCard item={item} key={item.id}/>
))}
</Grid>
</FullPageLayout>