function loadProblems(auto_check) { document.getElementById("problems_loader").style.display = 'block'; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { document.querySelector("#problems_content").innerHTML = this.responseText; document.getElementById("problems_loader").style.display = 'none'; loadDashboardInfo(); $(document).ready( function () { new DataTable('#problems_list_table', { paging: false, scrollCollapse: true, scrollY: '400px', layout: { topStart: { buttons: [ { extend: 'colvis', postfixButtons: ['colvisRestore'], popoverTitle: 'Visibilità colonne' }, { extend: 'print', split: ['print','excel','pdf', 'csv'] } ] } }, language: { emptyTable: "Nessun dato presente nella tabella", search: "Cerca:", infoEmpty: "Visualizzati da 0 a 0 di 0 risultati", info: "Visualizzati da _START_ a _END_ di _TOTAL_ risultati", buttons: { print: "Stampa", colvis: "Visualizza", colvisRestore: "Ripristina visualizzazione" } }, order: { idx: 4, dir: 'desc' } }); } ); } }; xmlhttp.open("GET", "public/dashboard/problems_list.php?auto_check="+auto_check); xmlhttp.send(); } function RunProblemsControl() { var start_date_check = document.getElementById("start_date_check").value; var end_date_check = document.getElementById("end_date_check").value; document.querySelector("#problems_content").innerHTML = ""; document.getElementById("problems_loader").style.display = 'block'; $.ajax({ type: "POST", url: "php/check_problems.php", data: { start_date_check: start_date_check, end_date_check : end_date_check, manual : 'true'}, success: function (res) { if (res === 'ok') { SuccessAlert('Controlli effettuati'); loadProblems(); } else { ErrorAlert("Errore: "+res); } document.getElementById("problems_loader").style.display = 'none'; } }); } function loadDashboardInfo() { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { document.querySelector("#dashboard_main_container").innerHTML = this.responseText; } }; xmlhttp.open("GET", "public/dashboard/dashboard_info.php"); xmlhttp.send(); } function resolveProblem(problem_id) { $.ajax({ type: "POST", url: "php/situation/resolve_problem.php", data: { problem_id: problem_id }, success: function (res) { if (res === 'error') { ErrorAlert("Errore: "+res) } else { SuccessAlert('Problema risolto'); loadProblems(''); } HidePageLoader(); } }); }