mirror of
https://github.com/inventree/InvenTree.git
synced 2026-04-01 17:11:12 +00:00
Badge fix (#11624)
* Fix "in production" badge - Use the total scheduled build quantity * Add "Allocated" badge * Tweak playwright tests
This commit is contained in:
@@ -999,6 +999,10 @@ export default function PartDetail() {
|
||||
return [];
|
||||
}
|
||||
|
||||
const allocated =
|
||||
partRequirements.allocated_to_build_orders +
|
||||
partRequirements.allocated_to_sales_orders;
|
||||
|
||||
const required =
|
||||
partRequirements.required_for_build_orders +
|
||||
partRequirements.required_for_sales_orders;
|
||||
@@ -1031,6 +1035,12 @@ export default function PartDetail() {
|
||||
visible={!part.virtual && partRequirements.total_stock == 0}
|
||||
key='no_stock'
|
||||
/>,
|
||||
<DetailsBadge
|
||||
label={`${t`Allocated`}: ${formatDecimal(allocated)}`}
|
||||
color='blue'
|
||||
visible={allocated > 0}
|
||||
key='allocated'
|
||||
/>,
|
||||
<DetailsBadge
|
||||
label={`${t`Required`}: ${formatDecimal(required)}`}
|
||||
color='grape'
|
||||
@@ -1044,9 +1054,9 @@ export default function PartDetail() {
|
||||
key='on_order'
|
||||
/>,
|
||||
<DetailsBadge
|
||||
label={`${t`In Production`}: ${formatDecimal(partRequirements.building)}`}
|
||||
label={`${t`In Production`}: ${formatDecimal(partRequirements.scheduled_to_build)}`}
|
||||
color='blue'
|
||||
visible={partRequirements.building > 0}
|
||||
visible={partRequirements.scheduled_to_build > 0}
|
||||
key='in_production'
|
||||
/>,
|
||||
<DetailsBadge
|
||||
|
||||
@@ -352,9 +352,10 @@ test('Parts - Requirements', async ({ browser }) => {
|
||||
|
||||
// Check top-level badges
|
||||
await page.getByText('In Stock: 209').waitFor();
|
||||
await page.getByText(/Allocated: \d/).waitFor();
|
||||
await page.getByText('Available: 204').waitFor();
|
||||
await page.getByText(/Required: 2\d+/).waitFor();
|
||||
await page.getByText('In Production: 24').waitFor();
|
||||
await page.getByText(/In Production: 2\d\d/).waitFor();
|
||||
|
||||
// Check requirements details
|
||||
await page.getByText('204 / 209').waitFor(); // Available stock
|
||||
@@ -374,7 +375,7 @@ test('Parts - Requirements', async ({ browser }) => {
|
||||
await page.getByText('In Stock: 44').waitFor();
|
||||
await page.getByText('Available: 39').waitFor();
|
||||
await page.getByText('Required: 100').waitFor();
|
||||
await page.getByText('In Production: 10').waitFor();
|
||||
await page.getByText(/In Production: 1\d\d/).waitFor();
|
||||
|
||||
await page.getByText('39 / 44').waitFor(); // Available stock
|
||||
await page.getByText('5 / 100').waitFor(); // Allocated to sales orders
|
||||
|
||||
Reference in New Issue
Block a user