refer text

This commit is contained in:
2024-11-20 06:47:41 +00:00
committed by AmirHossein Mahmoodi
parent 465b798e95
commit 2fbc371684
9 changed files with 129 additions and 41 deletions

View File

@@ -105,16 +105,27 @@ const TableContent = ({ rowId }) => {
"&:last-child td, &:last-child th": { border: 0 },
}}
>
<TableCell> {latest_history.expert.name}</TableCell>
<TableCell>
{" "}
{latest_history?.expert?.name ? latest_history.expert.name : null}
</TableCell>
<TableCell>
{moment(latest_history.created_at)
.locale("fa")
.format("HH:mm | yyyy/MM/DD")}
</TableCell>
<TableCell>{latest_history.expert.position}</TableCell>
<TableCell>{latest_history.previous_state_name}</TableCell>
<TableCell>{action_name[latest_history.action]}</TableCell>
<TableCell>{latest_history.expert_description}</TableCell>
<TableCell>
{latest_history?.expert?.position
? latest_history.expert.position
: null}
</TableCell>
<TableCell>
{latest_history?.previous_state_name
? latest_history.previous_state_name
: null}
</TableCell>
<TableCell>{action_name[latest_history?.action]}</TableCell>
<TableCell>{latest_history?.expert_description}</TableCell>
<TableCell>
{latest_history.attachments.map((attachment, index) => (
<PrintHistory key={index} attachment={attachment} />

View File

@@ -267,6 +267,16 @@ function DashboardNavganProvinceManagerComponent() {
columnFilterModeOptions: ["equals"],
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
},
{
accessorFn: (row) => row.interest_rate,
id: "interest_rate",
header: t("NavganProvinceManager.interest_rate"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: ["equals"],
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
},
{
accessorFn: (row) => row.committed_employment,
id: "committed_employment",

View File

@@ -54,6 +54,7 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type, row
.test("is-number", `${t("ConfirmDialog.repayment_period_number")}`, (value) => !isNaN(value))
.test("positive", `${t("ConfirmDialog.repayment_period_positive")}`, (value) => value >= 0)
.required(t("ConfirmDialog.repayment_period_error")),
confirm_reason: Yup.string().required(t("ConfirmDialog.confirm_reason_error")),
committed_employment: Yup.mixed()
.test("is-number", `${t("ConfirmDialog.committed_employment_number")}`, (value) => !isNaN(value))
.test("positive", `${t("ConfirmDialog.committed_employment_positive")}`, (value) => value >= 0)
@@ -62,6 +63,10 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type, row
.test("is-number", `${t("ConfirmDialog.existing_employment_number")}`, (value) => !isNaN(value))
.test("positive", `${t("ConfirmDialog.existing_employment_positive")}`, (value) => value >= 0)
.required(t("ConfirmDialog.existing_employment_error")),
loan_interest: Yup.mixed()
.test("is-number", `${t("ConfirmDialog.loan_interest_number")}`, (value) => !isNaN(value))
.test("positive", `${t("ConfirmDialog.loan_interest_positive")}`, (value) => value >= 0)
.required(t("ConfirmDialog.loan_interest_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)
@@ -83,7 +88,7 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type, row
const formik = useFormik({
initialValues: {
description: row.original.description || "",
confirm_reason: row.original.confirmation_reason || "",
approved_amount: row.original.approved_amount / 1000000 || "",
facility_bank: row.original.facility_bank / 1000000 || "",
facility_gov: row.original.facility_gov / 1000000 || "",
@@ -94,6 +99,7 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type, row
sakht_period: row.original.sakht_period || "",
tanafos_period: row.original.tanafos_period || "",
existing_employment: row.original.existing_employment || "",
loan_interest: row.original.interest_rate || "",
expert_img: null,
},
validationSchema,
@@ -106,10 +112,10 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type, row
formData.append("repayment_period", values.repayment_period);
formData.append("committed_employment", values.committed_employment);
formData.append("existing_employment", values.existing_employment);
formData.append("interest_rate", values.loan_interest);
formData.append("sakht_period", values.sakht_period);
formData.append("tanafos_period", values.tanafos_period);
if (values.description != "") formData.append("expert_description", values.description);
formData.append("confirmation_reason", values.confirm_reason);
if (values.physical_progress != "") formData.append("physical_progress", values.physical_progress);
if (values.expert_img != null) {
const attachments = [
@@ -179,24 +185,6 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type, row
<>
<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={formik.handleChange}
fullWidth
variant="outlined"
sx={{ mt: 1 }}
/>
</Stack>
<Stack>
<PriceField
name="approved_amount"
@@ -426,6 +414,36 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type, row
onBlur={formik.handleBlur("tanafos_period")}
/>
</Stack>
<Stack>
<SelectBox
name="loan_interest"
label={t("ConfirmDialog.loan_interest")}
size="small"
value={formik.values.loan_interest}
selectType="loan_interest"
selectors={[
{
id: 1,
value: "13",
name: "13 درصد",
},
{
id: 2,
value: "15",
name: "15 درصد",
},
]}
schema={{ value: "value", name: "name" }}
select={formik.values.loan_interest}
handleChange={(event) => {
formik.setFieldValue("loan_interest", event.target.value);
}}
setFieldTouched={formik.setFieldTouched}
error={formik.touched.loan_interest && Boolean(formik.errors.loan_interest)}
helperText={formik.touched.loan_interest && formik.errors.loan_interest}
onBlur={formik.handleBlur("loan_interest")}
/>
</Stack>
<Stack>
<TextField
name="committed_employment"
@@ -476,6 +494,22 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type, row
fullWidth
/>
</Stack>
<Stack>
<TextField
name="confirm_reason"
multiline
rows={4}
label={t("ConfirmDialog.confirm_reason")}
value={formik.values.confirm_reason}
onChange={formik.handleChange}
onBlur={formik.handleBlur("confirm_reason")}
error={formik.touched.confirm_reason && Boolean(formik.errors.confirm_reason)}
helperText={formik.touched.confirm_reason && formik.errors.confirm_reason}
fullWidth
variant="outlined"
sx={{ mt: 1 }}
/>
</Stack>
<Stack>
<Typography>{t("PassengerBoss.upload_expert_img")}</Typography>
<UploadSystem

View File

@@ -2,6 +2,7 @@ import UploadSystem from "@/core/components/UploadSystem";
import useNotification from "@/lib/app/hooks/useNotification";
import useRequest from "@/lib/app/hooks/useRequest";
import {
Box,
Button,
Checkbox,
DialogActions,
@@ -23,7 +24,7 @@ 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 ConfirmContent = ({ rowId, row, mutate, setOpenConfirmDialog, handleSizeChangeClick }) => {
const t = useTranslations();
const [selectedImage, setSelectedImage] = useState("");
const [fileType, setfileType] = useState(null);
@@ -256,6 +257,16 @@ const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, handleSizeChangeC
headerTitle={t("ConfirmDialog.repayment_period")}
unitTitle={t("ConfirmDialog.repayment_period_month")}
/>
<Box sx={{ border: "1px solid #ccc", p: 2, mb: 2, borderRadius: "8px" }}>
<Typography sx={{ color: "primary.main", fontWeight: 500 }}>
{t("ConfirmDialog.confirmation_reason")}
</Typography>
<Typography pt={1}>
{row.original.confirmation_reason
? row.original.confirmation_reason
: t("ConfirmDialog.no_info")}
</Typography>
</Box>
{renderCustomAccordions()}
</>
)}

View File

@@ -3,7 +3,7 @@ import { useTranslations } from "next-intl";
import { useState, useEffect } from "react";
import ConfirmContent from "./ConfirmContent";
import CallMadeIcon from "@mui/icons-material/CallMade";
const Confirm = ({ rowId, mutate }) => {
const Confirm = ({ rowId, mutate, row }) => {
const t = useTranslations();
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
const [dialogSize, setDialogSize] = useState("sm");
@@ -45,6 +45,7 @@ const Confirm = ({ rowId, mutate }) => {
<ConfirmContent
mutate={mutate}
rowId={rowId}
row={row}
setOpenConfirmDialog={setOpenConfirmDialog}
handleSizeChangeClick={handleSizeChangeClick}
/>

View File

@@ -10,7 +10,7 @@ const TableRow = ({ row, mutate }) => {
<Box sx={{ display: "flex", flexWrap: "nowrap", gap: "8px" }}>
{row.original.latest_history?.action === "refer" ? <ReferReason row={row} /> : null}
<UserInfoForm rowId={row.getValue("id")} row={row} />
<Confirm rowId={row.getValue("id")} mutate={mutate} />
<Confirm row={row} rowId={row.getValue("id")} mutate={mutate} />
<Revert rowId={row.getValue("id")} mutate={mutate} />
<Reject rowId={row.getValue("id")} mutate={mutate} />
</Box>

View File

@@ -265,6 +265,16 @@ function DashboardTransportationAssistanceComponent() {
columnFilterModeOptions: ["equals"],
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
},
{
accessorFn: (row) => row.interest_rate,
id: "interest_rate",
header: t("TransportationAssistance.interest_rate"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
columnFilterModeOptions: ["equals"],
Cell: ({ renderedCellValue }) => <Typography variant="body2">{renderedCellValue}</Typography>,
},
{
accessorFn: (row) => row.committed_employment,
id: "committed_employment",