mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-10 05:40:55 +00:00
add keys to badges
This commit is contained in:
@@ -5,7 +5,6 @@ export type DetailsBadgeProps = {
|
|||||||
label: string;
|
label: string;
|
||||||
size?: string;
|
size?: string;
|
||||||
visible?: boolean;
|
visible?: boolean;
|
||||||
key?: any;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function DetailsBadge(props: DetailsBadgeProps) {
|
export default function DetailsBadge(props: DetailsBadgeProps) {
|
||||||
@@ -14,12 +13,7 @@ export default function DetailsBadge(props: DetailsBadgeProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Badge
|
<Badge color={props.color} variant="filled" size={props.size ?? 'lg'}>
|
||||||
key={props.key}
|
|
||||||
color={props.color}
|
|
||||||
variant="filled"
|
|
||||||
size={props.size ?? 'lg'}
|
|
||||||
>
|
|
||||||
{props.label}
|
{props.label}
|
||||||
</Badge>
|
</Badge>
|
||||||
);
|
);
|
||||||
|
@@ -643,21 +643,25 @@ export default function PartDetail() {
|
|||||||
label={t`In Stock` + `: ${part.in_stock}`}
|
label={t`In Stock` + `: ${part.in_stock}`}
|
||||||
color={part.in_stock >= part.minimum_stock ? 'green' : 'orange'}
|
color={part.in_stock >= part.minimum_stock ? 'green' : 'orange'}
|
||||||
visible={part.in_stock > 0}
|
visible={part.in_stock > 0}
|
||||||
|
key="in_stock"
|
||||||
/>,
|
/>,
|
||||||
<DetailsBadge
|
<DetailsBadge
|
||||||
label={t`No Stock`}
|
label={t`No Stock`}
|
||||||
color="red"
|
color="red"
|
||||||
visible={part.in_stock == 0}
|
visible={part.in_stock == 0}
|
||||||
|
key="no_stock"
|
||||||
/>,
|
/>,
|
||||||
<DetailsBadge
|
<DetailsBadge
|
||||||
label={t`On Order` + `: ${part.ordering}`}
|
label={t`On Order` + `: ${part.ordering}`}
|
||||||
color="blue"
|
color="blue"
|
||||||
visible={part.on_order > 0}
|
visible={part.on_order > 0}
|
||||||
|
key="on_order"
|
||||||
/>,
|
/>,
|
||||||
<DetailsBadge
|
<DetailsBadge
|
||||||
label={t`In Production` + `: ${part.building}`}
|
label={t`In Production` + `: ${part.building}`}
|
||||||
color="blue"
|
color="blue"
|
||||||
visible={part.building > 0}
|
visible={part.building > 0}
|
||||||
|
key="in_production"
|
||||||
/>
|
/>
|
||||||
];
|
];
|
||||||
}, [part, instanceQuery]);
|
}, [part, instanceQuery]);
|
||||||
|
@@ -440,21 +440,25 @@ export default function StockDetail() {
|
|||||||
color="blue"
|
color="blue"
|
||||||
label={t`Serial Number` + `: ${stockitem.serial}`}
|
label={t`Serial Number` + `: ${stockitem.serial}`}
|
||||||
visible={!!stockitem.serial}
|
visible={!!stockitem.serial}
|
||||||
|
key="serial"
|
||||||
/>,
|
/>,
|
||||||
<DetailsBadge
|
<DetailsBadge
|
||||||
color="blue"
|
color="blue"
|
||||||
label={t`Quantity` + `: ${stockitem.quantity}`}
|
label={t`Quantity` + `: ${stockitem.quantity}`}
|
||||||
visible={!stockitem.serial}
|
visible={!stockitem.serial}
|
||||||
|
key="quantity"
|
||||||
/>,
|
/>,
|
||||||
<DetailsBadge
|
<DetailsBadge
|
||||||
color="blue"
|
color="blue"
|
||||||
label={t`Batch Code` + `: ${stockitem.batch}`}
|
label={t`Batch Code` + `: ${stockitem.batch}`}
|
||||||
visible={!!stockitem.batch}
|
visible={!!stockitem.batch}
|
||||||
|
key="batch"
|
||||||
/>,
|
/>,
|
||||||
<StatusRenderer
|
<StatusRenderer
|
||||||
status={stockitem.status}
|
status={stockitem.status}
|
||||||
type={ModelType.stockitem}
|
type={ModelType.stockitem}
|
||||||
options={{ size: 'lg' }}
|
options={{ size: 'lg' }}
|
||||||
|
key="status"
|
||||||
/>
|
/>
|
||||||
];
|
];
|
||||||
}, [stockitem, instanceQuery]);
|
}, [stockitem, instanceQuery]);
|
||||||
|
Reference in New Issue
Block a user