diff --git a/src/PowderCoating.Web/Views/Jobs/Board.cshtml b/src/PowderCoating.Web/Views/Jobs/Board.cshtml index e1d54da..d44afcb 100644 --- a/src/PowderCoating.Web/Views/Jobs/Board.cshtml +++ b/src/PowderCoating.Web/Views/Jobs/Board.cshtml @@ -314,6 +314,7 @@
@@ -569,15 +570,29 @@ dragClass: 'dragging', onEnd(evt) { - const card = evt.item; - const jobId = parseInt(card.dataset.jobId); - const newColEl = evt.to; - const newStatus = parseInt(newColEl.closest('.board-column').dataset.statusId); - const oldColEl = evt.from; + const card = evt.item; + const jobId = parseInt(card.dataset.jobId); + const newColEl = evt.to; + const newColWrapper = newColEl.closest('.board-column'); + const newStatus = parseInt(newColWrapper.dataset.statusId); + const newStatusCode = newColWrapper.dataset.statusCode; + const oldColEl = evt.from; // No-op if dropped in same column if (newColEl === oldColEl && evt.newIndex === evt.oldIndex) return; + // Completing a job requires the full completion flow (time, powder, email/SMS). + // Revert the visual move and send the user to the Details page where the + // Mark Complete modal captures all of that. + if (newStatusCode === 'COMPLETED') { + oldColEl.insertBefore(card, oldColEl.children[evt.oldIndex] ?? null); + updateCount(oldColEl); + updateCount(newColEl); + showToast('Opening job to complete with full details…', true); + setTimeout(() => { window.location.href = card.href + '#completeModal'; }, 600); + return; + } + // Update column counts immediately updateCount(oldColEl); updateCount(newColEl); diff --git a/src/PowderCoating.Web/Views/Jobs/Details.cshtml b/src/PowderCoating.Web/Views/Jobs/Details.cshtml index a36030b..771ae98 100644 --- a/src/PowderCoating.Web/Views/Jobs/Details.cshtml +++ b/src/PowderCoating.Web/Views/Jobs/Details.cshtml @@ -2440,6 +2440,13 @@ document.addEventListener('DOMContentLoaded', function () { jobPhotoModule.init(@Model.Id, @Html.Raw(ViewBag.PhotoTagSuggestions ?? "[]")); + // Auto-open the Mark Complete modal when arriving from the job board + if (window.location.hash === '#completeModal') { + const modal = document.getElementById('completeJobModal'); + if (modal) new bootstrap.Modal(modal).show(); + history.replaceState(null, '', window.location.pathname + window.location.search); + } + // ── Auto-submit after wizard saves an item ──────────────────────── let itemsModified = false;