From 296f43c5aef2a128defc3fe016c01f7d6455e6ba Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 14 Mar 2021 13:47:56 +0300 Subject: feat: enable transform of item fields --- src/services.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/services.js') diff --git a/src/services.js b/src/services.js index b9c2ecf..bebf07f 100644 --- a/src/services.js +++ b/src/services.js @@ -1,5 +1,17 @@ import { ServiceParams } from './containers/Service/ServiceContext'; + +const waybillStatusNames = { + waiting: 'Ожидание', + executed: 'Проведена', + cancelled: 'Отменена', +}; + +const operationNames = { + in: 'Приход', + out: 'Расход', +}; + const services: ServiceParams[] = [ { route: 'products', @@ -36,10 +48,10 @@ const services: ServiceParams[] = [ name: 'Накладные', nameSingular: 'Накладная', tableFields: [ - { key: 'operation', label: 'Операция' }, + { key: 'operation', label: 'Операция', transform: op => operationNames[op] }, { key: 'product.name', label: 'Товар' }, { key: 'contractor.name', label: 'Поставщик' }, - { key: 'status', label: 'Статус' }, + { key: 'status', label: 'Статус', transform: status => waybillStatusNames[status] }, { key: 'quantity', label: 'Количество' }, ], default: { -- cgit v1.2.3