12 Added notes and colours to customers

This commit is contained in:
2025-07-23 15:35:19 +02:00
parent 84d43f0dac
commit 541b181c87
17 changed files with 362 additions and 20 deletions

View File

@@ -66,7 +66,8 @@ export default class extends Controller {
return '<div class="no-results">No customers found. Fill in the details below.</div>';
},
option: function(item) {
return `<div>${item.label}</div>`;
const colorStyle = item.color_hex ? `background-color: ${item.color_hex}20; border-left: 4px solid ${item.color_hex};` : '';
return `<div style="${colorStyle} padding: 8px;">${item.label}</div>`;
}
},
@@ -98,6 +99,9 @@ export default class extends Controller {
if (initialValue) {
this.newCustomerFieldsTarget.classList.add('hidden');
this.customerSelected(initialValue);
} else {
// Show new customer fields if no existing customer
this.showNewCustomerFields();
}
}
@@ -148,4 +152,4 @@ export default class extends Controller {
this.selectInstance.destroy();
}
}
}
}