|
|
@@ -153,6 +153,7 @@
|
|
|
<table class="table tablesaw tableHead tablesaw-stack table--lista_utenti tableHead" width="100%" id="tablesaw-350" width="100%">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
+ <th scope="col"><input type="checkbox" name="chkAll" class="chkAll"></th>
|
|
|
<th scope="col" style="text-align: center">Cognome</th>
|
|
|
<th scope="col">Nome</th>
|
|
|
<th scope="col">Telefono</th>
|
|
|
@@ -290,12 +291,38 @@
|
|
|
|
|
|
@push('scripts')
|
|
|
<script>
|
|
|
+ function restoreMultipleData()
|
|
|
+ {
|
|
|
+ var ids = [];
|
|
|
+ $(".chkIds").each(function () {
|
|
|
+ if (this.checked) ids.push($(this).val());
|
|
|
+ });
|
|
|
+
|
|
|
+ if (ids.length) {
|
|
|
+ if (confirm('Sei sicuro? Gli utenti verranno ripristinati.'))
|
|
|
+ @this.restoreMultiple(ids);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
function restoreData(id)
|
|
|
{
|
|
|
if (confirm('Sei sicuro? L\'utente verrà ripristinato.'))
|
|
|
@this.restore(id);
|
|
|
}
|
|
|
|
|
|
+ function archiveMultipleData()
|
|
|
+ {
|
|
|
+ var ids = [];
|
|
|
+ $(".chkIds").each(function () {
|
|
|
+ if (this.checked) ids.push($(this).val());
|
|
|
+ });
|
|
|
+
|
|
|
+ if (ids.length) {
|
|
|
+ if (confirm('Sei sicuro? Tutti i dati relativi a questi utenti verranno archiviati e non saranno più visibili.'))
|
|
|
+ @this.archiveMultiple(ids);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
function archiveData(id)
|
|
|
{
|
|
|
if (confirm('Sei sicuro? Tutti i dati relativi a questo utente verranno archiviati e non saranno più visibili.'))
|
|
|
@@ -462,6 +489,14 @@
|
|
|
processing: true,
|
|
|
ajax: url,
|
|
|
columns: [
|
|
|
+ {
|
|
|
+ data: "member_id",
|
|
|
+ orderable: false,
|
|
|
+ render: function (data){
|
|
|
+ var ret = '<input type="checkbox" name="chk'+data+'" value="'+data+'" class="chkIds" onchange="updateMultipleSelection()">';
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
data: "last_name",
|
|
|
render: function (data){
|
|
|
@@ -537,16 +572,16 @@
|
|
|
topStart : null,
|
|
|
topEnd : null,
|
|
|
top1A: {
|
|
|
- // buttons: [
|
|
|
- // {
|
|
|
- // extend: 'collection',
|
|
|
- // text: 'ESPORTA',
|
|
|
+ buttons: [
|
|
|
+ {
|
|
|
+ extend: 'collection',
|
|
|
+ text: 'ESPORTA',
|
|
|
buttons: [
|
|
|
{
|
|
|
extend: 'excelHtml5',
|
|
|
text: '<i class="fa-solid fa-file-excel"></i>',
|
|
|
action: newexportaction,
|
|
|
- title: date_export + 'Utenti archiviati',
|
|
|
+ title: 'Utenti archiviati',
|
|
|
exportOptions: {
|
|
|
columns: ":not(':last')",
|
|
|
page: 'all'
|
|
|
@@ -556,7 +591,7 @@
|
|
|
extend: 'pdfHtml5',
|
|
|
text: '<i class="fa-solid fa-file-pdf"></i>',
|
|
|
action: newexportaction,
|
|
|
- title: date_export + 'Utenti archiviati',
|
|
|
+ title: 'Utenti archiviati',
|
|
|
exportOptions: {
|
|
|
columns: ":not(':last')"
|
|
|
},
|
|
|
@@ -568,15 +603,41 @@
|
|
|
extend: 'print',
|
|
|
action: newexportaction,
|
|
|
text: '<i class="fa-solid fa-print"></i>',
|
|
|
- title: date_export + 'Utenti archiviati',
|
|
|
+ title: 'Utenti archiviati',
|
|
|
exportOptions: {
|
|
|
columns: ":not(':last')"
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
- // dropup: true
|
|
|
- // }
|
|
|
- // ]
|
|
|
+ dropup: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '<i class="fa-solid fa-rotate-left"></i>',
|
|
|
+ attr: {
|
|
|
+ id: 'btnRestore',
|
|
|
+ style: 'display: none',
|
|
|
+ onclick: 'restoreMultipleData()',
|
|
|
+ class: 'btn archive-multiple-btn',
|
|
|
+ "data-bs-toggle":"popover",
|
|
|
+ "data-bs-trigger":"hover focus",
|
|
|
+ "data-bs-placement":"bottom",
|
|
|
+ "data-bs-content":"Ripristina",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '<i class="fa-regular fa-trash-can"></i>',
|
|
|
+ attr: {
|
|
|
+ id: 'btnArchive',
|
|
|
+ style: 'display: none',
|
|
|
+ onclick: 'archiveMultipleData()',
|
|
|
+ class: 'btn archive-multiple-btn',
|
|
|
+ "data-bs-toggle":"popover",
|
|
|
+ "data-bs-trigger":"hover focus",
|
|
|
+ "data-bs-placement":"bottom",
|
|
|
+ "data-bs-content":"Archivia",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ]
|
|
|
},
|
|
|
top1B : {
|
|
|
pageLength: {
|
|
|
@@ -603,6 +664,38 @@
|
|
|
$('#tablesaw-350').on('draw.dt', function() {
|
|
|
$('[data-bs-toggle="popover"]').popover()
|
|
|
});
|
|
|
+
|
|
|
+ $(".chkAll").change(function () {
|
|
|
+ var check = this.checked;
|
|
|
+ var ok = false;
|
|
|
+ $(".chkIds").each(function () {
|
|
|
+ $(this).prop("checked", check);
|
|
|
+ ok = true;
|
|
|
+ });
|
|
|
+ if (check && ok) {
|
|
|
+ $("#btnRestore").show();
|
|
|
+ $("#btnArchive").show();
|
|
|
+ } else {
|
|
|
+ $("#btnRestore").hide();
|
|
|
+ $("#btnArchive").hide();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function updateMultipleSelection() {
|
|
|
+ let checked = false;
|
|
|
+ $(".chkIds").each(function () {
|
|
|
+ if (this.checked) checked = true;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (checked) {
|
|
|
+ $("#btnRestore").show();
|
|
|
+ $("#btnArchive").show();
|
|
|
+ } else {
|
|
|
+ $("#btnRestore").hide();
|
|
|
+ $("#btnArchive").hide();
|
|
|
+ $(".chkAll").prop("checked", false);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Livewire.on('reload', (x) =>
|