$(document).ready(function() { // TABELLA CHECKBOX // // Updates "Select all" control in a data table // function updateDataTableSelectAllCtrl(table){ var $table = table.table().node(); var $chkbox_all = $('tbody input[type="checkbox"]', $table); var $chkbox_checked = $('tbody input[type="checkbox"]:checked', $table); var chkbox_select_all = $('thead input[id="check_all"]', $table).get(0); // If none of the checkboxes are checked if($chkbox_checked.length === 0){ chkbox_select_all.checked = false; if('indeterminate' in chkbox_select_all){ chkbox_select_all.indeterminate = false; } // If all of the checkboxes are checked } else if ($chkbox_checked.length === $chkbox_all.length){ chkbox_select_all.checked = true; if('indeterminate' in chkbox_select_all){ chkbox_select_all.indeterminate = false; } // If some of the checkboxes are checked } else { chkbox_select_all.checked = true; if('indeterminate' in chkbox_select_all){ chkbox_select_all.indeterminate = true; } } } $(document).ready(function (){ // Array holding selected row IDs var rows_selected = []; var table = $('#tabella-rinnova').DataTable({ "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false, 'columnDefs': [{ 'targets': 0, 'searchable':false, 'orderable':false, 'className': 'sorting_1', // 'render': function (data, type, full, meta){ // return ' '; // } }], 'order': [1, 'asc'], 'rowCallback': function(row, data, dataIndex){ // Get row ID var rowId = data[0]; // If row ID is in the list of selected row IDs if($.inArray(rowId, rows_selected) !== -1){ $(row).find('input[type="checkbox"]').prop('checked', true); $(row).addClass('selected'); } } }); // Handle click on checkbox $('#tabella-rinnova tbody').on('click', 'input[type="checkbox"]', function(e){ var $row = $(this).closest('tr'); // Get row data var data = table.row($row).data(); // Get row ID var rowId = data[0]; // Determine whether row ID is in the list of selected row IDs var index = $.inArray(rowId, rows_selected); // If checkbox is checked and row ID is not in list of selected row IDs if(this.checked && index === -1){ rows_selected.push(rowId); // Otherwise, if checkbox is not checked and row ID is in list of selected row IDs } else if (!this.checked && index !== -1){ rows_selected.splice(index, 1); } if(this.checked){ $row.addClass('selected'); } else { $row.removeClass('selected'); } // Update state of "Select all" control updateDataTableSelectAllCtrl(table); // Prevent click event from propagating to parent e.stopPropagation(); }); // Handle click on table cells with checkboxes $('#tabella-rinnova').on('click', 'tbody input[type="checkbox"], thead input[id="check_all"]', function(e){ $(this).parent().find('input[type="checkbox"]').trigger('click'); }); // Handle click on "Select all" control $('#tabella-rinnova thead input[id="check_all"]').on('click', function(e){ if(this.checked){ $('#tabella-rinnova tbody input[type="checkbox"]:not(:checked)').trigger('click'); } else { $('#tabella-rinnova tbody input[type="checkbox"]:checked').trigger('click'); } // Prevent click event from propagating to parent e.stopPropagation(); }); // Handle table draw event table.on('draw', function(){ // Update state of "Select all" control updateDataTableSelectAllCtrl(table); }); }); //TABELLA CHECKBOX function isFavorite(tr) { var checkbox = tr.next().find('#checkboxFavorite'); var star = tr.find(".fa-star").hasClass("icona-selezionata"); checkbox.prop("checked", star) if ($( ".fa-star" ).hasClass("icona-selezionata")) { checkbox.next().html("Rimuovi dai Preferiti"); } else { checkbox.next().html("Aggiungi Ai Preferiti"); } $("#checkboxFavorite").change(function() { var row = $("#checkboxFavorite").closest("tr").parent().closest("tr").prev(); var star = row.find('.fa-star') if($(this).is(":checked")) { star.removeClass('icona-preferito'); star.addClass('icona-selezionata'); row.addClass('bold'); checkbox.next().html("Rimuovi Ai Preferiti"); } else { star.removeClass('icona-selezionata'); star.addClass('icona-preferito'); row.removeClass('bold'); checkbox.next().html("Aggiungi dai Preferiti"); } }); } // DICHIARAZIONE DELLE TABELLE SENZA RIGA ESPANDIBILE, PER INSERIRNE UNA NUOVA, AGGIUNGERE L'ID NELLA SELEZIONE JQUERY $('#tabella-allegati-terra').dataTable( { "paging": false, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-fatture_associate_alla_prestazione , #tabella-categorieSPAI, #tabella-certificati, #tabella-regione, #tabella-fileXML, #tabella-documenti_allegati, #tabella-testimoni, #tabella-veicoli, #tabella-richieste, #tabella-comBozze , #tabella-comunicazioni-tardive, #tabella-nuove-comunicazioni').dataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $(document).on('change',".checkMe", function(){ if(!$(this).prop("checked")) { $("#check_all").prop("checked", false); } else { $(".checkMe").each(function (index) { if($(this).prop("checked")) { $("#check_all").prop("checked", true); } else { $("#check_all").prop("checked", false); return false; } }); } }); $('.dataTable').on('page.dt', function() { $(".checkMe").each(function (index) { if($(this).prop("checked")) { $("#check_all").prop("checked", true); } else { $("#check_all").prop("checked", false); return false; } }); }); $('#fileDo').dataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-denunce_bozze').dataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ domande totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-isi_bozze').dataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ bozze totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); // TABELLA SENZA RIGA ESPANDIBILE E SENZA PAGINAZIONE $('#tabella-1,#tabella-terra-7, #tabellaBozzeAzienda, #tabella-azienda-solo-bozze, #tabella-comAziendaBozze').dataTable( { "paging": false, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); // DICHIARAZIONE DELLE TABELLE CON RIGA ESPANDIBILE, PER INSERIRNE UNA NUOVA, AGGIUNGERE L'ID NELLA SELEZIONE JQUERY $('#tabella-richiesteGSPAI td, #tabella-pagamenti_associati_alla_prestazione td, #tabella-agendaGSPAI td, #tabella-impianti td, #tabella-malattie-aggiunte td, #tabella-ultime-attivita tr, #tabella-comTutte tr,#tabella-gestisci-file tr, #tabella-comFile tr, #tabella-risultati-ricerca-medico tr, #tabella-asl-ricerca-up tr, #tabella-3 tr, #tabella-2 tr, #tabella-ultime-attivita-domande-inviate tr,#tabella-associa-unita-prod tr, #dettaglio-pratica tr, #tabella-consulente-inviate tr, #tabella-deleghe tr, #tabella-eventi-agenda tr , #tabella-messaggi tr, #tabella-messaggi-patronato tr, #tabella-aggiungi-delega tr #tabella-aggiungi-aziende-deleghe tr, #tabella-ultime-deleghe tr , #tabella-denunce-infortunio-ultime-attivita tr, #tabella-denunce_inviate tr,#tabella-denunce_inviate_consulente tr, #tabella-deleghe-pratiche tr, #tabella-tutti_certificati tr').css("cursor" , "pointer"); var tableAll = $('#tabella-3').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false } ); var tableAdd = $('#tabella-aggiungi-delega').DataTable( { "paging": false, "ordering": true, "info": false, "searching": false } ); // TABELLA-3 $('#tabella-3 tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableAll , format); $('.details-option').click(function(event){ $( '.toHide' ).toggle(); $('.save').slideToggle( "slow"); event.stopImmediatePropagation(); }) }); // FINE TABELLA-3 // TABELLA-AGGIUNGI-DELEGA $('#tabella-aggiungi-delega tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableAll , formatAggiungiDelega); $('.details-option').click(function(event){ $( '.toHide' ).toggle(); $('.save').slideToggle( "slow"); event.stopImmediatePropagation(); }) }); // FINE TABELLA-AGGIUNGI-DELEGA // caratteristiche-tecniche-impianto var tableImpianto = $('#caratteristiche-tecniche-impianto').DataTable( { "paging": false, "ordering": true, "info": false, "searching": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } } } ); $('#caratteristiche-tecniche-impianto tbody').on('click', 'tr[role="row"].row-expandable', 'button.tabIndex-input', function (e) { if (!$(e.target).hasClass('fa-pencil')) { expandTable($(this) , tableImpianto , formatCaratteristicheTecniche); } $('.details-option').click(function(event){ $( '.toHide' ).toggle(); $('.save').slideToggle( "slow"); event.stopImmediatePropagation(); }) }); // FINE caratteristiche-tecniche-impianto // TABELLA-2 var table = $('#tabella-2').DataTable( { "paging": true, "ordering": true, "info": false, "searching": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } } } ); $('#tabella-2 tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function (e) { if (!$(e.target).hasClass('fa-exclamation-triangle')) { expandTable($(this) , table , format); } $('.details-option').click(function(event){ $( '.toHide' ).toggle(); $('.save').slideToggle( "slow"); event.stopImmediatePropagation(); }) }); // FINE TABELLA-2 // TABELLA-2 var tableAziendaDomandeInviate = $('#tabella-azienda-domande-inviate').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false } ); $('#tabella-azienda-domande-inviate tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableAziendaDomandeInviate , formatDomandeInviate); $('.details-option').click(function(event){ $( '.toHide' ).toggle(); $('.save').slideToggle( "slow"); event.stopImmediatePropagation(); }) }); // FINE TABELLA-2 // TABELLA-RETRIBUZIONI var tabellaRetribuzioni = $('#tabellaRetribuzioni').DataTable( { "paging": false, "ordering": true, "info": false, "searching": false } ); $('#tabellaRetribuzioni tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tabellaRetribuzioni , formatRetribuzioni); $('.details-option').click(function(event){ $( '.toHide' ).toggle(); $('.save').slideToggle( "slow"); event.stopImmediatePropagation(); }) }); // FINE TABELLA-RETRIBUZIONI // TABELLA-ASSOCIA-UNITA' PRODUTTIVA var tableMalattieAggiunte = $('#tabella-malattie-aggiunte').DataTable( { "paging": false, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-malattie-aggiunte tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableMalattieAggiunte , formatMalattieAggiunte); }); // FINE TABELLA-ASSOCIA-UNITA' PRODUTTIVA // TABELLA-ASSOCIA-UNITA' PRODUTTIVA var tableUnitaProd = $('#tabella-associa-unita-prod').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-associa-unita-prod tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableUnitaProd , formatUnitaProd); }); // FINE TABELLA-ASSOCIA-UNITA' PRODUTTIVA // TABELLA-ASSOCIA-UNITA' PRODUTTIVA var dettaglioPratica = $('#dettaglio-pratica').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#dettaglio-pratica tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , dettaglioPratica , formatDettaglioPratica); }); // FINE TABELLA-ASSOCIA-UNITA' PRODUTTIVA // TABELLA-ASSOCIA-UNITA' PRODUTTIVA var tableConsulenteInviate = $('#tabella-consulente-inviate').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-consulente-inviate tbody').on('click', 'tr[role="row"].clickday', 'button.tabIndex-input', function () { expandTable($(this) , tableConsulenteInviate , formatConsulenteInviateClickDay); }); $('#tabella-consulente-inviate tbody').on('click', 'tr[role="row"].presentata', 'button.tabIndex-input', function () { expandTable($(this) , tableConsulenteInviate , formatConsulenteInviatePresentata); }); $('#tabella-consulente-inviate tbody').on('click', 'tr[role="row"].verifica', 'button.tabIndex-input', function () { expandTable($(this) , tableConsulenteInviate , formatConsulenteInviateVerifica); }); // FINE TABELLA-ASSOCIA-UNITA' PRODUTTIVA // TABELLA-ASSOCIA-UNITA' PRODUTTIVA var ultimeAttivitaDomandeInviateAzienda = $('#tabella-ultime-attivita-domande-inviate').DataTable( { "paging": false, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ domande totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-ultime-attivita-domande-inviate tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , ultimeAttivitaDomandeInviateAzienda , formatUltimeAttivitaAzienda); }); var ultimeAttivitaDomandeInviateAziendaInfo = $('#tabella-ultime-attivita-domande-inviate-info').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ domande totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-ultime-attivita-domande-inviate-info tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , ultimeAttivitaDomandeInviateAziendaInfo , formatUltimeAttivitaAzienda); }); var ultimeAttivitaDomandeInviateAziendaInfoCombo = $('#tabella-ultime-attivita-domande-inviate-info-combo').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ domande totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-ultime-attivita-domande-inviate-info-combo tbody').on('click', 'tr.inviata', 'button.tabIndex-input', function () { expandTable($(this) , ultimeAttivitaDomandeInviateAziendaInfoCombo , formatUltimeAttivitaAziendaInviata); }); $('#tabella-ultime-attivita-domande-inviate-info-combo tbody').on('click', 'tr.clickDay', 'button.tabIndex-input', function () { expandTable($(this) , ultimeAttivitaDomandeInviateAziendaInfoCombo , formatUltimeAttivitaAziendaClickDay); }); $('#tabella-ultime-attivita-domande-inviate-info-combo tbody').on('click', 'tr.ammessaGraduatoria', 'button.tabIndex-input', function () { expandTable($(this) , ultimeAttivitaDomandeInviateAziendaInfoCombo , formatUltimeAttivitaAziendaAmmessaGraduatoria); }); $('#tabella-ultime-attivita-domande-inviate-info-combo tbody').on('click', 'tr.nonAmmessa', 'button.tabIndex-input', function () { expandTable($(this) , ultimeAttivitaDomandeInviateAziendaInfoCombo , formatUltimeAttivitaAziendaNonAmmessa); }); // FINE TABELLA-ASSOCIA-UNITA' PRODUTTIVA // TABELLA-AGGIUNGI AZIENDA DELEGHE var tableAggiungiAziendaDelega = $('#tabella-aggiungi-aziende-deleghe').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-aggiungi-aziende-deleghe tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function (e) { if (!$(e.target).hasClass("fa-star")) expandTable($(this) , tableAggiungiAziendaDelega , formatAziendaDeleghe); isFavorite($(this)); }); // FINE TABELLA-AGGIUNGI AZIENDA DELEGHE // TABELLA-AGGIUNGI AZIENDA DELEGHE var tableUltimeDeleghe = $('#tabella-ultime-deleghe').DataTable( { "paging": false, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "searching": false }); $('#tabella-ultime-deleghe tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function (e) { if (!$(e.target).hasClass("fa-star")) expandTable($(this) , tableUltimeDeleghe , formatAziendaDeleghe); isFavorite($(this)); }); // FINE TABELLA-AGGIUNGI AZIENDA DELEGHE // TABELLA-DELEGHE var tableDeleghe = $('#tabella-deleghe').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-deleghe tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function (e) { if (!$(e.target).hasClass("fa")) expandTable($(this) , tableDeleghe , formatDeleghe); }); // FINE TABELLA-DELEGHE // TABELLA-DELEGHE-PRATICHE var tableDeleghePratiche = $('#tabella-deleghe-pratiche').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-deleghe-pratiche tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function (e) { if (!$(e.target).hasClass("fa")) expandTable($(this) , tableDeleghePratiche , formatDeleghePratiche); }); // FINE TABELLA-DELEGHE-PRATICHE // TABELLA AGENDA var tableEventiAgenda = $('#tabella-eventi-agenda').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-eventi-agenda tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableEventiAgenda , formatEventiAgenda); // tableCollapsedRow($(this) , tableEventiAgenda , $('#tabella-eventi-agenda')); }); // FINE TABELLA AGENDA // TABELLA-MESSAGGI var tableMessaggi = $('#tabella-messaggi').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "sInfo": "_TOTAL_ eventi totali", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-messaggi tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableMessaggi , formatMessaggi); // tableCollapsedRow($(this) , tableEventiAgenda , $('#tabella-eventi-agenda')); }); // FINE TABELLA-MESSAGGI // TABELLA-denunce var tableDenunce = $('#tabella-denunce-infortunio-ultime-attivita').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "sInfo": "", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-denunce-infortunio-ultime-attivita tbody').on('click', 'tr[role="row"].inviata', 'button.tabIndex-input', function () { expandTable($(this) , tableDenunce , formatDenunce); // tableCollapsedRow($(this) , tableEventiAgenda , $('#tabella-eventi-agenda')); }); // FINE TABELLA-denunce // TABELLA-denunce var tableDenunceInviate = $('#tabella-denunce_inviate').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "sInfo": "_TOTAL_ domande totali", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-denunce_inviate tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { if ($(this).hasClass("invio-online")) expandTable($(this) , tableDenunceInviate , formatDenunce_online); if ($(this).hasClass("invio-dafile")) expandTable($(this) , tableDenunceInviate , formatDenunce_dafile); // tableCollapsedRow($(this) , tableEventiAgenda , $('#tabella-eventi-agenda')); }); var tableDenunceInviateConsulente = $('#tabella-denunce_inviate_consulente').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "sInfo": "_TOTAL_ domande totali", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-denunce_inviate_consulente tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { if ($(this).hasClass("invio-online")) expandTable($(this) , tableDenunceInviateConsulente , formatDenunceConsulente_online); if ($(this).hasClass("invio-dafile")) expandTable($(this) , tableDenunceInviateConsulente , formatDenunceConsulente_dafile); // tableCollapsedRow($(this) , tableEventiAgenda , $('#tabella-eventi-agenda')); }); // FINE TABELLA-denunce var tableMessaggiPatronato = $('#tabella-messaggi-patronato').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-messaggi-patronato tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableMessaggiPatronato , formatMessaggiPatronato); }); var tabellaAslRicercaUP = $('#tabella-asl-ricerca-up').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-asl-ricerca-up tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tabellaAslRicercaUP , formatAslRicercaUP); }); var tabellaDettaglioUP = $('#tabella-dettaglio-up').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-dettaglio-up tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tabellaDettaglioUP , formatAslDettaglioUP); }); var tabellaRisultatiRicercaMedico = $('#tabella-risultati-ricerca-medico').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-risultati-ricerca-medico tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tabellaRisultatiRicercaMedico , formatRisultatiRicercaMedico); }); var tabellaPagamenti_associati_alla_prestazione = $('#tabella-pagamenti_associati_alla_prestazione').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-pagamenti_associati_alla_prestazione tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tabellaPagamenti_associati_alla_prestazione , formatPagamenti_associati_alla_prestazione); }); var tabellaGestisciDocumento = $('#tabella-gestisci-documento').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-gestisci-documento tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tabellaGestisciDocumento , formatGestisciDocumento); }); var tabellaComTutte = $('#tabella-comTutte').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-comTutte tbody').on('click', 'tr[role="row"].annullata', 'button.tabIndex-input', function () { expandTable($(this) , tabellaComTutte , formatComunicazioneAnnullata); }); $('#tabella-comTutte tbody').on('click', 'tr[role="row"].inviata', 'button.tabIndex-input', function () { expandTable($(this) , tabellaComTutte , formatComunicazioneInviata); }); function expandTable(table , tableName, tableFunc) { var rowOpen = table.parents("tbody").data("rowOpen"); // leggo se esiste una riga aperta if (rowOpen) { // se esiste if (rowOpen.tableOpen != "table_" + table.index()) rowOpen.child.hide(); // e se è diversa dalla stessa cliccata precedentemente la nascondo } var trTable = table.closest('tr'); var rowTable = tableName.row( trTable ); var spanTable = table.find('button.tabIndex-input'); rowTable.tableOpen = "table_" + table.index(); table.parents("tbody").data("rowOpen" , rowTable); var collapsedRow = table.parents("tbody").find(".shown"); if(collapsedRow.length > 0 ){ collapsedRow.find("button.tabIndex-input").addClass('fa-angle-down'); collapsedRow.find("button.tabIndex-input").removeClass('fa-angle-up'); collapsedRow.removeClass('shown'); } if ( rowTable.child.isShown() ) { // This row is already open - close it rowTable.child.hide(); trTable.removeClass('shown'); spanTable.removeClass('fa-angle-up'); spanTable.addClass('fa-angle-down'); } else { // Open this row rowTable.child( tableFunc(rowTable.data()) ).show(); trTable.addClass('shown'); spanTable.removeClass('fa-angle-down'); spanTable.addClass('fa-angle-up'); } } // FINE TABELLA-DELEGHE // TABELLA ULTIME ATTIVITA' (CALCOLA IL PREMIO) var ultimeAttivitaConsulente = $('#tabella-ultime-attivita-consulente').DataTable( { "paging": false, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-ultime-attivita-consulente tbody').on('click', 'tr[role="row"].inviata', 'button.tabIndex-input', function () { expandTable($(this) , ultimeAttivitaConsulente , formatUltimeAttivitaConsulente); }); // TABELLA ULTIME ATTIVITA' (CALCOLA IL PREMIO) var ultimeAttivita = $('#tabella-ultime-attivita').DataTable( { "paging": false, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sInfo": "_TOTAL_ messaggi totali", "sLengthMenu": "Elementi per pagina _MENU_", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-ultime-attivita tbody').on('click', 'tr[role="row"].inviata', 'button.tabIndex-input', function () { expandTable($(this) , ultimeAttivita , formatRetribuzioni); }); // $('#tabella-comTutte tbody').on('click', 'tr[role="row"].inviata', 'button.tabIndex-input', function () { // expandTable($(this) , tabellaComTutte , formatComunicazioneInviata); // }); // TABELLA-tutti_certificati var tableTuttiCertificati = $('#tabella-tutti_certificati').DataTable( { "paging": true, "ordering": true, "info": true, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "sInfo": "_TOTAL_ eventi totali", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-tutti_certificati tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableTuttiCertificati , formatTuttiCertificati); // tableCollapsedRow($(this) , tableEventiAgenda , $('#tabella-eventi-agenda')); }); // FINE TABELLA-tutti_certificati // TABELLA-impianti var tableImpianti = $('#tabella-impianti').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "sInfo": "_TOTAL_ eventi totali", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-impianti tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function (e) { if(!$(e.target).is(".warning")) expandTable($(this) , tableImpianti , formatImpianti); // tableCollapsedRow($(this) , tableEventiAgenda , $('#tabella-eventi-agenda')); }); // FINE TABELLA-impianti // tabella-agendaGSPAI var tableagendaGSPAI = $('#tabella-agendaGSPAI').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "sInfo": "_TOTAL_ eventi totali", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-agendaGSPAI tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tableagendaGSPAI , formatAgendaGSPAI); // tableCollapsedRow($(this) , tableEventiAgenda , $('#tabella-eventi-agenda')); }); // FINE TABELLA-agendaGSPAI // tabella-richiesteGSPAI var tablerichiesteGSPAI = $('#tabella-richiesteGSPAI').DataTable( { "paging": true, "ordering": true, "info": false, "dom": 'rt<"bottom"flp i>', "oLanguage": { "sLengthMenu": "Elementi per pagina _MENU_", "sInfo": "_TOTAL_ eventi totali", "oPaginate": { "sPrevious": " ", "sNext": " " } }, "searching": false }); $('#tabella-richiesteGSPAI tbody').on('click', 'tr[role="row"]', 'button.tabIndex-input', function () { expandTable($(this) , tablerichiesteGSPAI , formatrichiesteGSPAI); // tableCollapsedRow($(this) , tableEventiAgenda , $('#tabella-eventi-agenda')); }); // FINE TABELLA-agendaGSPAI }); //documentready // function tableCollapsedRow(tableButton, table, tableDiv) { // var trTable = tableButton.closest('tr'); // var tableId = $(tableDiv).attr("id"); // if (trTable.hasClass("shown")) { // click sulla tr aperta // trTable.removeClass("shown"); // $("#"+tableId+" .collapsed-form").remove(); // tableButton.addClass('fa-angle-down'); // tableButton.removeClass('fa-angle-up'); // } // else { // if (tableDiv.find(".collapsed-form").length > 0) { // tableDiv.find(".collapsed-form").remove(); // tableDiv.find(".shown .tabIndex-input").addClass('fa-angle-down'); // tableDiv.find(".shown .tabIndex-input").removeClass('fa-angle-up'); // tableDiv.find(".shown").removeClass("shown"); // } // var rowCollapsed = $("#"+ tableId + "-collapsed-row tr").clone(); // var trTableShown = trTable.addClass("shown"); // rowCollapsed.insertAfter(trTableShown); // tableButton.removeClass('fa-angle-down'); // tableButton.addClass('fa-angle-up'); // } // // var trTable = tbody.closest('tr'); // // var rowTable = table.row( trTable ); // // var spanTable = tbody.find('button.tabIndex-input'); // // var tableId = $(tableDiv).attr("id"); // // var rowCollapsed = $("#"+ tableId + "-collapsed-row tr").clone(); // // console.log(tableDiv.find(".collapsed-form").length); // // if (tableDiv.find(".collapsed-form").length > 0) { // // rowTable.child.hide(); // // tableDiv.find(".shown .details-control").removeClass('fa-angle-up'); // // tableDiv.find(".shown .details-control").addClass('fa-angle-down'); // // tableDiv.find(".shown").removeClass('shown'); // // tableDiv.find(".collapsed-form").remove(); // // } // // rowTable.child( rowCollapsed ).show(); // // trTable.addClass('shown'); // // spanTable.removeClass('fa-angle-down'); // // spanTable.addClass('fa-angle-up'); // } // DETTAGLI DELLE TABELLE /* Formatting function for row details - modify as you need */ function format ( d ) { // `d` is the original data object for the row return '
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
' '+
''+
''+
''+
'INDIRIZZO DELLA SEDE INAIL'+
'Via Liguria, 38 - Milano 29145 (MI)'+
' '+
''+ 'MOTIVO DELL’APPUNTAMENTO'+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.'+ ' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
' '+
'' +
' '+
''+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec consequat nunc. In condimentum, orci sed mattis porta, diam sapien finibus velit, rhoncus laoreet mauris erat dictum erat. Integer id cursus turpis, vitae egestas libero. Pellentesque viverra enim quis massa tristique sodales. Fusce et est sollicitudin quam fermentum viverra sed a dolor. Praesent vitae justo in sapien porta venenatis in eu orci. Nam eu hendrerit libero, id consectetur urna. Fusce ornare enim at magna luctus dignissim.' + ' '+ '' +
' ' +
'Allegati: ' + ''+ '' + ' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
' '+
'' +
' '+
''+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec consequat nunc. In condimentum, orci sed mattis porta, diam sapien finibus velit, rhoncus laoreet mauris erat dictum erat. Integer id cursus turpis, vitae egestas libero. Pellentesque viverra enim quis massa tristique sodales. Fusce et est sollicitudin quam fermentum viverra sed a dolor. Praesent vitae justo in sapien porta venenatis in eu orci. Nam eu hendrerit libero, id consectetur urna. Fusce ornare enim at magna luctus dignissim.' + ' '+ '' +
' ' +
'Allegati: ' + ''+ '' + ' | '+
'
| '+
' '+
' '+
''+
''+
''+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
' '+
' '+
' '+
' | '+
'
| '+
' '+
' '+
' '+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'
| '+
' '+
''+
''+
' '+
' | '+
'