import { Grid } from "@mui/material";
import {useEffect, useState} from "react";
import {SHOW_LOAN_REQUEST_NAVGAN} from "@/core/data/apiRoutes";
import RequestCard from "@/components/dashboard/navgan/followUp-loan/RequestCard";
import {FullPageLayout , useRequest} from "@witel/webapp-builder";

const LoanFollowUpComponent = () => {
    const requestServer = useRequest();
    const [isLoading, setIsLoading] = useState(false)
    const [requestsList, setRequestsList] = useState([]);
    useEffect(() => {
        setIsLoading(true)
        requestServer(SHOW_LOAN_REQUEST_NAVGAN, "get", {
            auth: true,
            pending:false,
            success:{notification:{show:false}}
        })
            .then(function ({data}) {
                const items = data.data;
                setRequestsList(items);
                setIsLoading(false)
            })
            .catch(function (error) {
            })
    }, []);

    return (
        <FullPageLayout>
            <Grid
                container
                columnSpacing={2}
                rowSpacing={2}
                sx={{alignItems: "start", justifyContent: "center", padding: "24px"}}
            >
                {requestsList.map((item) => (
                    <RequestCard item={item} key={item.id}/>
                ))}
            </Grid>
        </FullPageLayout>


    );
};

export default LoanFollowUpComponent;
