Nextrek
@ 586
Nextrek / Android / SmartCharging / endPoints / nightly / control_panel / js / locals.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
function loadLocalInfo(html_data, local_data) { $("#cp_workarea").empty(); $("#cp_workarea").append(html_data); $("#full_local_info #nomelocale") .html(local_data.nomelocale); $("#full_local_info #username_owner") .html(local_data.username_owner); $("#full_local_info #descrizione") .html(local_data.descrizione); $("#full_local_info #tipologia") .html(local_data.tipologia); $("#full_local_info #lat") .html(local_data.lat); $("#full_local_info #lon") .html(local_data.lon); $("#full_local_info #indirizzo") .html(local_data.indirizzo); $("#full_local_info #email") .html(local_data.email); $("#full_local_info #telefono") .html(local_data.telefono); $("#full_local_info #sito") .html(local_data.sito); $("#full_local_info #n_punti_ricariche") .html(local_data.n_punti_ricariche); } function showLocalInfo(local_id) { params = { local_id: local_id, token: Cookies.get("token") }; params = JSON.stringify(params); $.ajax({ url: "../get_info_full_locale.php", data: params, cache: false, contentType: false, processData: false, type: 'POST', success: function(local_data) { getHtmlPage("./skeletons/full_local_info.html", function(html_data) { loadLocalInfo(html_data, local_data); }); }, error: function() { alert("Errore nel caricare le info del locale"); } }); } function showLocalTable(data) { $("#cp_workarea").append(data); var localTable = $('#dt_locallist').DataTable( { "processing": true, "serverSide": true, "ajax": "dt_locallist.php", "columns": [ { "data": "nomelocale" }, { "data": "descrizione" }, { "data": "tipologia" }, { "data": "indirizzo" }, { "data": "email" }, { "data": "telefono" }, { "data": "sito" }, { "data": "n_punti_ricarica" }, { "data": function(row) { return "<button value='modifica'>Modifica</button>" } } ] } ); $('#dt_locallist').on( 'click', 'button', function () { var data = localTable.row( $(this).parents('tr') ).data(); var value = $(this).attr("value"); var local_id = $(this).parents('tr').attr("id").replace("row_", ""); showLocalInfo(local_id); } ); } function showLocalList() { $("#cp_workarea").empty(); getHtmlPage("./skeletons/locallist.html", showLocalTable); } |