import React from 'react';
import { useTheme } from 'styled-components/native';
import {
CartStoresListing as StoresListingController,
useOrder,
useLanguage
} from 'ordering-components/native'
import { NotFoundSource } from '../NotFoundSource'
import { BusinessCart } from '../BusinessCart'
import { OIcon } from '../shared';
import {
Container,
ItemListing,
TopHeader,
HeaderItem
} from './styles';
const CartStoresListingUI = (props: any) => {
const {
businessIdSelect,
storesState,
changeStoreState,
handleCartStoreChange,
} = props
const [, t] = useLanguage()
const theme = useTheme();
const [orderState] = useOrder()
const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
const businessId = business?.business_id ?? null
return(
<>
{!storesState?.loading && !storesState?.error && storesState?.result && (
<>
{storesState?.result?.length > 0 ? (
{storesState?.result.map((store: any) => (
))}
) : (
)}
>
)}
{storesState?.loading && (
{[...Array(8).keys()].map(i => (
))}
)}
{!storesState?.loading && storesState?.error && (
)}
>
)
}
export const CartStoresListing = (props: any) => {
const storeProps = {
...props,
UIComponent: CartStoresListingUI
}
return (
)
}