Update part detail (#7629)

- Include variant stock in "in stock" badge
This commit is contained in:
Oliver 2024-07-12 10:13:25 +10:00 committed by GitHub
parent 3d8235423a
commit a237de10ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -209,6 +209,14 @@ export default function PartDetail() {
label: t`Available Stock`,
hidden: part.total_in_stock == part.unallocated_stock
},
{
type: 'string',
name: 'variant_stock',
unit: true,
label: t`Variant Stock`,
hidden: !part.variant_stock,
icon: 'stock'
},
{
type: 'string',
name: 'minimum_stock',
@ -221,7 +229,7 @@ export default function PartDetail() {
name: 'ordering',
label: t`On order`,
unit: true,
hidden: part.ordering <= 0
hidden: !part.purchaseable || part.ordering <= 0
},
{
type: 'progressbar',
@ -244,14 +252,14 @@ export default function PartDetail() {
name: 'can_build',
unit: true,
label: t`Can Build`,
hidden: !part.assembly
hidden: true // TODO: Expose "can_build" to the API
},
{
type: 'string',
name: 'building',
unit: true,
label: t`Building`,
hidden: !part.assembly
hidden: !part.assembly || !part.building
}
];
@ -666,8 +674,8 @@ export default function PartDetail() {
return [
<DetailsBadge
label={t`In Stock` + `: ${part.total_in_stock}`}
color={part.in_stock >= part.minimum_stock ? 'green' : 'orange'}
visible={part.in_stock > 0}
color={part.total_in_stock >= part.minimum_stock ? 'green' : 'orange'}
visible={part.total_in_stock > 0}
key="in_stock"
/>,
<DetailsBadge
@ -679,7 +687,7 @@ export default function PartDetail() {
<DetailsBadge
label={t`No Stock`}
color="red"
visible={part.in_stock == 0}
visible={part.total_in_stock == 0}
key="no_stock"
/>,
<DetailsBadge