mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 21:38:48 +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(() => {
|
const stockBadges: ReactNode[] = useMemo(() => {
|
||||||
|
let available = (stockitem?.quantity ?? 0) - (stockitem?.allocated ?? 0);
|
||||||
|
available = Math.max(0, available);
|
||||||
|
|
||||||
return instanceQuery.isLoading
|
return instanceQuery.isLoading
|
||||||
? []
|
? []
|
||||||
: [
|
: [
|
||||||
@ -521,6 +524,12 @@ export default function StockDetail() {
|
|||||||
visible={!stockitem.serial}
|
visible={!stockitem.serial}
|
||||||
key="quantity"
|
key="quantity"
|
||||||
/>,
|
/>,
|
||||||
|
<DetailsBadge
|
||||||
|
color="yellow"
|
||||||
|
label={t`Available` + `: ${available}`}
|
||||||
|
visible={!stockitem.serial && available != stockitem.quantity}
|
||||||
|
key="available"
|
||||||
|
/>,
|
||||||
<DetailsBadge
|
<DetailsBadge
|
||||||
color="blue"
|
color="blue"
|
||||||
label={t`Batch Code` + `: ${stockitem.batch}`}
|
label={t`Batch Code` + `: ${stockitem.batch}`}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user