change status order rate
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { ef } from '@/lib/helpers/utfNumbers';
|
import { ef } from '@/lib/helpers/utfNumbers';
|
||||||
import { ArrowLeft, Trash } from 'iconsax-react';
|
import { ArrowLeft } from 'iconsax-react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGetNotifications, useDeleteNotification, useReadAllNotifications } from './hooks/useNotificationData';
|
import { useGetNotifications, useReadAllNotifications } from './hooks/useNotificationData';
|
||||||
import type { Notification } from './types/Types';
|
import type { Notification } from './types/Types';
|
||||||
import { useGetNotificationsCount } from '../../(Main)/hooks/useMenuData';
|
import { useGetNotificationsCount } from '../../(Main)/hooks/useMenuData';
|
||||||
import Prompt from '@/components/utils/Prompt';
|
import Prompt from '@/components/utils/Prompt';
|
||||||
@@ -34,7 +34,6 @@ export default function NotificationsIndex({ }: Props) {
|
|||||||
const { t } = useTranslation('notifications')
|
const { t } = useTranslation('notifications')
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { data, isLoading } = useGetNotifications();
|
const { data, isLoading } = useGetNotifications();
|
||||||
const { mutate: deleteNotification } = useDeleteNotification();
|
|
||||||
const { mutate: readAllNotifications } = useReadAllNotifications();
|
const { mutate: readAllNotifications } = useReadAllNotifications();
|
||||||
const { data: notificationsCount } = useGetNotificationsCount();
|
const { data: notificationsCount } = useGetNotificationsCount();
|
||||||
const [showReadAllConfirm, setShowReadAllConfirm] = React.useState(false);
|
const [showReadAllConfirm, setShowReadAllConfirm] = React.useState(false);
|
||||||
@@ -43,10 +42,6 @@ export default function NotificationsIndex({ }: Props) {
|
|||||||
return data?.data ?? [];
|
return data?.data ?? [];
|
||||||
}, [data?.data]);
|
}, [data?.data]);
|
||||||
|
|
||||||
const handleDelete = (id: string) => {
|
|
||||||
deleteNotification(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleReadAll = (e: React.MouseEvent) => {
|
const handleReadAll = (e: React.MouseEvent) => {
|
||||||
e?.preventDefault();
|
e?.preventDefault();
|
||||||
e?.stopPropagation();
|
e?.stopPropagation();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import React, { useMemo, useState } from 'react'
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGetOrders } from './hooks/useHistoryData';
|
import { useGetOrders } from './hooks/useHistoryData';
|
||||||
import { HistoryOrderItem } from './types/Types';
|
import { HistoryOrderItem } from './types/Types';
|
||||||
|
import { OrderStatus } from './enum/Enum';
|
||||||
|
|
||||||
const fallbackImage = '/assets/images/food-preview.png';
|
const fallbackImage = '/assets/images/food-preview.png';
|
||||||
|
|
||||||
@@ -183,7 +184,7 @@ function OrdersIndex() {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{order.status === 'delivered' && (
|
{order.status === OrderStatus.COMPLETED && (
|
||||||
<Link href={`rate/${order.id}?foodId=${item.food.id}`}>
|
<Link href={`rate/${order.id}?foodId=${item.food.id}`}>
|
||||||
<Button className='text-xs px-3 py-2 h-auto'>{t('Card.Rate')}</Button>
|
<Button className='text-xs px-3 py-2 h-auto'>{t('Card.Rate')}</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
Reference in New Issue
Block a user