Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 1x 1x | import { FC } from 'react'
import { BackButton } from '@tmk/ui-kit'
import { useTranslate } from '@/shared/lib'
import { useRouter } from 'next/router'
import { operationNameAtom, useOperationJournal } from '../../model'
import { DRAFT_OPERATIONS_FILTERS_BY_STATUS, OPERATIONS_DRAFT_PRIMARY_KEY } from '../../lib'
import { useAtomValue } from 'jotai'
import { getOperationDraftNameFilters } from '@/entities/accounting-object'
export const OperationDraftHeader: FC = () => {
const { t } = useTranslate(['accounting-object'])
const router = useRouter()
const operationName = useAtomValue(operationNameAtom)
const { data: draftOperations } = useOperationJournal(OPERATIONS_DRAFT_PRIMARY_KEY, {
filters: {
status: DRAFT_OPERATIONS_FILTERS_BY_STATUS,
...getOperationDraftNameFilters(operationName),
},
})
return (
<div className='flex items-center gap-x-2.5'>
<BackButton defaultPath={router?.query?.from as string} />
<div className='flex items-center gap-x-2.5'>
<h1>{t('incomplete_operations')}</h1>
{!!draftOperations?.['hydra:totalItems'] && (
<div className='px-2 py-1 bg-gray-tertiary rounded-base hover:cursor-pointer'>
<h2 className='text-text-secondary'>{draftOperations['hydra:totalItems']}</h2>
</div>
)}
</div>
</div>
)
}
|