import React, { useEffect } from 'react'; import { useLanguage, useUtils, useConfig } from 'ordering-components/native'; import { OIcon, OIconButton, OText } from '../shared'; import { ActiveOrdersContainer, Card, Information, Logo, OrderInformation, BusinessInformation, Price, } from './styles'; import { View, StyleSheet, TouchableOpacity } from 'react-native'; import { ActiveOrdersParams } from '../../types'; import moment from 'moment'; import { useTheme } from 'styled-components/native'; export const ActiveOrders = (props: ActiveOrdersParams) => { const { onNavigationRedirect, orders, pagination, loadMoreOrders, getOrderStatus, isPreorders } = props; const theme = useTheme(); const [{ configs }] = useConfig(); const [, t] = useLanguage(); const [{ parseDate, parsePrice, optimizeImage }] = useUtils(); const formatDate = (date: string, option?: any) => { return option?.utc ? moment.utc(date).format('DD/MM/YY \u2022 h:m a') : moment(date).format('DD/MM/YY \u2022 h:m a'); }; const handleClickCard = (uuid: string) => { onNavigationRedirect && onNavigationRedirect('OrderDetails', { orderId: uuid }); }; const handleLike = () => { } const Order = ({ order, index }: { order: any; index: number }) => ( handleClickCard(order?.uuid)} activeOpacity={0.7}> {/* {!!order.business?.logo && ( )} */} {`${t('ORDER_NO', 'Order No')}.${order.id}`} {order?.delivery_datetime_utc ? formatDate(order?.delivery_datetime_utc) : formatDate(order?.delivery_datetime, { utc: false })} {/* {order?.status !== 0 && ( */} {getOrderStatus(order.status)?.value} {/* )} */} {parsePrice(order?.summary?.total || order?.total)} {/* {!isPreorders && } */} ); return ( orders.length === 0 ? null : ( <> {orders.length > 0 && orders.map((order: any, index: any) => ( ))} ) ); }; const styles = StyleSheet.create({ logo: { borderRadius: 7.6, width: 64, height: 64, }, orderNumber: { flexDirection: 'row', marginVertical: 3, }, loadOrders: { justifyContent: 'center', alignItems: 'center', minWidth: 230, }, });