From f840112b263edd10377e497e49fc35aa8cb8ac32 Mon Sep 17 00:00:00 2001 From: Saksham Arora Date: Fri, 14 Jun 2024 14:25:33 +0200 Subject: [PATCH] backoffice: DocumentItems: Add columnFormat parameter --- src/lib/index.js | 4 +--- .../DocumentDetails/DocumentItems/DocumentItems.js | 13 ++++++++++--- .../__snapshots__/DocumentItems.test.js.snap | 4 ++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/lib/index.js b/src/lib/index.js index 6fb29d557..aa4abe598 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -51,6 +51,4 @@ export { SectionInstallation } from '@pages/frontsite/Home/Sections/SectionInsta export { PaymentInformation } from '@components/backoffice/PaymentInformation'; export { OrderLine } from '@pages/backoffice/Acquisition/Order/OrderDetails/OrderLines'; export { formatPrice } from '@api/utils'; -export { Loader } from '@components/Loader'; -export { Error } from '@components/Error'; -export { SeeAllButton } from '@components/backoffice/buttons/SeeAllButton'; +export { DocumentItems } from '@pages/backoffice/Document/DocumentDetails/DocumentItems'; diff --git a/src/lib/pages/backoffice/Document/DocumentDetails/DocumentItems/DocumentItems.js b/src/lib/pages/backoffice/Document/DocumentDetails/DocumentItems/DocumentItems.js index cc4b84e42..f9cd559df 100644 --- a/src/lib/pages/backoffice/Document/DocumentDetails/DocumentItems/DocumentItems.js +++ b/src/lib/pages/backoffice/Document/DocumentDetails/DocumentItems/DocumentItems.js @@ -40,9 +40,8 @@ class DocumentItems extends Component { return `${row.metadata.internal_location.name} (${row.metadata.internal_location.location.name})`; }; - renderTable(data) { - const { showMaxItems } = this.props; - const columns = [ + getColumnFormat = () => { + return [ { title: 'Barcode', field: 'metadata.barcode', @@ -76,6 +75,12 @@ class DocumentItems extends Component { }, }, ]; + }; + + renderTable(data) { + const { showMaxItems, columnFormat } = this.props; + const columns = + columnFormat !== null ? columnFormat() : this.getColumnFormat(); return (