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 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 20:47:45 -04:00
parent e3c76ce7ce
commit ff231d9dd2
3 changed files with 9 additions and 2 deletions
@@ -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; }
@@ -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.
@@ -1590,7 +1590,7 @@
@if (Model.ConvertedToJobId.HasValue)
{
<a asp-controller="Jobs" asp-action="Details" asp-route-id="@Model.ConvertedToJobId" class="btn btn-outline-info">
<i class="bi bi-clipboard-check me-1"></i>View Job
<i class="bi bi-clipboard-check me-1"></i>View Job @Model.ConvertedToJobNumber
</a>
}
<a asp-action="DownloadPdf" asp-route-id="@Model.Id" class="btn btn-primary">