Merge branch 'feature/kargrouh_refahi_cartable' into 'develop'
Feature/kargrouh refahi cartable See merge request witel-front-end/loan-facilities/expert-v2!20
This commit is contained in:
@@ -10,6 +10,8 @@ NEXT_PUBLIC_FACILITY_BANK = 66
|
||||
NEXT_PUBLIC_FACILITY_PERSON = 20
|
||||
NEXT_PUBLIC_BUS_AMOUNT=10000
|
||||
NEXT_PUBLIC_MINIBUS_AMOUNT=4000
|
||||
NEXT_PUBLIC_RESTORE_LOAN_AMOUNT=10000
|
||||
NEXT_PUBLIC_BUILD_LOAN_AMOUNT=50000
|
||||
|
||||
NEXT_PUBLIC_BASE_URL = "https://loan-v2.witel.ir"
|
||||
NEXT_PUBLIC_POWERED_BY_URL = "https://witel.ir"
|
||||
|
||||
@@ -42,14 +42,24 @@
|
||||
},
|
||||
"sidebar": {
|
||||
"dashboard": "داشبورد",
|
||||
"restore": "مرمت و بازسازی مجتمع رفاهی",
|
||||
"build": "ساخت مجتمع رفاهی",
|
||||
"refahi": "رفاهی",
|
||||
"navgan": "ناوگان",
|
||||
"reports": "گزارشات",
|
||||
"refahi-province-manager": "بررسی وام های تبصره 18",
|
||||
"admin-setting": "تنظیمات ",
|
||||
"machinery-expert": "کارتابل کارشناسی",
|
||||
"passenger-boss": "کارتابل کارگروه",
|
||||
"restore-passenger-boss": "کارتابل کارگروه",
|
||||
"build-passenger-boss": "کارتابل کارگروه",
|
||||
"transportation-assistant": "بررسی وام های تبصره 18",
|
||||
"restore-transportation-assistant": "بررسی وام های تبصره 18",
|
||||
"build-transportation-assistant": "بررسی وام های تبصره 18",
|
||||
"bank-management": "کارتابل نظارت بانک",
|
||||
"navgan-province-manager": "بررسی وام های تبصره 18",
|
||||
"refahi-province-manager": "مدیر کل استانی",
|
||||
"restore-province-manager": "بررسی وام های تبصره 18",
|
||||
"build-province-manager": "بررسی وام های تبصره 18",
|
||||
"refahi-loan-management": "مدیریت وام",
|
||||
"navgan-loan-management": "مدیریت وام",
|
||||
"commercial-chief": "رئیس اداره بازرگانی",
|
||||
@@ -68,9 +78,11 @@
|
||||
},
|
||||
"secondary": {
|
||||
"passenger-boss": "کارگروه",
|
||||
"refahi-province-manager": "رفاهی",
|
||||
"loan-followup": "ناوگان",
|
||||
"refahi-loan-management": "رفاهی",
|
||||
"refahi-province-manager": "رفاهی",
|
||||
"refahi-transportation": "رفاهی",
|
||||
"refahi-province-working-group": "رفاهی",
|
||||
"navgan-loan-management": "ناوگان",
|
||||
"navgan-province-manager": "ناوگان",
|
||||
"admin-management": "ادمین"
|
||||
@@ -194,6 +206,9 @@
|
||||
},
|
||||
"NavganProvinceManager": {
|
||||
"name": "نام",
|
||||
"project_title": "نام پروژه",
|
||||
"first_name": "نام",
|
||||
"last_name": "نام خانوادگی",
|
||||
"id": "کد یکتا",
|
||||
"interest_rate": "نرخ بهره وام(درصد)",
|
||||
"physical_progress": "درصد پیشرفت فیزیکی",
|
||||
@@ -230,6 +245,9 @@
|
||||
},
|
||||
"PassengerBoss": {
|
||||
"name": "نام",
|
||||
"project_title": "نام پروژه",
|
||||
"first_name": "نام",
|
||||
"last_name": "نام خانوادگی",
|
||||
"button-reserve-confirm": "رزرو",
|
||||
"reserve-loan-title": "رزرو وام",
|
||||
"description-reserve-loan-first": "آیا از رزرو وام به کد یکتا",
|
||||
@@ -260,6 +278,7 @@
|
||||
"vehicle_type": "نوع ماشین",
|
||||
"state_name": "وضعیت درخواست",
|
||||
"confirm": "ارجاع به معاون حمل و نقل",
|
||||
"confirm_refahi": "ارجاع به معاون توسعه",
|
||||
"upload_file": "فایل خود را بارگذاری کنید(اختیاری)",
|
||||
"upload_expert_img": "فایل گزارش کارشناسی را بارگذاری کنید",
|
||||
"upload_file_required": "وارد کردن گزارش کارشناسی الزامیست",
|
||||
@@ -407,7 +426,10 @@
|
||||
},
|
||||
"TransportationAssistance": {
|
||||
"name": "نام",
|
||||
"project_title": "نام پروژه",
|
||||
"city_name": "شهرستان",
|
||||
"first_name": "نام",
|
||||
"last_name": "نام خانوادگی",
|
||||
"refer_reason": "علت ارجاع",
|
||||
"plate_number": "پلاک",
|
||||
"id": "کد یکتا",
|
||||
@@ -553,6 +575,8 @@
|
||||
"context": "آیا از تایید این آیتم اطمینان دارید؟",
|
||||
"button-cancel": "بستن",
|
||||
"loan_interest": "نرخ بهره وام",
|
||||
"physical_progress_number": "درصد پیشرفت پروژه باید عدد باشد",
|
||||
"physical_progress_positive": "درصد پیشرفت پروژه باید بین 0 تا 100 باشد",
|
||||
"button-confirm": "ارجاع",
|
||||
"facility_bank": "تسهیلات سهم بانک",
|
||||
"facility_person": "تسهیلات سهم متقاضی",
|
||||
@@ -841,6 +865,23 @@
|
||||
"real_person" : "شخص حقیقی",
|
||||
"activity_type": "نوع فعالیت",
|
||||
"navgan_plan_id": "عنوان پروژه",
|
||||
"welfare_complex_degree": "درجه مجتمع",
|
||||
"project_city_name": "شهر محل پروژه",
|
||||
"project_province_name": "استان محل پروژه",
|
||||
"project_address": "ادرس محل اجرا پروژه",
|
||||
"project_direction": "سمت پروژه",
|
||||
"project_axis": "محور پروژه",
|
||||
"project_kilometer_marker": "کیلومتر پروژه",
|
||||
"exploitation_date": "تاریخ بهره برداری",
|
||||
"exploitation_license_image": "تصویر پروانه بهره برداری",
|
||||
"exploitation_license_renewal_date": "تاریخ اخرین تمدیدی پروانه بهره برداری",
|
||||
"exploitation_license_renewal_image": "تصویر اخرین تمدیدی بهره برداری",
|
||||
"download_image": "دریافت تصویر",
|
||||
"project_physical_progress": "درصد پیشرفت پروژه",
|
||||
"basic_approval_number": "شماره موافقت اصولی",
|
||||
"basic_approval_renewal_date": "تاریخ اخرین تمدیدی موافقت اصولی",
|
||||
"basic_approval_image": "تصویر موافقت اصولی",
|
||||
"basic_approval_renewal_image": "تصویر اخرین تمدیدی موافقت اصولی",
|
||||
"shenasname_serial": "سریال پشت کارت ملی",
|
||||
"national_tracking_code": "کد رهگیری کارت ملی",
|
||||
"national_id": "کد ملی",
|
||||
@@ -852,6 +893,7 @@
|
||||
"committed_employment": "اشتغال ایجاد شده",
|
||||
"existing_employment": "اشتغال موجود",
|
||||
"plate" : "پلاک",
|
||||
"investment_amount" : "سرمایه گذاری انجام شده",
|
||||
"male" : "مرد",
|
||||
"female" : "زن",
|
||||
"IRAN" : "ایران",
|
||||
@@ -874,7 +916,8 @@
|
||||
"last_name": "نام خانوادگی",
|
||||
"vehicle_type": "نوع وسیله",
|
||||
"tel_number": "شماره ثابت (با پیش شماره استان)",
|
||||
"button-cancel": "بستن"
|
||||
"button-cancel": "بستن",
|
||||
"button-report": "گزارش"
|
||||
},
|
||||
"ReferDialog": {
|
||||
"refer-passenger-boss": "بازگشت به کارگروه",
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
import UploadSystem from "@/core/components/UploadSystem";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material";
|
||||
import { useFormik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { CONFIRM_COMMERCIAL_CHIEF } from "@/core/data/apiRoutes";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import { useState } from "react";
|
||||
|
||||
const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog }) => {
|
||||
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 });
|
||||
const { update_notification } = useNotification();
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
confirm_img: null,
|
||||
},
|
||||
onSubmit: (values, { setSubmitting }) => {
|
||||
const formData = new FormData();
|
||||
if (values.description != "") formData.append("description", values.description);
|
||||
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
|
||||
|
||||
requestServer(`${CONFIRM_COMMERCIAL_CHIEF}/${rowId}`, "post", {
|
||||
data: formData,
|
||||
})
|
||||
.then((response) => {
|
||||
setOpenConfirmDialog(false);
|
||||
update_notification();
|
||||
mutate();
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handleDescriptionChange = (event) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
};
|
||||
|
||||
const handleUploadChange = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const maxFileSize = 2 * 1024 * 1024;
|
||||
if (uploadedFile.size > maxFileSize) {
|
||||
UploadFileNotification(t);
|
||||
event.target.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImage(URL.createObjectURL(uploadedFile));
|
||||
setfileType(fileType);
|
||||
setfileName(fileName);
|
||||
formik.setFieldValue("confirm_img", uploadedFile);
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={
|
||||
<>
|
||||
<span>{t("ConfirmDialog.description")}</span>
|
||||
<small>{t("ConfirmDialog.optional")}</small>
|
||||
</>
|
||||
}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{ mt: 1 }}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>
|
||||
{t("UploadSystem.upload_file")}
|
||||
{t("UploadSystem.optional")}
|
||||
</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImage}
|
||||
handleUploadChange={handleUploadChange} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImage}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="confirm_img"
|
||||
fileType={fileType}
|
||||
fileName={fileName}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
setShowAddIcon={setShowAddIcon}
|
||||
showAddIcon={showAddIcon}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => setOpenConfirmDialog(false)}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={formik.isSubmitting}
|
||||
autoFocus
|
||||
>
|
||||
{t("ConfirmDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={formik.handleSubmit}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
disabled={formik.isSubmitting}
|
||||
>
|
||||
{t("ConfirmDialog.button-confirm")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ConfirmContent;
|
||||
@@ -1,135 +0,0 @@
|
||||
import UploadSystem from "@/core/components/UploadSystem";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material";
|
||||
import { useFormik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import * as Yup from "yup";
|
||||
import { REJECT_COMMERCIAL_CHIEF } from "@/core/data/apiRoutes";
|
||||
|
||||
const RejectContent = ({ rowId, mutate, setOpenRejectDialog }) => {
|
||||
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")),
|
||||
});
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
reject_img: null,
|
||||
},
|
||||
validationSchema,
|
||||
onSubmit: (values, { setSubmitting }) => {
|
||||
const formData = new FormData();
|
||||
formData.append("description", values.description);
|
||||
if (values.reject_img != null) formData.append("attachment", values.reject_img);
|
||||
|
||||
requestServer(`${REJECT_COMMERCIAL_CHIEF}/${rowId}`, "post", {
|
||||
data: formData,
|
||||
})
|
||||
.then((response) => {
|
||||
setOpenRejectDialog(false);
|
||||
mutate();
|
||||
update_notification();
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handleDescriptionChange = (event) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
formik.handleChange(event);
|
||||
};
|
||||
const handleUploadChange = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const maxFileSize = 2 * 1024 * 1024;
|
||||
if (uploadedFile.size > maxFileSize) {
|
||||
UploadFileNotification(t);
|
||||
event.target.value = "";
|
||||
return;
|
||||
}
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImage(URL.createObjectURL(uploadedFile));
|
||||
setfileType(fileType);
|
||||
setfileName(fileName);
|
||||
formik.setFieldValue("reject_img", uploadedFile);
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={t("RejectDialog.description")}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
onBlur={formik.handleBlur("description")}
|
||||
error={formik.touched.description && Boolean(formik.errors.description)}
|
||||
helperText={formik.touched.description && formik.errors.description}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{ mt: 1 }}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>
|
||||
{t("UploadSystem.upload_file")}
|
||||
{t("UploadSystem.optional")}
|
||||
</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImage}
|
||||
handleUploadChange={handleUploadChange} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImage}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="reject_img"
|
||||
fileType={fileType}
|
||||
fileName={fileName}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250 /*width*/, 150 /*height*/]}
|
||||
setShowAddIcon={setShowAddIcon}
|
||||
showAddIcon={showAddIcon}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => setOpenRejectDialog(false)}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={formik.isSubmitting}
|
||||
autoFocus
|
||||
>
|
||||
{t("RejectDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={formik.handleSubmit}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid}
|
||||
>
|
||||
{t("RejectDialog.button-reject")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default RejectContent;
|
||||
@@ -1,14 +0,0 @@
|
||||
import { Box } from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
|
||||
const TableRow = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexWrap: "nowrap", gap: "8px" }}>
|
||||
<Confirm rowId={row.getValue("id")} mutate={mutate} />
|
||||
<Reject rowId={row.getValue("id")} mutate={mutate} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableRow;
|
||||
@@ -1,134 +0,0 @@
|
||||
import UploadSystem from "@/core/components/UploadSystem";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material";
|
||||
import { useFormik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { CONFIRM_DEVELOPMENT_ASSISTANT } from "@/core/data/apiRoutes";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import { useState } from "react";
|
||||
|
||||
const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog }) => {
|
||||
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 });
|
||||
const { update_notification } = useNotification();
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
confirm_img: null,
|
||||
},
|
||||
onSubmit: (values, { setSubmitting }) => {
|
||||
const formData = new FormData();
|
||||
if (values.description != "") formData.append("description", values.description);
|
||||
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
|
||||
|
||||
requestServer(`${CONFIRM_DEVELOPMENT_ASSISTANT}/${rowId}`, "post", {
|
||||
data: formData,
|
||||
})
|
||||
.then((response) => {
|
||||
setOpenConfirmDialog(false);
|
||||
mutate();
|
||||
update_notification();
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handleDescriptionChange = (event) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
};
|
||||
|
||||
const handleUploadChange = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const maxFileSize = 2 * 1024 * 1024;
|
||||
if (uploadedFile.size > maxFileSize) {
|
||||
UploadFileNotification(t);
|
||||
event.target.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImage(URL.createObjectURL(uploadedFile));
|
||||
setfileType(fileType);
|
||||
setfileName(fileName);
|
||||
formik.setFieldValue("confirm_img", uploadedFile);
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={
|
||||
<>
|
||||
<span>{t("ConfirmDialog.description")}</span>
|
||||
<small>{t("ConfirmDialog.optional")}</small>
|
||||
</>
|
||||
}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{ mt: 1 }}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>
|
||||
{t("UploadSystem.upload_file")}
|
||||
{t("UploadSystem.optional")}
|
||||
</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImage}
|
||||
handleUploadChange={handleUploadChange} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImage}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="confirm_img"
|
||||
fileType={fileType}
|
||||
fileName={fileName}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
setShowAddIcon={setShowAddIcon}
|
||||
showAddIcon={showAddIcon}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => setOpenConfirmDialog(false)}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={formik.isSubmitting}
|
||||
autoFocus
|
||||
>
|
||||
{t("ConfirmDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={formik.handleSubmit}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
disabled={formik.isSubmitting}
|
||||
>
|
||||
{t("ConfirmDialog.button-confirm")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ConfirmContent;
|
||||
@@ -1,37 +0,0 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
|
||||
import { useState } from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({ rowId, mutate }) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
color="primary"
|
||||
onClick={() => {
|
||||
setOpenConfirmDialog(true);
|
||||
}}
|
||||
>
|
||||
<ThumbUpAltIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
fullWidth
|
||||
open={openConfirmDialog}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Confirm;
|
||||
@@ -1,14 +0,0 @@
|
||||
import { Box } from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
|
||||
const TableRow = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexWrap: "nowrap", gap: "8px" }}>
|
||||
<Confirm rowId={row.getValue("id")} mutate={mutate} />
|
||||
<Reject rowId={row.getValue("id")} mutate={mutate} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableRow;
|
||||
@@ -1,134 +0,0 @@
|
||||
import UploadSystem from "@/core/components/UploadSystem";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material";
|
||||
import { useFormik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { CONFIRM_INSPECTOR_EXPERT } from "@/core/data/apiRoutes";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import { useState } from "react";
|
||||
|
||||
const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog }) => {
|
||||
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 });
|
||||
const { update_notification } = useNotification();
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
confirm_img: null,
|
||||
},
|
||||
onSubmit: (values, { setSubmitting }) => {
|
||||
const formData = new FormData();
|
||||
if (values.description != "") formData.append("description", values.description);
|
||||
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
|
||||
|
||||
requestServer(`${CONFIRM_INSPECTOR_EXPERT}/${rowId}`, "post", {
|
||||
data: formData,
|
||||
})
|
||||
.then((response) => {
|
||||
setOpenConfirmDialog(false);
|
||||
mutate();
|
||||
update_notification();
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handleDescriptionChange = (event) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
};
|
||||
|
||||
const handleUploadChange = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const maxFileSize = 2 * 1024 * 1024;
|
||||
if (uploadedFile.size > maxFileSize) {
|
||||
UploadFileNotification(t);
|
||||
event.target.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImage(URL.createObjectURL(uploadedFile));
|
||||
setfileType(fileType);
|
||||
setfileName(fileName);
|
||||
formik.setFieldValue("confirm_img", uploadedFile);
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={
|
||||
<>
|
||||
<span>{t("ConfirmDialog.description")}</span>
|
||||
<small>{t("ConfirmDialog.optional")}</small>
|
||||
</>
|
||||
}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{ mt: 1 }}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>
|
||||
{t("UploadSystem.upload_file")}
|
||||
{t("UploadSystem.optional")}
|
||||
</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImage}
|
||||
handleUploadChange={handleUploadChange} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImage}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="confirm_img"
|
||||
fileType={fileType}
|
||||
fileName={fileName}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
setShowAddIcon={setShowAddIcon}
|
||||
showAddIcon={showAddIcon}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => setOpenConfirmDialog(false)}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={formik.isSubmitting}
|
||||
autoFocus
|
||||
>
|
||||
{t("ConfirmDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={formik.handleSubmit}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
disabled={formik.isSubmitting}
|
||||
>
|
||||
{t("ConfirmDialog.button-confirm")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ConfirmContent;
|
||||
@@ -1,37 +0,0 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import ReplyIcon from "@mui/icons-material/Reply";
|
||||
import { useState } from "react";
|
||||
import ReviseContent from "./ReviseContent";
|
||||
|
||||
const Revise = ({ rowId, mutate }) => {
|
||||
const t = useTranslations();
|
||||
const [openReviseDialog, setOpenReviseDialog] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ReviseDialog.revise")}>
|
||||
<IconButton
|
||||
color="primary"
|
||||
onClick={() => {
|
||||
setOpenReviseDialog(true);
|
||||
}}
|
||||
>
|
||||
<ReplyIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
fullWidth
|
||||
open={openReviseDialog}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle>{t("ReviseDialog.revise")}</DialogTitle>
|
||||
<ReviseContent mutate={mutate} rowId={rowId} setOpenReviseDialog={setOpenReviseDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Revise;
|
||||
@@ -1,16 +0,0 @@
|
||||
import { Box } from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
import Revise from "./Form/ReviseForm";
|
||||
|
||||
const TableRow = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexWrap: "nowrap", gap: "8px" }}>
|
||||
<Confirm rowId={row.getValue("id")} mutate={mutate} />
|
||||
<Reject rowId={row.getValue("id")} mutate={mutate} />
|
||||
<Revise rowId={row.getValue("id")} mutate={mutate} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableRow;
|
||||
@@ -2,7 +2,7 @@ import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import EditIcon from "@mui/icons-material/Edit";
|
||||
import EditContent from "@/components/dashboard/bank-management/Form/Edit/EditContent";
|
||||
import EditContent from "./Edit/EditContent";
|
||||
|
||||
const EditForm = ({ rowId, row, mutate, vehicle_type }) => {
|
||||
const t = useTranslations();
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Box } from "@mui/material";
|
||||
import UpdateForm from "@/components/dashboard/bank-management/Form/Update";
|
||||
import EditForm from "@/components/dashboard/bank-management/Form/Edit";
|
||||
import RejectForm from "@/components/dashboard/bank-management/Form/Reject";
|
||||
import UpdateForm from "./Form/Update";
|
||||
import EditForm from "./Form/Edit";
|
||||
import RejectForm from "./Form/Reject";
|
||||
|
||||
const TableRow = ({ row, mutate }) => {
|
||||
return (
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Stack } from "@mui/material";
|
||||
import PrintExcel from "@/components/dashboard/bank-management/Buttons/printExcel";
|
||||
import PrintExcel from "./Buttons/printExcel";
|
||||
|
||||
const TableToolbar = ({ table }) => {
|
||||
return (
|
||||
@@ -3,9 +3,9 @@ import { useMemo } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import moment from "jalali-moment";
|
||||
import DataTable from "@/core/components/DataTable";
|
||||
import TableRowActions from "@/components/dashboard/bank-management/TableRowActions";
|
||||
import TableRowActions from "./TableRowActions";
|
||||
import { GET_BANK_STATEMENT } from "@/core/data/apiRoutes";
|
||||
import TableToolbar from "@/components/dashboard/bank-management/TableToobar";
|
||||
import TableToolbar from "./TableToobar";
|
||||
|
||||
function DashboardBankManagementComponent() {
|
||||
const t = useTranslations();
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Box } from "@mui/material";
|
||||
import ReferPassengerBoss from "@/components/dashboard/loan-followup/Form/ReferPassengerBoss";
|
||||
import ReferPassengerBoss from "./Form/ReferPassengerBoss";
|
||||
import UserInfoForm from "./Form/UserInfoForm";
|
||||
import PlanningCouncilForm from "@/components/dashboard/loan-followup/Form/PlanningCouncilForm";
|
||||
import ComebackLoanDetail from "@/components/dashboard/loan-followup/Form/ComebackLoanDetail";
|
||||
import BankPayment from "@/components/dashboard/loan-followup/Form/BankPayment";
|
||||
import ApprovedBankLoan from "@/components/dashboard/loan-followup/Form/ApprovedBankLoan";
|
||||
import PlanningCouncilForm from "./Form/PlanningCouncilForm";
|
||||
import ComebackLoanDetail from "./Form/ComebackLoanDetail";
|
||||
import BankPayment from "./Form/BankPayment";
|
||||
import ApprovedBankLoan from "./Form/ApprovedBankLoan";
|
||||
|
||||
const TableRow = ({ row, mutate }) => {
|
||||
return (
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Stack } from "@mui/material";
|
||||
import PrintExcel from "@/components/dashboard/passenger-boss/Buttons/printExcel";
|
||||
import PrintExcel from "./Buttons/printExcel";
|
||||
|
||||
const TableToolbar = ({ table }) => {
|
||||
return (
|
||||
@@ -6,7 +6,7 @@ import TableRowActions from "./TableRowActions";
|
||||
import DataTable from "@/core/components/DataTable";
|
||||
import moment from "jalali-moment";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import TableToolbar from "@/components/dashboard/navgan-loan-management/TableToolbar";
|
||||
import TableToolbar from "./TableToolbar";
|
||||
|
||||
function DashboardNavganLoanManagementComponent() {
|
||||
const t = useTranslations();
|
||||
@@ -2,7 +2,7 @@ import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import CallReceivedIcon from "@mui/icons-material/CallReceived";
|
||||
import RevertContent from "@/components/dashboard/navgan-province-manager/Form/RevertForm/RevertContent";
|
||||
import RevertContent from "./RevertContent";
|
||||
|
||||
const Revert = ({ rowId, mutate }) => {
|
||||
const t = useTranslations();
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Box } from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
import Revert from "@/components/dashboard/navgan-province-manager/Form/RevertForm";
|
||||
import Revert from "./Form/RevertForm";
|
||||
import UserInfoForm from "./Form/UserInfoForm";
|
||||
|
||||
const TableRow = ({ row, mutate }) => {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Stack } from "@mui/material";
|
||||
import PrintExcel from "@/components/dashboard/navgan-loan-management/Buttons/printExcel";
|
||||
import PrintExcel from "./Buttons/printExcel";
|
||||
|
||||
const TableToolbar = ({ table }) => {
|
||||
return (
|
||||
@@ -6,7 +6,7 @@ import TableRowActions from "./TableRowActions";
|
||||
import moment from "jalali-moment";
|
||||
import DataTable from "@/core/components/DataTable";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import TableToolbar from "@/components/dashboard/navgan-province-manager/TableToolbar";
|
||||
import TableToolbar from "./TableToolbar";
|
||||
|
||||
function DashboardNavganProvinceManagerComponent() {
|
||||
const t = useTranslations();
|
||||
@@ -2,7 +2,7 @@ import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import ContactMailIcon from "@mui/icons-material/ContactMail";
|
||||
import ReferUserContent from "@/components/dashboard/passenger-boss/Form/ReferUser/ReferUserContent";
|
||||
import ReferUserContent from "./ReferUserContent";
|
||||
const ReferUser = ({ rowId, mutate }) => {
|
||||
const t = useTranslations();
|
||||
const [openReferDialog, setOpenReferDialog] = useState(false);
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Box } from "@mui/material";
|
||||
import Reject from "./Form/RejectForm";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import ReserveForm from "@/components/dashboard/passenger-boss/Form/ReserveForm";
|
||||
import ReferReason from "@/components/dashboard/passenger-boss/Form/ReferReason";
|
||||
import ReferUser from "@/components/dashboard/passenger-boss/Form/ReferUser";
|
||||
import ReserveForm from "./Form/ReserveForm";
|
||||
import ReferReason from "./Form/ReferReason";
|
||||
import ReferUser from "./Form/ReferUser";
|
||||
import UserInfoForm from "./Form/UserInfoForm";
|
||||
|
||||
const TableRow = ({ row, mutate }) => {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Stack } from "@mui/material";
|
||||
import PrintExcel from "@/components/dashboard/navgan-province-manager/Buttons/printExcel";
|
||||
import PrintExcel from "./Buttons/printExcel";
|
||||
|
||||
const TableToolbar = ({ table }) => {
|
||||
return (
|
||||
@@ -6,7 +6,7 @@ import TableRowActions from "./TableRowActions";
|
||||
import moment from "jalali-moment";
|
||||
import DataTable from "@/core/components/DataTable";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import TableToolbar from "@/components/dashboard/passenger-boss/TableToolbar";
|
||||
import TableToolbar from "./TableToolbar";
|
||||
|
||||
function DashboardPassengerOfficeComponent() {
|
||||
const t = useTranslations();
|
||||
@@ -6,7 +6,7 @@ import TableRowActions from "./TableRowActions";
|
||||
import moment from "jalali-moment";
|
||||
import DataTable from "@/core/components/DataTable";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import TableToolbar from "@/components/dashboard/reserve-loan/TableToolbar";
|
||||
import TableToolbar from "./TableToolbar";
|
||||
|
||||
function DashboardReserveLoan() {
|
||||
const t = useTranslations();
|
||||
@@ -2,7 +2,7 @@ import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import CallReceivedIcon from "@mui/icons-material/CallReceived";
|
||||
import RevertContent from "@/components/dashboard/transportation-assistance/Form/RevertForm/RevertContent";
|
||||
import RevertContent from "./RevertContent";
|
||||
|
||||
const Revert = ({ rowId, mutate }) => {
|
||||
const t = useTranslations();
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Box } from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
import Revert from "@/components/dashboard/transportation-assistance/Form/RevertForm";
|
||||
import ReferReason from "@/components/dashboard/transportation-assistance/Form/ReferReason";
|
||||
import Revert from "./Form/RevertForm";
|
||||
import ReferReason from "./Form/ReferReason";
|
||||
import UserInfoForm from "./Form/UserInfoForm";
|
||||
|
||||
const TableRow = ({ row, mutate }) => {
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Stack } from "@mui/material";
|
||||
import PrintExcel from "./Buttons/printExcel";
|
||||
|
||||
const TableToolbar = ({ table }) => {
|
||||
return (
|
||||
<Stack direction={"row"} spacing={2}>
|
||||
<PrintExcel table={table} />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableToolbar;
|
||||
@@ -6,7 +6,7 @@ import TableRowActions from "./TableRowActions";
|
||||
import moment from "jalali-moment";
|
||||
import DataTable from "@/core/components/DataTable";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import TableToolbar from "@/components/dashboard/transportation-assistance/TableToolbar";
|
||||
import TableToolbar from "./TableToolbar";
|
||||
|
||||
function DashboardTransportationAssistanceComponent() {
|
||||
const t = useTranslations();
|
||||
@@ -1,134 +0,0 @@
|
||||
import UploadSystem from "@/core/components/UploadSystem";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material";
|
||||
import { useFormik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { CONFIRM_PROVINCE_HEAD_EXPERT } from "@/core/data/apiRoutes";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import { useState } from "react";
|
||||
|
||||
const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog }) => {
|
||||
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 });
|
||||
const { update_notification } = useNotification();
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
confirm_img: null,
|
||||
},
|
||||
onSubmit: (values, { setSubmitting }) => {
|
||||
const formData = new FormData();
|
||||
if (values.description != "") formData.append("description", values.description);
|
||||
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
|
||||
|
||||
requestServer(`${CONFIRM_PROVINCE_HEAD_EXPERT}/${rowId}`, "post", {
|
||||
data: formData,
|
||||
})
|
||||
.then((response) => {
|
||||
setOpenConfirmDialog(false);
|
||||
mutate();
|
||||
update_notification();
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handleDescriptionChange = (event) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
};
|
||||
|
||||
const handleUploadChange = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const maxFileSize = 2 * 1024 * 1024;
|
||||
if (uploadedFile.size > maxFileSize) {
|
||||
UploadFileNotification(t);
|
||||
event.target.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImage(URL.createObjectURL(uploadedFile));
|
||||
setfileType(fileType);
|
||||
setfileName(fileName);
|
||||
formik.setFieldValue("confirm_img", uploadedFile);
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={
|
||||
<>
|
||||
<span>{t("ConfirmDialog.description")}</span>
|
||||
<small>{t("ConfirmDialog.optional")}</small>
|
||||
</>
|
||||
}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{ mt: 1 }}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>
|
||||
{t("UploadSystem.upload_file")}
|
||||
{t("UploadSystem.optional")}
|
||||
</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImage}
|
||||
handleUploadChange={handleUploadChange} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImage}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="confirm_img"
|
||||
fileType={fileType}
|
||||
fileName={fileName}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
setShowAddIcon={setShowAddIcon}
|
||||
showAddIcon={showAddIcon}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => setOpenConfirmDialog(false)}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={formik.isSubmitting}
|
||||
autoFocus
|
||||
>
|
||||
{t("ConfirmDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={formik.handleSubmit}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
disabled={formik.isSubmitting}
|
||||
>
|
||||
{t("ConfirmDialog.button-confirm")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ConfirmContent;
|
||||
@@ -1,135 +0,0 @@
|
||||
import UploadSystem from "@/core/components/UploadSystem";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material";
|
||||
import { useFormik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import * as Yup from "yup";
|
||||
import { REJECT_PROVINCE_HEAD_EXPERT } from "@/core/data/apiRoutes";
|
||||
|
||||
const RejectContent = ({ rowId, mutate, setOpenRejectDialog }) => {
|
||||
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")),
|
||||
});
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
reject_img: null,
|
||||
},
|
||||
validationSchema,
|
||||
onSubmit: (values, { setSubmitting }) => {
|
||||
const formData = new FormData();
|
||||
formData.append("description", values.description);
|
||||
if (values.reject_img != null) formData.append("attachment", values.reject_img);
|
||||
|
||||
requestServer(`${REJECT_PROVINCE_HEAD_EXPERT}/${rowId}`, "post", {
|
||||
data: formData,
|
||||
})
|
||||
.then((response) => {
|
||||
setOpenRejectDialog(false);
|
||||
mutate();
|
||||
update_notification();
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handleDescriptionChange = (event) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
formik.handleChange(event);
|
||||
};
|
||||
const handleUploadChange = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const maxFileSize = 2 * 1024 * 1024;
|
||||
if (uploadedFile.size > maxFileSize) {
|
||||
UploadFileNotification(t);
|
||||
event.target.value = "";
|
||||
return;
|
||||
}
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImage(URL.createObjectURL(uploadedFile));
|
||||
setfileType(fileType);
|
||||
setfileName(fileName);
|
||||
formik.setFieldValue("reject_img", uploadedFile);
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={t("RejectDialog.description")}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
onBlur={formik.handleBlur("description")}
|
||||
error={formik.touched.description && Boolean(formik.errors.description)}
|
||||
helperText={formik.touched.description && formik.errors.description}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{ mt: 1 }}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>
|
||||
{t("UploadSystem.upload_file")}
|
||||
{t("UploadSystem.optional")}
|
||||
</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImage}
|
||||
handleUploadChange={handleUploadChange} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImage}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="reject_img"
|
||||
fileType={fileType}
|
||||
fileName={fileName}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250 /*width*/, 150 /*height*/]}
|
||||
setShowAddIcon={setShowAddIcon}
|
||||
showAddIcon={showAddIcon}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => setOpenRejectDialog(false)}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={formik.isSubmitting}
|
||||
autoFocus
|
||||
>
|
||||
{t("RejectDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={formik.handleSubmit}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid}
|
||||
>
|
||||
{t("RejectDialog.button-reject")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default RejectContent;
|
||||
@@ -1,37 +0,0 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import ReplyIcon from "@mui/icons-material/Reply";
|
||||
import { useState } from "react";
|
||||
import ReviseContent from "./ReviseContent";
|
||||
|
||||
const Revise = ({ rowId, mutate }) => {
|
||||
const t = useTranslations();
|
||||
const [openReviseDialog, setOpenReviseDialog] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ReviseDialog.revise")}>
|
||||
<IconButton
|
||||
color="primary"
|
||||
onClick={() => {
|
||||
setOpenReviseDialog(true);
|
||||
}}
|
||||
>
|
||||
<ReplyIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
fullWidth
|
||||
open={openReviseDialog}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle>{t("ReviseDialog.revise")}</DialogTitle>
|
||||
<ReviseContent mutate={mutate} rowId={rowId} setOpenReviseDialog={setOpenReviseDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Revise;
|
||||
@@ -1,16 +0,0 @@
|
||||
import { Box } from "@mui/material";
|
||||
import Confirm from "./Form/ConfirmForm";
|
||||
import Reject from "./Form/RejectForm";
|
||||
import Revise from "./Form/ReviseForm";
|
||||
|
||||
const TableRowActions = ({ row, mutate }) => {
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexWrap: "nowrap", gap: "8px" }}>
|
||||
<Confirm rowId={row.getValue("id")} mutate={mutate} />
|
||||
<Reject rowId={row.getValue("id")} mutate={mutate} />
|
||||
<Revise rowId={row.getValue("id")} mutate={mutate} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableRowActions;
|
||||
@@ -1,119 +0,0 @@
|
||||
import { Box, Typography } from "@mui/material";
|
||||
import { useMemo } from "react";
|
||||
import { GET_PROVINCE_HEAD_EXPERT } from "@/core/data/apiRoutes";
|
||||
import { useTranslations } from "next-intl";
|
||||
import moment from "jalali-moment";
|
||||
import DataTable from "@/core/components/DataTable";
|
||||
import TableRowActions from "./TableRowActions";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
|
||||
function DashboardProvinceHeadExpertComponent() {
|
||||
const t = useTranslations();
|
||||
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
accessorFn: (row) => row.id,
|
||||
id: "id",
|
||||
header: t("ProvinceHeadExpert.id"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains", "lessThan", "greaterThan", "between"],
|
||||
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.name,
|
||||
id: "name",
|
||||
header: t("ProvinceHeadExpert.name"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.national_id,
|
||||
id: "national_id",
|
||||
header: t("ProvinceHeadExpert.national_id"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains", "lessThan", "greaterThan", "between"],
|
||||
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.phone_number,
|
||||
id: "phone_number",
|
||||
header: t("ProvinceHeadExpert.phone_number"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains", "lessThan", "greaterThan", "between"],
|
||||
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"),
|
||||
id: "created_at",
|
||||
header: t("ProvinceHeadExpert.created_at"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "date",
|
||||
filterFn: "lessThan",
|
||||
columnFilterModeOptions: ["lessThan", "greaterThan"],
|
||||
Cell: ({ renderedCellValue }) => {
|
||||
return <Typography variant="body2">{renderedCellValue}</Typography>;
|
||||
},
|
||||
Header: ({ column }) => <>{column.columnDef.header}</>,
|
||||
Filter: ({ column }) => {
|
||||
return <MuiDatePicker column={column} />;
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => moment(row.updated_at).locale("fa").format("HH:mm | yyyy/MM/DD"),
|
||||
id: "updated_at",
|
||||
header: t("ProvinceHeadExpert.updated_at"),
|
||||
enableColumnFilter: false,
|
||||
datatype: "numeric",
|
||||
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.state_name,
|
||||
id: "state_id",
|
||||
header: t("ProvinceHeadExpert.state_name"),
|
||||
enableColumnFilter: false,
|
||||
datatype: "numeric",
|
||||
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
|
||||
},
|
||||
],
|
||||
[]
|
||||
);
|
||||
return (
|
||||
<Box sx={{ px: 3 }}>
|
||||
<DataTable
|
||||
tableUrl={GET_PROVINCE_HEAD_EXPERT}
|
||||
columns={columns}
|
||||
selectableRow={false}
|
||||
enableCustomToolbar={false}
|
||||
enableLastUpdate={true}
|
||||
sorting={[
|
||||
{
|
||||
id: "id",
|
||||
desc: false,
|
||||
},
|
||||
]}
|
||||
enablePinning={true}
|
||||
enableDensityToggle={false}
|
||||
initialState={{ density: "compact" }} //compact (small) //comfortable (medium) //spacious (large)
|
||||
enableColumnFilters={true}
|
||||
enableHiding={true}
|
||||
enableFullScreenToggle={false}
|
||||
enableGlobalFilter={false}
|
||||
enableColumnResizing={false} // if you want true this you should change renderRowActions props ** see https://www.material-react-table.com/docs/guides/row-actions
|
||||
enableRowActions={true}
|
||||
TableRowAction={TableRowActions}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default DashboardProvinceHeadExpertComponent;
|
||||
@@ -1,134 +0,0 @@
|
||||
import UploadSystem from "@/core/components/UploadSystem";
|
||||
import useNotification from "@/lib/app/hooks/useNotification";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import { Button, DialogActions, DialogContent, Stack, TextField, Typography } from "@mui/material";
|
||||
import { useFormik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { CONFIRM_REFAHI_PROVINCE_MANAGER } from "@/core/data/apiRoutes";
|
||||
import UploadFileNotification from "@/core/components/notifications/UploadFileNotification";
|
||||
import { useState } from "react";
|
||||
|
||||
const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog }) => {
|
||||
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 });
|
||||
const { update_notification } = useNotification();
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
confirm_img: null,
|
||||
},
|
||||
onSubmit: (values, { setSubmitting }) => {
|
||||
const formData = new FormData();
|
||||
if (values.description != "") formData.append("description", values.description);
|
||||
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
|
||||
|
||||
requestServer(`${CONFIRM_REFAHI_PROVINCE_MANAGER}/${rowId}`, "post", {
|
||||
data: formData,
|
||||
})
|
||||
.then((response) => {
|
||||
setOpenConfirmDialog(false);
|
||||
mutate();
|
||||
update_notification();
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handleDescriptionChange = (event) => {
|
||||
formik.setFieldValue("description", event.target.value);
|
||||
};
|
||||
|
||||
const handleUploadChange = (event) => {
|
||||
const uploadedFile = event.target?.files?.[0];
|
||||
if (uploadedFile) {
|
||||
const maxFileSize = 2 * 1024 * 1024;
|
||||
if (uploadedFile.size > maxFileSize) {
|
||||
UploadFileNotification(t);
|
||||
event.target.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
const fileType = event.target?.files?.[0].type;
|
||||
const fileName = event.target?.files?.[0].name;
|
||||
setSelectedImage(URL.createObjectURL(uploadedFile));
|
||||
setfileType(fileType);
|
||||
setfileName(fileName);
|
||||
formik.setFieldValue("confirm_img", uploadedFile);
|
||||
setShowAddIcon(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
<TextField
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={
|
||||
<>
|
||||
<span>{t("ConfirmDialog.description")}</span>
|
||||
<small>{t("ConfirmDialog.optional")}</small>
|
||||
</>
|
||||
}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{ mt: 1 }}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack>
|
||||
<Typography>
|
||||
{t("UploadSystem.upload_file")}
|
||||
{t("UploadSystem.optional")}
|
||||
</Typography>
|
||||
<UploadSystem
|
||||
selectedImage={selectedImage}
|
||||
handleUploadChange={handleUploadChange} // Pass the updated function directly
|
||||
setselectedImage={setSelectedImage}
|
||||
setFieldValue={formik.setFieldValue} // Remove props.setFieldValue, use formik.setFieldValue
|
||||
fieldname="confirm_img"
|
||||
fileType={fileType}
|
||||
fileName={fileName}
|
||||
imageAlt={t("app_name")}
|
||||
imageSize={[250, 150]}
|
||||
setShowAddIcon={setShowAddIcon}
|
||||
showAddIcon={showAddIcon}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => setOpenConfirmDialog(false)}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
disabled={formik.isSubmitting}
|
||||
autoFocus
|
||||
>
|
||||
{t("ConfirmDialog.button-cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={formik.handleSubmit}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
disabled={formik.isSubmitting}
|
||||
>
|
||||
{t("ConfirmDialog.button-confirm")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default ConfirmContent;
|
||||
@@ -1,37 +0,0 @@
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
|
||||
import { useState } from "react";
|
||||
import ConfirmContent from "./ConfirmContent";
|
||||
|
||||
const Confirm = ({ rowId, mutate }) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ConfirmDialog.confirm")}>
|
||||
<IconButton
|
||||
color="primary"
|
||||
onClick={() => {
|
||||
setOpenConfirmDialog(true);
|
||||
}}
|
||||
>
|
||||
<ThumbUpAltIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
fullWidth
|
||||
open={openConfirmDialog}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DialogTitle>{t("ConfirmDialog.confirm")}</DialogTitle>
|
||||
<ConfirmContent mutate={mutate} rowId={rowId} setOpenConfirmDialog={setOpenConfirmDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Confirm;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user