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
}