diff options
author | eug-vs <eug-vs@keemail.me> | 2021-03-14 13:39:31 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2021-03-14 13:39:31 +0300 |
commit | 2ff20a6b93a92f0cac6b9f5584e81e39407e51c5 (patch) | |
tree | d04befe33aa739786af67109c83a70c26ba9957c | |
parent | 31a196a76513df809ee91427129926370de551ba (diff) | |
download | commercel-ui-2ff20a6b93a92f0cac6b9f5584e81e39407e51c5.tar.gz |
feat: display populated fields
-rw-r--r-- | src/components/ListTable.tsx | 3 | ||||
-rw-r--r-- | src/services.js | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/components/ListTable.tsx b/src/components/ListTable.tsx index 5c1333a..c333698 100644 --- a/src/components/ListTable.tsx +++ b/src/components/ListTable.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import _ from 'lodash'; interface Field { key: string; @@ -28,7 +29,7 @@ const ListTable: React.FC<Props> = ({ items = [], fields, handleRowClick = () => className={`border-b hover:bg-gray-100 cursor-pointer ${index % 2 && 'bg-gray-50'}`} onClick={() => handleRowClick(index)} > - {fields.map(field => <td key={`${item._id} ${field.label}`} className="p-3">{item[field.key]}</td>)} + {fields.map(field => <td key={`${item._id} ${field.label}`} className="p-3">{_.get(item, field.key)}</td>)} </tr> ))} </tbody> diff --git a/src/services.js b/src/services.js index b610aa9..b9c2ecf 100644 --- a/src/services.js +++ b/src/services.js @@ -37,8 +37,8 @@ const services: ServiceParams[] = [ nameSingular: 'Накладная', tableFields: [ { key: 'operation', label: 'Операция' }, - { key: 'productId', label: 'Товар' }, - { key: 'contractorId', label: 'Поставщик' }, + { key: 'product.name', label: 'Товар' }, + { key: 'contractor.name', label: 'Поставщик' }, { key: 'status', label: 'Статус' }, { key: 'quantity', label: 'Количество' }, ], |