Merge branch 'develop' into 'feature/yasi_add_confirmation_check'
# Conflicts: # src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
NEXT_PUBLIC_API_NAME = "Loan Facilities Dashboard"
|
||||
NEXT_PUBLIC_API_VERSION = "1.25.4"
|
||||
NEXT_PUBLIC_API_VERSION = "1.25.6"
|
||||
NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa"
|
||||
NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"
|
||||
|
||||
|
||||
@@ -359,10 +359,21 @@
|
||||
"description": "توضیحات خود را وارد نمائید",
|
||||
"choose_file": "انتخاب فایل",
|
||||
"approved_amount": "مبلغ تصویب شده",
|
||||
"sakht_period": "دوره ساخت",
|
||||
"tanafos_period": "دوره تنفس",
|
||||
"approved_amount_error": "وارد کردن مبلغ تصویب شده الزامیست",
|
||||
"sakht_period_error": "وارد کردن دوره ساخت الزامیست",
|
||||
"tanafos_period_error": "وارد کردن دوره تنفس الزامیست",
|
||||
"approved_amount_positive": "مبلغ تصویب شده باید مثبت باشد",
|
||||
"approved_amount_number": "مبلغ تصویب شده باید عدد باشد",
|
||||
"sakht_period_positive": "دوره ساخت باید مثبت باشد",
|
||||
"tanafos_period_positive": "دوره تنفس باید مثبت باشد",
|
||||
"sakht_period_number": "دوره ساخت باید عدد باشد",
|
||||
"tanafos_period_number": "دوره تنفس باید عدد باشد",
|
||||
"toman": "میلیون تومان",
|
||||
"tanafos_period_month": "ماه",
|
||||
"approved_amount_title": "مبلغ تصویب شده کارگروه",
|
||||
"sakht_period_day": "روز",
|
||||
"proposed_amount_error": "وارد کردن مقدار پیشنهادی الزامیست",
|
||||
"proposed_amount": "مبلغ پیشنهادی",
|
||||
"proposed_amount_positive": "مقدار پیشنهادی باید مثبت باشد",
|
||||
@@ -546,6 +557,8 @@
|
||||
"LoanHistory": {
|
||||
"id": "کد یکتا",
|
||||
"name": "نام",
|
||||
"tanafos_period": "دوره تنفس",
|
||||
"sakht_period": "دوره ساخت",
|
||||
"national_id": "کد ملی",
|
||||
"phone_number": "موبایل",
|
||||
"proposed_amount": "مبلغ پیشنهادی",
|
||||
@@ -556,6 +569,7 @@
|
||||
"vehicle_type": "نوع ماشین",
|
||||
"state_name": "وضعیت درخواست",
|
||||
"history": "تاریخچه",
|
||||
"province_name": "استان",
|
||||
"Table_history_error": "خطا در دریافت اطلاعات",
|
||||
"history_report": "فایل ضمیمه",
|
||||
"Table_head_name": "نام",
|
||||
|
||||
@@ -137,17 +137,6 @@ function DashboardLoanHistoryComponent() {
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) =>
|
||||
moment(row.updated_at).locale("fa").format("HH:mm | yyyy/MM/DD"),
|
||||
id: "updated_at",
|
||||
header: t("LoanHistory.updated_at"),
|
||||
enableColumnFilter: false,
|
||||
datatype: "numeric",
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.navgan_id,
|
||||
id: "navgan_id",
|
||||
@@ -167,6 +156,46 @@ function DashboardLoanHistoryComponent() {
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.sakht_period,
|
||||
id: "sakht_period",
|
||||
header: t("LoanHistory.sakht_period"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals"
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.tanafos_period,
|
||||
id: "tanafos_period",
|
||||
header: t("LoanHistory.tanafos_period"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals"
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.province_name,
|
||||
id: "province_name",
|
||||
header: t("LoanHistory.province_name"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.vehicle_type,
|
||||
id: "vehicle_type",
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
DialogContent,
|
||||
FormHelperText,
|
||||
Grid,
|
||||
InputAdornment,
|
||||
LinearProgress,
|
||||
Stack,
|
||||
TextField,
|
||||
@@ -14,10 +15,7 @@ import {
|
||||
} from "@mui/material"
|
||||
import {useFormik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {
|
||||
CONFIRM_MACHINARY_OFFICE,
|
||||
CONFIRM_MACHINARY_OFFICE_DETAILS
|
||||
} from "@/core/data/apiRoutes";
|
||||
import {CONFIRM_MACHINARY_OFFICE, CONFIRM_MACHINARY_OFFICE_DETAILS} from "@/core/data/apiRoutes";
|
||||
import {useEffect, useState} from "react";
|
||||
import PriceField from "@/core/components/PriceField";
|
||||
import * as Yup from "yup";
|
||||
@@ -28,13 +26,13 @@ const vehicle_amount = {
|
||||
"اتوبوس": 7000,
|
||||
"مینی بوس": 2000,
|
||||
}
|
||||
const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , handleSizeChangeClick}) => {
|
||||
const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type, handleSizeChangeClick}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setfileType] = useState(null);
|
||||
const [fileName, setfileName] = useState(null);
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const requestServer = useRequest({auth: true , notification: false})
|
||||
const requestServer = useRequest({auth: true, notification: false})
|
||||
const {update_notification} = useNotification()
|
||||
const [accordionStates, setAccordionStates] = useState([]);
|
||||
const [hasImageShown, setHasImageShown] = useState(false);
|
||||
@@ -46,7 +44,7 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han
|
||||
useEffect(() => {
|
||||
requestServer(`${CONFIRM_MACHINARY_OFFICE_DETAILS}/${rowId}`, 'get')
|
||||
.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);
|
||||
setDetailsData(response.data)
|
||||
})
|
||||
@@ -60,13 +58,11 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han
|
||||
const newAccordionStates = accordionStates.map((state, i) => i === index ? !state : false);
|
||||
setAccordionStates(newAccordionStates);
|
||||
|
||||
if (!newAccordionStates[index])
|
||||
{
|
||||
if (!newAccordionStates[index]) {
|
||||
handleSizeChangeClick('sm');
|
||||
setHasImageShown(false);
|
||||
setIsSkeleton(false)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
handleSizeChangeClick('xl');
|
||||
setHasImageShown(true);
|
||||
setImageLink(detailsList.data.attachment_files[index])
|
||||
@@ -75,14 +71,26 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han
|
||||
};
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
proposed_amount: Yup.mixed().test(
|
||||
"is-number",
|
||||
`${t("ConfirmDialog.proposed_amount_number")}`,
|
||||
(value) => !isNaN(value)
|
||||
).test("max-amount", `${t("MachinaryOffice.max_amount", {value: parseInt(vehicle_amount[vehicle_type]).toLocaleString('en')})}`,
|
||||
(value) => value <= vehicle_amount[vehicle_type])
|
||||
proposed_amount: Yup.mixed()
|
||||
.test(
|
||||
"is-number",
|
||||
`${t("ConfirmDialog.proposed_amount_number")}`,
|
||||
(value) => !isNaN(value)
|
||||
)
|
||||
.test("max-amount", `${t("MachinaryOffice.max_amount", {value: parseInt(vehicle_amount[vehicle_type]).toLocaleString('en')})}`,
|
||||
(value) => value <= vehicle_amount[vehicle_type])
|
||||
.test("positive", `${t("ConfirmDialog.proposed_amount_positive")}`, (value) => value >= 0)
|
||||
.required(t("ConfirmDialog.proposed_amount_error")),
|
||||
sakht_period: Yup.mixed()
|
||||
.test("is-number", `${t("ConfirmDialog.sakht_period_number")}`,
|
||||
(value) => !isNaN(value))
|
||||
.test("positive", `${t("ConfirmDialog.sakht_period_positive")}`, (value) => value > 0)
|
||||
.required(t("ConfirmDialog.sakht_period_error")),
|
||||
tanafos_period: Yup.mixed()
|
||||
.test("is-number", `${t("ConfirmDialog.tanafos_period_number")}`,
|
||||
(value) => !isNaN(value))
|
||||
.test("positive", `${t("ConfirmDialog.tanafos_period_positive")}`, (value) => value > 0)
|
||||
.required(t("ConfirmDialog.tanafos_period_error")),
|
||||
confirm_img: Yup.mixed()
|
||||
.required(t("MachinaryOffice.upload_file_required"))
|
||||
.test('fileSize', `${t("MachinaryOffice.upload_file_unit")}`, (value) => {
|
||||
@@ -98,15 +106,20 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han
|
||||
initialValues: {
|
||||
description: "",
|
||||
proposed_amount: "",
|
||||
sakht_period: "",
|
||||
tanafos_period: "",
|
||||
confirm_img: null
|
||||
}, validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("proposed_amount", values.proposed_amount);
|
||||
formData.append("sakht_period", values.sakht_period);
|
||||
formData.append("tanafos_period", values.tanafos_period);
|
||||
if (values.description != "") formData.append("expert_description", values.description);
|
||||
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
|
||||
requestServer(`${CONFIRM_MACHINARY_OFFICE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
notification: true
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
@@ -166,7 +179,7 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han
|
||||
<DialogContent>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={hasImageShown ? 6 : 12}>
|
||||
{loading ? <LinearProgress /> : renderCustomAccordions()}
|
||||
{loading ? <LinearProgress/> : renderCustomAccordions()}
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
@@ -208,6 +221,54 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han
|
||||
fullWidth
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="sakht_period"
|
||||
label={t("ConfirmDialog.sakht_period")}
|
||||
type={'number'}
|
||||
value={formik.values.sakht_period}
|
||||
onChange={formik.handleChange}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{mt: 1}}
|
||||
onBlur={formik.handleBlur("sakht_period")}
|
||||
error={
|
||||
formik.touched.sakht_period &&
|
||||
Boolean(formik.errors.sakht_period)
|
||||
}
|
||||
helperText={
|
||||
formik.touched.sakht_period && formik.errors.sakht_period
|
||||
}
|
||||
InputProps={{
|
||||
endAdornment: <InputAdornment
|
||||
position="end">{t("ConfirmDialog.sakht_period_day")}</InputAdornment>,
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="tanafos_period"
|
||||
label={t("ConfirmDialog.tanafos_period")}
|
||||
type={'number'}
|
||||
value={formik.values.tanafos_period}
|
||||
onChange={formik.handleChange}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{mt: 1}}
|
||||
onBlur={formik.handleBlur("tanafos_period")}
|
||||
error={
|
||||
formik.touched.tanafos_period &&
|
||||
Boolean(formik.errors.tanafos_period)
|
||||
}
|
||||
helperText={
|
||||
formik.touched.tanafos_period && formik.errors.tanafos_period
|
||||
}
|
||||
InputProps={{
|
||||
endAdornment: <InputAdornment
|
||||
position="end">{t("ConfirmDialog.tanafos_period_month")}</InputAdornment>,
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>{t("MachinaryOffice.upload_file")}</Typography>
|
||||
<UploadSystem
|
||||
@@ -237,8 +298,13 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han
|
||||
</Stack>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Stack sx={{ display: hasImageShown ? 'flex' : 'none', alignItems: 'center', gap: 0.5 , justifyContent:'center'}}>
|
||||
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
|
||||
<Stack sx={{
|
||||
display: hasImageShown ? 'flex' : 'none',
|
||||
alignItems: 'center',
|
||||
gap: 0.5,
|
||||
justifyContent: 'center'
|
||||
}}>
|
||||
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
|
||||
</Stack>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -33,9 +33,15 @@ const Confirm = ({rowId, mutate, vehicle_type}) => {
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {transition: 'all .3s' , boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}} maxWidth={dialogSize}>
|
||||
PaperProps={{
|
||||
sx: {
|
||||
transition: 'all .3s',
|
||||
boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'
|
||||
}
|
||||
}} maxWidth={dialogSize}>
|
||||
<DialogTitle>{t("MachinaryOffice.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} handleSizeChangeClick={handleSizeChangeClick}
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog}
|
||||
handleSizeChangeClick={handleSizeChangeClick}
|
||||
vehicle_type={vehicle_type}/>
|
||||
</Dialog>
|
||||
</>
|
||||
|
||||
@@ -2,7 +2,6 @@ import UploadSystem from "@/core/components/UploadSystem";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
@@ -20,6 +19,7 @@ import {useEffect, useState} from "react";
|
||||
import * as Yup from "yup";
|
||||
import CustomAccordion from "@/core/components/CustomAccordion";
|
||||
import ImageContent from "@/core/components/ImageContent";
|
||||
import NumberShowBox from "@/core/components/NumberShowBox";
|
||||
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeClick}) => {
|
||||
const t = useTranslations();
|
||||
@@ -90,6 +90,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
|
||||
requestServer(`${CONFIRM_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
notification: true
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
@@ -137,35 +138,6 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
return null;
|
||||
};
|
||||
|
||||
const numberShowBox = () => {
|
||||
return (
|
||||
<>
|
||||
<Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
|
||||
<Typography
|
||||
sx={{color: "primary.main", fontWeight: 500}}>{t("ConfirmDialog.proposed_amount")}</Typography>
|
||||
<Typography pt={1}>
|
||||
{isNaN((detailsList?.data?.proposed_amount) / 10)
|
||||
? ""
|
||||
: ((detailsList?.data?.proposed_amount) / 10).toLocaleString()}{" "}
|
||||
{t("ConfirmDialog.unit")}
|
||||
</Typography>
|
||||
</Box>
|
||||
<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 pt={1}>
|
||||
{isNaN((detailsList?.data?.approved_amount) / 10)
|
||||
? ""
|
||||
: ((detailsList?.data?.approved_amount) / 10).toLocaleString()}{" "}
|
||||
{t("ConfirmDialog.unit")}
|
||||
</Typography>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
@@ -173,7 +145,26 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
<Grid item xs={hasImageShown ? 6 : 12}>
|
||||
{loading ? <LinearProgress/> :
|
||||
<>
|
||||
{numberShowBox()}
|
||||
<NumberShowBox
|
||||
showNumber={(detailsList?.data?.proposed_amount) / 10}
|
||||
headerTitle={t("ConfirmDialog.proposed_amount")}
|
||||
unitTitle={t("ConfirmDialog.unit")}
|
||||
/>
|
||||
<NumberShowBox
|
||||
showNumber={(detailsList?.data?.approved_amount) / 10}
|
||||
headerTitle={t("ConfirmDialog.approved_amount_title")}
|
||||
unitTitle={t("ConfirmDialog.unit")}
|
||||
/>
|
||||
<NumberShowBox
|
||||
showNumber={detailsList?.data?.sakht_period}
|
||||
headerTitle={t("ConfirmDialog.sakht_period")}
|
||||
unitTitle={t("ConfirmDialog.sakht_period_day")}
|
||||
/>
|
||||
<NumberShowBox
|
||||
showNumber={detailsList?.data?.tanafos_period}
|
||||
headerTitle={t("ConfirmDialog.tanafos_period")}
|
||||
unitTitle={t("ConfirmDialog.tanafos_period_month")}
|
||||
/>
|
||||
{renderCustomAccordions()}
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import UploadSystem from "@/core/components/UploadSystem";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
@@ -21,6 +20,7 @@ import PriceField from "@/core/components/PriceField";
|
||||
import * as Yup from "yup";
|
||||
import CustomAccordion from "@/core/components/CustomAccordion";
|
||||
import ImageContent from "@/core/components/ImageContent";
|
||||
import NumberShowBox from "@/core/components/NumberShowBox";
|
||||
|
||||
const vehicle_amount = {
|
||||
"اتوبوس": 7000,
|
||||
@@ -105,6 +105,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand
|
||||
|
||||
requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
notification: true
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
@@ -158,22 +159,6 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const numberShowBox = () => {
|
||||
return (
|
||||
<>
|
||||
<Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
|
||||
<Typography
|
||||
sx={{color: "primary.main", fontWeight: 500}}>{t("ConfirmDialog.proposed_amount")}</Typography>
|
||||
<Typography pt={1}>
|
||||
{isNaN((detailsList?.data?.proposed_amount) / 10)
|
||||
? ""
|
||||
: ((detailsList?.data?.proposed_amount) / 10).toLocaleString()}{" "}
|
||||
{t("ConfirmDialog.unit")}
|
||||
</Typography>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -182,7 +167,21 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand
|
||||
<Grid item xs={hasImageShown ? 6 : 12}>
|
||||
{loading ? <LinearProgress/> :
|
||||
<>
|
||||
{numberShowBox()}
|
||||
<NumberShowBox
|
||||
showNumber={(detailsList?.data?.proposed_amount) / 10}
|
||||
headerTitle={t("ConfirmDialog.proposed_amount")}
|
||||
unitTitle={t("ConfirmDialog.unit")}
|
||||
/>
|
||||
<NumberShowBox
|
||||
showNumber={detailsList?.data?.sakht_period}
|
||||
headerTitle={t("ConfirmDialog.sakht_period")}
|
||||
unitTitle={t("ConfirmDialog.sakht_period_day")}
|
||||
/>
|
||||
<NumberShowBox
|
||||
showNumber={detailsList?.data?.tanafos_period}
|
||||
headerTitle={t("ConfirmDialog.tanafos_period")}
|
||||
unitTitle={t("ConfirmDialog.tanafos_period_month")}
|
||||
/>
|
||||
{renderCustomAccordions()}
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import {useEffect, useState} from "react";
|
||||
import * as Yup from "yup";
|
||||
import CustomAccordion from "@/core/components/CustomAccordion";
|
||||
import ImageContent from "@/core/components/ImageContent";
|
||||
import NumberShowBox from "@/core/components/NumberShowBox";
|
||||
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeClick}) => {
|
||||
const t = useTranslations();
|
||||
@@ -97,6 +98,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
|
||||
requestServer(`${CONFIRM_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
notification: true
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
@@ -146,34 +148,6 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const numberShowBox = () => {
|
||||
return (
|
||||
<>
|
||||
<Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
|
||||
<Typography
|
||||
sx={{color: "primary.main", fontWeight: 500}}>{t("ConfirmDialog.proposed_amount")}</Typography>
|
||||
<Typography pt={1}>
|
||||
{isNaN((detailsList?.data?.proposed_amount) / 10)
|
||||
? ""
|
||||
: ((detailsList?.data?.proposed_amount) / 10).toLocaleString()}{" "}
|
||||
{t("ConfirmDialog.unit")}
|
||||
</Typography>
|
||||
</Box>
|
||||
<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 pt={1}>
|
||||
{isNaN((detailsList?.data?.approved_amount) / 10)
|
||||
? ""
|
||||
: ((detailsList?.data?.approved_amount) / 10).toLocaleString()}{" "}
|
||||
{t("ConfirmDialog.unit")}
|
||||
</Typography>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
@@ -181,7 +155,26 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
<Grid item xs={hasImageShown ? 6 : 12}>
|
||||
{loading ? <LinearProgress/> :
|
||||
<>
|
||||
{numberShowBox()}
|
||||
<NumberShowBox
|
||||
showNumber={(detailsList?.data?.proposed_amount) / 10}
|
||||
headerTitle={t("ConfirmDialog.proposed_amount")}
|
||||
unitTitle={t("ConfirmDialog.unit")}
|
||||
/>
|
||||
<NumberShowBox
|
||||
showNumber={(detailsList?.data?.approved_amount) / 10}
|
||||
headerTitle={t("ConfirmDialog.approved_amount_title")}
|
||||
unitTitle={t("ConfirmDialog.unit")}
|
||||
/>
|
||||
<NumberShowBox
|
||||
showNumber={detailsList?.data?.sakht_period}
|
||||
headerTitle={t("ConfirmDialog.sakht_period")}
|
||||
unitTitle={t("ConfirmDialog.sakht_period_day")}
|
||||
/>
|
||||
<NumberShowBox
|
||||
showNumber={detailsList?.data?.tanafos_period}
|
||||
headerTitle={t("ConfirmDialog.tanafos_period")}
|
||||
unitTitle={t("ConfirmDialog.tanafos_period_month")}
|
||||
/>
|
||||
{renderCustomAccordions()}
|
||||
</>
|
||||
}
|
||||
|
||||
19
src/core/components/NumberShowBox.jsx
Normal file
19
src/core/components/NumberShowBox.jsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import {Box, Typography} from "@mui/material";
|
||||
|
||||
const NumberShowBox = ({showNumber, headerTitle, unitTitle}) => {
|
||||
return (
|
||||
<>
|
||||
<Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
|
||||
<Typography
|
||||
sx={{color: "primary.main", fontWeight: 500}}>{headerTitle}</Typography>
|
||||
<Typography pt={1}>
|
||||
{isNaN(showNumber) || showNumber === null
|
||||
? ""
|
||||
: (showNumber).toLocaleString()}{" "}
|
||||
{unitTitle}
|
||||
</Typography>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default NumberShowBox
|
||||
Reference in New Issue
Block a user