Merge branch 'feature/mohammad_add_column' into 'develop'

This commit is contained in:
AmirHossein Mahmoodi
2023-12-10 13:48:18 +00:00
6 changed files with 193 additions and 32 deletions

View File

@@ -191,6 +191,8 @@
"id": "کد یکتا", "id": "کد یکتا",
"national_id": "کد ملی", "national_id": "کد ملی",
"phone_number": "موبایل", "phone_number": "موبایل",
"proposed_amount": "مبلغ پیشنهادی",
"approved_amount": "مبلغ تصویب شده",
"created_at": "تاریخ درخواست", "created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی", "updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان", "navgan_id": "کد ناوگان",
@@ -206,6 +208,7 @@
"id": "کد یکتا", "id": "کد یکتا",
"national_id": "کد ملی", "national_id": "کد ملی",
"phone_number": "موبایل", "phone_number": "موبایل",
"proposed_amount": "مبلغ پیشنهادی",
"created_at": "تاریخ درخواست", "created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی", "updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان", "navgan_id": "کد ناوگان",
@@ -282,6 +285,8 @@
"id": "کد یکتا", "id": "کد یکتا",
"national_id": "کد ملی", "national_id": "کد ملی",
"phone_number": "موبایل", "phone_number": "موبایل",
"proposed_amount": "مبلغ پیشنهادی",
"approved_amount": "مبلغ تصویب شده",
"created_at": "تاریخ درخواست", "created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی", "updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان", "navgan_id": "کد ناوگان",
@@ -357,7 +362,7 @@
"approved_amount_number": "مبلغ تصویب شده باید عدد باشد", "approved_amount_number": "مبلغ تصویب شده باید عدد باشد",
"toman": "میلیون تومان", "toman": "میلیون تومان",
"proposed_amount_error": "وارد کردن مقدار پیشنهادی الزامیست", "proposed_amount_error": "وارد کردن مقدار پیشنهادی الزامیست",
"proposed_amount": قدار پیشنهادی", "proposed_amount": بلغ پیشنهادی",
"proposed_amount_positive": "مقدار پیشنهادی باید مثبت باشد", "proposed_amount_positive": "مقدار پیشنهادی باید مثبت باشد",
"proposed_amount_number": "مقدار پیشنهادی باید عدد باشد" "proposed_amount_number": "مقدار پیشنهادی باید عدد باشد"
}, },
@@ -537,6 +542,17 @@
"update_again": "بروزرسانی مجدد" "update_again": "بروزرسانی مجدد"
}, },
"LoanHistory": { "LoanHistory": {
"id": "کد یکتا",
"name": "نام",
"national_id": "کد ملی",
"phone_number": "موبایل",
"proposed_amount": "مبلغ پیشنهادی",
"approved_amount": "مبلغ تصویب شده",
"created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
"state_name": "وضعیت درخواست",
"history": "تاریخچه", "history": "تاریخچه",
"Table_history_error": "خطا در دریافت اطلاعات", "Table_history_error": "خطا در دریافت اطلاعات",
"history_report": "فایل ضمیمه", "history_report": "فایل ضمیمه",
@@ -547,4 +563,4 @@
"Table_head_file": "فایل پیوست", "Table_head_file": "فایل پیوست",
"empty_history_detail": "سابقه ای برای این وام وجود ندارد" "empty_history_detail": "سابقه ای برای این وام وجود ندارد"
} }
} }

View File

