versione 2.0.0
This commit is contained in:
@@ -295,6 +295,22 @@
|
||||
<label>Limite risultati</label>
|
||||
<input type="number" name="limit" class="form-control" placeholder="Es: 100" min="1">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Filtra per Tag</label>
|
||||
<select name="tag_filter[]" id="tag_filter" class="form-control select2-tags" multiple style="width: 100%;">
|
||||
@foreach($allTags as $tag)
|
||||
<option value="{{ $tag->id }}" style="background-color:{{ $tag->color ?? '#6c757d' }};">{{ $tag->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<small class="text-muted">Filtra i risultati per tag</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Modalità filtro tag</label>
|
||||
<select name="tag_filter_mode" class="form-control">
|
||||
<option value="any">Almeno un tag (OR)</option>
|
||||
<option value="all">Tutti i tag selezionati (AND)</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-block">
|
||||
<i class="fas fa-save mr-1"></i> Salva Report
|
||||
</button>
|
||||
@@ -346,6 +362,37 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
columnsSelectInitialized = false;
|
||||
}
|
||||
|
||||
let tagFilterSelect2Initialized = false;
|
||||
|
||||
function initTagFilterSelect2() {
|
||||
if (tagFilterSelect2Initialized) return;
|
||||
$('#tag_filter').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: 'Seleziona tag...',
|
||||
allowClear: true,
|
||||
width: '100%',
|
||||
templateResult: function(opt) {
|
||||
if (!opt.id) return opt.text;
|
||||
var color = $(opt.element).css('background-color');
|
||||
var $span = $('<span style="padding:2px 8px;border-radius:10px;color:#fff;background-color:' + color + '">' + opt.text + '</span>');
|
||||
return $span;
|
||||
},
|
||||
templateSelection: function(opt) {
|
||||
if (!opt.id) return opt.text;
|
||||
var color = $(opt.element).css('background-color');
|
||||
var $span = $('<span style="padding:2px 8px;border-radius:10px;color:#fff;background-color:' + color + '">' + opt.text + '</span>');
|
||||
return $span;
|
||||
}
|
||||
});
|
||||
tagFilterSelect2Initialized = true;
|
||||
}
|
||||
|
||||
function destroyTagFilterSelect2() {
|
||||
if (!tagFilterSelect2Initialized) return;
|
||||
$('#tag_filter').select2('destroy');
|
||||
tagFilterSelect2Initialized = false;
|
||||
}
|
||||
|
||||
function getSortOptions(tipoReport) {
|
||||
const cols = columnOptions[tipoReport] || {};
|
||||
const options = [];
|
||||
@@ -365,8 +412,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
$('#collapseThree').on('shown.bs.collapse', function () {
|
||||
initColumnsSelect2();
|
||||
initTagFilterSelect2();
|
||||
}).on('hidden.bs.collapse', function () {
|
||||
destroyColumnsSelect2();
|
||||
destroyTagFilterSelect2();
|
||||
});
|
||||
|
||||
if ($('#collapseTwo').hasClass('show')) {
|
||||
@@ -375,6 +424,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
if ($('#collapseThree').hasClass('show')) {
|
||||
initColumnsSelect2();
|
||||
initTagFilterSelect2();
|
||||
}
|
||||
|
||||
$('#tipo_report').on('change', function() {
|
||||
|
||||
Reference in New Issue
Block a user