icon delivery method
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import Combobox from '@/components/combobox/Combobox';
|
import Combobox from '@/components/combobox/Combobox';
|
||||||
import { Box } from 'iconsax-react';
|
import { Box, Location, Car, TruckTick, Building } from 'iconsax-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGetShipmentMethod } from '../../hooks/useOrderData';
|
import { useGetShipmentMethod } from '../../hooks/useOrderData';
|
||||||
import { DeliveryMethod } from '../../types/Types';
|
import { DeliveryMethod } from '../../types/Types';
|
||||||
@@ -24,13 +24,28 @@ export const ShippingSection = ({ deliveryType, onDeliveryTypeChange }: Shipping
|
|||||||
return tOrders(`deliveryMethod.${translationKey}`);
|
return tOrders(`deliveryMethod.${translationKey}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getDeliveryMethodIcon = (method: string) => {
|
||||||
|
switch (method) {
|
||||||
|
case 'dineIn':
|
||||||
|
return Building;
|
||||||
|
case 'pickup':
|
||||||
|
return Location;
|
||||||
|
case 'deliveryCar':
|
||||||
|
return Car;
|
||||||
|
case 'deliveryCourier':
|
||||||
|
return TruckTick;
|
||||||
|
default:
|
||||||
|
return Box;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const options = shipmentMethod?.data
|
const options = shipmentMethod?.data
|
||||||
.filter((item: DeliveryMethod) => item.enabled)
|
.filter((item: DeliveryMethod) => item.enabled)
|
||||||
.sort((a: DeliveryMethod, b: DeliveryMethod) => a.order - b.order)
|
.sort((a: DeliveryMethod, b: DeliveryMethod) => a.order - b.order)
|
||||||
.map((item: DeliveryMethod) => ({
|
.map((item: DeliveryMethod) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
title: getDeliveryMethodTranslation(item.method),
|
title: getDeliveryMethodTranslation(item.method),
|
||||||
icon: Box
|
icon: getDeliveryMethodIcon(item.method)
|
||||||
})) || [];
|
})) || [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user