From ff231d9dd28601ca410b09412289ab9b4f4fbad4 Mon Sep 17 00:00:00 2001 From: Scott Pouliot Date: Wed, 6 May 2026 20:47:45 -0400 Subject: [PATCH] Set quote status to Converted and show job number link on quote details - CreateJobFromQuote now sets QuoteStatusId to CONVERTED after creating the job - Added ConvertedToJobNumber to QuoteDto, populated in Details action - 'View Job' button on Quote Details now shows the job number (e.g. 'View Job JOB-2505-0001') Co-Authored-By: Claude Sonnet 4.6 --- src/PowderCoating.Application/DTOs/Quote/QuoteDtos.cs | 1 + src/PowderCoating.Web/Controllers/QuotesController.cs | 8 +++++++- src/PowderCoating.Web/Views/Quotes/Details.cshtml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/PowderCoating.Application/DTOs/Quote/QuoteDtos.cs b/src/PowderCoating.Application/DTOs/Quote/QuoteDtos.cs index 09ad66a..8acd67e 100644 --- a/src/PowderCoating.Application/DTOs/Quote/QuoteDtos.cs +++ b/src/PowderCoating.Application/DTOs/Quote/QuoteDtos.cs @@ -127,6 +127,7 @@ public class QuoteDto // Conversion Tracking public int? ConvertedToJobId { get; set; } + public string? ConvertedToJobNumber { get; set; } // Customer Approval Tracking public string? ApprovalToken { get; set; } diff --git a/src/PowderCoating.Web/Controllers/QuotesController.cs b/src/PowderCoating.Web/Controllers/QuotesController.cs index d7aaf77..49aae0a 100644 --- a/src/PowderCoating.Web/Controllers/QuotesController.cs +++ b/src/PowderCoating.Web/Controllers/QuotesController.cs @@ -315,6 +315,7 @@ public class QuotesController : Controller else { quoteDto.ConvertedToJobId = quote.ConvertedToJobId; + quoteDto.ConvertedToJobNumber = linkedJob.JobNumber; } } else @@ -3164,9 +3165,14 @@ public class QuotesController : Controller uniquePrepServiceIds.Count, job.JobNumber); } - // Update quote to track the conversion + // Update quote to track the conversion and mark it as converted quote.ConvertedToJobId = job.Id; quote.ConvertedDate = DateTime.UtcNow; + var companyIdForStatus = quote.CompanyId; + var quoteStatuses = await _lookupCache.GetQuoteStatusLookupsAsync(companyIdForStatus); + var convertedQuoteStatus = quoteStatuses.FirstOrDefault(s => s.StatusCode == "CONVERTED"); + if (convertedQuoteStatus != null) + quote.QuoteStatusId = convertedQuoteStatus.Id; await _unitOfWork.SaveChangesAsync(); // The interceptor just bumped quote.UpdatedAt as part of the ConvertedToJobId write. diff --git a/src/PowderCoating.Web/Views/Quotes/Details.cshtml b/src/PowderCoating.Web/Views/Quotes/Details.cshtml index 4e3db8a..ff96485 100644 --- a/src/PowderCoating.Web/Views/Quotes/Details.cshtml +++ b/src/PowderCoating.Web/Views/Quotes/Details.cshtml @@ -1590,7 +1590,7 @@ @if (Model.ConvertedToJobId.HasValue) { - View Job + View Job @Model.ConvertedToJobNumber }