From 05935b110a4a4c337f8d66f5b9bd52bc7699b135 Mon Sep 17 00:00:00 2001 From: Scott Pouliot Date: Sat, 23 May 2026 09:32:57 -0400 Subject: [PATCH] Open QR Label in modal instead of a new browser tab Adds an embed mode to the Label view (hides standalone nav controls) and an iframe-based modal on Inventory Details. The modal footer Print button calls contentWindow.print() so the print dialog opens without spawning a new window. Co-Authored-By: Claude Sonnet 4.6 --- .../Controllers/InventoryController.cs | 3 +- .../Views/Inventory/Details.cshtml | 31 +++++++++++++++++-- .../Views/Inventory/Label.cshtml | 10 +++++- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/PowderCoating.Web/Controllers/InventoryController.cs b/src/PowderCoating.Web/Controllers/InventoryController.cs index a703431..f396149 100644 --- a/src/PowderCoating.Web/Controllers/InventoryController.cs +++ b/src/PowderCoating.Web/Controllers/InventoryController.cs @@ -1623,11 +1623,12 @@ public class InventoryController : Controller /// Renders a print-optimised label for the inventory item containing the QR code, /// item name, SKU, and colour. Designed to be printed directly from the browser. /// - public async Task Label(int? id) + public async Task Label(int? id, bool embed = false) { if (id == null) return NotFound(); var item = await _unitOfWork.InventoryItems.GetByIdAsync(id.Value); if (item == null) return NotFound(); + ViewBag.IsEmbed = embed; return View(_mapper.Map(item)); } diff --git a/src/PowderCoating.Web/Views/Inventory/Details.cshtml b/src/PowderCoating.Web/Views/Inventory/Details.cshtml index 8145695..5399c1b 100644 --- a/src/PowderCoating.Web/Views/Inventory/Details.cshtml +++ b/src/PowderCoating.Web/Views/Inventory/Details.cshtml @@ -457,9 +457,9 @@ - + View Activity History @@ -644,6 +644,33 @@ +@* QR Label Modal *@ + + @section Scripts {