Problem statement
An order summary panel whose figures are computed from an in-memory array of order lines. A computation and a DOM rendering must together produce the item count, subtotal, discount, tax, and grand total for the order, using Vanilla TypeScript and standard DOM APIs.
Demo
The page, styles, mock data, and summary panel markup are already scaffolded and wired. Only the computeSummary function in src/js/totals.ts and the renderSummary function in src/js/render.ts are missing — implement them so every test passes. Do not edit any other file.
What to implement
- Show the total number of items in the order.
- Show the subtotal of every line that counts toward the order.
- Show the total discount deducted from the order.
- Show the tax that applies to the discounted subtotal.
- Show the grand total that ties out to the invoice.
- Keep cancelled lines and zero-quantity lines out of every figure.
- Show
0for the item count and0.00for every money figure when the order is empty or fully cancelled — neverNaN. - Write the item count as a whole number and every money figure with two decimals.
- Leave the order lines you were given unchanged, and leave the panel and the rest of the page as you found them.
- Everything shown must come from the order lines you were given — nothing should be hardcoded.
