All files / app/src/entities/accounting-object-import/ui/import-table import-table.tsx

100% Statements 28/28
100% Branches 1/1
100% Functions 1/1
100% Lines 28/28

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 37 38 39 40 41 42 43 44 45 46 47 481x                       1x 2x   2x 2x 2x 2x 2x         2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x     2x 2x   2x  
import { Import, ImportStatusEnum } from '@/entities/accounting-object-import'
import { getImportTableColumns } from './get-import-table'
import { DefaultRecordType } from 'rc-table/lib/interface'
import { FCWithClassName, Table } from '@tmk/ui-kit'
import { TableProps } from 'rc-table/lib/Table'
import { useTranslate } from '@/shared/lib'
 
export interface ImportTableProps extends TableProps<DefaultRecordType> {
  data?: Import[]
  isLoading?: boolean
  handleDeleteImport: (id: string, status: ImportStatusEnum | undefined) => void
}
export const ImportTable: FCWithClassName<ImportTableProps> = ({ data, isLoading, handleDeleteImport, ...rest }) => {
  const { t } = useTranslate(['common', 'accounting-object'])
 
  return (
    <Table
      {...rest}
      t={t}
      caption={false}
      //Вернуть как понадобится
      // rowLinkProps={{
      //   href: id => `/imports/${id}`,
      // }}
      rowClassName='text-min cursor-pointer bg-white hover:bg-gray-secondary'
      tableClassname={{
        body: {
          cell: 'border-b border-border first:text-center !py-0 h-14 !text-black align-middle !px-0',
          row: 'contents',
        },
        header: { cell: '!pb-0 h-[50px] !text-black !px-0' },
        table: 'rounded-base overflow-hidden',
      }}
      isLoading={isLoading}
      data={data}
      emptyText={
        <p className='text-main-regular text-text-secondary'>
          {t('accounting-object:The_import_list_is_empty_Click_the_button')}{' '}
          <span className='text-main-semibold'>”{t('accounting-object:Load_objects')}”</span>{' '}
          {t('accounting-object:to_start_a_new_import')}
        </p>
      }
    >
      {getImportTableColumns(t, handleDeleteImport)}
    </Table>
  )
}