2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-23 17:37:38 +00:00

Allocate Stock tweaks (#10618)

- Display IPN
- Display part units
This commit is contained in:
Oliver
2025-10-19 11:59:35 +11:00
committed by GitHub
parent 73ca468ff7
commit 2b1fd1c309
2 changed files with 13 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
import { Progress, Stack, Text } from '@mantine/core'; import { Group, Progress, Stack, Text } from '@mantine/core';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { formatDecimal } from '../functions/Formatting'; import { formatDecimal } from '../functions/Formatting';
@@ -9,6 +9,7 @@ export type ProgressBarProps = {
progressLabel?: boolean; progressLabel?: boolean;
animated?: boolean; animated?: boolean;
size?: string; size?: string;
units?: string;
}; };
/** /**
@@ -30,9 +31,12 @@ export function ProgressBar(props: Readonly<ProgressBarProps>) {
return ( return (
<Stack gap={2} style={{ flexGrow: 1, minWidth: '100px' }}> <Stack gap={2} style={{ flexGrow: 1, minWidth: '100px' }}>
{props.progressLabel && ( {props.progressLabel && (
<Group gap='xs' justify='center'>
<Text ta='center' size='xs'> <Text ta='center' size='xs'>
{formatDecimal(props.value)} / {formatDecimal(props.maximum)} {formatDecimal(props.value)} / {formatDecimal(props.maximum)}
</Text> </Text>
{props.units && <Text size='xs'>[{props.units}]</Text>}
</Group>
)} )}
<Progress <Progress
value={progress} value={progress}

View File

@@ -567,11 +567,15 @@ function BuildAllocateLineRow({
<Table.Td> <Table.Td>
<RenderPartColumn part={record.part_detail} /> <RenderPartColumn part={record.part_detail} />
</Table.Td> </Table.Td>
<Table.Td>
<Text size='sm'>{record.part_detail?.IPN}</Text>
</Table.Td>
<Table.Td> <Table.Td>
<ProgressBar <ProgressBar
value={record.allocatedQuantity} value={record.allocatedQuantity}
maximum={record.requiredQuantity - record.consumed} maximum={record.requiredQuantity - record.consumed}
progressLabel progressLabel
units={record.part_detail?.units}
/> />
</Table.Td> </Table.Td>
<Table.Td> <Table.Td>
@@ -624,6 +628,7 @@ export function useAllocateStockToBuildForm({
value: [], value: [],
headers: [ headers: [
{ title: t`Part`, style: { minWidth: '175px' } }, { title: t`Part`, style: { minWidth: '175px' } },
{ title: t`IPN`, style: { minWidth: '50px' } },
{ title: t`Allocated`, style: { minWidth: '175px' } }, { title: t`Allocated`, style: { minWidth: '175px' } },
{ title: t`Stock Item`, style: { width: '100%' } }, { title: t`Stock Item`, style: { width: '100%' } },
{ title: t`Quantity`, style: { minWidth: '175px' } }, { title: t`Quantity`, style: { minWidth: '175px' } },