Skip to content

Commit

Permalink
Part pricing cleanup (#8340)
Browse files Browse the repository at this point in the history
* Part pricing cleanup

- Improve / tweak rendering for PurchaseHistoryPanel

* Adjust playwright tests
  • Loading branch information
SchrodingersGat authored Oct 23, 2024
1 parent 28146bb commit a6bba14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@ export default function PurchaseHistoryPanel({
currency: record.purchase_price_currency
});

let units = record.supplier_part_detail?.pack_quantity;
let packQuatity = record.supplier_part_detail?.pack_quantity;
let hasPackQuantity =
!!packQuatity &&
record.supplier_part_detail?.pack_quantity_native != 1;

return (
<Group justify="space-between" gap="xs">
<Text>{price}</Text>
{units && <Text size="xs">[{units}]</Text>}
{hasPackQuantity && <Text size="xs">[{packQuatity}]</Text>}
</Group>
);
}
Expand All @@ -74,11 +77,12 @@ export default function PurchaseHistoryPanel({
});

let units = record.part_detail?.units;
let hasUnits = !!units && units !== 1;

return (
<Group justify="space-between" gap="xs">
<Text>{price}</Text>
{units && <Text size="xs">[{units}]</Text>}
{hasUnits && <Text size="xs">[{units}]</Text>}
</Group>
);
}
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/tests/pages/pui_stock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ test('Stock - Serial Numbers', async ({ page }) => {

// Now, with correct quantity
await page.getByLabel('number-field-quantity').fill('51');
await page.waitForTimeout(250);
await page.getByRole('button', { name: 'Submit' }).click();
await page.waitForTimeout(250);

await page
.getByText(
/The following serial numbers already exist or are invalid : 200,201,202,203,204/
Expand Down

0 comments on commit a6bba14

Please sign in to comment.