refactor(FE-208): restructure goods receipt table columns in PurchaseOrderDetail

This commit is contained in:
rstubryan
2025-11-17 13:51:32 +07:00
parent c8f1ea0e4f
commit 6467af35bc
@@ -613,87 +613,92 @@ const PurchaseOrderDetail = ({
const goodsReceiptColumns: ColumnDef<PurchaseItem>[] = [
{
header: 'No',
cell: (props) => props.row.index + 1,
},
{
accessorKey: 'received_date',
header: 'Tanggal Penerimaan',
cell: (props) =>
props.row.original.received_date
? formatDate(props.row.original.received_date, 'DD MMM YYYY')
: '-',
},
{
accessorKey: 'product_warehouse.warehouse.name',
header: 'Gudang Tujuan',
cell: (props) =>
props.row.original.product_warehouse?.warehouse?.name || '-',
},
{
accessorKey: 'travel_number',
header: 'No. Surat Jalan',
cell: (props) => props.row.original.travel_number || '-',
},
{
accessorKey: 'travel_number_docs',
header: 'Dokumen Surat Jalan',
cell: (props) => {
const documentPath = props.row.original.travel_number_docs;
return documentPath ? (
<Button
color='primary'
className='w-fit min-w-32 flex items-center justify-start gap-1 px-2 py-1 text-sm'
href={documentPath}
target='_blank'
rel='noopener noreferrer'
>
<Icon
icon='material-symbols:file-open-outline'
width={16}
height={16}
/>
Lihat Dokumen
</Button>
) : (
'-'
);
},
},
{
accessorKey: 'vehicle_number',
header: 'No. Armada',
cell: (props) => props.row.original.vehicle_number || '-',
},
{
accessorKey: 'pengangkut',
header: 'Pengangkut',
cell: (props) => props.row.original.product?.name || '-',
},
{
accessorKey: 'quantity',
header: 'Jumlah Total',
cell: (props) => formatNumber(props.getValue() as number),
},
{
accessorKey: 'sub_qty',
header: 'Jumlah Diterima',
cell: (props) => formatNumber(props.getValue() as number),
},
{
accessorKey: 'ekspedisi',
header: 'Ekspedisi',
cell: (props) => 'Ekspedisi 1',
},
{
accessorKey: 'price',
header: 'Transport /Item',
cell: (props) => formatCurrency(props.getValue() as number),
},
{
accessorKey: 'total_price',
header: 'Transport Total',
cell: (props) => formatCurrency(props.getValue() as number),
header: 'Header Placeholder untuk tiap Produk Penerimaan Barang',
columns: [
{
header: 'No',
cell: (props) => props.row.index + 1,
},
{
accessorKey: 'received_date',
header: 'Tanggal Penerimaan',
cell: (props) =>
props.row.original.received_date
? formatDate(props.row.original.received_date, 'DD MMM YYYY')
: '-',
},
{
accessorKey: 'product_warehouse.warehouse.name',
header: 'Gudang Tujuan',
cell: (props) =>
props.row.original.product_warehouse?.warehouse?.name || '-',
},
{
accessorKey: 'travel_number',
header: 'No. Surat Jalan',
cell: (props) => props.row.original.travel_number || '-',
},
{
accessorKey: 'travel_number_docs',
header: 'Dokumen Surat Jalan',
cell: (props) => {
const documentPath = props.row.original.travel_number_docs;
return documentPath ? (
<Button
color='primary'
className='w-fit min-w-32 flex items-center justify-start gap-1 px-2 py-1 text-sm'
href={documentPath}
target='_blank'
rel='noopener noreferrer'
>
<Icon
icon='material-symbols:file-open-outline'
width={16}
height={16}
/>
Lihat Dokumen
</Button>
) : (
'-'
);
},
},
{
accessorKey: 'vehicle_number',
header: 'No. Armada',
cell: (props) => props.row.original.vehicle_number || '-',
},
{
accessorKey: 'pengangkut',
header: 'Pengangkut',
cell: (props) => props.row.original.product?.name || '-',
},
{
accessorKey: 'quantity',
header: 'Jumlah Total',
cell: (props) => formatNumber(props.getValue() as number),
},
{
accessorKey: 'sub_qty',
header: 'Jumlah Diterima',
cell: (props) => formatNumber(props.getValue() as number),
},
{
accessorKey: 'ekspedisi',
header: 'Ekspedisi',
cell: (props) => 'Ekspedisi 1',
},
{
accessorKey: 'price',
header: 'Transport /Item',
cell: (props) => formatCurrency(props.getValue() as number),
},
{
accessorKey: 'total_price',
header: 'Transport Total',
cell: (props) => formatCurrency(props.getValue() as number),
},
],
},
];