From 4d87c4e79c0897a9abe6cc3582458dbd4bc9abad Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Tue, 19 Dec 2023 13:35:10 +0330 Subject: [PATCH 1/3] fake data --- .../dashboard/navgan/followUp-loan/index.jsx | 89 +++++++++++++------ 1 file changed, 60 insertions(+), 29 deletions(-) diff --git a/src/components/dashboard/navgan/followUp-loan/index.jsx b/src/components/dashboard/navgan/followUp-loan/index.jsx index 558babb..924364a 100644 --- a/src/components/dashboard/navgan/followUp-loan/index.jsx +++ b/src/components/dashboard/navgan/followUp-loan/index.jsx @@ -1,13 +1,11 @@ import { Grid, - Stack, } 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 {useLoading, useRequest} from "@witel/webapp-builder"; - +import { FullPageLayout, useLoading, useRequest} from "@witel/webapp-builder"; const LoanFollowUpComponent = () => { const requestServer = useRequest(); const {setLoadingPage} = useLoading(); @@ -17,39 +15,72 @@ const LoanFollowUpComponent = () => { setLoadingPage(true) requestServer(SHOW_LOAN_REQUEST_NAVGAN, "get", {auth: true, notification: false}) .then(function ({data}) { - const items = data.data; - 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, - })); - setRequestsList(formattedData); + // 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, + // })); + + setRequestsList(items); setLoadingPage(false) }) .catch(function (error) { }) }, []); - return ( - + - - {requestsList.map((item, index) => ( - - ))} - - + {requestsList.map((item) => ( + + ))} + + + + ); }; From 2361cfa8f782496f7854016d2e44c3f59c0b0883 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Tue, 19 Dec 2023 13:36:05 +0330 Subject: [PATCH 2/3] design request card --- .../navgan/followUp-loan/RequestCard.jsx | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/src/components/dashboard/navgan/followUp-loan/RequestCard.jsx b/src/components/dashboard/navgan/followUp-loan/RequestCard.jsx index 6e5dfd3..bc2d07d 100644 --- a/src/components/dashboard/navgan/followUp-loan/RequestCard.jsx +++ b/src/components/dashboard/navgan/followUp-loan/RequestCard.jsx @@ -1,25 +1,50 @@ -import {Card, CardContent, CardHeader, Grid, Typography} from "@mui/material"; -import SellIcon from '@mui/icons-material/Sell'; +import {Box, Button, Card, CardContent, Grid, Typography} from "@mui/material"; import {useTranslations} from "next-intl"; - +import moment from "jalali-moment"; +import {LinkRouting} from "@witel/webapp-builder"; +import AccessTimeFilledIcon from '@mui/icons-material/AccessTimeFilled'; +import CheckCircleIcon from '@mui/icons-material/CheckCircle'; +import CancelIcon from '@mui/icons-material/Cancel'; const RequestCard = ({item}) => { const t = useTranslations(); return ( - + - } - title={`${t("LoanFollowUp.request_number")}: (${item.id})`} - subheader={item.latest_history_created_at} - /> - - - {item.loan_state} + + + + {`${t("LoanFollowUp.loan_unique_code")}: ${item.unique_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_status")}: `} + {item.status} + {item.status === 'Pending' && } + {item.status === 'Approved' && } + {item.status === 'Rejected' && } + + From e98a63e219a8c0ab22deb541bf24d7d47ae8bf59 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Wed, 20 Dec 2023 10:07:51 +0330 Subject: [PATCH 3/3] 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) => ( - + ))}