mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add new "available" badge to stock page (#7368)
This commit is contained in:
parent
f3223c6d7f
commit
4cf395c06f
@ -501,6 +501,9 @@ export default function StockDetail() {
|
||||
);
|
||||
|
||||
const stockBadges: ReactNode[] = useMemo(() => {
|
||||
let available = (stockitem?.quantity ?? 0) - (stockitem?.allocated ?? 0);
|
||||
available = Math.max(0, available);
|
||||
|
||||
return instanceQuery.isLoading
|
||||
? []
|
||||
: [
|
||||
@ -521,6 +524,12 @@ export default function StockDetail() {
|
||||
visible={!stockitem.serial}
|
||||
key="quantity"
|
||||
/>,
|
||||
<DetailsBadge
|
||||
color="yellow"
|
||||
label={t`Available` + `: ${available}`}
|
||||
visible={!stockitem.serial && available != stockitem.quantity}
|
||||
key="available"
|
||||
/>,
|
||||
<DetailsBadge
|
||||
color="blue"
|
||||
label={t`Batch Code` + `: ${stockitem.batch}`}
|
||||
|
Loading…
Reference in New Issue
Block a user