From 65a1ed27168d3f006a21d3355afcfdbefeaa879f Mon Sep 17 00:00:00 2001 From: AminGhasempoor Date: Mon, 25 Dec 2023 11:32:07 +0330 Subject: [PATCH] add sakht and tanafos columns in loan history and sync cartables with backend --- public/locales/fa/app.json | 4 +++ .../dashboard/loan-history/index.jsx | 28 +++++++++++++++++++ .../Form/ConfirmForm/ConfirmContent.jsx | 3 ++ .../Form/ConfirmForm/ConfirmContent.jsx | 5 ++-- .../Form/ConfirmForm/ConfirmContent.jsx | 6 ++-- .../Form/ConfirmForm/ConfirmContent.jsx | 5 ++-- src/core/components/NumberShowBox.jsx | 2 +- 7 files changed, 46 insertions(+), 7 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 351fcec..d7e9da5 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -365,6 +365,8 @@ "tanafos_period_error": "وارد کردن دوره تنفس الزامیست", "approved_amount_positive": "مبلغ تصویب شده باید مثبت باشد", "approved_amount_number": "مبلغ تصویب شده باید عدد باشد", + "sakht_period_positive": "دوره ساخت باید مثبت باشد", + "tanafos_period_positive": "دوره تنفس باید مثبت باشد", "sakht_period_number": "دوره ساخت باید عدد باشد", "tanafos_period_number": "دوره تنفس باید عدد باشد", "toman": "میلیون تومان", @@ -554,6 +556,8 @@ "LoanHistory": { "id": "کد یکتا", "name": "نام", + "tanafos_period": "دوره تنفس", + "sakht_period": "دوره ساخت", "national_id": "کد ملی", "phone_number": "موبایل", "proposed_amount": "مبلغ پیشنهادی", diff --git a/src/components/dashboard/loan-history/index.jsx b/src/components/dashboard/loan-history/index.jsx index 66f28de..4836b3e 100644 --- a/src/components/dashboard/loan-history/index.jsx +++ b/src/components/dashboard/loan-history/index.jsx @@ -167,6 +167,34 @@ function DashboardLoanHistoryComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.sakht_period, + id: "sakht_period", + header: t("LoanHistory.sakht_period"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals" + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.tanafos_period, + id: "tanafos_period", + header: t("LoanHistory.tanafos_period"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals" + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => row.vehicle_type, id: "vehicle_type", diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx index 9dc919c..d338080 100644 --- a/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx @@ -84,10 +84,12 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type, hand sakht_period: Yup.mixed() .test("is-number", `${t("ConfirmDialog.sakht_period_number")}`, (value) => !isNaN(value)) + .test("positive", `${t("ConfirmDialog.sakht_period_positive")}`, (value) => value > 0) .required(t("ConfirmDialog.sakht_period_error")), tanafos_period: Yup.mixed() .test("is-number", `${t("ConfirmDialog.tanafos_period_number")}`, (value) => !isNaN(value)) + .test("positive", `${t("ConfirmDialog.tanafos_period_positive")}`, (value) => value > 0) .required(t("ConfirmDialog.tanafos_period_error")), confirm_img: Yup.mixed() .required(t("MachinaryOffice.upload_file_required")) @@ -117,6 +119,7 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type, hand if (values.confirm_img != null) formData.append("attachment", values.confirm_img); requestServer(`${CONFIRM_MACHINARY_OFFICE}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() diff --git a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx index f60e371..ae140fc 100644 --- a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx @@ -90,6 +90,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl requestServer(`${CONFIRM_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -155,12 +156,12 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl unitTitle={t("ConfirmDialog.unit")} /> diff --git a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx index f54c020..e66a522 100644 --- a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx @@ -47,6 +47,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand const booleanData = Array.from({length: response.data.data.attachment_files.length}, () => false); setAccordionStates(booleanData); setDetailsData(response.data) + console.log(response.data.data) }) .catch(() => { }).finally(() => { @@ -105,6 +106,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -172,12 +174,12 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand unitTitle={t("ConfirmDialog.unit")} /> diff --git a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx index 4934d8e..5a8b046 100644 --- a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx @@ -96,6 +96,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl requestServer(`${CONFIRM_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -160,12 +161,12 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl unitTitle={t("ConfirmDialog.unit")} /> diff --git a/src/core/components/NumberShowBox.jsx b/src/core/components/NumberShowBox.jsx index 528cf0b..b8e45b1 100644 --- a/src/core/components/NumberShowBox.jsx +++ b/src/core/components/NumberShowBox.jsx @@ -7,7 +7,7 @@ const NumberShowBox = ({showNumber, headerTitle, unitTitle}) => { {headerTitle} - {isNaN(showNumber) + {isNaN(showNumber) || showNumber === null ? "" : (showNumber).toLocaleString()}{" "} {unitTitle}