mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 11:30:55 +01:00
Aggiunto numero elementi selezionati nelle tabelle moduli
This commit is contained in:
parent
d5e7fa2a5a
commit
86d3deaa19
@ -364,10 +364,10 @@ function getTableSearch() {
|
||||
* @param selector
|
||||
*/
|
||||
function getTable(selector) {
|
||||
var table = $(selector);
|
||||
const table = $(selector);
|
||||
|
||||
var selected = new Map();
|
||||
var selected_ids = table.data('selected') ? table.data('selected').split(';') : [];
|
||||
const selected = new Map();
|
||||
const selected_ids = table.data('selected') ? table.data('selected').split(';') : [];
|
||||
selected_ids.forEach(function (item, index) {
|
||||
selected.set(item, true);
|
||||
});
|
||||
@ -388,11 +388,14 @@ function getTable(selector) {
|
||||
datatable: table.DataTable(),
|
||||
|
||||
// Funzioni per i contenitori relativi alla tabella
|
||||
getButtonsContainer: function () {
|
||||
return $('.row[data-target="' + table.attr('id') + '"]').find('.table-btn');
|
||||
getSelectControllerContainer: function () {
|
||||
return $('.row[data-target="' + table.attr('id') + '"]').find('.select-controller-container');
|
||||
},
|
||||
getExportContainer: function () {
|
||||
return $('.row[data-target="' + table.attr('id') + '"]').find('.export-container');
|
||||
},
|
||||
getActionsContainer: function () {
|
||||
return $('.row[data-target="' + table.attr('id') + '"]').find('.bulk-container');
|
||||
return $('.row[data-target="' + table.attr('id') + '"]').find('.actions-container');
|
||||
},
|
||||
|
||||
// Gestione delle righe selezionate
|
||||
@ -401,19 +404,24 @@ function getTable(selector) {
|
||||
return Array.from(selected.keys());
|
||||
},
|
||||
saveSelectedRows: function () {
|
||||
var selected_rows = this.getSelectedRows();
|
||||
const selected_rows = this.getSelectedRows();
|
||||
table.data('selected', selected_rows.join(';'));
|
||||
|
||||
var bulk_container = this.getActionsContainer();
|
||||
var btn_container = this.getButtonsContainer();
|
||||
// Abilitazione dinamica di azioni di gruppo e esportazione
|
||||
const bulk_container = this.getActionsContainer();
|
||||
const export_buttons = this.getExportContainer().find('.table-btn');
|
||||
if (selected_rows.length > 0) {
|
||||
bulk_container.removeClass('disabled').attr('disabled', false);
|
||||
btn_container.removeClass('disabled').attr('disabled', false);
|
||||
export_buttons.removeClass('disabled').attr('disabled', false);
|
||||
} else {
|
||||
bulk_container.addClass('disabled').attr('disabled', true);
|
||||
btn_container.addClass('disabled').attr('disabled', true);
|
||||
export_buttons.addClass('disabled').attr('disabled', true);
|
||||
}
|
||||
|
||||
// Aggiornamento contatore delle selezioni
|
||||
this.getSelectControllerContainer()
|
||||
.find('.selected-count').html(selected_rows.length);
|
||||
|
||||
// Aggiornamento del footer nel caso sia richiesto
|
||||
if (globals.restrict_summables_to_selected) {
|
||||
this.updateSelectedFooter();
|
||||
|
@ -165,9 +165,12 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
|
||||
echo '
|
||||
<div class="row" data-target="'.$table_id.'">
|
||||
<div class="col-md-5">
|
||||
<div class="btn-group" role="group">
|
||||
<div class="btn-group select-controller-container" role="group">
|
||||
<button type="button" class="btn btn-primary btn-select-all">'.tr('Seleziona tutto').'</button>
|
||||
<button type="button" class="btn btn-default btn-select-none">'.tr('Deseleziona tutto').'</button>
|
||||
<button type="button" class="btn btn-default btn-select-none">
|
||||
'.tr('Deseleziona tutto').'
|
||||
<span class="badge selected-count">0</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -175,7 +178,7 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
|
||||
|
||||
if (!empty($bulk)) {
|
||||
echo '
|
||||
<button class="btn btn-primary btn-block dropdown-toggle bulk-container disabled" type="button" data-toggle="dropdown" disabled>'.tr('Azioni di gruppo').' <span class="caret"></span></button>
|
||||
<button class="btn btn-primary btn-block dropdown-toggle actions-container disabled" type="button" data-toggle="dropdown" disabled>'.tr('Azioni di gruppo').' <span class="caret"></span></button>
|
||||
<ul class="dropdown-menu" data-target="'.$table_id.'" role="menu">';
|
||||
|
||||
foreach ($bulk as $key => $value) {
|
||||
@ -200,14 +203,14 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
|
||||
|
||||
<div class="col-md-5 text-right">
|
||||
<i class="fa fa-question-circle-o tip" title="'.tr('Le operazioni di esportazione, copia e stampa sono limitate alle righe selezionate e visibili della tabella').'. '.tr('Per azioni su tutti i contenuti selezionati, utilizzare le Azioni di gruppo').'."></i>
|
||||
<div class="btn-group" role="group">';
|
||||
<div class="btn-group export-container" role="group">';
|
||||
|
||||
if (setting('Abilita esportazione Excel e PDF')) {
|
||||
echo '
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary table-btn btn-csv disabled" disabled>'.tr('Esporta').'</button>
|
||||
|
||||
<button type="button" class="btn btn-primary table-btn disabled dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<button type="button" class="btn btn-primary table-btn disabled dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
@ -220,7 +223,7 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
|
||||
</div>';
|
||||
} else {
|
||||
echo '
|
||||
<button type="button" class="btn btn-primary table-btn btn-csv disabled" disabled>'.tr('Esporta').'</button>';
|
||||
<button type="button" class="btn btn-primary table-btn btn-csv disabled" disabled>'.tr('Esporta').'</button>';
|
||||
}
|
||||
|
||||
echo '
|
||||
|
Loading…
x
Reference in New Issue
Block a user