@@ -14,7 +14,7 @@ function DashboardLoanHistoryComponent() {
{ {
accessorFn: (row) => row.id, accessorFn: (row) => row.id,
id: "id", id: "id",
header: t("PassengerOffice.id"), header: t("LoanHistory.id"),
enableColumnFilter: true, enableColumnFilter: true,
datatype: "numeric", datatype: "numeric",
filterFn: "equals", filterFn: "equals",
@@ -33,7 +33,7 @@ function DashboardLoanHistoryComponent() {
{ {
accessorFn: (row) => row.name, accessorFn: (row) => row.name,
id: "name", id: "name",
header: t("MachinaryOffice.name"), header: t("LoanHistory.name"),
enableColumnFilter: true, enableColumnFilter: true,
datatype: "text", datatype: "text",
filterFn: "contains", filterFn: "contains",
@@ -45,7 +45,7 @@ function DashboardLoanHistoryComponent() {
{ {
accessorFn: (row) => row.national_id, accessorFn: (row) => row.national_id,
id: "national_id", id: "national_id",
header: t("MachinaryOffice.national_id"), header: t("LoanHistory.national_id"),
enableColumnFilter: true, enableColumnFilter: true,
datatype: "numeric", datatype: "numeric",
filterFn: "equals", filterFn: "equals",
@@ -64,7 +64,45 @@ function DashboardLoanHistoryComponent() {
{ {
accessorFn: (row) => row.phone_number, accessorFn: (row) => row.phone_number,
id: "phone_number", id: "phone_number",
header: t("MachinaryOffice.phone_number"), header: t("LoanHistory.phone_number"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.proposed_amount,
id: "proposed_amount",
header: t("LoanHistory.proposed_amount"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.approved_amount,
id: "approved_amount",
header: t("LoanHistory.approved_amount"),
enableColumnFilter: true, enableColumnFilter: true,
datatype: "numeric", datatype: "numeric",
filterFn: "equals", filterFn: "equals",
@@ -84,7 +122,7 @@ function DashboardLoanHistoryComponent() {
accessorFn: (row) => accessorFn: (row) =>
moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"), moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"),
id: "created_at", id: "created_at",
header: t("MachinaryOffice.created_at"), header: t("LoanHistory.created_at"),
enableColumnFilter: true, enableColumnFilter: true,
datatype: "date", datatype: "date",
filterFn: "lessThan", filterFn: "lessThan",
@@ -103,7 +141,7 @@ function DashboardLoanHistoryComponent() {
accessorFn: (row) => accessorFn: (row) =>
moment(row.updated_at).locale("fa").format("HH:mm | yyyy/MM/DD"), moment(row.updated_at).locale("fa").format("HH:mm | yyyy/MM/DD"),
id: "updated_at", id: "updated_at",
header: t("MachinaryOffice.updated_at"), header: t("LoanHistory.updated_at"),
enableColumnFilter: false, enableColumnFilter: false,
datatype: "numeric", datatype: "numeric",
Cell: ({renderedCellValue}) => ( Cell: ({renderedCellValue}) => (
@@ -113,7 +151,7 @@ function DashboardLoanHistoryComponent() {
{ {
accessorFn: (row) => row.navgan_id, accessorFn: (row) => row.navgan_id,
id: "navgan_id", id: "navgan_id",
header: t("MachinaryOffice.navgan_id"), header: t("LoanHistory.navgan_id"),
enableColumnFilter: true, enableColumnFilter: true,
datatype: "numeric", datatype: "numeric",
filterFn: "equals", filterFn: "equals",
@@ -132,7 +170,7 @@ function DashboardLoanHistoryComponent() {
{ {
accessorFn: (row) => row.vehicle_type, accessorFn: (row) => row.vehicle_type,
id: "vehicle_type", id: "vehicle_type",
header: t("MachinaryOffice.vehicle_type"), header: t("LoanHistory.vehicle_type"),
enableColumnFilter: true, enableColumnFilter: true,
datatype: "text", datatype: "text",
filterFn: "contains", filterFn: "contains",
@@ -144,7 +182,7 @@ function DashboardLoanHistoryComponent() {
{ {
accessorFn: (row) => row.state_name, accessorFn: (row) => row.state_name,
id: "state_id", id: "state_id",
header: t("MachinaryOffice.state_name"), header: t("LoanHistory.state_name"),
enableColumnFilter: false, enableColumnFilter: false,
datatype: "numeric", datatype: "numeric",
Cell: ({renderedCellValue}) => ( Cell: ({renderedCellValue}) => (

View File

@@ -82,6 +82,44 @@ function DashboardNavganProvinceManagerComponent() {
<Typography variant="body2">{renderedCellValue}</Typography> <Typography variant="body2">{renderedCellValue}</Typography>
), ),
}, },
{
accessorFn: (row) => row.proposed_amount,
id: "proposed_amount",
header: t("NavganProvinceManager.proposed_amount"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.approved_amount,
id: "approved_amount",
header: t("NavganProvinceManager.approved_amount"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{ {
accessorFn: (row) => accessorFn: (row) =>
moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"), moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"),

View File

@@ -82,6 +82,25 @@ function DashboardPassengerOfficeComponent() {
<Typography variant="body2">{renderedCellValue}</Typography> <Typography variant="body2">{renderedCellValue}</Typography>
), ),
}, },
{
accessorFn: (row) => row.proposed_amount,
id: "proposed_amount",
header: t("PassengerBoss.proposed_amount"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{ {
accessorFn: (row) => accessorFn: (row) =>
moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"), moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"),

View File

@@ -6,7 +6,9 @@ import {
Button, Button,
DialogActions, DialogActions,
DialogContent, DialogContent,
FormHelperText, Grid, LinearProgress, FormHelperText,
Grid,
LinearProgress,
Stack, Stack,
TextField, TextField,
Typography Typography
@@ -18,13 +20,14 @@ import {useEffect, useState} from "react";
import * as Yup from "yup"; import * as Yup from "yup";
import CustomAccordion from "@/core/components/CustomAccordion"; import CustomAccordion from "@/core/components/CustomAccordion";
import ImageContent from "@/core/components/ImageContent"; import ImageContent from "@/core/components/ImageContent";
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeClick}) => {
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeClick}) => {
const t = useTranslations(); const t = useTranslations();
const [selectedImage, setSelectedImage] = useState(""); const [selectedImage, setSelectedImage] = useState("");
const [fileType, setfileType] = useState(null); const [fileType, setfileType] = useState(null);
const [fileName, setfileName] = useState(null); const [fileName, setfileName] = useState(null);
const [showAddIcon, setShowAddIcon] = useState(true); const [showAddIcon, setShowAddIcon] = useState(true);
const requestServer = useRequest({auth: true , notification: false}) const requestServer = useRequest({auth: true, notification: false})
const [accordionStates, setAccordionStates] = useState([]); const [accordionStates, setAccordionStates] = useState([]);
const [hasAccordionOpened, setHasAccordionOpened] = useState([]); const [hasAccordionOpened, setHasAccordionOpened] = useState([]);
const {update_notification} = useNotification(); const {update_notification} = useNotification();
@@ -37,14 +40,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
useEffect(() => { useEffect(() => {
requestServer(`${GET_TRANSPORTATION_ASSISTANCE_DETAILS}/${rowId}`, 'get') requestServer(`${GET_TRANSPORTATION_ASSISTANCE_DETAILS}/${rowId}`, 'get')
.then((response) => { .then((response) => {
const booleanData = Array.from({ length: response.data.data.attachment_files.length }, () => false); const booleanData = Array.from({length: response.data.data.attachment_files.length}, () => false);
setAccordionStates(booleanData); setAccordionStates(booleanData);
setHasAccordionOpened(booleanData); setHasAccordionOpened(booleanData);
setDetailsData(response.data) setDetailsData(response.data)
}) })
.catch(() => { .catch(() => {
}).finally(() => { }).finally(() => {
setLoading(false); setLoading(false);
}); });
}, []); }, []);
@@ -52,13 +55,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
const newAccordionStates = accordionStates.map((state, i) => i === index ? !state : false); const newAccordionStates = accordionStates.map((state, i) => i === index ? !state : false);
setAccordionStates(newAccordionStates); setAccordionStates(newAccordionStates);
if (!newAccordionStates[index]) if (!newAccordionStates[index]) {
{
handleSizeChangeClick('sm'); handleSizeChangeClick('sm');
setHasImageShown(false); setHasImageShown(false);
setIsSkeleton(false) setIsSkeleton(false)
} } else {
else {
handleSizeChangeClick('xl'); handleSizeChangeClick('xl');
setHasImageShown(true); setHasImageShown(true);
setImageLink(detailsList.data.attachment_files[index]) setImageLink(detailsList.data.attachment_files[index])
@@ -144,8 +145,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
const numberShowBox = () => { const numberShowBox = () => {
return ( return (
<> <>
<Box sx={{ border: '1px solid #ccc' ,p:2 , mb:2 , borderRadius: '8px'}}> <Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
<Typography sx={{color: "primary.main" , fontWeight: 500}}>{t("ConfirmDialog.approved_amount")} {t("sidebar.machinery-expert")}</Typography> <Typography sx={{
color: "primary.main",
fontWeight: 500
}}>{t("ConfirmDialog.proposed_amount")} {t("sidebar.machinery-expert")}</Typography>
<Typography pt={1}> <Typography pt={1}>
{isNaN((detailsList?.data?.proposed_amount) / 10) {isNaN((detailsList?.data?.proposed_amount) / 10)
? "" ? ""
@@ -153,8 +157,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
{t("ConfirmDialog.unit")} {t("ConfirmDialog.unit")}
</Typography> </Typography>
</Box> </Box>
<Box sx={{ border: '1px solid #ccc' ,p:2 , mb:2 , borderRadius: '8px'}}> <Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
<Typography sx={{color: "primary.main" , fontWeight: 500}}>{t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")}</Typography> <Typography sx={{
color: "primary.main",
fontWeight: 500
}}>{t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")}</Typography>
<Typography pt={1}> <Typography pt={1}>
{isNaN((detailsList?.data?.approved_amount) / 10) {isNaN((detailsList?.data?.approved_amount) / 10)
? "" ? ""
@@ -170,7 +177,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
<DialogContent> <DialogContent>
<Grid container spacing={2}> <Grid container spacing={2}>
<Grid item xs={hasImageShown ? 6 : 12}> <Grid item xs={hasImageShown ? 6 : 12}>
{loading ? <LinearProgress /> : {loading ? <LinearProgress/> :
<> <>
{numberShowBox()} {numberShowBox()}
{renderCustomAccordions()} {renderCustomAccordions()}
@@ -220,9 +227,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
</Stack> </Stack>
</Grid> </Grid>
<Grid item xs={6}> <Grid item xs={6}>
<Stack sx={{ display: hasImageShown ? 'flex' : 'none', alignItems: 'center', gap: 0.5 , justifyContent:'center'}}> <Stack sx={{
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/> display: hasImageShown ? 'flex' : 'none',
</Stack> alignItems: 'center',
gap: 0.5,
justifyContent: 'center'
}}>
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
</Stack>
</Grid> </Grid>
</Grid> </Grid>
</DialogContent> </DialogContent>
@@ -233,7 +245,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
</Button> </Button>
<Button onClick={formik.handleSubmit} variant="contained" color="primary" <Button onClick={formik.handleSubmit} variant="contained" color="primary"
disabled={formik.isSubmitting || !formik.isValid || disabled={formik.isSubmitting || !formik.isValid ||
hasAccordionOpened.some((opened) => !opened) } hasAccordionOpened.some((opened) => !opened)}
> >
{t("ConfirmDialog.button-confirm")} {t("ConfirmDialog.button-confirm")}
</Button> </Button>

View File

@@ -82,6 +82,44 @@ function DashboardTransportationAssistanceComponent() {
<Typography variant="body2">{renderedCellValue}</Typography> <Typography variant="body2">{renderedCellValue}</Typography>
), ),
}, },
{
accessorFn: (row) => row.proposed_amount,
id: "proposed_amount",
header: `${t("TransportationAssistance.proposed_amount")}`,
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.approved_amount,
id: "approved_amount",
header: t("TransportationAssistance.approved_amount"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{ {
accessorFn: (row) => accessorFn: (row) =>
moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"), moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"),