From e98a63e219a8c0ab22deb541bf24d7d47ae8bf59 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Wed, 20 Dec 2023 10:07:51 +0330 Subject: [PATCH] yasi_follow_loan_design --- .../navgan/followUp-loan/RequestCard.jsx | 14 ++-- .../dashboard/navgan/followUp-loan/index.jsx | 72 ++++--------------- 2 files changed, 22 insertions(+), 64 deletions(-) diff --git a/src/components/dashboard/navgan/followUp-loan/RequestCard.jsx b/src/components/dashboard/navgan/followUp-loan/RequestCard.jsx index bc2d07d..54695db 100644 --- a/src/components/dashboard/navgan/followUp-loan/RequestCard.jsx +++ b/src/components/dashboard/navgan/followUp-loan/RequestCard.jsx @@ -24,24 +24,24 @@ const RequestCard = ({item}) => { }} > - {`${t("LoanFollowUp.loan_unique_code")}: ${item.unique_id}`} + {`${t("LoanFollowUp.loan_unique_code")}: ${item.id}`} {`${t("LoanFollowUp.loan_date")}: ${moment(item.created_at).locale("fa").format("HH:mm | YYYY/MM/DD")}`} - {`${t("LoanFollowUp.loan_bank_branch")}: ${item.banknum === null ? '-' : item.banknum}`} + {`${t("LoanFollowUp.loan_bank_branch")}: ${item.branch_info === null ? '-' : item.branch_info}`} {`${t("LoanFollowUp.loan_status")}: `} - {item.status} - {item.status === 'Pending' && } - {item.status === 'Approved' && } - {item.status === 'Rejected' && } + {item.loan_state} + {item.state_id >= 1 && item.state_id <= 6 && } + {item.state_id === 8 && } + {item.state_id === 7 && } diff --git a/src/components/dashboard/navgan/followUp-loan/index.jsx b/src/components/dashboard/navgan/followUp-loan/index.jsx index 924364a..aa031a6 100644 --- a/src/components/dashboard/navgan/followUp-loan/index.jsx +++ b/src/components/dashboard/navgan/followUp-loan/index.jsx @@ -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 ( {requestsList.map((item) => ( - + ))}