Fix invoice ProjectName not pre-filling on edit; add to Details view

Edit GET now falls back to job.ProjectName for invoices created before the
column was added. Details view shows Project Name alongside Customer PO.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 08:58:09 -04:00
parent 9367e358d9
commit 7cbae31916
2 changed files with 8 additions and 1 deletions
@@ -903,7 +903,7 @@ public class InvoicesController : Controller
InternalNotes = invoice.InternalNotes,
Terms = invoice.Terms,
CustomerPO = invoice.CustomerPO,
ProjectName = invoice.ProjectName,
ProjectName = invoice.ProjectName ?? invoice.Job?.ProjectName,
InvoiceItems = invoice.InvoiceItems
.Where(i => !i.IsDeleted)
.OrderBy(i => i.DisplayOrder)
@@ -193,6 +193,13 @@
<p class="mb-0">@Model.CustomerPO</p>
</div>
}
@if (!string.IsNullOrWhiteSpace(Model.ProjectName))
{
<div class="col-md-6">
<label class="text-muted small mb-1">Project Name</label>
<p class="mb-0">@Model.ProjectName</p>
</div>
}
@if (!string.IsNullOrWhiteSpace(Model.ExternalReference))
{
<div class="col-md-6">