From b96b8b8a04fbcb29d819a82f48827bbd2975281a Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 16 Jul 2024 00:39:30 +1000 Subject: [PATCH] [PUI] Tweak purchase order line table (#7656) * Add "packaging" field to PO line table * Fixes for order detail pages --- .../pages/purchasing/PurchaseOrderDetail.tsx | 14 -------------- .../src/pages/sales/SalesOrderDetail.tsx | 10 ++-------- .../purchasing/PurchaseOrderLineItemTable.tsx | 17 +++++++++++------ 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx b/src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx index 9fab1e1ccf..5e83b22f2b 100644 --- a/src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx +++ b/src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx @@ -134,12 +134,6 @@ export default function PurchaseOrderDetail() { ]; let tr: DetailsField[] = [ - { - type: 'text', - name: 'line_items', - label: t`Line Items`, - icon: 'list' - }, { type: 'progressbar', name: 'completed', @@ -148,14 +142,6 @@ export default function PurchaseOrderDetail() { total: order.line_items, progress: order.completed_lines }, - { - type: 'progressbar', - name: 'shipments', - icon: 'shipment', - label: t`Completed Shipments`, - total: order.shipments, - progress: order.completed_shipments - }, { type: 'text', name: 'currency', diff --git a/src/frontend/src/pages/sales/SalesOrderDetail.tsx b/src/frontend/src/pages/sales/SalesOrderDetail.tsx index 2222f7cbd2..1045244fb8 100644 --- a/src/frontend/src/pages/sales/SalesOrderDetail.tsx +++ b/src/frontend/src/pages/sales/SalesOrderDetail.tsx @@ -106,12 +106,6 @@ export default function SalesOrderDetail() { ]; let tr: DetailsField[] = [ - { - type: 'text', - name: 'line_items', - label: t`Line Items`, - icon: 'list' - }, { type: 'progressbar', name: 'completed', @@ -126,8 +120,8 @@ export default function SalesOrderDetail() { icon: 'shipment', label: t`Completed Shipments`, total: order.shipments, - progress: order.completed_shipments - // TODO: Fix this progress bar + progress: order.completed_shipments, + hidden: !order.shipments }, { type: 'text', diff --git a/src/frontend/src/tables/purchasing/PurchaseOrderLineItemTable.tsx b/src/frontend/src/tables/purchasing/PurchaseOrderLineItemTable.tsx index 2fb8a1c629..faf61b207d 100644 --- a/src/frontend/src/tables/purchasing/PurchaseOrderLineItemTable.tsx +++ b/src/frontend/src/tables/purchasing/PurchaseOrderLineItemTable.tsx @@ -23,6 +23,7 @@ import { import { useTable } from '../../hooks/UseTable'; import { apiUrl } from '../../states/ApiState'; import { useUserState } from '../../states/UserState'; +import { TableColumn } from '../Column'; import { CurrencyColumn, LinkColumn, @@ -65,7 +66,7 @@ export function PurchaseOrderLineItemTable({ } }); - const tableColumns = useMemo(() => { + const tableColumns: TableColumn[] = useMemo(() => { return [ { accessor: 'part', @@ -138,17 +139,21 @@ export function PurchaseOrderLineItemTable({ ) }, { - accessor: 'pack_quantity', + accessor: 'supplier_part_detail.packaging', sortable: false, - title: t`Pack Quantity`, - render: (record: any) => record?.supplier_part_detail?.pack_quantity + title: t`Packaging` }, { - accessor: 'SKU', + accessor: 'supplier_part_detail.pack_quantity', + sortable: false, + title: t`Pack Quantity` + }, + { + accessor: 'supplier_part_detail.SKU', title: t`Supplier Code`, switchable: false, sortable: true, - render: (record: any) => record?.supplier_part_detail?.SKU + ordering: 'SKU' }, { accessor: 'supplier_link',