mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 19:46:46 +00:00
[PUI]: Refactor columns (#7136)
This commit is contained in:
parent
e4c227f876
commit
6ae64467eb
@ -18,6 +18,7 @@ import { ApiEndpoints } from '../../../enums/ApiEndpoints';
|
|||||||
import { useTable } from '../../../hooks/UseTable';
|
import { useTable } from '../../../hooks/UseTable';
|
||||||
import { apiUrl } from '../../../states/ApiState';
|
import { apiUrl } from '../../../states/ApiState';
|
||||||
import { TableColumn } from '../../../tables/Column';
|
import { TableColumn } from '../../../tables/Column';
|
||||||
|
import { DateColumn } from '../../../tables/ColumnRenderers';
|
||||||
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
import { InvenTreeTable } from '../../../tables/InvenTreeTable';
|
||||||
import { NoPricingData } from './PricingPanel';
|
import { NoPricingData } from './PricingPanel';
|
||||||
|
|
||||||
@ -40,13 +41,12 @@ export default function SaleHistoryPanel({ part }: { part: any }): ReactNode {
|
|||||||
switchable: true,
|
switchable: true,
|
||||||
render: (record: any) => record?.customer_detail?.name
|
render: (record: any) => record?.customer_detail?.name
|
||||||
},
|
},
|
||||||
{
|
DateColumn({
|
||||||
accessor: 'shipment_date',
|
accessor: 'order_detail.shipment_date',
|
||||||
title: t`Date`,
|
title: t`Date`,
|
||||||
sortable: false,
|
sortable: false,
|
||||||
switchable: true,
|
switchable: true
|
||||||
render: (record: any) => renderDate(record.order_detail.shipment_date)
|
}),
|
||||||
},
|
|
||||||
{
|
{
|
||||||
accessor: 'sale_price',
|
accessor: 'sale_price',
|
||||||
title: t`Sale Price`,
|
title: t`Sale Price`,
|
||||||
|
@ -191,9 +191,11 @@ export function DateColumn({
|
|||||||
accessor,
|
accessor,
|
||||||
sortable,
|
sortable,
|
||||||
switchable,
|
switchable,
|
||||||
|
ordering,
|
||||||
title
|
title
|
||||||
}: {
|
}: {
|
||||||
accessor?: string;
|
accessor?: string;
|
||||||
|
ordering?: string;
|
||||||
sortable?: boolean;
|
sortable?: boolean;
|
||||||
switchable?: boolean;
|
switchable?: boolean;
|
||||||
title?: string;
|
title?: string;
|
||||||
@ -201,9 +203,10 @@ export function DateColumn({
|
|||||||
return {
|
return {
|
||||||
accessor: accessor ?? 'date',
|
accessor: accessor ?? 'date',
|
||||||
sortable: sortable ?? true,
|
sortable: sortable ?? true,
|
||||||
|
ordering: ordering,
|
||||||
title: title ?? t`Date`,
|
title: title ?? t`Date`,
|
||||||
switchable: switchable,
|
switchable: switchable,
|
||||||
render: (record: any) => renderDate(record[accessor ?? 'date'])
|
render: (record: any) => renderDate(resolveItem(record, accessor ?? 'date'))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import { useUserState } from '../../states/UserState';
|
|||||||
import { TableColumn } from '../Column';
|
import { TableColumn } from '../Column';
|
||||||
import {
|
import {
|
||||||
CreationDateColumn,
|
CreationDateColumn,
|
||||||
|
DateColumn,
|
||||||
ProjectCodeColumn,
|
ProjectCodeColumn,
|
||||||
ReferenceColumn,
|
ReferenceColumn,
|
||||||
ResponsibleColumn,
|
ResponsibleColumn,
|
||||||
@ -62,11 +63,10 @@ function buildOrderTableColumns(): TableColumn[] {
|
|||||||
},
|
},
|
||||||
CreationDateColumn(),
|
CreationDateColumn(),
|
||||||
TargetDateColumn(),
|
TargetDateColumn(),
|
||||||
{
|
DateColumn({
|
||||||
accessor: 'completion_date',
|
accessor: 'completion_date',
|
||||||
sortable: true,
|
sortable: true
|
||||||
render: (record: any) => renderDate(record.completion_date)
|
}),
|
||||||
},
|
|
||||||
{
|
{
|
||||||
accessor: 'issued_by',
|
accessor: 'issued_by',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -206,18 +206,12 @@ function stockItemTableColumns(): TableColumn[] {
|
|||||||
title: t`Stocktake`,
|
title: t`Stocktake`,
|
||||||
sortable: true
|
sortable: true
|
||||||
}),
|
}),
|
||||||
{
|
DateColumn({
|
||||||
accessor: 'expiry_date',
|
accessor: 'expiry_date'
|
||||||
sortable: true,
|
}),
|
||||||
switchable: true,
|
DateColumn({
|
||||||
render: (record: any) => renderDate(record.expiry_date)
|
accessor: 'updated'
|
||||||
},
|
}),
|
||||||
{
|
|
||||||
accessor: 'updated',
|
|
||||||
sortable: true,
|
|
||||||
switchable: true,
|
|
||||||
render: (record: any) => renderDate(record.updated)
|
|
||||||
},
|
|
||||||
// TODO: purchase order
|
// TODO: purchase order
|
||||||
// TODO: Supplier part
|
// TODO: Supplier part
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user