summaryrefslogtreecommitdiff
path: root/src/services/transfers/index.ts
blob: ece8dae66e0fe1acf968af2646eb405f2443cb8d (plain)
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
import Form from './TransferForm';
import UploadPage from './TransfersUpload';
import { transformOperation } from '../transforms';
import { ServiceParams } from '../../lib/ServiceContext';
import { Transfer } from '../types';


const service: ServiceParams<Transfer> = {
  route: 'transfers',
  name: 'Переводы',
  nameSingular: 'Перевод',
  tableFields: [
    { key: 'date', label: 'Дата', transform: date => new Date(date).toLocaleDateString() },
    { key: 'contractor.name', label: 'Контрагент' },
    { key: 'operation', label: 'Операция', transform: transformOperation },
    { key: 'amount', label: 'Сумма' },
  ],
  filters: [
    { key: 'operation', label: 'Операция', transform: transformOperation },
    { key: 'contractorId', label: 'Контрагент', as: 'contractor.name' },
  ],
  actions: [
    {
      name: 'Загрузить выписку',
      route: '/transfers/upload',
      variant: 'outlined',
    },
    {
      name: 'Добавить',
      route: '/transfers/add',
    },
  ],
  default: {
    operation: 'in',
  },
  routes: { upload: UploadPage },
  Form,
};

export default service;