diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json
index d5d2da8..8170a99 100644
--- a/public/locales/fa/app.json
+++ b/public/locales/fa/app.json
@@ -93,7 +93,7 @@
},
"PassengerOffice": {
"name": "نام",
- "id": "کد ملی",
+ "national_id": "کد ملی",
"phone_number": "موبایل",
"created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی",
@@ -113,24 +113,28 @@
},
"MachinaryOffice": {
"name": "نام",
- "id": "کد ملی",
+ "national_id": "کد ملی",
"phone_number": "موبایل",
"created_at": "تاریخ درخواست",
"updated_at": "تاریخ بروزرسانی",
"navgan_id": "کد ناوگان",
"vehicle_type": "نوع ماشین",
- "state_name": "وضعیت درخواست"
+ "state_name": "وضعیت درخواست",
+ "proposed_amount": "مقدار پیشنهادی"
},
"ConfirmDialog": {
"confirm": "تایید",
"context": "آیا از تایید این آیتم اطمینان دارید",
"button-confirm": "تایید",
- "button-cancel": "بستن"
+ "button-cancel": "بستن",
+ "amount_error": "وارد کردن مقدار پیشنهادی الزامیست"
},
"RejectDialog": {
"reject": "عدم تایید",
"context": "آیا از عدم تایید این آیتم اطمینان دارید",
"button-reject": "عدم تایید",
- "button-cancel": "بستن"
+ "button-cancel": "بستن",
+ "description": "توضیحات",
+ "description_error": "وارد کردن توضیحات الزامی است!"
}
}
diff --git a/public/locales/fa/datatable.js b/public/locales/fa/datatable.js
index e42208f..819a84b 100644
--- a/public/locales/fa/datatable.js
+++ b/public/locales/fa/datatable.js
@@ -1,92 +1,92 @@
export const FA_DATATABLE_LOCALIZATION = {
- actions: "Actions",
- and: "and",
- cancel: "Cancel",
- changeFilterMode: "Change filter mode",
- changeSearchMode: "Change search mode",
- clearFilter: "Clear filter",
- clearSearch: "Clear search",
- clearSort: "Clear sort",
- clickToCopy: "Click to copy",
- collapse: "Collapse",
- collapseAll: "Collapse all",
- columnActions: "Column Actions",
- copiedToClipboard: "Copied to clipboard",
- dropToGroupBy: "Drop to group by {column}",
- edit: "Edit",
- expand: "Expand",
- expandAll: "Expand all",
- filterArrIncludes: "Includes",
- filterArrIncludesAll: "Includes all",
- filterArrIncludesSome: "Includes",
- filterBetween: "Between",
- filterBetweenInclusive: "Between Inclusive",
- filterByColumn: "Filter by {column}",
- filterContains: "Contains",
- filterEmpty: "Empty",
- filterEndsWith: "Ends With",
- filterEquals: "Equals",
- filterEqualsString: "Equals",
- filterFuzzy: "Fuzzy",
- filterGreaterThan: "Greater Than",
- filterGreaterThanOrEqualTo: "Greater Than Or Equal To",
- filterInNumberRange: "Between",
- filterIncludesString: "Contains",
- filterIncludesStringSensitive: "Contains",
- filterLessThan: "Less Than",
- filterLessThanOrEqualTo: "Less Than Or Equal To",
- filterMode: "Filter Mode: {filterType}",
- filterNotEmpty: "Not Empty",
- filterNotEquals: "Not Equals",
- filterStartsWith: "Starts With",
- filterWeakEquals: "Equals",
- filteringByColumn: "Filtering by {column} - {filterType} {filterValue}",
- goToFirstPage: "Go to first page",
- goToLastPage: "Go to last page",
- goToNextPage: "Go to next page",
- goToPreviousPage: "Go to previous page",
- grab: "Grab",
- groupByColumn: "Group by {column}",
- groupedBy: "Grouped by ",
- hideAll: "Hide all",
- hideColumn: "Hide {column} column",
- max: "Max",
- min: "Min",
- move: "Move",
- noRecordsToDisplay: "No records to display",
- noResultsFound: "No results found",
- of: "of",
- or: "or",
- pinToLeft: "Pin to left",
- pinToRight: "Pin to right",
- resetColumnSize: "Reset column size",
- resetOrder: "Reset order",
- rowActions: "Row Actions",
+ actions: "عملیات",
+ and: "و",
+ cancel: "لغو",
+ changeFilterMode: "تغییر حالت فیلتر",
+ changeSearchMode: "تغییر حالت جستجو",
+ clearFilter: "پاک کردن فیلتر",
+ clearSearch: "پاک کردن جستجو",
+ clearSort: "پاک کردن مرتب سازی",
+ clickToCopy: "کلیک برای کپی",
+ collapse: "جمع شدن",
+ collapseAll: "جمع شدن همه",
+ columnActions: "عملیات ستون",
+ copiedToClipboard: "کپی شد",
+ dropToGroupBy: "رها کردن برای گروه بندی بر اساس {column}",
+ edit: "ویرایش",
+ expand: "باز شدن",
+ expandAll: "باز شدن همه",
+ filterArrIncludes: "شامل",
+ filterArrIncludesAll: "شامل همه",
+ filterArrIncludesSome: "شامل",
+ filterBetween: "میان",
+ filterBetweenInclusive: "میان با احتساب هر دو",
+ filterByColumn: "فیلتر بر اساس {column}",
+ filterContains: "شامل",
+ filterEmpty: "خالی",
+ filterEndsWith: "به پایان میرسد با",
+ filterEquals: "برابر",
+ filterEqualsString: "برابر",
+ filterFuzzy: "نزدیک",
+ filterGreaterThan: "بزرگتر از",
+ filterGreaterThanOrEqualTo: "بزرگتر یا مساوی",
+ filterInNumberRange: "میان",
+ filterIncludesString: "شامل",
+ filterIncludesStringSensitive: "شامل",
+ filterLessThan: "کوچکتر از",
+ filterLessThanOrEqualTo: "کوچکتر یا مساوی",
+ filterMode: "حالت فیلتر: {filterType}",
+ filterNotEmpty: "غیر خالی",
+ filterNotEquals: "نا برابر",
+ filterStartsWith: "شروع میشود با",
+ filterWeakEquals: "برابر",
+ filteringByColumn: "فیلتر بر اساس {column} - {filterType} {filterValue}",
+ goToFirstPage: "رفتن به صفحه اول",
+ goToLastPage: "رفتن به صفحه آخر",
+ goToNextPage: "رفتن به صفحه بعدی",
+ goToPreviousPage: "رفتن به صفحه قبلی",
+ grab: "گرفتن",
+ groupByColumn: "گروه بندی بر اساس {column}",
+ groupedBy: "گروه بندی شده بر اساس",
+ hideAll: "پنهان کردن همه",
+ hideColumn: "پنهان کردن ستون {column}",
+ max: "حداکثر",
+ min: "حداقل",
+ move: "انتقال",
+ noRecordsToDisplay: "هیچ رکوردی برای نمایش وجود ندارد",
+ noResultsFound: "نتیجهای یافت نشد",
+ of: "از",
+ or: "یا",
+ pinToLeft: "چسباندن به سمت چپ",
+ pinToRight: "چسباندن به سمت راست",
+ resetColumnSize: "بازنشانی اندازه ستون",
+ resetOrder: "بازنشانی ترتیب",
+ rowActions: "عملیات ردیف",
rowNumber: "#",
- rowNumbers: "Row Numbers",
- rowsPerPage: "Rows per page",
- save: "Save",
- search: "Search",
+ rowNumbers: "شماره ردیف",
+ rowsPerPage: "ردیف در هر صفحه",
+ save: "ذخیره",
+ search: "جستجو",
selectedCountOfRowCountRowsSelected:
- "{selectedCount} of {rowCount} row(s) selected",
- select: "Select",
- showAll: "Show all",
- showAllColumns: "Show all columns",
- showHideColumns: "Show/Hide columns",
- showHideFilters: "Show/Hide filters",
- showHideSearch: "Show/Hide search",
- sortByColumnAsc: "Sort by {column} ascending",
- sortByColumnDesc: "Sort by {column} descending",
- sortedByColumnAsc: "Sorted by {column} ascending",
- sortedByColumnDesc: "Sorted by {column} descending",
- thenBy: ", then by ",
- toggleDensity: "Toggle density",
- toggleFullScreen: "Toggle full screen",
- toggleSelectAll: "Toggle select all",
- toggleSelectRow: "Toggle select row",
- toggleVisibility: "Toggle visibility",
- ungroupByColumn: "Ungroup by {column}",
- unpin: "Unpin",
- unpinAll: "Unpin all",
- unsorted: "Unsorted",
+ "{selectedCount} از {rowCount} ردیف انتخاب شده",
+ select: "انتخاب",
+ showAll: "نمایش همه",
+ showAllColumns: "نمایش همه ستونها",
+ showHideColumns: "نمایش/مخفی کردن ستونها",
+ showHideFilters: "نمایش/مخفی کردن فیلترها",
+ showHideSearch: "نمایش/مخفی کردن جستجو",
+ sortByColumnAsc: "مرتب سازی بر اساس {column} صعودی",
+ sortByColumnDesc: "مرتب سازی بر اساس {column} نزولی",
+ sortedByColumnAsc: "مرتب شده بر اساس {column} صعودی",
+ sortedByColumnDesc: "مرتب شده بر اساس {column} نزولی",
+ thenBy: "، سپس بر اساس ",
+ toggleDensity: "تغییر تراکم",
+ toggleFullScreen: "تغییر حالت تمام صفحه",
+ toggleSelectAll: "انتخاب/عدم انتخاب همه",
+ toggleSelectRow: "انتخاب/عدم انتخاب ردیف",
+ toggleVisibility: "تغییر پیدا/پنهان",
+ ungroupByColumn: "لغو گروه بندی بر اساس {column}",
+ unpin: "رها کردن",
+ unpinAll: "رها کردن همه",
+ unsorted: "بدون مرتب سازی",
};
diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx
index 5fd3f3b..754abce 100644
--- a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx
+++ b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx
@@ -1,3 +1,4 @@
+import { CONFIRM_MACHINARY_OFFICE } from "@/core/data/apiRoutes";
import {
Dialog,
DialogTitle,
@@ -5,32 +6,86 @@ import {
DialogContentText,
DialogActions,
Button,
+ TextField,
} from "@mui/material";
import { useTranslations } from "next-intl";
+import { useState } from "react";
+import { useFormik } from "formik";
+import * as Yup from "yup";
-const ConfirmForm = ({
- open,
- handleClose,
- handleDelete,
- rowId,
- deleteData,
-}) => {
+const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => {
const t = useTranslations();
- const handleDeleteExpert = () => {
- handleDelete();
+ const [proposedAmount, setProposedAmount] = useState("");
+ const [description, setDescription] = useState("");
+
+ //formik
+ const validationSchema = Yup.object().shape({
+ proposed_amount: Yup.string().required(t("ConfirmDialog.amount_error")),
+ });
+ const formik = useFormik({
+ initialValues: {
+ proposed_amount: "",
+ description: "",
+ },
+ validationSchema,
+ onSubmit: () => {
+ const formData = new FormData();
+ formData.append("proposed_amount", proposedAmount);
+ if (description != "") formData.append("expert_description", description);
+ handleClose();
+ confirmData(CONFIRM_MACHINARY_OFFICE, rowId, formData);
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ setDescription(event.target.value);
};
+ const handleAmountChange = (event) => {
+ setProposedAmount(event.target.value);
+ formik.handleChange(event);
+ };
+
return (
diff --git a/src/components/dashboard/machinary-office/Form/RejectForm.jsx b/src/components/dashboard/machinary-office/Form/RejectForm.jsx
index cf551a8..723f9a6 100644
--- a/src/components/dashboard/machinary-office/Form/RejectForm.jsx
+++ b/src/components/dashboard/machinary-office/Form/RejectForm.jsx
@@ -1,3 +1,4 @@
+import { REJECT_MACHINARY_OFFICE } from "@/core/data/apiRoutes";
import {
Dialog,
DialogTitle,
@@ -5,29 +6,71 @@ import {
DialogContentText,
DialogActions,
Button,
+ TextField,
} from "@mui/material";
import { useTranslations } from "next-intl";
+import { useFormik } from "formik";
+import * as Yup from "yup";
+import { useState } from "react";
-const RejectForm = ({ open, handleClose, handleDelete, rowId, deleteData }) => {
+const RejectForm = ({ open, handleClose, rowId, rejectData }) => {
const t = useTranslations();
- const handleDeleteExpert = () => {
- handleDelete();
+ const [description, setDescription] = useState("");
+
+ const validationSchema = Yup.object().shape({
+ description: Yup.string().required(t("RejectDialog.description_error")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ },
+ validationSchema,
+ onSubmit: () => {
+ const formData = new FormData();
+ formData.append("expert_description", description);
+ handleClose();
+ rejectData(REJECT_MACHINARY_OFFICE, rowId, formData);
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ setDescription(event.target.value);
+ formik.handleChange(event);
};
+
return (
);
};
+
export default RejectForm;
diff --git a/src/components/dashboard/machinary-office/TableRowActions.jsx b/src/components/dashboard/machinary-office/TableRowActions.jsx
index 832e77e..e9e815e 100644
--- a/src/components/dashboard/machinary-office/TableRowActions.jsx
+++ b/src/components/dashboard/machinary-office/TableRowActions.jsx
@@ -6,39 +6,47 @@ import { DataTableContext } from "@/lib/app/contexts/DataTableContext";
import ConfirmForm from "./Form/ConfirmForm";
import RejectForm from "./Form/RejectForm";
-// import DeleteForm from "./Form/DeleteForm";
-
const TableRowActions = ({ row }) => {
- // const {
- // openDeleteDialog,
- // handleOpenDeleteDialog,
- // handleCloseDeleteDialog,
- // handleDeleteDialog,
- // rowId,
- // deleteData,
- // } = useContext(DataTableContext);
+ const {
+ openConfirmDialog,
+ openRejectDialog,
+ handleOpenConfirmDialog,
+ handleOpenRejectDialog,
+ handleCloseConfirmDialog,
+ handleCloseRejectDialog,
+ rowId,
+ confirmData,
+ rejectData,
+ } = useContext(DataTableContext);
return (
- handleOpenDeleteDialog(row)}>
+ {
+ handleOpenConfirmDialog(row);
+ }}
+ >
- {/* */}
- handleOpenDeleteDialog(row)}>
+ {openConfirmDialog && (
+
+ )}
+ handleOpenRejectDialog(row)}>
- {/* */}
+ {openRejectDialog && (
+
+ )}
);
};
diff --git a/src/components/dashboard/machinary-office/index.jsx b/src/components/dashboard/machinary-office/index.jsx
index a9af448..bcd3eb4 100644
--- a/src/components/dashboard/machinary-office/index.jsx
+++ b/src/components/dashboard/machinary-office/index.jsx
@@ -3,7 +3,7 @@ import DashboardLayouts from "@/layouts/dashboardLayouts";
import { Box, Typography } from "@mui/material";
import { useMemo } from "react";
// import TableToolbar from "./TableTollbar";
-import { GET_PASSENGER_OFFICE } from "@/core/data/apiRoutes";
+import { GET_MACHINARY_OFFICE } from "@/core/data/apiRoutes";
import { useTranslations } from "next-intl";
import TableRowActions from "./TableRowActions";
@@ -24,9 +24,9 @@ function DashboardMachinaryOfficeComponent() {
),
},
{
- accessorFn: (row) => row.id,
- id: "id",
- header: t("MachinaryOffice.id"),
+ accessorFn: (row) => row.national_id,
+ id: "national_id",
+ header: t("MachinaryOffice.national_id"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
@@ -153,7 +153,7 @@ function DashboardMachinaryOfficeComponent() {
{
+const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => {
const t = useTranslations();
const handleConfirm = () => {
- handleDelete();
+ handleClose();
confirmData(CONFIRM_PASSENGER_OFFICE, rowId);
};
return (
diff --git a/src/components/dashboard/passenger-office/Form/RejectForm.jsx b/src/components/dashboard/passenger-office/Form/RejectForm.jsx
index 5c8ec93..149c480 100644
--- a/src/components/dashboard/passenger-office/Form/RejectForm.jsx
+++ b/src/components/dashboard/passenger-office/Form/RejectForm.jsx
@@ -6,23 +6,63 @@ import {
DialogContentText,
DialogActions,
Button,
+ TextField,
} from "@mui/material";
import { useTranslations } from "next-intl";
+import { useFormik } from "formik";
+import * as Yup from "yup";
+import { useState } from "react";
-const RejectForm = ({ open, handleClose, handleDelete, rowId, rejectData }) => {
+const RejectForm = ({ open, handleClose, rowId, rejectData }) => {
const t = useTranslations();
- const handleRejectRequest = () => {
- handleDelete();
- rejectData(REJECT_PASSENGER_OFFICE, rowId);
+ const [description, setDescription] = useState("");
+
+ const validationSchema = Yup.object().shape({
+ description: Yup.string().required(t("RejectDialog.description_error")),
+ });
+
+ const formik = useFormik({
+ initialValues: {
+ description: "",
+ },
+ validationSchema,
+ onSubmit: () => {
+ const formData = new FormData();
+ formData.append("expert_description", description);
+ handleClose();
+ rejectData(REJECT_PASSENGER_OFFICE, rowId, formData);
+ },
+ });
+
+ const handleDescriptionChange = (event) => {
+ setDescription(event.target.value);
+ formik.handleChange(event);
};
+
return (
);
};
+
export default RejectForm;
diff --git a/src/components/dashboard/passenger-office/TableRowActions.jsx b/src/components/dashboard/passenger-office/TableRowActions.jsx
index ec2d790..e9e815e 100644
--- a/src/components/dashboard/passenger-office/TableRowActions.jsx
+++ b/src/components/dashboard/passenger-office/TableRowActions.jsx
@@ -6,8 +6,6 @@ import { DataTableContext } from "@/lib/app/contexts/DataTableContext";
import ConfirmForm from "./Form/ConfirmForm";
import RejectForm from "./Form/RejectForm";
-// import DeleteForm from "./Form/DeleteForm";
-
const TableRowActions = ({ row }) => {
const {
openConfirmDialog,
@@ -16,34 +14,39 @@ const TableRowActions = ({ row }) => {
handleOpenRejectDialog,
handleCloseConfirmDialog,
handleCloseRejectDialog,
- handleConfirmDialog,
- handleRejectDialog,
rowId,
confirmData,
rejectData,
} = useContext(DataTableContext);
return (
- handleOpenConfirmDialog(row)}>
+ {
+ handleOpenConfirmDialog(row);
+ }}
+ >
-
+ {openConfirmDialog && (
+
+ )}
handleOpenRejectDialog(row)}>
-
+ {openRejectDialog && (
+
+ )}
);
};
diff --git a/src/components/dashboard/passenger-office/index.jsx b/src/components/dashboard/passenger-office/index.jsx
index 98af2b7..9313a5b 100644
--- a/src/components/dashboard/passenger-office/index.jsx
+++ b/src/components/dashboard/passenger-office/index.jsx
@@ -24,9 +24,9 @@ function DashboardPassengerOfficeComponent() {
),
},
{
- accessorFn: (row) => row.id,
- id: "id",
- header: t("PassengerOffice.id"),
+ accessorFn: (row) => row.national_id,
+ id: "national_id",
+ header: t("PassengerOffice.national_id"),
enableColumnFilter: true,
datatype: "numeric",
filterFn: "equals",
diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js
index 702c9c9..0f57675 100644
--- a/src/core/data/apiRoutes.js
+++ b/src/core/data/apiRoutes.js
@@ -23,6 +23,7 @@ export const REJECT_PASSENGER_OFFICE =
BASE_URL + "/dashboard/passenger_office_chief/reject";
//passenger office
+<<<<<<< HEAD
//transportation assistance
export const GET_TRANSPORTATION_ASSISTANCE =
BASE_URL + "/dashboard/transportation_asisstants/show";
@@ -33,3 +34,15 @@ export const CONFIRM_TRANSPORTATION_ASSISTANCE =
export const REJECT_TRANSPORTATION_ASSISTANCE =
BASE_URL + "/dashboard/transportation_asisstants/reject";
//transportation assistance
+=======
+//machinary office
+export const GET_MACHINARY_OFFICE =
+ BASE_URL + "/dashboard/machinery_expert/show";
+
+export const CONFIRM_MACHINARY_OFFICE =
+ BASE_URL + "/dashboard/machinery_expert/confirm";
+
+export const REJECT_MACHINARY_OFFICE =
+ BASE_URL + "/dashboard/machinery_expert/reject";
+//passenger office
+>>>>>>> a683c4029fdd3b3cae26a4cc7823835ad7e687b1
diff --git a/src/lib/app/hooks/useDatatable.jsx b/src/lib/app/hooks/useDatatable.jsx
index ccd772a..ddde95f 100644
--- a/src/lib/app/hooks/useDatatable.jsx
+++ b/src/lib/app/hooks/useDatatable.jsx
@@ -43,30 +43,33 @@ const useDataTable = () => {
const { token } = useUser();
- const confirmData = useCallback(async (url, rowID) => {
- dispatch({ type: "CONFIRM_DATA", url: url, rowID: rowID });
+ const confirmData = useCallback(async (url, rowID, values) => {
+ dispatch({ type: "CONFIRM_DATA", url: url, rowID: rowID, values: values });
axios
- .post(`${url}/${rowID}`, null, {
+ .post(`${url}/${rowID}`, values, {
headers: { authorization: `Bearer ${token}` },
})
- .then(() => {
+ .then((response) => {
setReloadDataTable(true);
+ Notifications(directionApp, response, t);
})
.catch((error) => {
Notifications(directionApp, error.response, t);
});
}, []);
- const rejectData = useCallback(async (url, rowID) => {
- dispatch({ type: "REJECT_DATA", url: url, rowID: rowID });
+ const rejectData = useCallback(async (url, rowID, values) => {
+ dispatch({ type: "REJECT_DATA", url: url, rowID: rowID, values: values });
axios
- .post(`${url}/${rowID}`, {
+ .post(`${url}/${rowID}`, values, {
headers: { authorization: `Bearer ${token}` },
})
- .then(() => {
+ .then((response) => {
setReloadDataTable(true);
+ Notifications(directionApp, response, t);
})
.catch((error) => {
+ console.log(error);
Notifications(directionApp, error.response, t);
});
}, []);
@@ -80,10 +83,6 @@ const useDataTable = () => {
const handleCloseConfirmDialog = () => {
setOpenConfirmDialog(false);
};
-
- const handleConfirmDialog = () => {
- setOpenConfirmDialog(false);
- };
//End Confirm Data
// Reject Data
@@ -95,19 +94,13 @@ const useDataTable = () => {
const handleCloseRejectDialog = () => {
setOpenRejectDialog(false);
};
-
- const handleRejectDialog = () => {
- setOpenRejectDialog(false);
- };
// End Reject Data
const contextValue = {
handleOpenConfirmDialog,
handleCloseConfirmDialog,
- handleConfirmDialog,
handleOpenRejectDialog,
handleCloseRejectDialog,
- handleRejectDialog,
rowId,
openConfirmDialog,
openRejectDialog,