passengers boss forms A B
This commit is contained in:
@@ -264,13 +264,10 @@
|
||||
"vehicle_type": "نوع ماشین",
|
||||
"state_name": "وضعیت درخواست",
|
||||
"confirm": "ارجاع به معاون حمل و نقل",
|
||||
"upload_file": "صورت جلسه کارگروه را بارگذاری کنید",
|
||||
"upload_file_first_required": "وارد کردن فرم الف الزامیست",
|
||||
"upload_file_second_required": "وارد کردن فرم ب الزامیست",
|
||||
"upload_file": "فایل خود را بارگذاری کنید(اختیاری)",
|
||||
"upload_file_required": "وارد کردن گزارش کارشناسی الزامیست",
|
||||
"upload_file_unit": "فایل بارگذاری شده باید حداکثر 5Mb باشد",
|
||||
"upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
|
||||
"print_form_a": "چاپ فرم الف",
|
||||
"print_form_b": "چاپ فرم ب",
|
||||
"max_amount": "حداکثر مبلغ تصویب شده {value} میلیون ریال می باشد",
|
||||
"excel_report": "گزارش اکسل",
|
||||
"first_form": "فرم الف را بارگذاری کنید",
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
import {useTranslations} from "next-intl";
|
||||
import {useRouter} from "next/router";
|
||||
import {useState} from "react";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import usePrint from "@/lib/app/hooks/usePrint";
|
||||
import {Button, CircularProgress} from "@mui/material";
|
||||
import PrintIcon from "@mui/icons-material/Print";
|
||||
import {GET_PASSENGER_BOSS} from "@/core/data/apiRoutes";
|
||||
|
||||
const PrintFormA = () => {
|
||||
const t = useTranslations();
|
||||
const router = useRouter()
|
||||
const [loading, setLoading] = useState(false)
|
||||
const requestServer = useRequest({auth: true, pending: false, success: {notification: {show: false}}})
|
||||
const {setPrintPage, setPrintTitle} = usePrint()
|
||||
|
||||
const filterRequest = async (filterArr) => {
|
||||
setLoading(true);
|
||||
|
||||
const requests = filterArr.map(async (item) => {
|
||||
try {
|
||||
const params = new URLSearchParams();
|
||||
params.set("start", '0');
|
||||
params.set("filters", JSON.stringify([item]));
|
||||
params.set("sorting", '[]');
|
||||
|
||||
const response = await requestServer(`${GET_PASSENGER_BOSS}?${params}`, 'get');
|
||||
const _chunkSize = 6;
|
||||
const _data = response.data.data;
|
||||
const chunk = Array.from({length: Math.ceil(_data.length / _chunkSize)}, (v, i) =>
|
||||
_data.slice(i * _chunkSize, i * _chunkSize + _chunkSize)
|
||||
);
|
||||
return chunk;
|
||||
} catch (error) {
|
||||
setLoading(false);
|
||||
throw error; // Propagate the error
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
const chunks = await Promise.all(requests);
|
||||
setLoading(false);
|
||||
return chunks.flat(); // Flatten the chunks into a single array
|
||||
} catch (error) {
|
||||
console.error("Error processing requests:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const clickHandler = async () => {
|
||||
try {
|
||||
const chunks = await filterRequest([
|
||||
{
|
||||
id: "vehicle_type",
|
||||
value: "اتوبوس",
|
||||
fn: "contains",
|
||||
datatype: "text",
|
||||
},
|
||||
{
|
||||
id: "vehicle_type",
|
||||
value: "مینی بوس",
|
||||
fn: "contains",
|
||||
datatype: "text",
|
||||
},
|
||||
]);
|
||||
setPrintPage(chunks.length);
|
||||
setPrintTitle(t('PassengerBoss.print_form_a'));
|
||||
sessionStorage.setItem('form-a-print', JSON.stringify(chunks));
|
||||
router.push('/dashboard/passenger-boss/prints/form-a');
|
||||
} catch (error) {
|
||||
console.error("Error in clickHandler:", error);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Button
|
||||
color="primary"
|
||||
variant="contained"
|
||||
size="small"
|
||||
disabled={loading}
|
||||
sx={{textTransform: "unset", alignSelf: "center"}}
|
||||
startIcon={loading ? <CircularProgress size={18} color="inherit"/> : <PrintIcon/>}
|
||||
onClick={clickHandler}
|
||||
>
|
||||
{t("PassengerBoss.print_form_a")}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export default PrintFormA
|
||||
@@ -1,47 +0,0 @@
|
||||
import {useTranslations} from "next-intl";
|
||||
import {useRouter} from "next/router";
|
||||
import {useState} from "react";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import usePrint from "@/lib/app/hooks/usePrint";
|
||||
import {GET_PASSENGER_BOSS} from "@/core/data/apiRoutes";
|
||||
import {Button, CircularProgress} from "@mui/material";
|
||||
import PrintIcon from "@mui/icons-material/Print";
|
||||
|
||||
const PrintFormB = () => {
|
||||
const t = useTranslations();
|
||||
const router = useRouter()
|
||||
const [loading, setLoading] = useState(false)
|
||||
const requestServer = useRequest({auth: true, pending: false, success: {notification: {show: false}}})
|
||||
const {setPrintPage, setPrintTitle} = usePrint()
|
||||
const clickHandler = () => {
|
||||
setLoading(true)
|
||||
const params = new URLSearchParams();
|
||||
params.set("start", '0');
|
||||
params.set("filters", '[]');
|
||||
params.set("sorting", '[]');
|
||||
requestServer(`${GET_PASSENGER_BOSS}?${params}`, 'get').then((response) => {
|
||||
const _data = response.data.data
|
||||
setPrintPage(_data.length)
|
||||
setPrintTitle(t('PassengerBoss.print_form_b'))
|
||||
sessionStorage.setItem('form-b-print', JSON.stringify(_data))
|
||||
router.push('/dashboard/passenger-boss/prints/form-b')
|
||||
}).catch(() => {
|
||||
setLoading(false)
|
||||
})
|
||||
}
|
||||
return (
|
||||
<Button
|
||||
color="primary"
|
||||
variant="contained"
|
||||
size="small"
|
||||
disabled={loading}
|
||||
sx={{textTransform: "unset", alignSelf: "center"}}
|
||||
startIcon={loading ? <CircularProgress size={18} color="inherit"/> : <PrintIcon/>}
|
||||
onClick={clickHandler}
|
||||
>
|
||||
{t("PassengerBoss.print_form_b")}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export default PrintFormB
|
||||
@@ -28,14 +28,10 @@ const vehicle_amount = {
|
||||
}
|
||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, handleSizeChangeClick}) => {
|
||||
const t = useTranslations();
|
||||
const [selectedImageAForm, setSelectedImageAForm] = useState("");
|
||||
const [selectedImageBForm, setSelectedImageBForm] = useState("");
|
||||
const [fileTypesA, setFileTypesA] = useState(null);
|
||||
const [fileNamesA, setFileNamesA] = useState(null);
|
||||
const [fileTypesB, setFileTypesB] = useState(null);
|
||||
const [fileNamesB, setFileNamesB] = useState(null);
|
||||
const [showAddIconA, setShowAddIconA] = useState(true);
|
||||
const [showAddIconB, setShowAddIconB] = useState(true);
|
||||
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 {update_notification} = useNotification();
|
||||
const [attachmentsData, setAttachmentsData] = useState([]);
|
||||
@@ -98,22 +94,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand
|
||||
(value) => value <= vehicle_amount[vehicle_type])
|
||||
.test("positive", `${t("ConfirmDialog.approved_amount_positive")}`, (value) => value >= 0)
|
||||
.required(t("ConfirmDialog.approved_amount_error")),
|
||||
first_img: Yup.mixed()
|
||||
.required(t("PassengerBoss.upload_file_first_required"))
|
||||
confirm_img: Yup.mixed().notRequired(t("ConfirmDialog.approved_amount_error"))
|
||||
.test('fileSize', `${t("PassengerBoss.upload_file_unit")}`, (value) => {
|
||||
if (!value) return true
|
||||
return value.size <= 5 * 1024 * 1024;
|
||||
})
|
||||
.test('fileType', `${t("PassengerBoss.upload_file_format")}`, (value) => {
|
||||
const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf']; // Define your allowed file types
|
||||
return allowedTypes.includes(value.type);
|
||||
}),
|
||||
second_img: Yup.mixed()
|
||||
.required(t("PassengerBoss.upload_file_second_required"))
|
||||
.test('fileSize', `${t("PassengerBoss.upload_file_unit")}`, (value) => {
|
||||
return value.size <= 5 * 1024 * 1024;
|
||||
})
|
||||
.test('fileType', `${t("PassengerBoss.upload_file_format")}`, (value) => {
|
||||
const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf']; // Define your allowed file types
|
||||
if (!value) return true
|
||||
const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf'];
|
||||
return allowedTypes.includes(value.type);
|
||||
})
|
||||
});
|
||||
@@ -122,25 +110,25 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand
|
||||
initialValues: {
|
||||
description: "",
|
||||
approved_amount: "",
|
||||
first_img: null,
|
||||
second_img: null
|
||||
confirm_img: null,
|
||||
}, validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append("approved_amount", values.approved_amount);
|
||||
|
||||
if (values.description != "") formData.append("expert_description", values.description);
|
||||
|
||||
const attachments = [
|
||||
{title: 'فرم الف', file: values.first_img},
|
||||
{title: 'فرم ب', file: values.second_img}
|
||||
];
|
||||
|
||||
attachments.forEach((attachment, index) => {
|
||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||
formData.append(`attachment[${index}][file]`, attachment.file);
|
||||
});
|
||||
if (values.confirm_img != null) {
|
||||
const attachments = [
|
||||
{
|
||||
title: "فایل ضمیمه کارتابل کارگروه",
|
||||
file: values.confirm_img
|
||||
}
|
||||
];
|
||||
attachments.forEach((attachment, index) => {
|
||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||
formData.append(`attachment[${index}][file]`, attachment.file);
|
||||
});
|
||||
}
|
||||
|
||||
requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, 'post', {
|
||||
notification: true,
|
||||
@@ -160,32 +148,18 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand
|
||||
formik.setFieldValue("description", event.target.value)
|
||||
};
|
||||
|
||||
const handleUploadChangeAForm = (event) => {
|
||||
const handleUploadChange = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImageAForm(URL.createObjectURL(uploadedFile));
|
||||
setFileTypesA(fileType);
|
||||
setFileNamesA(fileName);
|
||||
formik.setFieldValue("first_img", uploadedFile).then(() => {
|
||||
formik.setFieldTouched("first_img", true);
|
||||
setSelectedImage(URL.createObjectURL(uploadedFile));
|
||||
setFileType(fileType);
|
||||
setFileName(fileName);
|
||||
formik.setFieldValue("confirm_img", uploadedFile).then(() => {
|
||||
formik.setFieldTouched("confirm_img", true);
|
||||
})
|
||||
setShowAddIconA(false);
|
||||
}
|
||||
};
|
||||
const handleUploadChangeBForm = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImageBForm(URL.createObjectURL(uploadedFile));
|
||||
setFileTypesB(fileType);
|
||||
setFileNamesB(fileName);
|
||||
formik.setFieldValue("second_img", uploadedFile).then(() => {
|
||||
formik.setFieldTouched("second_img", true);
|
||||
})
|
||||
setShowAddIconB(false);
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
const handleAmountChange = (event) => {
|
||||
@@ -279,60 +253,30 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<Typography>{t("PassengerBoss.first_form")}</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImageAForm}
|
||||
handleUploadChange={handleUploadChangeAForm} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImageAForm}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="first_img"
|
||||
fileType={fileTypesA}
|
||||
fileName={fileNamesA}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
setShowAddIcon={setShowAddIconA}
|
||||
showAddIcon={showAddIconA}
|
||||
onBlur={() => formik.handleBlur("first_img")}
|
||||
error={
|
||||
formik.touched.first_img &&
|
||||
Boolean(formik.errors.first_img)
|
||||
}
|
||||
/>
|
||||
<FormHelperText
|
||||
error={Boolean(formik.errors.first_img)}
|
||||
>
|
||||
{formik.touched.first_img && formik.errors.first_img}
|
||||
</FormHelperText>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<Typography>{t("PassengerBoss.second_form")}</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImageBForm}
|
||||
handleUploadChange={handleUploadChangeBForm} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImageBForm}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="second_img"
|
||||
fileType={fileTypesB} // Use fileTypes array at index 0 for the first instance
|
||||
fileName={fileNamesB}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
setShowAddIcon={setShowAddIconB}
|
||||
showAddIcon={showAddIconB}
|
||||
onBlur={() => formik.handleBlur("second_img")}
|
||||
error={
|
||||
formik.touched.second_img &&
|
||||
Boolean(formik.errors.second_img)
|
||||
}
|
||||
/>
|
||||
<FormHelperText
|
||||
error={Boolean(formik.errors.second_img)}
|
||||
>
|
||||
{formik.touched.second_img && formik.errors.second_img}
|
||||
</FormHelperText>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Typography>{t("PassengerBoss.upload_file")}</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImage}
|
||||
handleUploadChange={handleUploadChange}
|
||||
setselectedImage={setSelectedImage}
|
||||
setFieldValue={formik.setFieldValue}
|
||||
fieldname="confirm_img"
|
||||
fileType={fileType}
|
||||
fileName={fileName}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
onBlur={formik.handleBlur("confirm_img")}
|
||||
error={
|
||||
formik.touched.confirm_img &&
|
||||
Boolean(formik.errors.confirm_img)
|
||||
}
|
||||
setShowAddIcon={setShowAddIcon}
|
||||
showAddIcon={showAddIcon}
|
||||
/>
|
||||
<FormHelperText
|
||||
error={Boolean(formik.errors.confirm_img)}
|
||||
>
|
||||
{formik.touched.confirm_img && formik.errors.confirm_img}
|
||||
</FormHelperText>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Grid>
|
||||
|
||||
@@ -9,38 +9,24 @@ import * as Yup from "yup";
|
||||
import {REJECT_PASSENGER_BOSS} from "@/core/data/apiRoutes";
|
||||
|
||||
const RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const [selectedImageAForm, setSelectedImageAForm] = useState("");
|
||||
const [selectedImageBForm, setSelectedImageBForm] = useState("");
|
||||
const [fileTypesA, setFileTypesA] = useState(null);
|
||||
const [fileNamesA, setFileNamesA] = useState(null);
|
||||
const [fileTypesB, setFileTypesB] = useState(null);
|
||||
const [fileNamesB, setFileNamesB] = useState(null);
|
||||
const [showAddIconA, setShowAddIconA] = useState(true);
|
||||
const [showAddIconB, setShowAddIconB] = useState(true);
|
||||
const [selectedImage, setSelectedImage] = useState("");
|
||||
const [fileType, setFileType] = useState(null);
|
||||
const [fileName, setFileName] = useState(null);
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest({auth: true})
|
||||
const {update_notification} = useNotification()
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
|
||||
first_reject_img: Yup.mixed()
|
||||
.required(t("PassengerBoss.upload_file_first_required"))
|
||||
confirm_img: Yup.mixed().notRequired(t("ConfirmDialog.approved_amount_error"))
|
||||
.test('fileSize', `${t("PassengerBoss.upload_file_unit")}`, (value) => {
|
||||
if (!value) return true
|
||||
return value.size <= 5 * 1024 * 1024;
|
||||
})
|
||||
.test('fileType', `${t("PassengerBoss.upload_file_format")}`, (value) => {
|
||||
const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf']; // Define your allowed file types
|
||||
return allowedTypes.includes(value.type);
|
||||
}),
|
||||
|
||||
second_reject_img: Yup.mixed()
|
||||
.required(t("PassengerBoss.upload_file_second_required"))
|
||||
.test('fileSize', `${t("PassengerBoss.upload_file_unit")}`, (value) => {
|
||||
return value.size <= 5 * 1024 * 1024;
|
||||
})
|
||||
.test('fileType', `${t("PassengerBoss.upload_file_format")}`, (value) => {
|
||||
const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf']; // Define your allowed file types
|
||||
if (!value) return true
|
||||
const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf'];
|
||||
return allowedTypes.includes(value.type);
|
||||
})
|
||||
});
|
||||
@@ -48,23 +34,24 @@ const RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
first_reject_img: null,
|
||||
second_reject_img:null
|
||||
confirm_img: null,
|
||||
},
|
||||
validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("expert_description", values.description);
|
||||
|
||||
const attachments = [
|
||||
{ title: 'فرم الف', file: values.first_reject_img },
|
||||
{ title: 'فرم ب', file: values.second_reject_img }
|
||||
];
|
||||
|
||||
attachments.forEach((attachment, index) => {
|
||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||
formData.append(`attachment[${index}][file]`, attachment.file);
|
||||
});
|
||||
if (values.confirm_img != null) {
|
||||
const attachments = [
|
||||
{
|
||||
title: "فایل ضمیمه کارتابل کارگروه",
|
||||
file: values.confirm_img
|
||||
}
|
||||
];
|
||||
attachments.forEach((attachment, index) => {
|
||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||
formData.append(`attachment[${index}][file]`, attachment.file);
|
||||
});
|
||||
}
|
||||
|
||||
requestServer(`${REJECT_PASSENGER_BOSS}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
@@ -83,32 +70,18 @@ const RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
formik.handleChange(event);
|
||||
};
|
||||
const handleUploadChangeAForm = (event) => {
|
||||
const handleUploadChange = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImageAForm(URL.createObjectURL(uploadedFile));
|
||||
setFileTypesA(fileType);
|
||||
setFileNamesA(fileName);
|
||||
formik.setFieldValue("first_reject_img", uploadedFile).then(() => {
|
||||
formik.setFieldTouched("first_reject_img", true);
|
||||
setSelectedImage(URL.createObjectURL(uploadedFile));
|
||||
setFileType(fileType);
|
||||
setFileName(fileName);
|
||||
formik.setFieldValue("confirm_img", uploadedFile).then(() => {
|
||||
formik.setFieldTouched("confirm_img", true);
|
||||
})
|
||||
setShowAddIconA(false);
|
||||
}
|
||||
};
|
||||
const handleUploadChangeBForm = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImageBForm(URL.createObjectURL(uploadedFile));
|
||||
setFileTypesB(fileType);
|
||||
setFileNamesB(fileName);
|
||||
formik.setFieldValue("second_reject_img", uploadedFile).then(() => {
|
||||
formik.setFieldTouched("second_reject_img", true);
|
||||
})
|
||||
setShowAddIconB(false);
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
@@ -134,60 +107,30 @@ const RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<Typography>{t("PassengerBoss.first_form")}</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImageAForm}
|
||||
handleUploadChange={handleUploadChangeAForm} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImageAForm}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="first_reject_img"
|
||||
fileType={fileTypesA}
|
||||
fileName={fileNamesA}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
setShowAddIcon={setShowAddIconA}
|
||||
showAddIcon={showAddIconA}
|
||||
onBlur={() => formik.handleBlur("first_reject_img")}
|
||||
error={
|
||||
formik.touched.first_reject_img &&
|
||||
Boolean(formik.errors.first_reject_img)
|
||||
}
|
||||
/>
|
||||
<FormHelperText
|
||||
error={Boolean(formik.errors.first_reject_img)}
|
||||
>
|
||||
{formik.touched.first_reject_img && formik.errors.first_reject_img}
|
||||
</FormHelperText>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<Typography>{t("PassengerBoss.second_form")}</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImageBForm}
|
||||
handleUploadChange={handleUploadChangeBForm} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImageBForm}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="second_reject_img"
|
||||
fileType={fileTypesB} // Use fileTypes array at index 0 for the first instance
|
||||
fileName={fileNamesB}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
setShowAddIcon={setShowAddIconB}
|
||||
showAddIcon={showAddIconB}
|
||||
onBlur={() => formik.handleBlur("second_reject_img")}
|
||||
error={
|
||||
formik.touched.second_reject_img &&
|
||||
Boolean(formik.errors.second_reject_img)
|
||||
}
|
||||
/>
|
||||
<FormHelperText
|
||||
error={Boolean(formik.errors.second_reject_img)}
|
||||
>
|
||||
{formik.touched.second_reject_img && formik.errors.second_reject_img}
|
||||
</FormHelperText>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Typography>{t("PassengerBoss.upload_file")}</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImage}
|
||||
handleUploadChange={handleUploadChange}
|
||||
setselectedImage={setSelectedImage}
|
||||
setFieldValue={formik.setFieldValue}
|
||||
fieldname="confirm_img"
|
||||
fileType={fileType}
|
||||
fileName={fileName}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
onBlur={formik.handleBlur("confirm_img")}
|
||||
error={
|
||||
formik.touched.confirm_img &&
|
||||
Boolean(formik.errors.confirm_img)
|
||||
}
|
||||
setShowAddIcon={setShowAddIcon}
|
||||
showAddIcon={showAddIcon}
|
||||
/>
|
||||
<FormHelperText
|
||||
error={Boolean(formik.errors.confirm_img)}
|
||||
>
|
||||
{formik.touched.confirm_img && formik.errors.confirm_img}
|
||||
</FormHelperText>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import {Stack} from "@mui/material";
|
||||
import PrintExcel from "@/components/dashboard/passenger-boss/Buttons/printExcel";
|
||||
import PrintFormB from "@/components/dashboard/passenger-boss/Buttons/printFormB";
|
||||
import PrintFormA from "@/components/dashboard/passenger-boss/Buttons/printFormA";
|
||||
|
||||
const TableToolbar = ({table}) => {
|
||||
return (
|
||||
<Stack direction={"row"} spacing={2}>
|
||||
<PrintFormA/>
|
||||
<PrintFormB/>
|
||||
<PrintExcel table={table}/>
|
||||
</Stack>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user