Merge branch 'feature/refahi_crud' into 'develop'

TF-45 Implemention Follow Up Loan Page For Refahi Type Of User

See merge request witel3/loan-facilities-user!23
This commit is contained in:
AmirHossein Mahmoodi
2023-08-28 08:29:22 +00:00
32 changed files with 937 additions and 94 deletions

783
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -20,6 +20,7 @@
"eslint": "8.36.0", "eslint": "8.36.0",
"formik": "^2.2.9", "formik": "^2.2.9",
"fs-extra": "^11.1.1", "fs-extra": "^11.1.1",
"jalali-moment": "^3.3.11",
"material-react-table": "^1.11.1", "material-react-table": "^1.11.1",
"moment": "^2.29.4", "moment": "^2.29.4",
"next": "^13.3.0", "next": "^13.3.0",

View File

@@ -16,6 +16,72 @@ This set of fonts are used in this project under the license: (.....)
-------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------
* *
**/ **/
@font-face {
font-family: IRANSansFaNum;
font-style: normal;
font-weight: 900;
src: url('./fonts/eot/IRANSansWeb(FaNum)_Black.eot');
src: url('./fonts/eot/IRANSansWeb(FaNum)_Black.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('./fonts/woff2/IRANSansWeb(FaNum)_Black.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('./fonts/woff/IRANSansWeb(FaNum)_Black.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('./fonts/ttf/IRANSansWeb(FaNum)_Black.ttf') format('truetype');
}
@font-face {
font-family: IRANSansFaNum;
font-style: normal;
font-weight: bold;
src: url('./fonts/eot/IRANSansWeb(FaNum)_Bold.eot');
src: url('./fonts/eot/IRANSansWeb(FaNum)_Bold.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('./fonts/woff2/IRANSansWeb(FaNum)_Bold.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('./fonts/woff/IRANSansWeb(FaNum)_Bold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('./fonts/ttf/IRANSansWeb(FaNum)_Bold.ttf') format('truetype');
}
@font-face {
font-family: IRANSansFaNum;
font-style: normal;
font-weight: 500;
src: url('./fonts/eot/IRANSansWeb(FaNum)_Medium.eot');
src: url('./fonts/eot/IRANSansWeb(FaNum)_Medium.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('./fonts/woff2/IRANSansWeb(FaNum)_Medium.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('./fonts/woff/IRANSansWeb(FaNum)_Medium.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('./fonts/ttf/IRANSansWeb(FaNum)_Medium.ttf') format('truetype');
}
@font-face {
font-family: IRANSansFaNum;
font-style: normal;
font-weight: 300;
src: url('./fonts/eot/IRANSansWeb(FaNum)_Light.eot');
src: url('./fonts/eot/IRANSansWeb(FaNum)_Light.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('./fonts/woff2/IRANSansWeb(FaNum)_Light.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('./fonts/woff/IRANSansWeb(FaNum)_Light.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('./fonts/ttf/IRANSansWeb(FaNum)_Light.ttf') format('truetype');
}
@font-face {
font-family: IRANSansFaNum;
font-style: normal;
font-weight: 200;
src: url('./fonts/eot/IRANSansWeb(FaNum)_UltraLight.eot');
src: url('./fonts/eot/IRANSansWeb(FaNum)_UltraLight.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('./fonts/woff2/IRANSansWeb(FaNum)_UltraLight.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('./fonts/woff/IRANSansWeb(FaNum)_UltraLight.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('./fonts/ttf/IRANSansWeb(FaNum)_UltraLight.ttf') format('truetype');
}
@font-face {
font-family: IRANSansFaNum;
font-style: normal;
font-weight: normal;
src: url('./fonts/eot/IRANSansWeb(FaNum).eot');
src: url('./fonts/eot/IRANSansWeb(FaNum).eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('./fonts/woff2/IRANSansWeb(FaNum).woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('./fonts/woff/IRANSansWeb(FaNum).woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('./fonts/ttf/IRANSansWeb(FaNum).ttf') format('truetype');
}
@font-face { @font-face {
font-family: IRANSans; font-family: IRANSans;
font-style: normal; font-style: normal;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -108,7 +108,10 @@
"dashboard_page": "داشبورد" "dashboard_page": "داشبورد"
}, },
"LoanFollowUp": { "LoanFollowUp": {
"loan_follow_up_page": "پیگیری درخواست" "loan_follow_up_page": "پیگیری درخواست",
"loan_request_correction": "اصلاح درخواست",
"loan_request_detail": "مشاهده جزئیات",
"request_number": "درخواست شماره"
}, },
"LoanRequest": { "LoanRequest": {
"loan_request_page": "ثبت درخواست وام", "loan_request_page": "ثبت درخواست وام",

View File

@@ -0,0 +1,52 @@
import {
Card,
CardContent,
CardHeader,
Grid, IconButton, Tooltip,
Typography,
} from "@mui/material";
import SellIcon from '@mui/icons-material/Sell';
import EditIcon from '@mui/icons-material/Edit';
import {useTranslations} from "next-intl";
import {NextLinkComposed} from "@/core/components/LinkRouting";
const RequestCard = ({item}) => {
const t = useTranslations();
return (
<Grid item xs={12} md={6} lg={4}>
<Card sx={{
width: "100%",
boxShadow: "rgba(0, 0, 0, 0.15) 0px 5px 15px 0px"
}}>
<CardHeader
avatar={<SellIcon color="primary"/>}
title={`${t("LoanFollowUp.request_number")}: (${item.id})`}
subheader={item.latest_history_created_at}
action={
item.state_id === 7 ? ( // Use the ternary operator or if/else inside curly braces
<Tooltip title={t("LoanFollowUp.loan_request_correction")}>
<IconButton size="small"
color="primary"
variant="outlined"
component={NextLinkComposed}
to={{
pathname: `edit-request-loan/${item.id}`,
}} aria-label="fingerprint">
<EditIcon/>
</IconButton>
</Tooltip>
) : null
}
/>
<CardContent sx={{pt: 0}}>
<Typography variant="button">
{item.loan_state}
</Typography>
</CardContent>
</Card>
</Grid>
);
};
export default RequestCard;

View File

@@ -1,66 +1,37 @@
import DashboardLayouts from "@/layouts/dashboardLayouts"; import DashboardLayouts from "@/layouts/dashboardLayouts";
import useUser from "@/lib/app/hooks/useUser";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import { import {
Avatar,
Card,
CardActions,
CardContent,
CardHeader,
Collapse,
Grid, Grid,
IconButton,
Stack, Stack,
Typography
} from "@mui/material"; } from "@mui/material";
import {styled} from "@mui/material/styles"; import {useEffect, useState} from "react";
import {useTranslations} from "next-intl"; import {SHOW_LOAN_REQUEST_WELFARE} from "@/core/data/apiRoutes";
import {useState} from "react"; import useLoading from "@/lib/app/hooks/useLoading";
import useRequest from "@/lib/app/hooks/useRequest";
const ExpandMore = styled((props) => { import moment from "jalali-moment";
const {expand, ...other} = props; import RequestCard from "@/components/dashboard/refahi/followUp-loan/RequestCard";
return <IconButton {...other} />;
})(({theme, expand}) => ({
transform: !expand ? "rotate(0deg)" : "rotate(180deg)",
marginLeft: "auto",
transition: theme.transitions.create("transform", {
duration: theme.transitions.duration.shortest,
}),
}));
const data = [
{
name: "جان دو",
date: "۱۳۹۹/۰۴/۲۵",
description:
"لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است.",
},
{
name: "جین اسمیت",
date: "۱۳۹۹/۰۴/۲۶",
description: "نُلا ویته الیت لیبرو آ، آ فارِترا آوگوه.",
},
{
name: "مایک جانسون",
date: "۱۳۹۹/۰۴/۲۷",
description:
"دوئیس مولیس، است نُن کُمُدو لُکتوس، نیسی ارات پورتیتور لیگولا.",
},
];
const LoanFollowUpComponent = () => { const LoanFollowUpComponent = () => {
const t = useTranslations(); const requestServer = useRequest();
const {token} = useUser(); const {setLoadingPage} = useLoading();
const [requestsList, setRequestsList] = useState([]);
const [expanded, setExpanded] = useState([]); // get form data
useEffect(() => {
const handleExpandClick = (index) => { setLoadingPage(true)
setExpanded((prevExpanded) => { requestServer(SHOW_LOAN_REQUEST_WELFARE, "get", {auth: true, notification: false})
const newExpanded = [...prevExpanded]; .then(function ({data}) {
newExpanded[index] = !newExpanded[index]; const items = data.data;
return newExpanded; 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);
setLoadingPage(false)
})
.catch(function (error) {
})
}, []);
return ( return (
<DashboardLayouts> <DashboardLayouts>
@@ -77,42 +48,8 @@ const LoanFollowUpComponent = () => {
rowSpacing={2} rowSpacing={2}
sx={{alignItems: "start", justifyContent: "center"}} sx={{alignItems: "start", justifyContent: "center"}}
> >
{data.map((item, index) => ( {requestsList.map((item, index) => (
<Grid item xs={12} md={6} lg={4} key={index}> <RequestCard item={item} key={item.id}/>
<Card sx={{width: "100%"}}>
<CardHeader
avatar={
<Avatar
sx={{bgcolor: "primary.main"}}
aria-label="recipe"
></Avatar>
}
title={item.name}
subheader={item.date}
/>
<CardContent>
<Typography variant="body2" color="text.secondary">
متن تست
</Typography>
</CardContent>
<CardActions disableSpacing>
<ExpandMore
expand={expanded[index]}
onClick={() => handleExpandClick(index)}
aria-expanded={expanded[index]}
aria-label="show more"
>
<ExpandMoreIcon/>
</ExpandMore>
</CardActions>
<Collapse in={expanded[index]} timeout="auto" unmountOnExit>
<CardContent>
<Typography paragraph>اطلاعات تکمیلی:</Typography>
<Typography paragraph>{item.description}</Typography>
</CardContent>
</Collapse>
</Card>
</Grid>
))} ))}
</Grid> </Grid>
</Stack> </Stack>

View File

@@ -7,6 +7,7 @@ export const SEND_OTP_TOKEN = BASE_URL + "/otp";
export const REGISTER = BASE_URL + "/register"; export const REGISTER = BASE_URL + "/register";
export const USER_INFO = BASE_URL + "/profile/info"; export const USER_INFO = BASE_URL + "/profile/info";
export const SEND_LOAN_REQUEST_NAVGAN = BASE_URL + "/navgan/loan/store"; export const SEND_LOAN_REQUEST_NAVGAN = BASE_URL + "/navgan/loan/store";
export const SHOW_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/index";
export const SEND_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/store"; export const SEND_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/store";
export const UPDATE_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/update/"; export const UPDATE_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/update/";
export const DETAILS_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/details/"; export const DETAILS_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/details/";

View File

@@ -4,7 +4,7 @@ import theme from "./theme";
const themeRtl = createTheme({ const themeRtl = createTheme({
direction: "rtl", direction: "rtl",
typography: { typography: {
fontFamily: `IRANSans, sans-serif`, fontFamily: `IRANSansFaNum, sans-serif`,
}, },
...theme, ...theme,
}); });