12 Added notes and colours to customers
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user