guide schedule
This commit is contained in:
+15
-1
@@ -50,7 +50,7 @@
|
|||||||
"sidebar": {
|
"sidebar": {
|
||||||
"menu": "منو",
|
"menu": "منو",
|
||||||
"mainpage": "صفحه اصلی",
|
"mainpage": "صفحه اصلی",
|
||||||
"schedule": "برنامه زمانبندی",
|
"schedule": "زمان سفارش گیری",
|
||||||
"foods": "غذا ها",
|
"foods": "غذا ها",
|
||||||
"orders": "سفارشات",
|
"orders": "سفارشات",
|
||||||
"customers": "مشتریان",
|
"customers": "مشتریان",
|
||||||
@@ -807,5 +807,19 @@
|
|||||||
"status": "وضعیت",
|
"status": "وضعیت",
|
||||||
"full_name": "نام و نام خانوادگی",
|
"full_name": "نام و نام خانوادگی",
|
||||||
"users": "کاربران"
|
"users": "کاربران"
|
||||||
|
},
|
||||||
|
"schedule": {
|
||||||
|
"multiple_shifts_hint": "برای یک روز میتوانید چند شیفت زمانی ثبت کنید مثلا 8 تا 12 و 14 تا 18",
|
||||||
|
"attention": "دقت کنید",
|
||||||
|
"order_time_limit": "فقط در زمان های فوق امکان سفارش گیری هست",
|
||||||
|
"weekDay": {
|
||||||
|
"0": "شنبه",
|
||||||
|
"1": "یکشنبه",
|
||||||
|
"2": "دوشنبه",
|
||||||
|
"3": "سهشنبه",
|
||||||
|
"4": "چهارشنبه",
|
||||||
|
"5": "پنجشنبه",
|
||||||
|
"6": "جمعه"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const updateRole = async (id: string, params: CreateRoleType) => {
|
|||||||
|
|
||||||
export const getPermissions = async (): Promise<GetPermissionsResponseType> => {
|
export const getPermissions = async (): Promise<GetPermissionsResponseType> => {
|
||||||
const { data } = await axios.get<GetPermissionsResponseType>(
|
const { data } = await axios.get<GetPermissionsResponseType>(
|
||||||
`/admin/permissions`
|
`/admin/roles/permissions`
|
||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { type FC } from 'react';
|
import { type FC } from 'react';
|
||||||
import { useFormik } from 'formik';
|
import { useFormik } from 'formik';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import { TickCircle } from 'iconsax-react';
|
import { TickCircle, InfoCircle } from 'iconsax-react';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import Button from '@/components/Button';
|
import Button from '@/components/Button';
|
||||||
import ScheduleFormFields from './components/ScheduleFormFields';
|
import ScheduleFormFields from './components/ScheduleFormFields';
|
||||||
import { useCreateSchedule } from './hooks/useScheduleData';
|
import { useCreateSchedule } from './hooks/useScheduleData';
|
||||||
@@ -13,6 +14,7 @@ import { extractErrorMessage } from '@/config/func';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
const CreateSchedule: FC = () => {
|
const CreateSchedule: FC = () => {
|
||||||
|
const { t } = useTranslation('global');
|
||||||
const { mutate: createSchedule, isPending } = useCreateSchedule();
|
const { mutate: createSchedule, isPending } = useCreateSchedule();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const formik = useFormik<CreateScheduleType>({
|
const formik = useFormik<CreateScheduleType>({
|
||||||
@@ -48,7 +50,7 @@ const CreateSchedule: FC = () => {
|
|||||||
<div className='mt-5'>
|
<div className='mt-5'>
|
||||||
<div className='flex w-full justify-between items-center'>
|
<div className='flex w-full justify-between items-center'>
|
||||||
<div className='text-lg font-light'>
|
<div className='text-lg font-light'>
|
||||||
زمانبندی جدید
|
ایجاد یک شیف جدید سفارش گیری
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
@@ -64,6 +66,20 @@ const CreateSchedule: FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='mt-6 p-4 bg-blue-50 border border-blue-200 rounded-xl flex gap-3 items-center'>
|
||||||
|
<InfoCircle color='blue' className='size-5 text-blue-600 flex-shrink-0 mt-0.5' />
|
||||||
|
<div className='text-sm text-blue-800 leading-relaxed'>
|
||||||
|
<p className='mb-1'>
|
||||||
|
{t('schedule.multiple_shifts_hint')}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{t('schedule.attention')}
|
||||||
|
{' '}
|
||||||
|
{t('schedule.order_time_limit')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className='mt-6'>
|
<div className='mt-6'>
|
||||||
<ScheduleFormFields formik={formik} />
|
<ScheduleFormFields formik={formik} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { type FC } from 'react'
|
import { type FC } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
import Table from '@/components/Table'
|
import Table from '@/components/Table'
|
||||||
import Filters from '@/components/Filters'
|
import Filters from '@/components/Filters'
|
||||||
import { Add } from 'iconsax-react'
|
import { Add } from 'iconsax-react'
|
||||||
@@ -11,6 +12,7 @@ import { Link } from 'react-router-dom'
|
|||||||
import { Pages } from '@/config/Pages'
|
import { Pages } from '@/config/Pages'
|
||||||
|
|
||||||
const ScheduleList: FC = () => {
|
const ScheduleList: FC = () => {
|
||||||
|
const { t } = useTranslation('global')
|
||||||
const {
|
const {
|
||||||
filters,
|
filters,
|
||||||
currentPage,
|
currentPage,
|
||||||
@@ -26,7 +28,8 @@ const ScheduleList: FC = () => {
|
|||||||
const schedules = schedulesData?.data || []
|
const schedules = schedulesData?.data || []
|
||||||
const columns = getScheduleTableColumns({
|
const columns = getScheduleTableColumns({
|
||||||
onDelete: (id: string) => deleteSchedule(id),
|
onDelete: (id: string) => deleteSchedule(id),
|
||||||
isDeleting
|
isDeleting,
|
||||||
|
t
|
||||||
})
|
})
|
||||||
const filterFields = useScheduleFiltersFields()
|
const filterFields = useScheduleFiltersFields()
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { type FC, useEffect } from 'react';
|
|||||||
import { useParams, useNavigate } from 'react-router-dom';
|
import { useParams, useNavigate } from 'react-router-dom';
|
||||||
import { useFormik } from 'formik';
|
import { useFormik } from 'formik';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import { TickCircle } from 'iconsax-react';
|
import { InfoCircle, TickCircle } from 'iconsax-react';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import Button from '@/components/Button';
|
import Button from '@/components/Button';
|
||||||
import ScheduleFormFields from './components/ScheduleFormFields';
|
import ScheduleFormFields from './components/ScheduleFormFields';
|
||||||
@@ -13,8 +13,10 @@ import type { ErrorType } from '@/helpers/types';
|
|||||||
import { extractErrorMessage } from '@/config/func';
|
import { extractErrorMessage } from '@/config/func';
|
||||||
import PageLoading from '@/components/PageLoading';
|
import PageLoading from '@/components/PageLoading';
|
||||||
import { formatTimeToHHmm } from '@/helpers/utils';
|
import { formatTimeToHHmm } from '@/helpers/utils';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const UpdateSchedule: FC = () => {
|
const UpdateSchedule: FC = () => {
|
||||||
|
const { t } = useTranslation('global');
|
||||||
const { id } = useParams<{ id: string }>();
|
const { id } = useParams<{ id: string }>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { data: scheduleData, isLoading } = useGetSchedule(id || '');
|
const { data: scheduleData, isLoading } = useGetSchedule(id || '');
|
||||||
@@ -75,7 +77,7 @@ const UpdateSchedule: FC = () => {
|
|||||||
<div className='mt-5'>
|
<div className='mt-5'>
|
||||||
<div className='flex w-full justify-between items-center'>
|
<div className='flex w-full justify-between items-center'>
|
||||||
<div className='text-lg font-light'>
|
<div className='text-lg font-light'>
|
||||||
ویرایش زمانبندی
|
ویرایش یک شیف زمانی سفارش گیری
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
@@ -91,6 +93,20 @@ const UpdateSchedule: FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='mt-6 p-4 bg-blue-50 border border-blue-200 rounded-xl flex gap-3 items-center'>
|
||||||
|
<InfoCircle color='blue' className='size-5 text-blue-600 flex-shrink-0 mt-0.5' />
|
||||||
|
<div className='text-sm text-blue-800 leading-relaxed'>
|
||||||
|
<p className='mb-1'>
|
||||||
|
{t('schedule.multiple_shifts_hint')}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{t('schedule.attention')}
|
||||||
|
{' '}
|
||||||
|
{t('schedule.order_time_limit')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className='mt-6'>
|
<div className='mt-6'>
|
||||||
<ScheduleFormFields formik={formik} />
|
<ScheduleFormFields formik={formik} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,14 +5,23 @@ import TrashWithConfrim from '@/components/TrashWithConfrim'
|
|||||||
import { Eye } from 'iconsax-react'
|
import { Eye } from 'iconsax-react'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { Pages } from '@/config/Pages'
|
import { Pages } from '@/config/Pages'
|
||||||
|
import type { TFunction } from 'i18next'
|
||||||
|
|
||||||
interface GetScheduleTableColumnsParams {
|
interface GetScheduleTableColumnsParams {
|
||||||
onDelete?: (id: string) => void
|
onDelete?: (id: string) => void
|
||||||
isDeleting?: boolean
|
isDeleting?: boolean
|
||||||
|
t: TFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getScheduleTableColumns = ({ onDelete, isDeleting }: GetScheduleTableColumnsParams = {}): ColumnType<Schedule>[] => {
|
export const getScheduleTableColumns = ({ onDelete, isDeleting, t }: GetScheduleTableColumnsParams): ColumnType<Schedule>[] => {
|
||||||
return [
|
return [
|
||||||
|
{
|
||||||
|
key: 'weekDay',
|
||||||
|
title: 'روز هفته',
|
||||||
|
render: (item: Schedule) => {
|
||||||
|
return t('schedule.weekDay.' + item.weekDay)
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'openTime',
|
key: 'openTime',
|
||||||
title: 'زمان باز',
|
title: 'زمان باز',
|
||||||
|
|||||||
Reference in New Issue
Block a user