import { DocumentText } from 'iconsax-react'
import { type FC } from 'react'
import { useTranslation } from 'react-i18next'
import SubMenuItem from './SubMenuItem'
import { useLocation } from 'react-router-dom'
import { Pages } from '../../config/Pages'

const OrdersSubMenu: FC = () => {

    const location = useLocation()
    const { t } = useTranslation('global')

    const isActive = (name: string) => {
        return location.pathname.includes(name)
    }

    return (
        <div className='py-12'>
            <div className='flex gap-3 items-center border-b border-border pb-10 px-6'>
                <DocumentText
                    size={24}
                    color='#000'
                    variant='Bold'
                />
                <div className='text-xs'>
                    {t('sidebar.orders')}
                </div>
            </div>

            <div className='flex flex-col mt-10 gap-4'>
                <SubMenuItem
                    title={t('submenu.orders_list')}
                    isActive={isActive('list')}
                    link={Pages.orders.list}
                />
                <SubMenuItem
                    title={t('submenu.orders_food_report')}
                    isActive={isActive('report/by-food')}
                    link={Pages.orders.foodReport}
                />
                {/* <SubMenuItem
                    title={t('submenu.add_order')}
                    isActive={isActive('add')}
                    link={Pages.orders.add}
                /> */}
            </div>
        </div>
    )
}

export default OrdersSubMenu

