From 6950e1c3ad9fe1d7571b9406ca29da57052f806a Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sat, 22 Nov 2025 12:01:46 +0330 Subject: [PATCH] guide schedule --- src/langs/fa.json | 16 ++++++++++++++- src/pages/roles/service/RolesService.ts | 2 +- src/pages/schedule/Create.tsx | 20 +++++++++++++++++-- src/pages/schedule/List.tsx | 5 ++++- src/pages/schedule/Update.tsx | 20 +++++++++++++++++-- .../components/ScheduleTableColumns.tsx | 11 +++++++++- 6 files changed, 66 insertions(+), 8 deletions(-) diff --git a/src/langs/fa.json b/src/langs/fa.json index 17de7f4..0ddff8d 100644 --- a/src/langs/fa.json +++ b/src/langs/fa.json @@ -50,7 +50,7 @@ "sidebar": { "menu": "منو", "mainpage": "صفحه اصلی", - "schedule": "برنامه زمان‌بندی", + "schedule": "زمان سفارش گیری", "foods": "غذا ها", "orders": "سفارشات", "customers": "مشتریان", @@ -807,5 +807,19 @@ "status": "وضعیت", "full_name": "نام و نام خانوادگی", "users": "کاربران" + }, + "schedule": { + "multiple_shifts_hint": "برای یک روز میتوانید چند شیفت زمانی ثبت کنید مثلا 8 تا 12 و 14 تا 18", + "attention": "دقت کنید", + "order_time_limit": "فقط در زمان های فوق امکان سفارش گیری هست", + "weekDay": { + "0": "شنبه", + "1": "یکشنبه", + "2": "دوشنبه", + "3": "سه‌شنبه", + "4": "چهارشنبه", + "5": "پنج‌شنبه", + "6": "جمعه" + } } } diff --git a/src/pages/roles/service/RolesService.ts b/src/pages/roles/service/RolesService.ts index 55d7de8..f531484 100644 --- a/src/pages/roles/service/RolesService.ts +++ b/src/pages/roles/service/RolesService.ts @@ -47,7 +47,7 @@ export const updateRole = async (id: string, params: CreateRoleType) => { export const getPermissions = async (): Promise => { const { data } = await axios.get( - `/admin/permissions` + `/admin/roles/permissions` ); return data; }; diff --git a/src/pages/schedule/Create.tsx b/src/pages/schedule/Create.tsx index 93bd0e5..57c1dbd 100644 --- a/src/pages/schedule/Create.tsx +++ b/src/pages/schedule/Create.tsx @@ -1,8 +1,9 @@ import { type FC } from 'react'; import { useFormik } from 'formik'; import * as Yup from 'yup'; -import { TickCircle } from 'iconsax-react'; +import { TickCircle, InfoCircle } from 'iconsax-react'; import { toast } from 'react-toastify'; +import { useTranslation } from 'react-i18next'; import Button from '@/components/Button'; import ScheduleFormFields from './components/ScheduleFormFields'; import { useCreateSchedule } from './hooks/useScheduleData'; @@ -13,6 +14,7 @@ import { extractErrorMessage } from '@/config/func'; import { useNavigate } from 'react-router-dom'; const CreateSchedule: FC = () => { + const { t } = useTranslation('global'); const { mutate: createSchedule, isPending } = useCreateSchedule(); const navigate = useNavigate(); const formik = useFormik({ @@ -48,7 +50,7 @@ const CreateSchedule: FC = () => {
- زمانبندی جدید + ایجاد یک شیف جدید سفارش گیری
+
+ +
+

+ {t('schedule.multiple_shifts_hint')} +

+

+ {t('schedule.attention')} + {' '} + {t('schedule.order_time_limit')} +

+
+
+
diff --git a/src/pages/schedule/List.tsx b/src/pages/schedule/List.tsx index 3b5d4c1..aab0f7c 100644 --- a/src/pages/schedule/List.tsx +++ b/src/pages/schedule/List.tsx @@ -1,4 +1,5 @@ import { type FC } from 'react' +import { useTranslation } from 'react-i18next' import Table from '@/components/Table' import Filters from '@/components/Filters' import { Add } from 'iconsax-react' @@ -11,6 +12,7 @@ import { Link } from 'react-router-dom' import { Pages } from '@/config/Pages' const ScheduleList: FC = () => { + const { t } = useTranslation('global') const { filters, currentPage, @@ -26,7 +28,8 @@ const ScheduleList: FC = () => { const schedules = schedulesData?.data || [] const columns = getScheduleTableColumns({ onDelete: (id: string) => deleteSchedule(id), - isDeleting + isDeleting, + t }) const filterFields = useScheduleFiltersFields() diff --git a/src/pages/schedule/Update.tsx b/src/pages/schedule/Update.tsx index 8cd8e54..f46f847 100644 --- a/src/pages/schedule/Update.tsx +++ b/src/pages/schedule/Update.tsx @@ -2,7 +2,7 @@ import { type FC, useEffect } from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import { useFormik } from 'formik'; import * as Yup from 'yup'; -import { TickCircle } from 'iconsax-react'; +import { InfoCircle, TickCircle } from 'iconsax-react'; import { toast } from 'react-toastify'; import Button from '@/components/Button'; import ScheduleFormFields from './components/ScheduleFormFields'; @@ -13,8 +13,10 @@ import type { ErrorType } from '@/helpers/types'; import { extractErrorMessage } from '@/config/func'; import PageLoading from '@/components/PageLoading'; import { formatTimeToHHmm } from '@/helpers/utils'; +import { useTranslation } from 'react-i18next'; const UpdateSchedule: FC = () => { + const { t } = useTranslation('global'); const { id } = useParams<{ id: string }>(); const navigate = useNavigate(); const { data: scheduleData, isLoading } = useGetSchedule(id || ''); @@ -75,7 +77,7 @@ const UpdateSchedule: FC = () => {
- ویرایش زمانبندی + ویرایش یک شیف زمانی سفارش گیری
+
+ +
+

+ {t('schedule.multiple_shifts_hint')} +

+

+ {t('schedule.attention')} + {' '} + {t('schedule.order_time_limit')} +

+
+
+
diff --git a/src/pages/schedule/components/ScheduleTableColumns.tsx b/src/pages/schedule/components/ScheduleTableColumns.tsx index 731f57e..b01c3cf 100644 --- a/src/pages/schedule/components/ScheduleTableColumns.tsx +++ b/src/pages/schedule/components/ScheduleTableColumns.tsx @@ -5,14 +5,23 @@ import TrashWithConfrim from '@/components/TrashWithConfrim' import { Eye } from 'iconsax-react' import { Link } from 'react-router-dom' import { Pages } from '@/config/Pages' +import type { TFunction } from 'i18next' interface GetScheduleTableColumnsParams { onDelete?: (id: string) => void isDeleting?: boolean + t: TFunction } -export const getScheduleTableColumns = ({ onDelete, isDeleting }: GetScheduleTableColumnsParams = {}): ColumnType[] => { +export const getScheduleTableColumns = ({ onDelete, isDeleting, t }: GetScheduleTableColumnsParams): ColumnType[] => { return [ + { + key: 'weekDay', + title: 'روز هفته', + render: (item: Schedule) => { + return t('schedule.weekDay.' + item.weekDay) + }, + }, { key: 'openTime', title: 'زمان باز',