Merge branch 'release/1.25.4'

This commit is contained in:
AmirHossein Mahmoodi
2023-12-20 15:20:49 +03:30
14 changed files with 341 additions and 188 deletions

View File

@@ -1,5 +1,5 @@
NEXT_PUBLIC_API_NAME = "Loan Facilities Dashboard"
NEXT_PUBLIC_API_VERSION = "1.28.3"
NEXT_PUBLIC_API_VERSION = "1.25.4"
NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa"
NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"

View File

@@ -42,10 +42,10 @@
"dashboard": "داشبورد",
"reports": "گزارشات",
"passenger-office-chief": "اداره مسافر",
"machinery-expert": "ماشین آلات",
"passenger-boss": "رئیس مسافر ",
"transportation-assistant": "معاونت حمل و نقل",
"navgan-province-manager": "مدیر کل استانی",
"machinery-expert": "کارتابل قیمت گذاری",
"passenger-boss": "کارتابل کارگروه",
"transportation-assistant": "بررسی وام های تبصره 18",
"navgan-province-manager": "بررسی وام های تبصره 18",
"refahi-province-manager": "مدیر کل استانی",
"refahi-loan-management": "مدیریت وام",
"navgan-loan-management": "مدیریت وام",
@@ -62,11 +62,12 @@
},
"secondary": {
"passenger-office": "توزیع درخواست",
"passenger-boss": "کارگروه استانی",
"passenger-boss": "کارگروه",
"refahi-province-manager": "رفاهی",
"refahi-loan-management": "رفاهی",
"navgan-loan-management": "ناوگان",
"navgan-province-manager": "ناوگان"
"navgan-province-manager": "ناوگان",
"admin-management": "ادمین"
},
"Authorization": {
"typography_your_login_is_valid_and_you_do_not_need_to_login_again": "شما دسترسی لازم به این صفحه را دارید نیاز به ورود مجدد نیست.",
@@ -102,14 +103,14 @@
"Dashboard": {
"dashboard_page": "داشبورد",
"reports": "گزارشات",
"passenger_boss_page": "رئیس مسافر",
"transportation_assistance": "معاونت حمل و نقل",
"passenger_boss_page": "کارتابل کارگروه",
"transportation_assistance": "بررسی وام های تبصره 18",
"change_password": "تغییر رمز عبور",
"province_manager_page": "مدیر کل استانی",
"province_manager_page": "بررسی وام های تبصره 18",
"province_head_expert": "کارشناس ستادی",
"passenger_office_page": "اداره مسافر",
"loan_management_page": "مدیریت وام",
"machinary_office_page": "ماشین آلات",
"machinary_office_page": "کارتابل قیمت گذاری",
"development_assistant_page": "معاون توسعه",
"inspector_expert_page": "بازدید کارشناس",
"commercial_chief_page": "رئیس اداره بازرگانی",
@@ -191,6 +192,8 @@
"id": "کد یکتا",
"national_id": "کد ملی",
"phone_number": "موبایل",
"proposed_amount": "مبلغ پیشنهادی",
"approved_amount": "مبلغ تصویب شده",
"created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
@@ -206,14 +209,15 @@
"id": "کد یکتا",
"national_id": "کد ملی",
"phone_number": "موبایل",
"proposed_amount": "مبلغ پیشنهادی",
"created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
"state_name": "وضعیت درخواست",
"confirm": "ارجاع به معاون حمل و نقل",
"upload_file": "صورت جلسه کارگروه استانی را بارگذاری کنید",
"upload_file_required": "وارد کردن صورت جلسه کارگروه استانی الزامیست",
"upload_file": "صورت جلسه کارگروه را بارگذاری کنید",
"upload_file_required": "وارد کردن صورت جلسه کارگروه الزامیست",
"upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
"upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
"print_final_credit_amount": "چاپ صورت جلسه تعیین مبلغ نهایی",
@@ -282,12 +286,14 @@
"id": "کد یکتا",
"national_id": "کد ملی",
"phone_number": "موبایل",
"proposed_amount": "مبلغ پیشنهادی",
"approved_amount": "مبلغ تصویب شده",
"created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
"state_name": "وضعیت درخواست",
"confirm": "ارجاع به مدیر کل استانی",
"confirm": "ارجاع به مدیر کل",
"upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
"upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
"excel_report": "گزارش اکسل"
@@ -313,12 +319,12 @@
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
"state_name": "وضعیت درخواست",
"confirm": "ارجاع به کارگروه استانی",
"confirm": "ارجاع به کارگروه",
"upload_file": "گزارش کارشناسی را بارگذاری کنید",
"upload_file_required": "وارد کردن گزارش کارشناسی الزامیست",
"upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد",
"upload_file_format": "فرمت قابل قبول : png,jpg,pdf",
"print_report": "چاپ گزارش کارشناسی ماشین آلات",
"print_report": "چاپ گزارش کارشناسی",
"max_amount": "حداکثر مبلغ پیشنهادی {value} میلیون ریال می باشد",
"excel_report": "گزارش اکسل"
},
@@ -357,7 +363,7 @@
"approved_amount_number": "مبلغ تصویب شده باید عدد باشد",
"toman": "میلیون تومان",
"proposed_amount_error": "وارد کردن مقدار پیشنهادی الزامیست",
"proposed_amount": قدار پیشنهادی",
"proposed_amount": بلغ پیشنهادی",
"proposed_amount_positive": "مقدار پیشنهادی باید مثبت باشد",
"proposed_amount_number": "مقدار پیشنهادی باید عدد باشد"
},
@@ -537,6 +543,17 @@
"update_again": "بروزرسانی مجدد"
},
"LoanHistory": {
"id": "کد یکتا",
"name": "نام",
"national_id": "کد ملی",
"phone_number": "موبایل",
"proposed_amount": "مبلغ پیشنهادی",
"approved_amount": "مبلغ تصویب شده",
"created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
"state_name": "وضعیت درخواست",
"history": "تاریخچه",
"Table_history_error": "خطا در دریافت اطلاعات",
"history_report": "فایل ضمیمه",
@@ -547,4 +564,4 @@
"Table_head_file": "فایل پیوست",
"empty_history_detail": "سابقه ای برای این وام وجود ندارد"
}
}
}

