Merge branch 'develop' of https://gitlab.com/witel-front-end/loan-facilities/expert into feature/yasi_add_extra_file
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"
|
||||
|
||||
|
||||
@@ -299,7 +299,8 @@
|
||||
"confirm": "ارجاع به مدیر کل",
|
||||
"upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
|
||||
"upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
|
||||
"excel_report": "گزارش اکسل"
|
||||
"excel_report": "گزارش اکسل",
|
||||
"confirm_text": "فرم الف و ب به رویت و تایید رسید."
|
||||
},
|
||||
"InspectorExpert": {
|
||||
"name": "نام",
|
||||
@@ -361,10 +362,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": "مقدار پیشنهادی باید مثبت باشد",
|
||||
@@ -548,6 +560,8 @@
|
||||
"LoanHistory": {
|
||||
"id": "کد یکتا",
|
||||
"name": "نام",
|
||||
"tanafos_period": "دوره تنفس",
|
||||
"sakht_period": "دوره ساخت",
|
||||
"national_id": "کد ملی",
|
||||
"phone_number": "موبایل",
|
||||
"proposed_amount": "مبلغ پیشنهادی",
|
||||
@@ -558,6 +572,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) => {
|
||||
@@ -93,20 +101,35 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han
|
||||
return allowedTypes.includes(value.type);
|
||||
})
|
||||
});
|
||||
|
||||
const formik = useFormik({
|
||||
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);
|
||||
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_MACHINARY_OFFICE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
notification: true
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
@@ -166,7 +189,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 +231,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 +308,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>
|
||||
</>
|
||||
|
||||
@@ -30,8 +30,18 @@ const RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("expert_description", values.description);
|
||||
if (values.reject_img != null) formData.append("attachment", values.reject_img);
|
||||
|
||||
if (values.reject_img != null) {
|
||||
const attachments = [
|
||||
{
|
||||
title: "فایل ضمیمه کارتابل قیمت گذاری",
|
||||
file: values.reject_img
|
||||
}
|
||||
];
|
||||
attachments.forEach((attachment, index) => {
|
||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||
formData.append(`attachment[${index}][file]`, attachment.file);
|
||||
});
|
||||
}
|
||||
requestServer(`${REJECT_MACHINARY_OFFICE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
|
||||
@@ -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();
|
||||
@@ -29,6 +29,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
const [showAddIcon, setShowAddIcon] = useState(true);
|
||||
const requestServer = useRequest({auth: true, notification: false})
|
||||
const {update_notification} = useNotification()
|
||||
const [attachmentsData, setAttachmentsData] = useState([]);
|
||||
const [accordionStates, setAccordionStates] = useState([]);
|
||||
const [hasImageShown, setHasImageShown] = useState(false);
|
||||
const [imageLink, setImageLink] = useState(null);
|
||||
@@ -52,9 +53,14 @@ 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);
|
||||
setAccordionStates(booleanData);
|
||||
setDetailsData(response.data)
|
||||
const allAttachments = [];
|
||||
response.data.data.histories.map((history) => {
|
||||
history.attachments.map((attachment) => {
|
||||
allAttachments.push(attachment);
|
||||
});
|
||||
});
|
||||
setAttachmentsData(allAttachments);
|
||||
setDetailsData(response.data);
|
||||
})
|
||||
.catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -62,6 +68,13 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (attachmentsData.length !== 0) {
|
||||
const booleanData = Array.from({length: attachmentsData.length}, () => false);
|
||||
setAccordionStates(booleanData);
|
||||
}
|
||||
}, [attachmentsData]);
|
||||
|
||||
const handleAccordionChange = (index) => {
|
||||
const newAccordionStates = accordionStates.map((state, i) => i === index ? !state : false);
|
||||
setAccordionStates(newAccordionStates);
|
||||
@@ -73,7 +86,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
} else {
|
||||
handleSizeChangeClick('xl');
|
||||
setHasImageShown(true);
|
||||
setImageLink(detailsList.data.attachment_files[index])
|
||||
setImageLink(attachmentsData[index])
|
||||
setIsSkeleton(true)
|
||||
}
|
||||
};
|
||||
@@ -85,11 +98,22 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
}, validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
if (values.description != "") formData.append("expert_description", values.description);
|
||||
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
|
||||
|
||||
if (values.description !== "") formData.append("expert_description", values.description);
|
||||
if (values.confirm_img != null) {
|
||||
const attachments = [
|
||||
{
|
||||
title: "فایل ضمیمه کارتابل بررسی وام های تبصره 18",
|
||||
file: values.confirm_img
|
||||
}
|
||||
];
|
||||
attachments.forEach((attachment, index) => {
|
||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||
formData.append(`attachment[${index}][file]`, attachment.file);
|
||||
});
|
||||
}
|
||||
requestServer(`${CONFIRM_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
notification: true
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
@@ -121,8 +145,8 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
};
|
||||
|
||||
const renderCustomAccordions = () => {
|
||||
if (detailsList && detailsList.data && detailsList.data.attachment_files) {
|
||||
return detailsList.data.attachment_files.map((file, index) => (
|
||||
if (attachmentsData) {
|
||||
return attachmentsData.map((file, index) => (
|
||||
<CustomAccordion
|
||||
key={index}
|
||||
title={`${file.title}`}
|
||||
@@ -130,42 +154,13 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
hasAccordionOpened={null}
|
||||
handleAccordionChange={() => handleAccordionChange(index)}
|
||||
accordionIndex={index}
|
||||
downloadFile={file.attachment}
|
||||
downloadFile={file.file}
|
||||
/>
|
||||
));
|
||||
}
|
||||
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 +168,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()}
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -30,8 +30,18 @@ const RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("expert_description", values.description);
|
||||
if (values.reject_img != null) formData.append("attachment", values.reject_img);
|
||||
|
||||
if (values.reject_img != null) {
|
||||
const attachments = [
|
||||
{
|
||||
title: "فایل ضمیمه کارتابل بررسی وام های تبصره 18",
|
||||
file: values.reject_img
|
||||
}
|
||||
];
|
||||
attachments.forEach((attachment, index) => {
|
||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||
formData.append(`attachment[${index}][file]`, attachment.file);
|
||||
});
|
||||
}
|
||||
requestServer(`${REJECT_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
|
||||
@@ -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,
|
||||
@@ -131,6 +131,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand
|
||||
requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, 'post',{
|
||||
notification: true,
|
||||
data: formData,
|
||||
notification: true
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
@@ -198,22 +199,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 (
|
||||
<>
|
||||
@@ -222,7 +207,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()}
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Button, Checkbox,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogContent, FormControlLabel,
|
||||
FormHelperText,
|
||||
Grid,
|
||||
LinearProgress,
|
||||
@@ -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();
|
||||
@@ -27,7 +28,8 @@ 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 [attachmentsData, setAttachmentsData] = useState([]);
|
||||
const [accordionStates, setAccordionStates] = useState([]);
|
||||
const [hasAccordionOpened, setHasAccordionOpened] = useState([]);
|
||||
const {update_notification} = useNotification();
|
||||
@@ -36,14 +38,19 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
const [detailsList, setDetailsData] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [isSkeleton, setIsSkeleton] = useState(false);
|
||||
const [checked, setChecked] = useState(false);
|
||||
|
||||
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 allAttachments = [];
|
||||
response.data.data.histories.map((history) => {
|
||||
history.attachments.map((attachment) => {
|
||||
allAttachments.push(attachment);
|
||||
});
|
||||
});
|
||||
setDetailsData(response.data);
|
||||
setAttachmentsData(allAttachments);
|
||||
})
|
||||
.catch(() => {
|
||||
}).finally(() => {
|
||||
@@ -51,6 +58,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (attachmentsData.length !== 0) {
|
||||
const booleanData = Array.from({length: attachmentsData.length}, () => false);
|
||||
setAccordionStates(booleanData);
|
||||
setHasAccordionOpened(booleanData);
|
||||
}
|
||||
}, [attachmentsData]);
|
||||
|
||||
const handleAccordionChange = (index) => {
|
||||
const newAccordionStates = accordionStates.map((state, i) => i === index ? !state : false);
|
||||
setAccordionStates(newAccordionStates);
|
||||
@@ -58,12 +73,12 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
if (!newAccordionStates[index]) {
|
||||
handleSizeChangeClick('sm');
|
||||
setHasImageShown(false);
|
||||
setIsSkeleton(false)
|
||||
setIsSkeleton(false);
|
||||
} else {
|
||||
handleSizeChangeClick('xl');
|
||||
setHasImageShown(true);
|
||||
setImageLink(detailsList.data.attachment_files[index])
|
||||
setIsSkeleton(true)
|
||||
setImageLink(attachmentsData[index]);
|
||||
setIsSkeleton(true);
|
||||
const newHasAccordionOpened = [...hasAccordionOpened];
|
||||
newHasAccordionOpened[index] = true;
|
||||
setHasAccordionOpened(newHasAccordionOpened);
|
||||
@@ -91,11 +106,22 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
}, validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
if (values.description != "") formData.append("expert_description", values.description);
|
||||
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
|
||||
|
||||
if (values.description !== "") formData.append("expert_description", values.description);
|
||||
if (values.confirm_img != null) {
|
||||
const attachments = [
|
||||
{
|
||||
title: "فایل ضمیمه کارتابل بررسی وام های تبصره 18",
|
||||
file: values.confirm_img
|
||||
}
|
||||
];
|
||||
attachments.forEach((attachment, index) => {
|
||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||
formData.append(`attachment[${index}][file]`, attachment.file);
|
||||
});
|
||||
}
|
||||
requestServer(`${CONFIRM_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
notification: true
|
||||
}).then((response) => {
|
||||
setOpenConfirmDialog(false)
|
||||
mutate()
|
||||
@@ -125,10 +151,13 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
const handleCheckboxChange = (event) => {
|
||||
setChecked(event.target.checked);
|
||||
};
|
||||
|
||||
const renderCustomAccordions = () => {
|
||||
if (detailsList && detailsList.data && detailsList.data.attachment_files) {
|
||||
return detailsList.data.attachment_files.map((file, index) => (
|
||||
if (attachmentsData) {
|
||||
return attachmentsData.map((file, index) => (
|
||||
<CustomAccordion
|
||||
key={index}
|
||||
title={`${file.title}`}
|
||||
@@ -136,40 +165,12 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
hasAccordionOpened={hasAccordionOpened[index]}
|
||||
handleAccordionChange={() => handleAccordionChange(index)}
|
||||
accordionIndex={index}
|
||||
downloadFile={file.attachment}
|
||||
downloadFile={file.file}
|
||||
/>
|
||||
));
|
||||
}
|
||||
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>
|
||||
@@ -177,7 +178,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()}
|
||||
</>
|
||||
}
|
||||
@@ -188,7 +208,9 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
multiline
|
||||
rows={8}
|
||||
label={<>
|
||||
<span>{t("ConfirmDialog.description")}</span><small>{t("ConfirmDialog.optional")}</small></>}
|
||||
<span>{t("ConfirmDialog.description")}</span>
|
||||
<small>{t("ConfirmDialog.optional")}</small>
|
||||
</>}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
fullWidth
|
||||
@@ -216,12 +238,22 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
Boolean(formik.errors.confirm_img)
|
||||
}
|
||||
/>
|
||||
<FormHelperText
|
||||
error={Boolean(formik.errors.confirm_img)}
|
||||
>
|
||||
<FormHelperText error={Boolean(formik.errors.confirm_img)}>
|
||||
{formik.touched.confirm_img && formik.errors.confirm_img}
|
||||
</FormHelperText>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={checked}
|
||||
onChange={handleCheckboxChange}
|
||||
color="primary"
|
||||
/>
|
||||
}
|
||||
label={t("TransportationAssistance.confirm_text")}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
@@ -243,7 +275,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) || !checked}
|
||||
>
|
||||
{t("ConfirmDialog.button-confirm")}
|
||||
</Button>
|
||||
|
||||
@@ -30,8 +30,18 @@ const RejectContent = ({rowId, mutate, setOpenRejectDialog}) => {
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("expert_description", values.description);
|
||||
if (values.reject_img != null) formData.append("attachment", values.reject_img);
|
||||
|
||||
if (values.reject_img != null) {
|
||||
const attachments = [
|
||||
{
|
||||
title: "فایل ضمیمه کارتابل بررسی وام های تبصره 18",
|
||||
file: values.reject_img
|
||||
}
|
||||
];
|
||||
attachments.forEach((attachment, index) => {
|
||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||
formData.append(`attachment[${index}][file]`, attachment.file);
|
||||
});
|
||||
}
|
||||
requestServer(`${REJECT_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
|
||||
@@ -3,17 +3,28 @@ import {
|
||||
AccordionDetails,
|
||||
AccordionSummary,
|
||||
Box,
|
||||
Typography,
|
||||
Grid, ButtonGroup, Button, CircularProgress
|
||||
Button,
|
||||
ButtonGroup,
|
||||
CircularProgress,
|
||||
Grid,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
||||
import VerifiedIcon from '@mui/icons-material/Verified';
|
||||
import Check from "@mui/icons-material/Check";
|
||||
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
|
||||
import {useState} from "react";
|
||||
const CustomAccordion = ({ title, hasOpened, hasAccordionOpened, handleAccordionChange, accordionIndex , downloadFile}) => {
|
||||
|
||||
const CustomAccordion = ({
|
||||
title,
|
||||
hasOpened,
|
||||
hasAccordionOpened,
|
||||
handleAccordionChange,
|
||||
accordionIndex,
|
||||
downloadFile
|
||||
}) => {
|
||||
const [downloadStatus, setDownloadStatus] = useState('initial');
|
||||
const handleDownloadClick = (setStatus , url) => {
|
||||
const handleDownloadClick = (setStatus, url) => {
|
||||
setStatus('downloading');
|
||||
window.open(url, '_blank');
|
||||
setTimeout(() => {
|
||||
@@ -23,39 +34,40 @@ const CustomAccordion = ({ title, hasOpened, hasAccordionOpened, handleAccordion
|
||||
}, 1200);
|
||||
}, 1000);
|
||||
};
|
||||
return(
|
||||
<Accordion elevation={0} expanded={hasOpened || false} onChange={() => handleAccordionChange(accordionIndex)} sx={{
|
||||
mb: 2,
|
||||
boxShadow: 1,
|
||||
backgroundColor: "#f7f7f7"
|
||||
}}>
|
||||
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
||||
<Box sx={{ width: "100%", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
|
||||
<Box sx={{ display: "flex", alignItems: "center", gap: 0.5 }}>
|
||||
<Typography sx={{ fontWeight: 500, color: "primary.main" }}>{title}</Typography>
|
||||
{hasAccordionOpened && <VerifiedIcon style={{ color: "green" }} />}
|
||||
return (
|
||||
<Accordion elevation={0} expanded={hasOpened || false} onChange={() => handleAccordionChange(accordionIndex)}
|
||||
sx={{
|
||||
mb: 2,
|
||||
boxShadow: 1,
|
||||
backgroundColor: "#f7f7f7"
|
||||
}}>
|
||||
<AccordionSummary expandIcon={<ExpandMoreIcon/>}>
|
||||
<Box sx={{width: "100%", display: "flex", alignItems: "center", justifyContent: "space-between"}}>
|
||||
<Box sx={{display: "flex", alignItems: "center", gap: 0.5}}>
|
||||
<Typography sx={{fontWeight: 500, color: "primary.main"}}>{title}</Typography>
|
||||
{hasAccordionOpened && <VerifiedIcon style={{color: "green"}}/>}
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
</AccordionSummary>
|
||||
<AccordionDetails sx={{ display: "flex", justifyContent: "center", alignItems: "center" }}>
|
||||
<Grid container direction="column" alignItems="center">
|
||||
<Grid item>
|
||||
<ButtonGroup variant="contained" aria-label="outlined primary button group">
|
||||
<Button onClick={() => handleDownloadClick(setDownloadStatus , downloadFile)}>
|
||||
{downloadStatus === 'completed' ? (
|
||||
<Check sx={{ color: 'white' }} fontSize="small" />
|
||||
) : downloadStatus === 'downloading' ? (
|
||||
<CircularProgress sx={{ color: 'white' }} size={18} />
|
||||
) : (
|
||||
<FileDownloadOutlinedIcon sx={{ color: 'white' }} fontSize="small" />
|
||||
)}
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</AccordionSummary>
|
||||
<AccordionDetails sx={{display: "flex", justifyContent: "center", alignItems: "center"}}>
|
||||
<Grid container direction="column" alignItems="center">
|
||||
<Grid item>
|
||||
<ButtonGroup variant="contained" aria-label="outlined primary button group">
|
||||
<Button onClick={() => handleDownloadClick(setDownloadStatus, downloadFile)}>
|
||||
{downloadStatus === 'completed' ? (
|
||||
<Check sx={{color: 'white'}} fontSize="small"/>
|
||||
) : downloadStatus === 'downloading' ? (
|
||||
<CircularProgress sx={{color: 'white'}} size={18}/>
|
||||
) : (
|
||||
<FileDownloadOutlinedIcon sx={{color: 'white'}} fontSize="small"/>
|
||||
)}
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
);
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
);
|
||||
}
|
||||
|
||||
export default CustomAccordion;
|
||||
|
||||
@@ -1,30 +1,46 @@
|
||||
import {Box, Skeleton, Stack} from "@mui/material";
|
||||
import {useEffect} from "react";
|
||||
|
||||
const ImageContent = (prop) => {
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
prop.setIsSkeleton(false);
|
||||
}, 1500);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [prop.isSkeleton]);
|
||||
|
||||
const isPDF = prop.imageLink && prop.imageLink.attachment && prop.imageLink.attachment.endsWith('.pdf');
|
||||
const isPDF = prop.imageLink && prop.imageLink.file && prop.imageLink.file.endsWith('.pdf');
|
||||
return (
|
||||
<>
|
||||
<Stack sx={{width :"100%"}}>
|
||||
<Stack sx={{width: "100%"}}>
|
||||
{prop.isSkeleton && (
|
||||
<Box sx={{display:'flex' ,justifyContent:'center' , border: '1px solid #ccc' ,p:5 , height: '700px' , borderRadius: '8px' , width:'100%'}}>
|
||||
<Skeleton variant="rectangular" animation="wave" sx={{ width: '100%', height: '100%' }} />
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
border: '1px solid #ccc',
|
||||
p: 5,
|
||||
height: '700px',
|
||||
borderRadius: '8px',
|
||||
width: '100%'
|
||||
}}>
|
||||
<Skeleton variant="rectangular" animation="wave" sx={{width: '100%', height: '100%'}}/>
|
||||
</Box>
|
||||
)}
|
||||
{isPDF ? (
|
||||
<embed src={prop.imageLink.attachment} type="application/pdf" width="100%" height="700px" style={{ display: prop.isSkeleton ? 'none' : 'block' }}/>
|
||||
<embed src={prop.imageLink.file} type="application/pdf" width="100%" height="700px"
|
||||
style={{display: prop.isSkeleton ? 'none' : 'block'}}/>
|
||||
) : (
|
||||
prop.imageLink && prop.imageLink.attachment && (
|
||||
<Box sx={{display: prop.isSkeleton ? 'none' : 'flex' ,justifyContent:'center' , border: '1px solid #ccc' , p:5 , height: '700px' , borderRadius: '8px',}}>
|
||||
<Box component="img" src={prop.imageLink.attachment} alt="Image Preview" width="auto" height="auto" sx={{maxHeight: '700px' , maxWidth:'100%'}}></Box>
|
||||
prop.imageLink && prop.imageLink.file && (
|
||||
<Box sx={{
|
||||
display: prop.isSkeleton ? 'none' : 'flex',
|
||||
justifyContent: 'center',
|
||||
border: '1px solid #ccc',
|
||||
p: 5,
|
||||
height: '700px',
|
||||
borderRadius: '8px',
|
||||
}}>
|
||||
<Box component="img" src={prop.imageLink.file} alt="Image Preview" width="auto"
|
||||
height="auto" sx={{maxHeight: '700px', maxWidth: '100%'}}></Box>
|
||||
</Box>
|
||||
)
|
||||
)}
|
||||
|
||||
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