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

const ReceiptSubMenu: 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 pb-10 px-6'>
                <Receipt21
                    size={24}
                    color='#000'
                    variant='Bold'
                />
                <div className='text-xs'>
                    {t('receip.receips')}
                </div>
            </div>

            <div className='flex flex-col mt-10 gap-4'>
                <SubMenuItem
                    title={t('receip.receip_list')}
                    isActive={isActive('list')}
                    link={Pages.receipts.index}
                />
                <SubMenuItem
                    title={t('receip.add_receip')}
                    isActive={isActive('create')}
                    link={Pages.receipts.create}
                />
            </div>
        </div>
    )
}

export default ReceiptSubMenu