change titles
This commit is contained in:
@@ -15,10 +15,7 @@ import {
|
||||
} from "@mui/material"
|
||||
import {useFormik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {
|
||||
CONFIRM_NAVGAN_PROVINCE_MANAGER,
|
||||
CONFIRM_PROVINCE_MANAGER_DETAILS
|
||||
} from "@/core/data/apiRoutes";
|
||||
import {CONFIRM_NAVGAN_PROVINCE_MANAGER, CONFIRM_PROVINCE_MANAGER_DETAILS} from "@/core/data/apiRoutes";
|
||||
import {useEffect, useState} from "react";
|
||||
import * as Yup from "yup";
|
||||
import CustomAccordion from "@/core/components/CustomAccordion";
|
||||
@@ -30,7 +27,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
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);
|
||||
@@ -55,7 +52,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
useEffect(() => {
|
||||
requestServer(`${CONFIRM_PROVINCE_MANAGER_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)
|
||||
})
|
||||
@@ -69,13 +66,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
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])
|
||||
@@ -143,28 +138,32 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
};
|
||||
|
||||
const numberShowBox = () => {
|
||||
return (
|
||||
<>
|
||||
<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 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 (
|
||||
<>
|
||||
<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 (
|
||||
@@ -172,10 +171,10 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
<DialogContent>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={hasImageShown ? 6 : 12}>
|
||||
{loading ? <LinearProgress /> :
|
||||
{loading ? <LinearProgress/> :
|
||||
<>
|
||||
{numberShowBox()}
|
||||
{renderCustomAccordions()}
|
||||
{numberShowBox()}
|
||||
{renderCustomAccordions()}
|
||||
</>
|
||||
}
|
||||
<Stack spacing={2}>
|
||||
@@ -222,8 +221,13 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
</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>
|
||||
|
||||
@@ -15,10 +15,7 @@ import {
|
||||
} from "@mui/material"
|
||||
import {useFormik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {
|
||||
CONFIRM_PASSENGER_BOSS,
|
||||
EXPORT_PASSENGER_BOSS_DETAILS,
|
||||
} from "@/core/data/apiRoutes";
|
||||
import {CONFIRM_PASSENGER_BOSS, EXPORT_PASSENGER_BOSS_DETAILS,} from "@/core/data/apiRoutes";
|
||||
import {useEffect, useState} from "react";
|
||||
import PriceField from "@/core/components/PriceField";
|
||||
import * as Yup from "yup";
|
||||
@@ -29,13 +26,13 @@ const vehicle_amount = {
|
||||
"اتوبوس": 7000,
|
||||
"مینی بوس": 2000,
|
||||
}
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , handleSizeChangeClick}) => {
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, 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);
|
||||
@@ -47,7 +44,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han
|
||||
useEffect(() => {
|
||||
requestServer(`${EXPORT_PASSENGER_BOSS_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)
|
||||
})
|
||||
@@ -61,13 +58,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, 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])
|
||||
@@ -166,8 +161,9 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han
|
||||
const numberShowBox = () => {
|
||||
return (
|
||||
<>
|
||||
<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>
|
||||
<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)
|
||||
? ""
|
||||
@@ -184,7 +180,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han
|
||||
<DialogContent>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={hasImageShown ? 6 : 12}>
|
||||
{loading ? <LinearProgress /> :
|
||||
{loading ? <LinearProgress/> :
|
||||
<>
|
||||
{numberShowBox()}
|
||||
{renderCustomAccordions()}
|
||||
@@ -260,8 +256,13 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, 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>
|
||||
|
||||
@@ -6,7 +6,9 @@ import {
|
||||
Button,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
FormHelperText, Grid, LinearProgress,
|
||||
FormHelperText,
|
||||
Grid,
|
||||
LinearProgress,
|
||||
Stack,
|
||||
TextField,
|
||||
Typography
|
||||
@@ -18,13 +20,14 @@ import {useEffect, useState} from "react";
|
||||
import * as Yup from "yup";
|
||||
import CustomAccordion from "@/core/components/CustomAccordion";
|
||||
import ImageContent from "@/core/components/ImageContent";
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeClick}) => {
|
||||
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, 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 [accordionStates, setAccordionStates] = useState([]);
|
||||
const [hasAccordionOpened, setHasAccordionOpened] = useState([]);
|
||||
const {update_notification} = useNotification();
|
||||
@@ -37,14 +40,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
|
||||
useEffect(() => {
|
||||
requestServer(`${GET_TRANSPORTATION_ASSISTANCE_DETAILS}/${rowId}`, 'get')
|
||||
.then((response) => {
|
||||
const booleanData = Array.from({ length: response.data.data.attachment_files.length }, () => false);
|
||||
setAccordionStates(booleanData);
|
||||
setHasAccordionOpened(booleanData);
|
||||
setDetailsData(response.data)
|
||||
const booleanData = Array.from({length: response.data.data.attachment_files.length}, () => false);
|
||||
setAccordionStates(booleanData);
|
||||
setHasAccordionOpened(booleanData);
|
||||
setDetailsData(response.data)
|
||||
})
|
||||
.catch(() => {
|
||||
}).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);
|
||||
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])
|
||||
@@ -144,8 +145,9 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
|
||||
const numberShowBox = () => {
|
||||
return (
|
||||
<>
|
||||
<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>
|
||||
<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)
|
||||
? ""
|
||||
@@ -153,8 +155,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
|
||||
{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>
|
||||
<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)
|
||||
? ""
|
||||
@@ -170,7 +175,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
|
||||
<DialogContent>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={hasImageShown ? 6 : 12}>
|
||||
{loading ? <LinearProgress /> :
|
||||
{loading ? <LinearProgress/> :
|
||||
<>
|
||||
{numberShowBox()}
|
||||
{renderCustomAccordions()}
|
||||
@@ -220,9 +225,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
|
||||
</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>
|
||||
<Stack sx={{
|
||||
display: hasImageShown ? 'flex' : 'none',
|
||||
alignItems: 'center',
|
||||
gap: 0.5,
|
||||
justifyContent: 'center'
|
||||
}}>
|
||||
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
|
||||
</Stack>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DialogContent>
|
||||
@@ -233,7 +243,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
|
||||
</Button>
|
||||
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
|
||||
disabled={formik.isSubmitting || !formik.isValid ||
|
||||
hasAccordionOpened.some((opened) => !opened) }
|
||||
hasAccordionOpened.some((opened) => !opened)}
|
||||
>
|
||||
{t("ConfirmDialog.button-confirm")}
|
||||
</Button>
|
||||
|
||||
@@ -37,7 +37,7 @@ const sidebarMenu = [
|
||||
},
|
||||
{
|
||||
key: "sidebar.passenger-office-chief",
|
||||
secondary: "secondary.passenger-office",
|
||||
secondary: "secondary.navgan-province-manager",
|
||||
name: "passenger_office_chief",
|
||||
type: "page",
|
||||
route: "/dashboard/passenger-office-chief",
|
||||
@@ -47,6 +47,7 @@ const sidebarMenu = [
|
||||
},
|
||||
{
|
||||
key: "sidebar.machinery-expert",
|
||||
secondary: "secondary.navgan-province-manager",
|
||||
name: "machinery_expert",
|
||||
type: "page",
|
||||
route: "/dashboard/machinery-expert",
|
||||
@@ -56,7 +57,7 @@ const sidebarMenu = [
|
||||
},
|
||||
{
|
||||
key: "sidebar.passenger-boss",
|
||||
secondary: "secondary.passenger-boss",
|
||||
secondary: "secondary.navgan-province-manager",
|
||||
name: "province_working_group",
|
||||
type: "page",
|
||||
route: "/dashboard/passenger-boss",
|
||||
@@ -67,6 +68,7 @@ const sidebarMenu = [
|
||||
|
||||
{
|
||||
key: "sidebar.transportation-assistant",
|
||||
secondary: "secondary.navgan-province-manager",
|
||||
name: "transportation_assistant",
|
||||
type: "page",
|
||||
route: "/dashboard/transportation-assistant",
|
||||
|
||||
Reference in New Issue
Block a user