Add AI Profile draft generator and hide AI Quick Quote for release

- GenerateAiProfileDraft endpoint builds suggested AI Profile text from
  existing company config (ovens, workers, inventory categories, rates)
- "Generate from my settings" button wired in Company Settings AI Profile tab
- Add "hrs" unit label to Billable Hours/Month input in Company Settings and Setup Wizard Step 3
- Hide AI Quick Quote widget (commented out in _Layout) pending next release

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-24 21:29:42 -04:00
parent 27ac793f62
commit 3327c86909
4 changed files with 187 additions and 8 deletions
@@ -370,7 +370,7 @@
<i class="bi bi-question-circle"></i>
</a>
</h6>
<div class="row align-items-end">
<div class="row align-items-start">
<div class="col-md-3">
<div class="mb-3">
<label for="monthlyRent" class="form-label">Monthly Rent</label>
@@ -395,7 +395,10 @@
<div class="col-md-3">
<div class="mb-3">
<label for="monthlyBillableHours" class="form-label">Billable Hours/Month</label>
<input type="number" step="1" class="form-control facility-overhead-input" id="monthlyBillableHours" name="MonthlyBillableHours" value="@(Model.OperatingCosts?.MonthlyBillableHours ?? 160)" min="1" max="10000">
<div class="input-group">
<input type="number" step="1" class="form-control facility-overhead-input" id="monthlyBillableHours" name="MonthlyBillableHours" value="@(Model.OperatingCosts?.MonthlyBillableHours ?? 160)" min="1" max="10000">
<span class="input-group-text">hrs</span>
</div>
<small class="text-muted">Typical: 160 hrs (4 wks × 40 hrs)</small>
</div>
</div>
@@ -757,10 +760,16 @@
<small class="text-muted"><span id="aiProfileCharCount">@(Model.OperatingCosts?.AiContextProfile?.Length ?? 0)</span>/2000</small>
</div>
</div>
<button type="button" class="btn btn-primary" id="btnSaveAiProfile">
<i class="bi bi-floppy me-1"></i> Save AI Profile
</button>
<span id="aiProfileStatus" class="ms-3 small"></span>
<div class="d-flex align-items-center gap-2 flex-wrap">
<button type="button" class="btn btn-primary" id="btnSaveAiProfile">
<i class="bi bi-floppy me-1"></i> Save AI Profile
</button>
<button type="button" class="btn btn-outline-secondary" id="btnGenerateAiDraft"
title="Build a suggested profile from your existing settings — ovens, workers, inventory categories, and rates">
<i class="bi bi-stars me-1"></i> Generate from my settings
</button>
<span id="aiProfileStatus" class="small"></span>
</div>
</div>
<div class="col-lg-4">
@@ -2274,6 +2283,32 @@
});
});
$('#btnGenerateAiDraft').on('click', function () {
const btn = $(this);
const existing = $('#aiContextProfile').val().trim();
if (existing && !confirm('This will replace your current profile text with a generated draft. Continue?')) return;
btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm"></span> Generating...');
$.ajax({
url: '@Url.Action("GenerateAiProfileDraft", "CompanySettings")',
type: 'GET',
success: function (response) {
if (response.success) {
$('#aiContextProfile').val(response.draft);
$('#aiProfileCharCount').text(response.draft.length);
showToast('info', 'Draft generated — review and edit it, then click Save AI Profile.');
} else {
showToast('error', response.message);
}
},
error: function () {
showToast('error', 'An error occurred while generating the draft.');
},
complete: function () {
btn.prop('disabled', false).html('<i class="bi bi-stars me-1"></i> Generate from my settings');
}
});
});
// Quoting Calibration — save
$('#saveBlastProfile').on('click', function () {
var btn = $(this);
@@ -88,7 +88,10 @@
</div>
<div class="col-md-4">
<label asp-for="MonthlyBillableHours" class="form-label fw-semibold"></label>
<input asp-for="MonthlyBillableHours" class="form-control wz-overhead" step="1" type="number" min="1" />
<div class="input-group">
<input asp-for="MonthlyBillableHours" class="form-control wz-overhead" step="1" type="number" min="1" />
<span class="input-group-text">hrs</span>
</div>
<div class="form-text">Hours per month the shop is actively producing work. Default: 160 (4 wks × 40 hrs).</div>
</div>
<div class="col-md-4">
@@ -2089,7 +2089,7 @@
@if (User.Identity?.IsAuthenticated == true)
{
@await Html.PartialAsync("_AiQuickQuoteWidget")
@* @await Html.PartialAsync("_AiQuickQuoteWidget") *@
@await Html.PartialAsync("_AiHelpWidget")
}