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:
@@ -127,6 +127,7 @@ public class QuoteDto
|
|||||||
|
|
||||||
// Conversion Tracking
|
// Conversion Tracking
|
||||||
public int? ConvertedToJobId { get; set; }
|
public int? ConvertedToJobId { get; set; }
|
||||||
|
public string? ConvertedToJobNumber { get; set; }
|
||||||
|
|
||||||
// Customer Approval Tracking
|
// Customer Approval Tracking
|
||||||
public string? ApprovalToken { get; set; }
|
public string? ApprovalToken { get; set; }
|
||||||
|
|||||||
@@ -315,6 +315,7 @@ public class QuotesController : Controller
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
quoteDto.ConvertedToJobId = quote.ConvertedToJobId;
|
quoteDto.ConvertedToJobId = quote.ConvertedToJobId;
|
||||||
|
quoteDto.ConvertedToJobNumber = linkedJob.JobNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3164,9 +3165,14 @@ public class QuotesController : Controller
|
|||||||
uniquePrepServiceIds.Count, job.JobNumber);
|
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.ConvertedToJobId = job.Id;
|
||||||
quote.ConvertedDate = DateTime.UtcNow;
|
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();
|
await _unitOfWork.SaveChangesAsync();
|
||||||
|
|
||||||
// The interceptor just bumped quote.UpdatedAt as part of the ConvertedToJobId write.
|
// The interceptor just bumped quote.UpdatedAt as part of the ConvertedToJobId write.
|
||||||
|
|||||||
@@ -1590,7 +1590,7 @@
|
|||||||
@if (Model.ConvertedToJobId.HasValue)
|
@if (Model.ConvertedToJobId.HasValue)
|
||||||
{
|
{
|
||||||
<a asp-controller="Jobs" asp-action="Details" asp-route-id="@Model.ConvertedToJobId" class="btn btn-outline-info">
|
<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>
|
||||||
}
|
}
|
||||||
<a asp-action="DownloadPdf" asp-route-id="@Model.Id" class="btn btn-primary">
|
<a asp-action="DownloadPdf" asp-route-id="@Model.Id" class="btn btn-primary">
|
||||||
|
|||||||
Reference in New Issue
Block a user