View File

@@ -14,7 +14,7 @@ function DashboardLoanHistoryComponent() {
{
accessorFn: (row) => row.id,
id: "id",
header: t("PassengerOffice.id"),
header: t("LoanHistory.id"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
@@ -33,7 +33,7 @@ function DashboardLoanHistoryComponent() {
{
accessorFn: (row) => row.name,
id: "name",
header: t("MachinaryOffice.name"),
header: t("LoanHistory.name"),
enableColumnFilter: true,
datatype: "text",
filterFn: "contains",
@@ -45,7 +45,7 @@ function DashboardLoanHistoryComponent() {
{
accessorFn: (row) => row.national_id,
id: "national_id",
header: t("MachinaryOffice.national_id"),
header: t("LoanHistory.national_id"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
@@ -64,7 +64,45 @@ function DashboardLoanHistoryComponent() {
{
accessorFn: (row) => row.phone_number,
id: "phone_number",
header: t("MachinaryOffice.phone_number"),
header: t("LoanHistory.phone_number"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.proposed_amount,
id: "proposed_amount",
header: t("LoanHistory.proposed_amount"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.approved_amount,
id: "approved_amount",
header: t("LoanHistory.approved_amount"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
@@ -84,7 +122,7 @@ function DashboardLoanHistoryComponent() {
accessorFn: (row) =>
moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"),
id: "created_at",
header: t("MachinaryOffice.created_at"),
header: t("LoanHistory.created_at"),
enableColumnFilter: true,
datatype: "date",
filterFn: "lessThan",
@@ -103,7 +141,7 @@ function DashboardLoanHistoryComponent() {
accessorFn: (row) =>
moment(row.updated_at).locale("fa").format("HH:mm | yyyy/MM/DD"),
id: "updated_at",
header: t("MachinaryOffice.updated_at"),
header: t("LoanHistory.updated_at"),
enableColumnFilter: false,
datatype: "numeric",
Cell: ({renderedCellValue}) => (
@@ -113,7 +151,7 @@ function DashboardLoanHistoryComponent() {
{
accessorFn: (row) => row.navgan_id,
id: "navgan_id",
header: t("MachinaryOffice.navgan_id"),
header: t("LoanHistory.navgan_id"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
@@ -132,7 +170,7 @@ function DashboardLoanHistoryComponent() {
{
accessorFn: (row) => row.vehicle_type,
id: "vehicle_type",
header: t("MachinaryOffice.vehicle_type"),
header: t("LoanHistory.vehicle_type"),
enableColumnFilter: true,
datatype: "text",
filterFn: "contains",
@@ -144,7 +182,7 @@ function DashboardLoanHistoryComponent() {
{
accessorFn: (row) => row.state_name,
id: "state_id",
header: t("MachinaryOffice.state_name"),
header: t("LoanHistory.state_name"),
enableColumnFilter: false,
datatype: "numeric",
Cell: ({renderedCellValue}) => (

View File

@@ -15,10 +15,7 @@ import {
} from "@mui/material"
import {useFormik} from "formik";
import {useTranslations} from "next-intl";
import {
CONFIRM_NAVGAN_PROVINCE_MANAGER,
CONFIRM_PROVINCE_MANAGER_DETAILS
} from "@/core/data/apiRoutes";
import {CONFIRM_NAVGAN_PROVINCE_MANAGER, CONFIRM_PROVINCE_MANAGER_DETAILS} from "@/core/data/apiRoutes";
import {useEffect, useState} from "react";
import * as Yup from "yup";
import CustomAccordion from "@/core/components/CustomAccordion";
@@ -30,7 +27,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
const [fileType, setfileType] = useState(null);
const [fileName, setfileName] = useState(null);
const [showAddIcon, setShowAddIcon] = useState(true);
const requestServer = useRequest({auth: true , notification: false})
const requestServer = useRequest({auth: true, notification: false})
const {update_notification} = useNotification()
const [accordionStates, setAccordionStates] = useState([]);
const [hasImageShown, setHasImageShown] = useState(false);
@@ -55,7 +52,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
useEffect(() => {
requestServer(`${CONFIRM_PROVINCE_MANAGER_DETAILS}/${rowId}`, 'get')
.then((response) => {
const booleanData = Array.from({ length: response.data.data.attachment_files.length }, () => false);
const booleanData = Array.from({length: response.data.data.attachment_files.length}, () => false);
setAccordionStates(booleanData);
setDetailsData(response.data)
})
@@ -69,13 +66,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
const newAccordionStates = accordionStates.map((state, i) => i === index ? !state : false);
setAccordionStates(newAccordionStates);
if (!newAccordionStates[index])
{
if (!newAccordionStates[index]) {
handleSizeChangeClick('sm');
setHasImageShown(false);
setIsSkeleton(false)
}
else {
} else {
handleSizeChangeClick('xl');
setHasImageShown(true);
setImageLink(detailsList.data.attachment_files[index])
@@ -143,28 +138,32 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
};
const numberShowBox = () => {
return (
<>
<Box sx={{ border: '1px solid #ccc' ,p:2 , mb:2 , borderRadius: '8px'}}>
<Typography sx={{color: "primary.main" , fontWeight: 500}}>{t("ConfirmDialog.approved_amount")} {t("sidebar.machinery-expert")}</Typography>
<Typography pt={1}>
{isNaN((detailsList?.data?.proposed_amount) / 10)
? ""
: ((detailsList?.data?.proposed_amount) / 10).toLocaleString()}{" "}
{t("ConfirmDialog.unit")}
</Typography>
</Box>
<Box sx={{ border: '1px solid #ccc' ,p:2 , mb:2 , borderRadius: '8px'}}>
<Typography sx={{color: "primary.main" , fontWeight: 500}}>{t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")}</Typography>
<Typography pt={1}>
{isNaN((detailsList?.data?.approved_amount) / 10)
? ""
: ((detailsList?.data?.approved_amount) / 10).toLocaleString()}{" "}
{t("ConfirmDialog.unit")}
</Typography>
</Box>
</>
);
return (
<>
<Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
<Typography
sx={{color: "primary.main", fontWeight: 500}}>{t("ConfirmDialog.proposed_amount")}</Typography>
<Typography pt={1}>
{isNaN((detailsList?.data?.proposed_amount) / 10)
? ""
: ((detailsList?.data?.proposed_amount) / 10).toLocaleString()}{" "}
{t("ConfirmDialog.unit")}
</Typography>
</Box>
<Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
<Typography sx={{
color: "primary.main",
fontWeight: 500
}}>{t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")}</Typography>
<Typography pt={1}>
{isNaN((detailsList?.data?.approved_amount) / 10)
? ""
: ((detailsList?.data?.approved_amount) / 10).toLocaleString()}{" "}
{t("ConfirmDialog.unit")}
</Typography>
</Box>
</>
);
};
return (
@@ -172,10 +171,10 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
<DialogContent>
<Grid container spacing={2}>
<Grid item xs={hasImageShown ? 6 : 12}>
{loading ? <LinearProgress /> :
{loading ? <LinearProgress/> :
<>
{numberShowBox()}
{renderCustomAccordions()}
{numberShowBox()}
{renderCustomAccordions()}
</>
}
<Stack spacing={2}>
@@ -222,8 +221,13 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
</Stack>
</Grid>
<Grid item xs={6}>
<Stack sx={{ display: hasImageShown ? 'flex' : 'none', alignItems: 'center', gap: 0.5 , justifyContent:'center'}}>
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
<Stack sx={{
display: hasImageShown ? 'flex' : 'none',
alignItems: 'center',
gap: 0.5,
justifyContent: 'center'
}}>
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
</Stack>
</Grid>
</Grid>

View File

@@ -82,6 +82,44 @@ function DashboardNavganProvinceManagerComponent() {
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.proposed_amount,
id: "proposed_amount",
header: t("NavganProvinceManager.proposed_amount"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.approved_amount,
id: "approved_amount",
header: t("NavganProvinceManager.approved_amount"),
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"),

View File

@@ -15,10 +15,7 @@ import {
} from "@mui/material"
import {useFormik} from "formik";
import {useTranslations} from "next-intl";
import {
CONFIRM_PASSENGER_BOSS,
EXPORT_PASSENGER_BOSS_DETAILS,
} from "@/core/data/apiRoutes";
import {CONFIRM_PASSENGER_BOSS, EXPORT_PASSENGER_BOSS_DETAILS,} from "@/core/data/apiRoutes";
import {useEffect, useState} from "react";
import PriceField from "@/core/components/PriceField";
import * as Yup from "yup";
@@ -29,13 +26,13 @@ const vehicle_amount = {
"اتوبوس": 7000,
"مینی بوس": 2000,
}
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , handleSizeChangeClick}) => {
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, handleSizeChangeClick}) => {
const t = useTranslations();
const [selectedImage, setSelectedImage] = useState("");
const [fileType, setfileType] = useState(null);
const [fileName, setfileName] = useState(null);
const [showAddIcon, setShowAddIcon] = useState(true);
const requestServer = useRequest({auth: true ,notification: false})
const requestServer = useRequest({auth: true, notification: false})
const {update_notification} = useNotification();
const [accordionStates, setAccordionStates] = useState([]);
const [hasImageShown, setHasImageShown] = useState(false);
@@ -47,7 +44,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han
useEffect(() => {
requestServer(`${EXPORT_PASSENGER_BOSS_DETAILS}/${rowId}`, 'get')
.then((response) => {
const booleanData = Array.from({ length: response.data.data.attachment_files.length }, () => false);
const booleanData = Array.from({length: response.data.data.attachment_files.length}, () => false);
setAccordionStates(booleanData);
setDetailsData(response.data)
})
@@ -61,13 +58,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han
const newAccordionStates = accordionStates.map((state, i) => i === index ? !state : false);
setAccordionStates(newAccordionStates);
if (!newAccordionStates[index])
{
if (!newAccordionStates[index]) {
handleSizeChangeClick('sm');
setHasImageShown(false);
setIsSkeleton(false)
}
else {
} else {
handleSizeChangeClick('xl');
setHasImageShown(true);
setImageLink(detailsList.data.attachment_files[index])
@@ -166,8 +161,9 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han
const numberShowBox = () => {
return (
<>
<Box sx={{ border: '1px solid #ccc' ,p:2 , mb:2 , borderRadius: '8px'}}>
<Typography sx={{color: "primary.main" , fontWeight: 500}}>{t("ConfirmDialog.approved_amount")} {t("sidebar.machinery-expert")}</Typography>
<Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
<Typography
sx={{color: "primary.main", fontWeight: 500}}>{t("ConfirmDialog.proposed_amount")}</Typography>
<Typography pt={1}>
{isNaN((detailsList?.data?.proposed_amount) / 10)
? ""
@@ -184,7 +180,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han
<DialogContent>
<Grid container spacing={2}>
<Grid item xs={hasImageShown ? 6 : 12}>
{loading ? <LinearProgress /> :
{loading ? <LinearProgress/> :
<>
{numberShowBox()}
{renderCustomAccordions()}
@@ -260,8 +256,13 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han
</Stack>
</Grid>
<Grid item xs={6}>
<Stack sx={{ display: hasImageShown ? 'flex' : 'none', alignItems: 'center', gap: 0.5 , justifyContent:'center'}}>
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
<Stack sx={{
display: hasImageShown ? 'flex' : 'none',
alignItems: 'center',
gap: 0.5,
justifyContent: 'center'
}}>
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
</Stack>
</Grid>
</Grid>

View File

@@ -82,6 +82,25 @@ function DashboardPassengerOfficeComponent() {
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.proposed_amount,
id: "proposed_amount",
header: t("PassengerBoss.proposed_amount"),
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"),

View File

@@ -6,7 +6,9 @@ import {
Button,
DialogActions,
DialogContent,
FormHelperText, Grid, LinearProgress,
FormHelperText,
Grid,
LinearProgress,
Stack,
TextField,
Typography
@@ -18,13 +20,14 @@ import {useEffect, useState} from "react";
import * as Yup from "yup";
import CustomAccordion from "@/core/components/CustomAccordion";
import ImageContent from "@/core/components/ImageContent";
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeClick}) => {
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeClick}) => {
const t = useTranslations();
const [selectedImage, setSelectedImage] = useState("");
const [fileType, setfileType] = useState(null);
const [fileName, setfileName] = useState(null);
const [showAddIcon, setShowAddIcon] = useState(true);
const requestServer = useRequest({auth: true , notification: false})
const requestServer = useRequest({auth: true, notification: false})
const [accordionStates, setAccordionStates] = useState([]);
const [hasAccordionOpened, setHasAccordionOpened] = useState([]);
const {update_notification} = useNotification();
@@ -37,14 +40,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
useEffect(() => {
requestServer(`${GET_TRANSPORTATION_ASSISTANCE_DETAILS}/${rowId}`, 'get')
.then((response) => {
const booleanData = Array.from({ length: response.data.data.attachment_files.length }, () => false);
setAccordionStates(booleanData);
setHasAccordionOpened(booleanData);
setDetailsData(response.data)
const booleanData = Array.from({length: response.data.data.attachment_files.length}, () => false);
setAccordionStates(booleanData);
setHasAccordionOpened(booleanData);
setDetailsData(response.data)
})
.catch(() => {
}).finally(() => {
setLoading(false);
setLoading(false);
});
}, []);
@@ -52,13 +55,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
const newAccordionStates = accordionStates.map((state, i) => i === index ? !state : false);
setAccordionStates(newAccordionStates);
if (!newAccordionStates[index])
{
if (!newAccordionStates[index]) {
handleSizeChangeClick('sm');
setHasImageShown(false);
setIsSkeleton(false)
}
else {
} else {
handleSizeChangeClick('xl');
setHasImageShown(true);
setImageLink(detailsList.data.attachment_files[index])
@@ -144,8 +145,9 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
const numberShowBox = () => {
return (
<>
<Box sx={{ border: '1px solid #ccc' ,p:2 , mb:2 , borderRadius: '8px'}}>
<Typography sx={{color: "primary.main" , fontWeight: 500}}>{t("ConfirmDialog.approved_amount")} {t("sidebar.machinery-expert")}</Typography>
<Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
<Typography
sx={{color: "primary.main", fontWeight: 500}}>{t("ConfirmDialog.proposed_amount")}</Typography>
<Typography pt={1}>
{isNaN((detailsList?.data?.proposed_amount) / 10)
? ""
@@ -153,8 +155,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
{t("ConfirmDialog.unit")}
</Typography>
</Box>
<Box sx={{ border: '1px solid #ccc' ,p:2 , mb:2 , borderRadius: '8px'}}>
<Typography sx={{color: "primary.main" , fontWeight: 500}}>{t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")}</Typography>
<Box sx={{border: '1px solid #ccc', p: 2, mb: 2, borderRadius: '8px'}}>
<Typography sx={{
color: "primary.main",
fontWeight: 500
}}>{t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")}</Typography>
<Typography pt={1}>
{isNaN((detailsList?.data?.approved_amount) / 10)
? ""
@@ -170,7 +175,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
<DialogContent>
<Grid container spacing={2}>
<Grid item xs={hasImageShown ? 6 : 12}>
{loading ? <LinearProgress /> :
{loading ? <LinearProgress/> :
<>
{numberShowBox()}
{renderCustomAccordions()}
@@ -220,9 +225,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
</Stack>
</Grid>
<Grid item xs={6}>
<Stack sx={{ display: hasImageShown ? 'flex' : 'none', alignItems: 'center', gap: 0.5 , justifyContent:'center'}}>
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
</Stack>
<Stack sx={{
display: hasImageShown ? 'flex' : 'none',
alignItems: 'center',
gap: 0.5,
justifyContent: 'center'
}}>
<ImageContent imageLink={imageLink} isSkeleton={isSkeleton} setIsSkeleton={setIsSkeleton}/>
</Stack>
</Grid>
</Grid>
</DialogContent>
@@ -233,7 +243,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl
</Button>
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
disabled={formik.isSubmitting || !formik.isValid ||
hasAccordionOpened.some((opened) => !opened) }
hasAccordionOpened.some((opened) => !opened)}
>
{t("ConfirmDialog.button-confirm")}
</Button>

View File

@@ -82,6 +82,44 @@ function DashboardTransportationAssistanceComponent() {
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.proposed_amount,
id: "proposed_amount",
header: `${t("TransportationAssistance.proposed_amount")}`,
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: [
"equals",
"notEquals",
"contains",
"lessThan",
"greaterThan",
"between",
],
Cell: ({renderedCellValue}) => (
<Typography variant="body2">{renderedCellValue}</Typography>
),
},
{
accessorFn: (row) => row.approved_amount,
id: "approved_amount",
header: t("TransportationAssistance.approved_amount"),
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"),

View File

@@ -8,51 +8,34 @@ import useUser from "@/lib/app/hooks/useUser";
function reducer(state, action) {
switch (action.type) {
case "COLLAPSE_MENU":
return state.map((itemsArr) =>
itemsArr.map((item) =>
action.key === item.key ? {...item, showSubItem: !item.showSubItem} : item
)
);
return state.map((itemsArr) => itemsArr.map((item) => action.key === item.key ? {
...item,
showSubItem: !item.showSubItem
} : item));
case "SELECTED":
return state.map((itemsArr) =>
itemsArr.map((item) => {
return item.type === "page"
? {...item, selected: action.route === item.route, routing: false}
: item.subItem && Array.isArray(item.subItem)
? {
...item,
subItem: item.subItem.map((subitem) => ({
...subitem,
selected: subitem.route === action.route,
routing: false
})),
showSubItem: item.subItem.some(
(subitem) => subitem.selected
),
}
: item;
})
);
return state.map((itemsArr) => itemsArr.map((item) => {
return item.type === "page" ? {
...item,
selected: action.route === item.route,
routing: false
} : item.subItem && Array.isArray(item.subItem) ? {
...item, subItem: item.subItem.map((subitem) => ({
...subitem, selected: subitem.route === action.route, routing: false
})), showSubItem: item.subItem.some((subitem) => subitem.selected),
} : item;
}));
case "SELECTING":
return state.map((itemsArr) =>
itemsArr.map((item) => {
return item.type === "page"
? {...item, selected: action.route === item.route, routing: action.route === item.route}
: item.subItem && Array.isArray(item.subItem)
? {
...item,
subItem: item.subItem.map((subitem) => ({
...subitem,
selected: subitem.route === action.route,
routing: subitem.route === action.route
})),
showSubItem: item.subItem.some(
(subitem) => subitem.selected
),
}
: item;
})
);
return state.map((itemsArr) => itemsArr.map((item) => {
return item.type === "page" ? {
...item,
selected: action.route === item.route,
routing: action.route === item.route
} : item.subItem && Array.isArray(item.subItem) ? {
...item, subItem: item.subItem.map((subitem) => ({
...subitem, selected: subitem.route === action.route, routing: subitem.route === action.route
})), showSubItem: item.subItem.some((subitem) => subitem.selected),
} : item;
}));
default:
throw new Error();
}
@@ -81,28 +64,21 @@ export default function SidebarList({handleDrawerToggle}) {
useEffect(() => {
selectedKey && document.querySelector(`[data-route="${selectedKey}"]`)?.scrollIntoView({
behavior: "smooth",
block: "center"
behavior: "smooth", block: "center"
});
}, [selectedKey]);
return (
<List dense={true} sx={{overflow: "scroll"}}>
{itemMenu.map((itemArr, index) => (
<Fragment key={index}>
{itemArr.map((item) =>
<Fragment key={item.key}>
{(user?.permissions?.includes(item.permission) || item.permission === "all") &&
<SidebarListItem
item={item}
dispatch={dispatch}
handleDrawerToggle={handleDrawerToggle}
/>}
</Fragment>
)}
return (<List dense={true} sx={{overflow: "scroll", p: 0}}>
{itemMenu.map((itemArr, index) => (<Fragment key={index}>
{itemArr.map((item) => <Fragment key={item.key}>
{(user?.permissions?.includes(item.permission) || item.permission === "all") && <SidebarListItem
item={item}
dispatch={dispatch}
handleDrawerToggle={handleDrawerToggle}
/>}
</Fragment>)}
<Divider/>
</Fragment>
))}
</Fragment>))}
</List>
);

View File

@@ -5,7 +5,7 @@ import Header from "@/components/layouts/Dashboard/Header";
import Sidebar from "@/components/layouts/Dashboard/Sidebar";
import Content from "@/components/layouts/Dashboard/Content";
const drawerWidth = 240;
const drawerWidth = 260;
const DashboardLayouts = (props) => {
const {window} = props;

View File

@@ -33,11 +33,21 @@ const sidebarMenu = [
route: "/dashboard/reports",
icon: <AssessmentIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "all",
permission: "view_reports_navgan",
},
{
key: "sidebar.loan-history",
name: "loan-history",
type: "page",
route: "/dashboard/loan-history",
icon: <SecurityIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "view_navgan_loans",
},
], [
{
key: "sidebar.passenger-office-chief",
secondary: "secondary.passenger-office",
secondary: "secondary.navgan-province-manager",
name: "passenger_office_chief",
type: "page",
route: "/dashboard/passenger-office-chief",
@@ -47,6 +57,7 @@ const sidebarMenu = [
},
{
key: "sidebar.machinery-expert",
secondary: "secondary.navgan-province-manager",
name: "machinery_expert",
type: "page",
route: "/dashboard/machinery-expert",
@@ -56,7 +67,7 @@ const sidebarMenu = [
},
{
key: "sidebar.passenger-boss",
secondary: "secondary.passenger-boss",
secondary: "secondary.navgan-province-manager",
name: "province_working_group",
type: "page",
route: "/dashboard/passenger-boss",
@@ -67,6 +78,7 @@ const sidebarMenu = [
{
key: "sidebar.transportation-assistant",
secondary: "secondary.navgan-province-manager",
name: "transportation_assistant",
type: "page",
route: "/dashboard/transportation-assistant",
@@ -84,8 +96,20 @@ const sidebarMenu = [
selected: false,
permission: "manage_province_affairs_navgan",
},
{
key: "sidebar.navgan-loan-management",
secondary: "secondary.navgan-loan-management",
name: "navgan_loan_management",
type: "page",
route: "/dashboard/navgan-loan-management",
icon: <PaidIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_navgan_loan",
},
], [
{
key: "sidebar.province-head-expert",
secondary: "secondary.refahi-province-manager",
name: "province_head_expert",
type: "page",
route: "/dashboard/province-head-expert",
@@ -95,6 +119,7 @@ const sidebarMenu = [
},
{
key: "sidebar.inspector-expert",
secondary: "secondary.refahi-province-manager",
name: "inspector_expert",
type: "page",
route: "/dashboard/inspector-expert",
@@ -104,6 +129,7 @@ const sidebarMenu = [
},
{
key: "sidebar.commercial-chief",
secondary: "secondary.refahi-province-manager",
name: "commercial_chief",
type: "page",
route: "/dashboard/commercial-chief",
@@ -113,6 +139,7 @@ const sidebarMenu = [
},
{
key: "sidebar.development-assistant",
secondary: "secondary.refahi-province-manager",
name: "development_assistant",
type: "page",
route: "/dashboard/development-assistant",
@@ -140,18 +167,10 @@ const sidebarMenu = [
selected: false,
permission: "manage_refahi_loan",
},
{
key: "sidebar.navgan-loan-management",
secondary: "secondary.navgan-loan-management",
name: "navgan_loan_management",
type: "page",
route: "/dashboard/navgan-loan-management",
icon: <PaidIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_navgan_loan",
},
], [
{
key: "sidebar.expert-management",
secondary: "secondary.admin-management",
name: "expert_management",
type: "page",
route: "/dashboard/expert-management",
@@ -161,6 +180,7 @@ const sidebarMenu = [
},
{
key: "sidebar.user-management",
secondary: "secondary.admin-management",
name: "user_management",
type: "page",
route: "/dashboard/user-management",
@@ -170,22 +190,14 @@ const sidebarMenu = [
},
{
key: "sidebar.role-management",
secondary: "secondary.admin-management",
name: "role_management",
type: "page",
route: "/dashboard/role-management",
icon: <AccessibilityIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_roles",
},
{
key: "sidebar.loan-history",
name: "loan-history",
type: "page",
route: "/dashboard/loan-history",
icon: <SecurityIcon sx={{width: 'inherit', height: 'inherit'}}/>,
selected: false,
permission: "manage_navgan_loan",
},
}
],
];

View File

@@ -15,7 +15,7 @@ export async function getServerSideProps({req, locale}) {
title: "Dashboard.loan_history",
isBot,
locale,
layout: {name: 'DashboardLayout', props: {permissions: ["manage_navgan_loan"]}}
layout: {name: 'DashboardLayout', props: {permissions: ["view_navgan_loans"]}}
},
};
}

View File

@@ -14,7 +14,7 @@ export async function getServerSideProps({req, locale}) {
messages: (await import(`&/locales/${locale}/app.json`)).default,
title: "Dashboard.reports",
isBot,
layout: {name: 'DashboardLayout'}
layout: {name: 'DashboardLayout', props: {permissions: ["view_reports_navgan"]}}
},
};
}