From 40b6361c4214ed65e57f82d1ed3a18d30e83f8a7 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Tue, 11 Jul 2023 11:37:25 +0330 Subject: [PATCH 01/20] initialize first demo of passenger office --- public/locales/fa/app.json | 3 +- .../passenger-office/TableRowActions.jsx | 50 +++++ .../passenger-office/TableTollbar.jsx | 32 +++ .../dashboard/passenger-office/index.jsx | 192 ++++++++++++++++++ src/core/components/ImageConvertor.jsx | 22 ++ .../dashboard/passenger-office/index.jsx | 23 +++ 6 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 src/components/dashboard/passenger-office/TableRowActions.jsx create mode 100644 src/components/dashboard/passenger-office/TableTollbar.jsx create mode 100644 src/components/dashboard/passenger-office/index.jsx create mode 100644 src/pages/dashboard/passenger-office/index.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 09654eb..8a7b730 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -43,7 +43,8 @@ "error_message_required": "اجباری!" }, "Dashboard": { - "dashboard_page": "داشبورد" + "dashboard_page": "داشبورد", + "passenger_office_page": "اداره مسافر" }, "MuiDatePicker": { "date_picker_birthday": "تاریخ" diff --git a/src/components/dashboard/passenger-office/TableRowActions.jsx b/src/components/dashboard/passenger-office/TableRowActions.jsx new file mode 100644 index 0000000..0290214 --- /dev/null +++ b/src/components/dashboard/passenger-office/TableRowActions.jsx @@ -0,0 +1,50 @@ +import DeleteIcon from "@mui/icons-material/Delete"; +import EditIcon from "@mui/icons-material/Edit"; +import { Box, IconButton } from "@mui/material"; +// import EditForm from "./Form/EditForm"; +import { useContext } from "react"; +import { DataTableContext } from "@/lib/app/contexts/DataTableContext"; +// import DeleteForm from "./Form/DeleteForm"; + +const TableRowActions = ({ row }) => { + const { + toggleDrawer, + setDrawerContent, + openDeleteDialog, + handleOpenDeleteDialog, + handleCloseDeleteDialog, + handleDeleteDialog, + rowId, + deleteData, + } = useContext(DataTableContext); + return ( + + { + toggleDrawer(true); + // setDrawerContent(); + }} + > + + + handleOpenDeleteDialog(row)} + > + + + {/* */} + + ); +}; + +export default TableRowActions; diff --git a/src/components/dashboard/passenger-office/TableTollbar.jsx b/src/components/dashboard/passenger-office/TableTollbar.jsx new file mode 100644 index 0000000..0b29ba8 --- /dev/null +++ b/src/components/dashboard/passenger-office/TableTollbar.jsx @@ -0,0 +1,32 @@ +import { DataTableContext } from "@/lib/app/contexts/DataTableContext"; +import DataSaverOnIcon from "@mui/icons-material/DataSaverOn"; +import { Button, Stack, Tooltip } from "@mui/material"; +import { useTranslations } from "next-intl"; +import { useContext } from "react"; +// import AddForm from "./Form/AddForm"; + +function TableToolbar() { + const t = useTranslations(); + const { toggleDrawer, setDrawerContent } = useContext(DataTableContext); + return ( + + + + + + ); +} + +export default TableToolbar; diff --git a/src/components/dashboard/passenger-office/index.jsx b/src/components/dashboard/passenger-office/index.jsx new file mode 100644 index 0000000..2d52dd3 --- /dev/null +++ b/src/components/dashboard/passenger-office/index.jsx @@ -0,0 +1,192 @@ +import DataTableStructure from "@/core/components/DatatableStructure"; +import DashboardLayouts from "@/layouts/dashboardLayouts"; +import { ContentCopy } from "@mui/icons-material"; +import { Box, Typography } from "@mui/material"; +import { DateTimePicker, LocalizationProvider } from "@mui/x-date-pickers"; +import { format } from "date-fns-jalali"; +import { useMemo } from "react"; +import TableToolbar from "./TableTollbar"; +import TableRowActions from "./TableRowActions"; + +function DashboardPassengerOfficeComponent() { + const columns = useMemo( + () => [ + { + accessorFn: (row) => row.id, + id: "id", + header: "Id", + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.username, + id: "username", + header: "Username", + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.name, + id: "name", + header: "Name", + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + muiTableBodyCellCopyButtonProps: { + fullWidth: true, + endIcon: , + sx: { justifyContent: "space-between" }, + }, + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.phone_number, + id: "phone_number", + header: "Phone Number", + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["equals", "notEquals", "contains"], + muiTableBodyCellCopyButtonProps: { + fullWidth: true, + endIcon: , + sx: { justifyContent: "space-between" }, + }, + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.status, + id: "status", + header: "Status", + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + filterSelectOptions: [ + { text: "Active", value: "0" }, + { text: "Deactive", value: "1" }, + ], + filterVariant: "select", + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.gender, + id: "gender", + header: "Gender", + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + filterSelectOptions: [ + { text: "Male", value: "male" }, + { text: "Female", value: "female" }, + ], + filterVariant: "select", + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.national_id_code, + id: "national_id_code", + header: "National Id Code", + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["equals", "notEquals", "contains"], + muiTableBodyCellCopyButtonProps: { + fullWidth: true, + endIcon: , + sx: { justifyContent: "space-between" }, + }, + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => new Date(row.updated_at), + id: "updated_at", + header: "Update Date", + enableColumnFilter: true, + datatype: "date", + filterFn: "lessThan", + columnFilterModeOptions: ["lessThan", "greaterThan"], + Cell: ({ renderedCellValue }) => { + const date = new Date(renderedCellValue); + const formattedDate = format(date, "MM/dd/yyyy HH:mm"); + return {formattedDate}; + }, + Header: ({ column }) => {column.columnDef.header}, + Filter: ({ column }) => { + return ( + + { + const date = new Date(newValue); + const formattedDate = format(date, "yyyy-MM-dd HH:mm"); + column.setFilterValue(formattedDate); + }} + slotProps={{ + textField: { + helperText: `Filter Mode: ${column.columnDef._filterFn}`, + sx: { minWidth: "120px" }, + variant: "standard", + }, + }} + value={column.getFilterValue()} + /> + + ); + }, + }, + ], + [] + ); + return ( + + + } + enableLastUpdate={true} + enablePinning={true} + enableDensityToggle={true} + enableColumnFilters={true} + enableHiding={true} + enableFullScreenToggle={false} + enableGlobalFilter={false} + enableColumnResizing={false} // if you want true this you shold change renderRowActions props ** see https://www.material-react-table.com/docs/guides/row-actions + enableRowActions={true} + renderRowActions={({ row }) => } + /> + + + ); +} + +export default DashboardPassengerOfficeComponent; diff --git a/src/core/components/ImageConvertor.jsx b/src/core/components/ImageConvertor.jsx index e69de29..667182e 100644 --- a/src/core/components/ImageConvertor.jsx +++ b/src/core/components/ImageConvertor.jsx @@ -0,0 +1,22 @@ +import ImageResize from "image-resize"; + +const ImageResizer = async (image) => { + const imageResize = new ImageResize({ + quality: 1, + format: "jpg", + outputType: "base64", + width: 400, + }); + + const get = await imageResize.get(image); + const resize = await imageResize.resize(get).then(); + const output = await imageResize.output(resize).then(); + + const avatar = await (await import("image-to-file-converter")) + .base64ToFile(output) + .then(); + + return avatar; +}; + +export default ImageResizer; diff --git a/src/pages/dashboard/passenger-office/index.jsx b/src/pages/dashboard/passenger-office/index.jsx new file mode 100644 index 0000000..78ec016 --- /dev/null +++ b/src/pages/dashboard/passenger-office/index.jsx @@ -0,0 +1,23 @@ +import DashboardPassengerOfficeComponent from "@/components/dashboard/passenger-office"; +import TitlePage from "@/core/components/TitlePage"; +import WithAuthMiddleware from "@/middlewares/WithoutAuth"; +import { parse } from "next-useragent"; + +export default function PassengerOffice() { + return ( + + + + + ); +} + +export async function getServerSideProps({ req, locale }) { + const { isBot } = parse(req.headers["user-agent"]); + return { + props: { + messages: (await import(`&/locales/${locale}/app.json`)).default, + isBot, + }, + }; +} From 76164ed9c49ef588f21db7fc7a6b535e8365fd0b Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Thu, 13 Jul 2023 13:45:41 +0330 Subject: [PATCH 02/20] fix app.json bug --- public/locales/fa/app.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index e5a6462..79010f4 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -46,12 +46,9 @@ }, "Dashboard": { "dashboard_page": "داشبورد", -<<<<<<< HEAD - "passenger_office_page": "اداره مسافر" -======= + "passenger_office_page": "اداره مسافر", "change_password": "تغییر رمز عبور", "edit_profile": "ویرایش پروفایل" ->>>>>>> 135f6d1e2f3495abe68e3ca758870023dcd85d76 }, "MuiDatePicker": { "date_picker_birthday": "تاریخ" From 6b4a3e0c9b9da4da755b3affdd147b3082ad53bd Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Sat, 15 Jul 2023 11:03:02 +0330 Subject: [PATCH 03/20] loading page design --- public/images/loading_logo.svg | 1 + src/core/components/LoadingHardPage.jsx | 2 +- src/core/components/Messages.jsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 public/images/loading_logo.svg diff --git a/public/images/loading_logo.svg b/public/images/loading_logo.svg new file mode 100644 index 0000000..48fde43 --- /dev/null +++ b/public/images/loading_logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/core/components/LoadingHardPage.jsx b/src/core/components/LoadingHardPage.jsx index 5da632d..5a86af8 100644 --- a/src/core/components/LoadingHardPage.jsx +++ b/src/core/components/LoadingHardPage.jsx @@ -28,7 +28,7 @@ const LoadingHardPage = ({ children, loading }) => { > { Date: Sat, 15 Jul 2023 15:14:16 +0330 Subject: [PATCH 04/20] passenger office implement --- public/locales/fa/app.json | 11 + .../passenger-office/Form/ConfirmForm.jsx | 39 ++++ .../passenger-office/Form/RejectForm.jsx | 33 +++ .../passenger-office/TableRowActions.jsx | 54 ++--- .../passenger-office/TableTollbar.jsx | 23 +- .../dashboard/passenger-office/index.jsx | 221 ++++++++---------- src/core/data/apiRoutes.js | 15 +- src/lib/app/hooks/useDatatable.jsx | 6 +- .../dashboard/passenger-office/index.jsx | 2 +- 9 files changed, 230 insertions(+), 174 deletions(-) create mode 100644 src/components/dashboard/passenger-office/Form/ConfirmForm.jsx create mode 100644 src/components/dashboard/passenger-office/Form/RejectForm.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 79010f4..9d1409c 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -6,6 +6,7 @@ "login": "ورود", "login_expert": "ورود کارشناس", "expert": "کارشناس", + "last_updated_at": "اخرین بروز رسانی", "header": { "open_profile": "پروفایل", "edit_profile": "ویرایش پروفایل", @@ -88,5 +89,15 @@ "warning_static_text": "خطا سرور", "success_static_text": "عملیات شما با موفقیت انجام شد", "pending": "در حال انجام..." + }, + "PassengerOffice": { + "name": "نام", + "id": "کد ملی", + "phone_number": "موبایل", + "created_at": "تاریخ درخواست", + "updated_at": "تاریخ بروزرسانی", + "navgan_id": "کد ناوگان", + "vehicle_type": "نوع ماشین", + "state_name": "وضعیت درخواست" } } diff --git a/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx b/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx new file mode 100644 index 0000000..5fd3f3b --- /dev/null +++ b/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx @@ -0,0 +1,39 @@ +import { + Dialog, + DialogTitle, + DialogContent, + DialogContentText, + DialogActions, + Button, +} from "@mui/material"; +import { useTranslations } from "next-intl"; + +const ConfirmForm = ({ + open, + handleClose, + handleDelete, + rowId, + deleteData, +}) => { + const t = useTranslations(); + const handleDeleteExpert = () => { + handleDelete(); + }; + return ( + + {t("delete-dialog.confirm")} + + {t("delete-dialog.context")} + + + + + + + ); +}; +export default ConfirmForm; diff --git a/src/components/dashboard/passenger-office/Form/RejectForm.jsx b/src/components/dashboard/passenger-office/Form/RejectForm.jsx new file mode 100644 index 0000000..cf551a8 --- /dev/null +++ b/src/components/dashboard/passenger-office/Form/RejectForm.jsx @@ -0,0 +1,33 @@ +import { + Dialog, + DialogTitle, + DialogContent, + DialogContentText, + DialogActions, + Button, +} from "@mui/material"; +import { useTranslations } from "next-intl"; + +const RejectForm = ({ open, handleClose, handleDelete, rowId, deleteData }) => { + const t = useTranslations(); + const handleDeleteExpert = () => { + handleDelete(); + }; + return ( + + {t("delete-dialog.confirm")} + + {t("delete-dialog.context")} + + + + + + + ); +}; +export default RejectForm; diff --git a/src/components/dashboard/passenger-office/TableRowActions.jsx b/src/components/dashboard/passenger-office/TableRowActions.jsx index 0290214..832e77e 100644 --- a/src/components/dashboard/passenger-office/TableRowActions.jsx +++ b/src/components/dashboard/passenger-office/TableRowActions.jsx @@ -1,42 +1,38 @@ -import DeleteIcon from "@mui/icons-material/Delete"; -import EditIcon from "@mui/icons-material/Edit"; +import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt"; +import ThumbDownIcon from "@mui/icons-material/ThumbDown"; import { Box, IconButton } from "@mui/material"; -// import EditForm from "./Form/EditForm"; import { useContext } from "react"; 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 { - toggleDrawer, - setDrawerContent, - openDeleteDialog, - handleOpenDeleteDialog, - handleCloseDeleteDialog, - handleDeleteDialog, - rowId, - deleteData, - } = useContext(DataTableContext); + // const { + // openDeleteDialog, + // handleOpenDeleteDialog, + // handleCloseDeleteDialog, + // handleDeleteDialog, + // rowId, + // deleteData, + // } = useContext(DataTableContext); return ( - { - toggleDrawer(true); - // setDrawerContent(); - }} - > - + handleOpenDeleteDialog(row)}> + - handleOpenDeleteDialog(row)} - > - + {/* */} + handleOpenDeleteDialog(row)}> + - {/* - - - + ); } diff --git a/src/components/dashboard/passenger-office/index.jsx b/src/components/dashboard/passenger-office/index.jsx index 2d52dd3..98af2b7 100644 --- a/src/components/dashboard/passenger-office/index.jsx +++ b/src/components/dashboard/passenger-office/index.jsx @@ -1,20 +1,32 @@ import DataTableStructure from "@/core/components/DatatableStructure"; import DashboardLayouts from "@/layouts/dashboardLayouts"; -import { ContentCopy } from "@mui/icons-material"; import { Box, Typography } from "@mui/material"; -import { DateTimePicker, LocalizationProvider } from "@mui/x-date-pickers"; -import { format } from "date-fns-jalali"; import { useMemo } from "react"; -import TableToolbar from "./TableTollbar"; +// import TableToolbar from "./TableTollbar"; +import { GET_PASSENGER_OFFICE } from "@/core/data/apiRoutes"; +import { useTranslations } from "next-intl"; import TableRowActions from "./TableRowActions"; function DashboardPassengerOfficeComponent() { + const t = useTranslations(); const columns = useMemo( () => [ + { + accessorFn: (row) => row.name, + id: "name", + header: t("PassengerOffice.name"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => row.id, id: "id", - header: "Id", + header: t("PassengerOffice.id"), enableColumnFilter: true, datatype: "numeric", filterFn: "equals", @@ -30,56 +42,98 @@ function DashboardPassengerOfficeComponent() { {renderedCellValue} ), }, - { - accessorFn: (row) => row.username, - id: "username", - header: "Username", - enableColumnFilter: true, - datatype: "text", - filterFn: "contains", - columnFilterModeOptions: ["contains", "equals", "notEquals"], - Cell: ({ renderedCellValue }) => ( - {renderedCellValue} - ), - }, - { - accessorFn: (row) => row.name, - id: "name", - header: "Name", - enableColumnFilter: true, - datatype: "text", - filterFn: "contains", - columnFilterModeOptions: ["contains", "equals", "notEquals"], - muiTableBodyCellCopyButtonProps: { - fullWidth: true, - endIcon: , - sx: { justifyContent: "space-between" }, - }, - Cell: ({ renderedCellValue }) => ( - {renderedCellValue} - ), - }, { accessorFn: (row) => row.phone_number, id: "phone_number", - header: "Phone Number", + header: t("PassengerOffice.phone_number"), enableColumnFilter: true, - datatype: "text", - filterFn: "contains", - columnFilterModeOptions: ["equals", "notEquals", "contains"], - muiTableBodyCellCopyButtonProps: { - fullWidth: true, - endIcon: , - sx: { justifyContent: "space-between" }, - }, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], Cell: ({ renderedCellValue }) => ( {renderedCellValue} ), }, { - accessorFn: (row) => row.status, - id: "status", - header: "Status", + accessorFn: (row) => row.created_at, + id: "created_at", + header: t("PassengerOffice.created_at"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.updated_at, + id: "updated_at", + header: t("PassengerOffice.updated_at"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.navgan_id, + id: "navgan_id", + header: t("PassengerOffice.navgan_id"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.vehicle_type, + id: "vehicle_type", + header: t("PassengerOffice.vehicle_type"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.state_name, + id: "state_id", + header: t("PassengerOffice.state_name"), enableColumnFilter: true, datatype: "numeric", filterFn: "equals", @@ -92,75 +146,6 @@ function DashboardPassengerOfficeComponent() { {renderedCellValue} ), }, - { - accessorFn: (row) => row.gender, - id: "gender", - header: "Gender", - enableColumnFilter: true, - datatype: "text", - filterFn: "equals", - filterSelectOptions: [ - { text: "Male", value: "male" }, - { text: "Female", value: "female" }, - ], - filterVariant: "select", - Cell: ({ renderedCellValue }) => ( - {renderedCellValue} - ), - }, - { - accessorFn: (row) => row.national_id_code, - id: "national_id_code", - header: "National Id Code", - enableColumnFilter: true, - datatype: "text", - filterFn: "contains", - columnFilterModeOptions: ["equals", "notEquals", "contains"], - muiTableBodyCellCopyButtonProps: { - fullWidth: true, - endIcon: , - sx: { justifyContent: "space-between" }, - }, - Cell: ({ renderedCellValue }) => ( - {renderedCellValue} - ), - }, - { - accessorFn: (row) => new Date(row.updated_at), - id: "updated_at", - header: "Update Date", - enableColumnFilter: true, - datatype: "date", - filterFn: "lessThan", - columnFilterModeOptions: ["lessThan", "greaterThan"], - Cell: ({ renderedCellValue }) => { - const date = new Date(renderedCellValue); - const formattedDate = format(date, "MM/dd/yyyy HH:mm"); - return {formattedDate}; - }, - Header: ({ column }) => {column.columnDef.header}, - Filter: ({ column }) => { - return ( - - { - const date = new Date(newValue); - const formattedDate = format(date, "yyyy-MM-dd HH:mm"); - column.setFilterValue(formattedDate); - }} - slotProps={{ - textField: { - helperText: `Filter Mode: ${column.columnDef._filterFn}`, - sx: { minWidth: "120px" }, - variant: "standard", - }, - }} - value={column.getFilterValue()} - /> - - ); - }, - }, ], [] ); @@ -168,11 +153,11 @@ function DashboardPassengerOfficeComponent() { } + // CustomToolbar={} enableLastUpdate={true} enablePinning={true} enableDensityToggle={true} diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 1b299cc..5c73fcf 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -8,6 +8,17 @@ export const GET_USER_TOKEN = BASE_URL + "/dashboard/login"; export const CHANGE_PASSWORD = BASE_URL + "/dashboard/profile/change_password"; //end change password -//user data +//user data export const GET_USER_ROUTE = BASE_URL + "/dashboard/profile/info"; -//user data \ No newline at end of file +//user data + +//passenger office +export const GET_PASSENGER_OFFICE = + BASE_URL + "/dashboard/passenger_office_chief/show"; + +export const CONFIRM_PASSENGER_OFFICE = + BASE_URL + "/dashboard/passenger_office_chief/confirm"; + +export const REJECT_PASSENGER_OFFICE = + BASE_URL + "/dashboard/passenger_office_chief/reject"; +//passenger office diff --git a/src/lib/app/hooks/useDatatable.jsx b/src/lib/app/hooks/useDatatable.jsx index e0626e7..71d0b9d 100644 --- a/src/lib/app/hooks/useDatatable.jsx +++ b/src/lib/app/hooks/useDatatable.jsx @@ -4,7 +4,7 @@ import { useState, useReducer, useCallback, useContext } from "react"; import axios from "axios"; import ImageResizer from "@/core/components/ImageConvertor"; import useUser from "./useUser"; -import { ReloadDataTableContext } from "../contexts/ReloadDatatableContext"; +// import { ReloadDataTableContext } from "../contexts/ReloadDatatableContext"; const initialValues = { url: "", @@ -48,7 +48,7 @@ const reducer = (state, action) => { }; const useDataTable = () => { - const { setReloadDataTable } = useContext(ReloadDataTableContext); + // const { setReloadDataTable } = useContext(ReloadDataTableContext); const [state, dispatch] = useReducer(reducer, initialValues); const [drawerContent, setDrawerContent] = useState(null); const [openDeleteDialog, setOpenDeleteDialog] = useState(false); @@ -95,7 +95,7 @@ const useDataTable = () => { }, }) .then(() => { - setReloadDataTable(true); + // setReloadDataTable(true); }) .catch(() => {}); }, []); diff --git a/src/pages/dashboard/passenger-office/index.jsx b/src/pages/dashboard/passenger-office/index.jsx index 78ec016..36e2a95 100644 --- a/src/pages/dashboard/passenger-office/index.jsx +++ b/src/pages/dashboard/passenger-office/index.jsx @@ -1,6 +1,6 @@ import DashboardPassengerOfficeComponent from "@/components/dashboard/passenger-office"; import TitlePage from "@/core/components/TitlePage"; -import WithAuthMiddleware from "@/middlewares/WithoutAuth"; +import WithAuthMiddleware from "@/middlewares/WithAuth"; import { parse } from "next-useragent"; export default function PassengerOffice() { From f2568ff74e4b45aa26be90f9110a4f1db6cd88f5 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sat, 15 Jul 2023 16:25:32 +0330 Subject: [PATCH 05/20] interaction with back --- public/locales/fa/app.json | 11 ++ .../machinary-office/Form/ConfirmForm.jsx | 39 ++++ .../machinary-office/Form/RejectForm.jsx | 33 ++++ .../machinary-office/TableRowActions.jsx | 46 +++++ .../machinary-office/TableTolbar.jsx | 13 ++ .../dashboard/machinary-office/index.jsx | 177 ++++++++++++++++++ src/components/login-expert/index.jsx | 2 - .../dashboard/machinary-office/index.jsx | 23 +++ 8 files changed, 342 insertions(+), 2 deletions(-) create mode 100644 src/components/dashboard/machinary-office/Form/ConfirmForm.jsx create mode 100644 src/components/dashboard/machinary-office/Form/RejectForm.jsx create mode 100644 src/components/dashboard/machinary-office/TableRowActions.jsx create mode 100644 src/components/dashboard/machinary-office/TableTolbar.jsx create mode 100644 src/components/dashboard/machinary-office/index.jsx create mode 100644 src/pages/dashboard/machinary-office/index.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 9d1409c..af3efcc 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -48,6 +48,7 @@ "Dashboard": { "dashboard_page": "داشبورد", "passenger_office_page": "اداره مسافر", + "machinary_office_page": "ماشین آلات", "change_password": "تغییر رمز عبور", "edit_profile": "ویرایش پروفایل" }, @@ -99,5 +100,15 @@ "navgan_id": "کد ناوگان", "vehicle_type": "نوع ماشین", "state_name": "وضعیت درخواست" + }, + "MachinaryOffice": { + "name": "نام", + "id": "کد ملی", + "phone_number": "موبایل", + "created_at": "تاریخ درخواست", + "updated_at": "تاریخ بروزرسانی", + "navgan_id": "کد ناوگان", + "vehicle_type": "نوع ماشین", + "state_name": "وضعیت درخواست" } } diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx new file mode 100644 index 0000000..5fd3f3b --- /dev/null +++ b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx @@ -0,0 +1,39 @@ +import { + Dialog, + DialogTitle, + DialogContent, + DialogContentText, + DialogActions, + Button, +} from "@mui/material"; +import { useTranslations } from "next-intl"; + +const ConfirmForm = ({ + open, + handleClose, + handleDelete, + rowId, + deleteData, +}) => { + const t = useTranslations(); + const handleDeleteExpert = () => { + handleDelete(); + }; + return ( + + {t("delete-dialog.confirm")} + + {t("delete-dialog.context")} + + + + + + + ); +}; +export default ConfirmForm; diff --git a/src/components/dashboard/machinary-office/Form/RejectForm.jsx b/src/components/dashboard/machinary-office/Form/RejectForm.jsx new file mode 100644 index 0000000..cf551a8 --- /dev/null +++ b/src/components/dashboard/machinary-office/Form/RejectForm.jsx @@ -0,0 +1,33 @@ +import { + Dialog, + DialogTitle, + DialogContent, + DialogContentText, + DialogActions, + Button, +} from "@mui/material"; +import { useTranslations } from "next-intl"; + +const RejectForm = ({ open, handleClose, handleDelete, rowId, deleteData }) => { + const t = useTranslations(); + const handleDeleteExpert = () => { + handleDelete(); + }; + return ( + + {t("delete-dialog.confirm")} + + {t("delete-dialog.context")} + + + + + + + ); +}; +export default RejectForm; diff --git a/src/components/dashboard/machinary-office/TableRowActions.jsx b/src/components/dashboard/machinary-office/TableRowActions.jsx new file mode 100644 index 0000000..832e77e --- /dev/null +++ b/src/components/dashboard/machinary-office/TableRowActions.jsx @@ -0,0 +1,46 @@ +import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt"; +import ThumbDownIcon from "@mui/icons-material/ThumbDown"; +import { Box, IconButton } from "@mui/material"; +import { useContext } from "react"; +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); + return ( + + handleOpenDeleteDialog(row)}> + + + {/* */} + handleOpenDeleteDialog(row)}> + + + {/* */} + + ); +}; + +export default TableRowActions; diff --git a/src/components/dashboard/machinary-office/TableTolbar.jsx b/src/components/dashboard/machinary-office/TableTolbar.jsx new file mode 100644 index 0000000..3f06d3b --- /dev/null +++ b/src/components/dashboard/machinary-office/TableTolbar.jsx @@ -0,0 +1,13 @@ +import { Stack, Tooltip } from "@mui/material"; +import { useTranslations } from "next-intl"; + +function TableToolbar() { + const t = useTranslations(); + return ( + + + + ); +} + +export default TableToolbar; diff --git a/src/components/dashboard/machinary-office/index.jsx b/src/components/dashboard/machinary-office/index.jsx new file mode 100644 index 0000000..a9af448 --- /dev/null +++ b/src/components/dashboard/machinary-office/index.jsx @@ -0,0 +1,177 @@ +import DataTableStructure from "@/core/components/DatatableStructure"; +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 { useTranslations } from "next-intl"; +import TableRowActions from "./TableRowActions"; + +function DashboardMachinaryOfficeComponent() { + const t = useTranslations(); + const columns = useMemo( + () => [ + { + accessorFn: (row) => row.name, + id: "name", + header: t("MachinaryOffice.name"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.id, + id: "id", + header: t("MachinaryOffice.id"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.phone_number, + id: "phone_number", + header: t("MachinaryOffice.phone_number"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.created_at, + id: "created_at", + header: t("MachinaryOffice.created_at"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.updated_at, + id: "updated_at", + header: t("MachinaryOffice.updated_at"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.navgan_id, + id: "navgan_id", + header: t("MachinaryOffice.navgan_id"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.vehicle_type, + id: "vehicle_type", + header: t("MachinaryOffice.vehicle_type"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.state_name, + id: "state_id", + header: t("MachinaryOffice.state_name"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + filterSelectOptions: [ + { text: "Active", value: "0" }, + { text: "Deactive", value: "1" }, + ], + filterVariant: "select", + Cell: ({ renderedCellValue }) => ( + {renderedCellValue} + ), + }, + ], + [] + ); + return ( + + + } + enableLastUpdate={true} + enablePinning={true} + enableDensityToggle={true} + enableColumnFilters={true} + enableHiding={true} + enableFullScreenToggle={false} + enableGlobalFilter={false} + enableColumnResizing={false} // if you want true this you shold change renderRowActions props ** see https://www.material-react-table.com/docs/guides/row-actions + enableRowActions={true} + renderRowActions={({ row }) => } + /> + + + ); +} + +export default DashboardMachinaryOfficeComponent; diff --git a/src/components/login-expert/index.jsx b/src/components/login-expert/index.jsx index bcc3b1a..4d6af4a 100644 --- a/src/components/login-expert/index.jsx +++ b/src/components/login-expert/index.jsx @@ -41,12 +41,10 @@ const LoginComponent = () => { password: values.password, }) .then(function (response) { - console.log(response); setToken(response.data.token); }) .catch(function (error) { // Notifications(directionApp, error.response, t); - console.log(error); props.setSubmitting(false); }); }; diff --git a/src/pages/dashboard/machinary-office/index.jsx b/src/pages/dashboard/machinary-office/index.jsx new file mode 100644 index 0000000..0bb3553 --- /dev/null +++ b/src/pages/dashboard/machinary-office/index.jsx @@ -0,0 +1,23 @@ +import DashboardMachinaryOfficeComponent from "@/components/dashboard/machinary-office"; +import TitlePage from "@/core/components/TitlePage"; +import WithAuthMiddleware from "@/middlewares/WithAuth"; +import { parse } from "next-useragent"; + +export default function PassengerOffice() { + return ( + + + + + ); +} + +export async function getServerSideProps({ req, locale }) { + const { isBot } = parse(req.headers["user-agent"]); + return { + props: { + messages: (await import(`&/locales/${locale}/app.json`)).default, + isBot, + }, + }; +} From 83dad6f040a13e446053b403cf9b125a315c0169 Mon Sep 17 00:00:00 2001 From: Mohammad Jalali Date: Sat, 15 Jul 2023 16:26:35 +0330 Subject: [PATCH 06/20] debug datatable structure --- public/locales/fa/app.json | 12 ++ .../passenger-office/Form/ConfirmForm.jsx | 8 +- .../passenger-office/Form/RejectForm.jsx | 13 +- .../passenger-office/TableRowActions.jsx | 44 ++--- src/core/components/DatatableStructure.jsx | 2 +- src/lib/app/hooks/useDatatable.jsx | 154 ++++++------------ 6 files changed, 97 insertions(+), 136 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 9d1409c..d263ce5 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -99,5 +99,17 @@ "navgan_id": "کد ناوگان", "vehicle_type": "نوع ماشین", "state_name": "وضعیت درخواست" + }, + "ConfirmDialog": { + "confirm": "تایید", + "context": "آیا از تایید این آیتم اطمینان دارید", + "button-confirm": "تایید", + "button-cancel": "بستن" + }, + "RejectDialog": { + "reject": "عدم تایید", + "context": "آیا از عدم تایید این آیتم اطمینان دارید", + "button-reject": "عدم تایید", + "button-cancel": "بستن" } } diff --git a/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx b/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx index 5fd3f3b..f5adf2f 100644 --- a/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx +++ b/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx @@ -21,16 +21,16 @@ const ConfirmForm = ({ }; return ( - {t("delete-dialog.confirm")} + {t("ConfirmDialog.confirm")} - {t("delete-dialog.context")} + {t("ConfirmDialog.context")} diff --git a/src/components/dashboard/passenger-office/Form/RejectForm.jsx b/src/components/dashboard/passenger-office/Form/RejectForm.jsx index cf551a8..75a0e4e 100644 --- a/src/components/dashboard/passenger-office/Form/RejectForm.jsx +++ b/src/components/dashboard/passenger-office/Form/RejectForm.jsx @@ -10,21 +10,22 @@ import { useTranslations } from "next-intl"; const RejectForm = ({ open, handleClose, handleDelete, rowId, deleteData }) => { const t = useTranslations(); - const handleDeleteExpert = () => { + const handleRejectRequest = () => { handleDelete(); }; + console.log(rowId); return ( - {t("delete-dialog.confirm")} + {t("RejectDialog.reject")} - {t("delete-dialog.context")} + {t("RejectDialog.context")} - diff --git a/src/components/dashboard/passenger-office/TableRowActions.jsx b/src/components/dashboard/passenger-office/TableRowActions.jsx index 832e77e..5aefae7 100644 --- a/src/components/dashboard/passenger-office/TableRowActions.jsx +++ b/src/components/dashboard/passenger-office/TableRowActions.jsx @@ -9,36 +9,40 @@ 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, + handleConfirmDialog, + handleRejectDialog, + rowId, + deleteData, + } = useContext(DataTableContext); return ( - handleOpenDeleteDialog(row)}> + handleOpenConfirmDialog(row)}> - {/* */} - handleOpenDeleteDialog(row)}> + /> + handleOpenRejectDialog(row)}> - {/* */} + /> ); }; diff --git a/src/core/components/DatatableStructure.jsx b/src/core/components/DatatableStructure.jsx index e13ed16..e033a09 100644 --- a/src/core/components/DatatableStructure.jsx +++ b/src/core/components/DatatableStructure.jsx @@ -1,4 +1,4 @@ -import { DataTableProvider } from "@/lib/app/contexts/DatatableContext"; +import { DataTableProvider } from "@/lib/app/contexts/DataTableContext"; import DataTable from "./Datatable"; import { ReloadDataTableProvider } from "@/lib/app/contexts/ReloadDatatableContext"; diff --git a/src/lib/app/hooks/useDatatable.jsx b/src/lib/app/hooks/useDatatable.jsx index 71d0b9d..6b0789a 100644 --- a/src/lib/app/hooks/useDatatable.jsx +++ b/src/lib/app/hooks/useDatatable.jsx @@ -1,46 +1,28 @@ -import { useMediaQuery } from "@mui/material"; -import { useTheme } from "@mui/material/styles"; -import { useState, useReducer, useCallback, useContext } from "react"; import axios from "axios"; -import ImageResizer from "@/core/components/ImageConvertor"; +import { useCallback, useContext, useReducer, useState } from "react"; +import { ReloadDataTableContext } from "../contexts/ReloadDatatableContext"; import useUser from "./useUser"; -// import { ReloadDataTableContext } from "../contexts/ReloadDatatableContext"; const initialValues = { url: "", rowID: "", values: {}, - image: { - key: "", - value: {}, - }, }; const reducer = (state, action) => { switch (action.type) { - case "ADD_DATA": + case "CONFIRM_DATA": return { ...state, url: action.url, - values: action.values, - image: action.image, - rowID: "", - }; - case "EDIT_DATA": - return { - ...state, - url: action.url, - values: action.values, rowID: action.rowID, - image: action.image, }; - case "DELETE_DATA": + case "REJECT_DATA": return { ...state, url: action.url, rowID: action.rowID, values: {}, - image: {}, }; default: return state; @@ -48,120 +30,82 @@ const reducer = (state, action) => { }; const useDataTable = () => { - // const { setReloadDataTable } = useContext(ReloadDataTableContext); + const { setReloadDataTable } = useContext(ReloadDataTableContext); const [state, dispatch] = useReducer(reducer, initialValues); - const [drawerContent, setDrawerContent] = useState(null); - const [openDeleteDialog, setOpenDeleteDialog] = useState(false); + const [openConfirmDialog, setOpenConfirmDialog] = useState(false); + const [openRejectDialog, setOpenRejectDialog] = useState(false); const [rowId, setRowId] = useState(null); - const theme = useTheme(); + const { token } = useUser(); - const drawerDirection = useMediaQuery(theme.breakpoints.up("sm")) - ? "right" - : "bottom"; - const [sweepableDrawer, setSweepableDrawer] = useState({ - bottom: false, - right: false, - }); - - const addData = useCallback(async (url, values, image) => { - dispatch({ type: "ADD_DATA", url: url, values: values, image: image }); - if (image != null) { - var resizedAvatar = await ImageResizer(image.value); - formData.append(image.key, resizedAvatar); - axios.post(url, formData, { - headers: { - authorization: `Bearer ${token}`, - "Content-Type": "multipart/form-data", - }, - }); - } + const confirmData = useCallback(async (url, rowID) => { + dispatch({ type: "CONFIRM_DATA", url: url, rowID: rowID }); axios - .post(url, values, { - headers: { - authorization: `Bearer ${token}`, - }, - }) - .then(() => {}) - .catch(() => {}); - }, []); - - const deleteData = useCallback(async (url, rowID) => { - dispatch({ type: "DELETE_DATA", url: url, rowID: rowID }); - axios - .delete(`${url}/${rowID}`, { + .post(`${url}/${rowID}`, { headers: { authorization: `Bearer ${token}`, }, }) .then(() => { - // setReloadDataTable(true); + setReloadDataTable(true); }) .catch(() => {}); }, []); - const editData = useCallback(async (url, values, rowID, image) => { - dispatch({ - type: "EDIT_DATA", - url: url, - values: values, - rowID: rowID, - image: image, - }); - if (image != null) { - var resizedAvatar = await ImageResizer(image.value); - formData.append(image.key, resizedAvatar); - axios.post(`${url}/${rowID}`, formData, { - headers: { - authorization: `Bearer ${token}`, - "Content-Type": "multipart/form-data", - }, - }); - } + const rejectData = useCallback(async (url, rowID) => { + dispatch({ type: "REJECT_DATA", url: url, rowID: rowID }); axios - .post(`${url}/${rowID}`, values, { + .post(`${url}/${rowID}`, { headers: { authorization: `Bearer ${token}`, }, }) - .then(() => {}) + .then(() => { + setReloadDataTable(true); + }) .catch(() => {}); }, []); - const toggleDrawer = (open) => { - open == false && - setTimeout(() => { - setDrawerContent(null); - }, theme.transitions.duration.leavingScreen); - setSweepableDrawer({ ...sweepableDrawer, [drawerDirection]: open }); - }; - const handleOpenDeleteDialog = (row) => { + const handleOpenConfirmDialog = (row) => { setRowId(row.getValue("id")); - setOpenDeleteDialog(true); + setOpenConfirmDialog(true); }; - const handleCloseDeleteDialog = () => { - setOpenDeleteDialog(false); + const handleCloseConfirmDialog = () => { + setOpenConfirmDialog(false); }; - const handleDeleteDialog = () => { - setOpenDeleteDialog(false); + const handleConfirmDialog = () => { + setOpenConfirmDialog(false); }; + // Reject Data + const handleOpenRejectDialog = (row) => { + setRowId(row.getValue("id")); + setOpenRejectDialog(true); + }; + + const handleCloseRejectDialog = () => { + setOpenRejectDialog(false); + }; + + const handleRejectDialog = () => { + setOpenRejectDialog(false); + }; + // End Reject Data + const contextValue = { - toggleDrawer, - drawerDirection, - sweepableDrawer, - setSweepableDrawer, - setDrawerContent, - drawerContent, - openDeleteDialog, - handleOpenDeleteDialog, - handleCloseDeleteDialog, - handleDeleteDialog, + handleOpenConfirmDialog, + handleCloseConfirmDialog, + handleConfirmDialog, + handleOpenRejectDialog, + handleCloseRejectDialog, + handleRejectDialog, rowId, - deleteData, - addData, + openConfirmDialog, + openRejectDialog, + rejectData, + confirmData, }; return contextValue; }; From d7f3638b67f2b9d5368eeada449039af844acd19 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sat, 15 Jul 2023 16:38:26 +0330 Subject: [PATCH 07/20] merg conflict --- public/locales/fa/app.json | 1 + 1 file changed, 1 insertion(+) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index c332aa5..1a505df 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -123,3 +123,4 @@ "button-reject": "عدم تایید", "button-cancel": "بستن" } +} From abcd523663a7b34e9fb86efcbd53481a8bf676eb Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sat, 15 Jul 2023 17:17:53 +0330 Subject: [PATCH 08/20] confirm data and reject data --- .../dashboard/passenger-office/Form/ConfirmForm.jsx | 8 +++++--- .../dashboard/passenger-office/Form/RejectForm.jsx | 5 +++-- .../dashboard/passenger-office/TableRowActions.jsx | 7 ++++--- src/lib/app/hooks/useDatatable.jsx | 5 ++++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx b/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx index f5adf2f..738428a 100644 --- a/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx +++ b/src/components/dashboard/passenger-office/Form/ConfirmForm.jsx @@ -1,3 +1,4 @@ +import { CONFIRM_PASSENGER_OFFICE } from "@/core/data/apiRoutes"; import { Dialog, DialogTitle, @@ -13,11 +14,12 @@ const ConfirmForm = ({ handleClose, handleDelete, rowId, - deleteData, + confirmData, }) => { const t = useTranslations(); - const handleDeleteExpert = () => { + const handleConfirm = () => { handleDelete(); + confirmData(CONFIRM_PASSENGER_OFFICE, rowId); }; return ( @@ -26,7 +28,7 @@ const ConfirmForm = ({ {t("ConfirmDialog.context")} - diff --git a/src/components/dashboard/machinary-office/Form/RejectForm.jsx b/src/components/dashboard/machinary-office/Form/RejectForm.jsx index cf551a8..4fce632 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, @@ -8,23 +9,24 @@ import { } from "@mui/material"; import { useTranslations } from "next-intl"; -const RejectForm = ({ open, handleClose, handleDelete, rowId, deleteData }) => { +const RejectForm = ({ open, handleClose, handleDelete, rowId, rejectData }) => { const t = useTranslations(); - const handleDeleteExpert = () => { + const handleRejectRequest = () => { handleDelete(); + rejectData(REJECT_MACHINARY_OFFICE, rowId); }; return ( - {t("delete-dialog.confirm")} + {t("RejectDialog.reject")} - {t("delete-dialog.context")} + {t("RejectDialog.context")} - diff --git a/src/components/dashboard/machinary-office/TableRowActions.jsx b/src/components/dashboard/machinary-office/TableRowActions.jsx index 832e77e..f5ec46b 100644 --- a/src/components/dashboard/machinary-office/TableRowActions.jsx +++ b/src/components/dashboard/machinary-office/TableRowActions.jsx @@ -6,39 +6,42 @@ 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, + handleConfirmDialog, + handleRejectDialog, + rowId, + confirmData, + rejectData, + } = useContext(DataTableContext); return ( - handleOpenDeleteDialog(row)}> + handleOpenConfirmDialog(row)}> - {/* */} - handleOpenDeleteDialog(row)}> + open={openConfirmDialog} + handleClose={handleCloseConfirmDialog} + handleDelete={handleConfirmDialog} + confirmData={confirmData} + /> + handleOpenRejectDialog(row)}> - {/* */} + open={openRejectDialog} + handleClose={handleCloseRejectDialog} + handleDelete={handleRejectDialog} + rejectData={rejectData} + /> ); }; diff --git a/src/components/dashboard/machinary-office/index.jsx b/src/components/dashboard/machinary-office/index.jsx index a9af448..8a88f5f 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"; @@ -153,7 +153,7 @@ function DashboardMachinaryOfficeComponent() { { const { openConfirmDialog, @@ -24,7 +22,12 @@ const TableRowActions = ({ row }) => { } = useContext(DataTableContext); return ( - handleOpenConfirmDialog(row)}> + { + handleOpenConfirmDialog(row); + }} + > { dispatch({ type: "CONFIRM_DATA", url: url, rowID: rowID }); axios .post(`${url}/${rowID}`, { - headers: { authorization: `Bearer ${token}` }, + headers: { + Authorization: `Bearer ${token}`, + }, }) .then(() => { setReloadDataTable(true); From 024da3baf7dd45649f397950459276f5501ac0a4 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sun, 16 Jul 2023 13:39:46 +0330 Subject: [PATCH 12/20] machinary implement --- public/locales/fa/app.json | 3 ++- .../machinary-office/Form/ConfirmForm.jsx | 16 +++++++++++++++- src/lib/app/hooks/useDatatable.jsx | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 1a505df..35fa040 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -109,7 +109,8 @@ "updated_at": "تاریخ بروزرسانی", "navgan_id": "کد ناوگان", "vehicle_type": "نوع ماشین", - "state_name": "وضعیت درخواست" + "state_name": "وضعیت درخواست", + "proposed_amount": "مقدار پیشنهادی" }, "ConfirmDialog": { "confirm": "تایید", diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx index 702ce9b..3e64087 100644 --- a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx +++ b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx @@ -6,8 +6,10 @@ import { DialogContentText, DialogActions, Button, + TextField, } from "@mui/material"; import { useTranslations } from "next-intl"; +import { useState } from "react"; const ConfirmForm = ({ open, @@ -17,15 +19,27 @@ const ConfirmForm = ({ confirmData, }) => { const t = useTranslations(); + const [proposedAmount, setProposedAmount] = useState(""); const handleConfirm = () => { + const formData = new FormData(); + formData.append("proposed_amount", proposedAmount); handleDelete(); - confirmData(CONFIRM_MACHINARY_OFFICE, rowId); + confirmData(CONFIRM_MACHINARY_OFFICE, rowId, formData); }; return ( {t("ConfirmDialog.confirm")} {t("ConfirmDialog.context")} + setProposedAmount(e.target.value)} + sx={{ mt: 2 }} + fullWidth + /> ); }; + export default RejectForm; diff --git a/src/components/dashboard/passenger-office/TableRowActions.jsx b/src/components/dashboard/passenger-office/TableRowActions.jsx index ec2d790..1c3004c 100644 --- a/src/components/dashboard/passenger-office/TableRowActions.jsx +++ b/src/components/dashboard/passenger-office/TableRowActions.jsx @@ -16,8 +16,6 @@ const TableRowActions = ({ row }) => { handleOpenRejectDialog, handleCloseConfirmDialog, handleCloseRejectDialog, - handleConfirmDialog, - handleRejectDialog, rowId, confirmData, rejectData, @@ -27,23 +25,25 @@ const TableRowActions = ({ row }) => { handleOpenConfirmDialog(row)}> - + {openConfirmDialog && ( + + )} handleOpenRejectDialog(row)}> - + {openRejectDialog && ( + + )} ); }; diff --git a/src/lib/app/hooks/useDatatable.jsx b/src/lib/app/hooks/useDatatable.jsx index ccd772a..5627213 100644 --- a/src/lib/app/hooks/useDatatable.jsx +++ b/src/lib/app/hooks/useDatatable.jsx @@ -57,10 +57,10 @@ const useDataTable = () => { }); }, []); - 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(() => { @@ -80,10 +80,6 @@ const useDataTable = () => { const handleCloseConfirmDialog = () => { setOpenConfirmDialog(false); }; - - const handleConfirmDialog = () => { - setOpenConfirmDialog(false); - }; //End Confirm Data // Reject Data @@ -95,19 +91,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, From 7d5d69203f31c200307800c8d8be7888021773e9 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Sun, 16 Jul 2023 14:55:54 +0330 Subject: [PATCH 14/20] fix confirm data --- src/lib/app/hooks/useDatatable.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/app/hooks/useDatatable.jsx b/src/lib/app/hooks/useDatatable.jsx index 5627213..2a9d31f 100644 --- a/src/lib/app/hooks/useDatatable.jsx +++ b/src/lib/app/hooks/useDatatable.jsx @@ -43,10 +43,10 @@ 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(() => { @@ -60,7 +60,7 @@ const useDataTable = () => { const rejectData = useCallback(async (url, rowID, values) => { dispatch({ type: "REJECT_DATA", url: url, rowID: rowID, values: values }); axios - .post(`${url}/${rowID}`,values, { + .post(`${url}/${rowID}`, values, { headers: { authorization: `Bearer ${token}` }, }) .then(() => { From 29d031a83e6b34afd11c9d1046bf284ea8a61826 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sun, 16 Jul 2023 15:16:31 +0330 Subject: [PATCH 15/20] machinary implement --- public/locales/fa/app.json | 3 +- .../machinary-office/Form/ConfirmForm.jsx | 69 +++++++++++++++---- .../machinary-office/Form/RejectForm.jsx | 51 ++++++++++++-- .../machinary-office/TableRowActions.jsx | 39 ++++++----- src/core/data/apiRoutes.js | 2 +- src/lib/app/hooks/useDatatable.jsx | 7 +- 6 files changed, 129 insertions(+), 42 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index c7b9d16..ef91fef 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -116,7 +116,8 @@ "confirm": "تایید", "context": "آیا از تایید این آیتم اطمینان دارید", "button-confirm": "تایید", - "button-cancel": "بستن" + "button-cancel": "بستن", + "amount_error": "وارد کردن مقدار پیشنهادی الزامیست" }, "RejectDialog": { "reject": "عدم تایید", diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx index 3e64087..804036a 100644 --- a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx +++ b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx @@ -10,39 +10,78 @@ import { } 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, - confirmData, -}) => { +const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => { const t = useTranslations(); const [proposedAmount, setProposedAmount] = useState(""); - const handleConfirm = () => { - const formData = new FormData(); - formData.append("proposed_amount", proposedAmount); - handleDelete(); - confirmData(CONFIRM_MACHINARY_OFFICE, rowId, formData); + 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); + 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 ( {t("ConfirmDialog.confirm")} {t("ConfirmDialog.context")} + setProposedAmount(e.target.value)} - sx={{ mt: 2 }} + onChange={handleAmountChange} + onBlur={formik.handleBlur("proposed_amount")} + error={ + formik.touched.proposed_amount && + Boolean(formik.errors.proposed_amount) + } + helperText={ + formik.touched.proposed_amount && formik.errors.proposed_amount + } + sx={{ mt: 1 }} fullWidth /> - ); }; + export default RejectForm; diff --git a/src/components/dashboard/machinary-office/TableRowActions.jsx b/src/components/dashboard/machinary-office/TableRowActions.jsx index f5ec46b..e9e815e 100644 --- a/src/components/dashboard/machinary-office/TableRowActions.jsx +++ b/src/components/dashboard/machinary-office/TableRowActions.jsx @@ -14,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/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index f16d573..79046bc 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -31,5 +31,5 @@ export const CONFIRM_MACHINARY_OFFICE = BASE_URL + "/dashboard/machinery_expert/confirm"; export const REJECT_MACHINARY_OFFICE = - BASE_URL + "dashboard/machinery_expert/reject"; + BASE_URL + "/dashboard/machinery_expert/reject"; //passenger office diff --git a/src/lib/app/hooks/useDatatable.jsx b/src/lib/app/hooks/useDatatable.jsx index e7730bc..9823aca 100644 --- a/src/lib/app/hooks/useDatatable.jsx +++ b/src/lib/app/hooks/useDatatable.jsx @@ -44,9 +44,9 @@ const useDataTable = () => { const { token } = useUser(); const confirmData = useCallback(async (url, rowID, values) => { - dispatch({ type: "CONFIRM_DATA", url: url, rowID: rowID }); + dispatch({ type: "CONFIRM_DATA", url: url, rowID: rowID, values: values }); axios - .post(`${url}/${rowID}`, null, { + .post(`${url}/${rowID}`, values, { headers: { authorization: `Bearer ${token}` }, }) .then(() => { @@ -60,13 +60,14 @@ const useDataTable = () => { const rejectData = useCallback(async (url, rowID, values) => { dispatch({ type: "REJECT_DATA", url: url, rowID: rowID, values: values }); axios - .post(`${url}/${rowID}`,values, { + .post(`${url}/${rowID}`, values, { headers: { authorization: `Bearer ${token}` }, }) .then(() => { setReloadDataTable(true); }) .catch((error) => { + console.log(error); Notifications(directionApp, error.response, t); }); }, []); From c2259031fc73e68b090fd9b88b45d9789e802c1e Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sun, 16 Jul 2023 15:31:20 +0330 Subject: [PATCH 16/20] confirm data --- src/components/dashboard/machinary-office/Form/ConfirmForm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx index 804036a..754abce 100644 --- a/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx +++ b/src/components/dashboard/machinary-office/Form/ConfirmForm.jsx @@ -31,7 +31,7 @@ const ConfirmForm = ({ open, handleClose, rowId, confirmData }) => { onSubmit: () => { const formData = new FormData(); formData.append("proposed_amount", proposedAmount); - formData.append("expert_description", description); + if (description != "") formData.append("expert_description", description); handleClose(); confirmData(CONFIRM_MACHINARY_OFFICE, rowId, formData); }, From 69a7f3525a3ad5233a761db690d599e607f0a0d7 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Sun, 16 Jul 2023 15:41:58 +0330 Subject: [PATCH 17/20] add notification to datatable --- src/lib/app/hooks/useDatatable.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/app/hooks/useDatatable.jsx b/src/lib/app/hooks/useDatatable.jsx index 2a9d31f..8b097b1 100644 --- a/src/lib/app/hooks/useDatatable.jsx +++ b/src/lib/app/hooks/useDatatable.jsx @@ -49,8 +49,9 @@ const useDataTable = () => { .post(`${url}/${rowID}`, values, { headers: { authorization: `Bearer ${token}` }, }) - .then(() => { + .then((response) => { setReloadDataTable(true); + Notifications(directionApp, response, t); }) .catch((error) => { Notifications(directionApp, error.response, t); @@ -63,8 +64,9 @@ const useDataTable = () => { .post(`${url}/${rowID}`, values, { headers: { authorization: `Bearer ${token}` }, }) - .then(() => { + .then((response) => { setReloadDataTable(true); + Notifications(directionApp, response, t); }) .catch((error) => { Notifications(directionApp, error.response, t); From 4e9d81ca719aa20b1645637ddace4f372336e151 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sun, 16 Jul 2023 15:59:31 +0330 Subject: [PATCH 18/20] change id to national id --- public/locales/fa/app.json | 4 ++-- src/components/dashboard/machinary-office/index.jsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index ef91fef..f50b62e 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": "تاریخ بروزرسانی", @@ -103,7 +103,7 @@ }, "MachinaryOffice": { "name": "نام", - "id": "کد ملی", + "national_id": "کد ملی", "phone_number": "موبایل", "created_at": "تاریخ درخواست", "updated_at": "تاریخ بروزرسانی", diff --git a/src/components/dashboard/machinary-office/index.jsx b/src/components/dashboard/machinary-office/index.jsx index 8a88f5f..bcd3eb4 100644 --- a/src/components/dashboard/machinary-office/index.jsx +++ b/src/components/dashboard/machinary-office/index.jsx @@ -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", From c505f57cfbb92a989d611dcde4b8d37d4b48b352 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sun, 16 Jul 2023 16:01:22 +0330 Subject: [PATCH 19/20] change id to national id in passenger office --- src/components/dashboard/passenger-office/index.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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", From 05d436058e85a04b2a09e55e63d51cbef08098db Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Sun, 16 Jul 2023 16:38:26 +0330 Subject: [PATCH 20/20] datatable_locale --- public/locales/fa/datatable.js | 176 ++++++++++++++++----------------- 1 file changed, 88 insertions(+), 88 deletions(-) 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: "بدون مرتب سازی", };