new: add warning icon for tariffs without price list in offer form select
This commit is contained in:
@@ -158,13 +158,16 @@
|
||||
var tariffStatuses = {!! json_encode($tariff_statuses ?? (object)[]) !!};
|
||||
var tariffStatusLabels = {!! json_encode($tariff_status_labels ?? []) !!};
|
||||
var tariffStatusColors = {0: '#28a745', 1: '#ffc107', 2: '#6c757d', 3: '#dc3545'};
|
||||
var tariffPLCounts = {!! json_encode($tariff_pricelist_counts ?? (object)[]) !!};
|
||||
|
||||
function formatTariff(item) {
|
||||
if (!item.id) return item.text;
|
||||
var statusId = tariffStatuses[item.id];
|
||||
var color = tariffStatusColors[statusId] || '#6c757d';
|
||||
var label = tariffStatusLabels[statusId] || '';
|
||||
return $('<span style="display:flex;justify-content:space-between;align-items:center;width:100%;">' + item.text + '<span class="badge" style="background:' + color + ';color:#fff;font-size:0.75em;margin-left:8px;">' + label + '</span></span>');
|
||||
var plCount = tariffPLCounts[item.id] || 0;
|
||||
var warning = plCount == 0 ? '<span style="margin-left:4px;cursor:help;" title="Aucune liste de prix"><i class="fas fa-exclamation-triangle text-danger" style="font-size:1.4em;vertical-align:-2px;"></i></span>' : '';
|
||||
return $('<span style="display:flex;justify-content:space-between;align-items:center;width:100%;">' + item.text + '<span>' + warning + '<span class="badge" style="background:' + color + ';color:#fff;font-size:0.75em;margin-left:4px;">' + label + '</span></span></span>');
|
||||
}
|
||||
|
||||
$('#tariff_id').select2('destroy').select2({
|
||||
|
||||
Reference in New Issue
Block a user