Custom Formula Templates — How It Works
diff --git a/src/PowderCoating.Web/Views/Quotes/Create.cshtml b/src/PowderCoating.Web/Views/Quotes/Create.cshtml
index c96e881..155d46f 100644
--- a/src/PowderCoating.Web/Views/Quotes/Create.cshtml
+++ b/src/PowderCoating.Web/Views/Quotes/Create.cshtml
@@ -590,7 +590,7 @@
function applyMode(mode) {
if (mode === 'simple') {
form.classList.add('quote-simple-mode');
- hint.textContent = 'Advanced fields are hidden — switch to Full Quote to see them.';
+ hint.innerHTML = 'Advanced fields are hidden — switch to Full Quote to see them.';
} else {
form.classList.remove('quote-simple-mode');
hint.textContent = '';
diff --git a/src/PowderCoating.Web/wwwroot/js/item-wizard.js b/src/PowderCoating.Web/wwwroot/js/item-wizard.js
index b7b266e..127a2cc 100644
--- a/src/PowderCoating.Web/wwwroot/js/item-wizard.js
+++ b/src/PowderCoating.Web/wwwroot/js/item-wizard.js
@@ -209,11 +209,20 @@ function wizardNext() {
if (wz.step === 1) {
wz.step = 2;
} else if (wz.step === 2) {
- // Generic / labor / sales: step 2 is the last step
- if (wz.itemType === 'generic' || wz.itemType === 'labor' || wz.itemType === 'sales') {
+ // Labor / sales: step 2 is the last step
+ if (wz.itemType === 'labor' || wz.itemType === 'sales') {
wizardSave();
return;
}
+ // Flat-Rate Charge: go to step 3 only if user opted in to specifying coatings
+ if (wz.itemType === 'generic') {
+ if (wz.data.genericHasCoatings) {
+ wz.step = 3;
+ } else {
+ wizardSave();
+ return;
+ }
+ }
// AI: step 2 must be accepted before proceeding
if (wz.itemType === 'ai') {
if (!wz.ai.accepted) {
@@ -223,6 +232,11 @@ function wizardNext() {
}
wz.step = 3;
} else if (wz.step === 3) {
+ // Flat-Rate Charge with coatings stops here — no prep or catalog-save step
+ if (wz.itemType === 'generic') {
+ wizardSave();
+ return;
+ }
// Step 4 (prep services) for product, calculated, and ai items — always shown
// so users with no prep services configured see the empty-state prompt
wz.step = 4;
@@ -615,6 +629,18 @@ function renderGenericFields() {
@@ -2265,6 +2292,19 @@ function customPowderCatalogClose(i) {
if (qEl) qEl.value = '';
}
+// When the catalog search loses focus without a catalog result being selected,
+// copy whatever the user typed into Color Name (if Color Name is still empty).
+// This handles the common case of typing a color name in the search, not finding
+// a catalog match, and expecting the typed text to become the color name.
+function catalogQBlur(i) {
+ const q = document.getElementById(`coat_catalog_q_${i}`);
+ const catId = document.getElementById(`coat_custom_catalogItemId_${i}`);
+ const cn = document.getElementById(`coat_colorName_${i}`);
+ if (q && !catId?.value && q.value.trim() && cn && !cn.value.trim()) {
+ cn.value = q.value.trim();
+ }
+}
+
function applyCustomCatalogResult(i, r) {
customPowderCatalogClose(i);
// Fill in the custom fields from the catalog result
@@ -2967,9 +3007,12 @@ function buildCardHtml(item, i) {
const orderBadge = (!c.inventoryItemId && c.powderToOrder)
? ` ORDER ${parseFloat(c.powderToOrder).toFixed(2)} lbs`
: '';
+ const noColorHint = (!color && !c.inventoryItemId && c.powderToOrder)
+ ? ` No color specified`
+ : '';
const coatNotes = c.notes ? `— ${escHtml(c.notes)}` : '';
return `