Subversion Repository Public Repository

Nextrek

Diff Revisions 586 vs 587 for /Android/SmartCharging/endPoints/nightly/control_panel/js/locals.js

Diff revisions: vs.
  @@ -1,3 +1,47 @@
1 + function fetchComments(local_id, startIndex) {
2 + params = {
3 + id: local_id,
4 + startIndex: startIndex,
5 + length: 10,
6 + token: Cookies.get("token")
7 + };
8 +
9 + params = JSON.stringify(params);
10 +
11 + $.ajax({
12 + url: "../get_commenti.php",
13 + data: params,
14 + cache: false,
15 + contentType: false,
16 + processData: false,
17 + type: 'POST',
18 + success: function(data) {
19 + if (data.return == 0) {
20 + alert(JSON.stringify());
21 + /*if (data.comments && data.comments.length > 0) {
22 +
23 + } else {
24 +
25 + }*/
26 + } else {
27 + alert("Errore nel caricare i commenti");
28 + }
29 + },
30 + error: function() {
31 + alert("Errore nel caricare i commenti");
32 + }
33 + });
34 +
35 + }
36 +
37 + function showComments(local_id) {
38 + $("#comments").show();
39 +
40 + if (isEmpty($("#comment-list"))) {
41 + fetchComments(local_id, 0);
42 + }
43 + }
44 +
1 45 function loadLocalInfo(html_data, local_data) {
2 46 $("#cp_workarea").empty();
3 47 $("#cp_workarea").append(html_data);
  @@ -22,9 +66,14 @@
22 66 .html(local_data.telefono);
23 67 $("#full_local_info #sito")
24 68 .html(local_data.sito);
25 - $("#full_local_info #n_punti_ricariche")
26 - .html(local_data.n_punti_ricariche);
69 + $("#full_local_info #n_punti_ricarica")
70 + .html(local_data.n_punti_ricarica);
71 +
72 + //$("#full_local_info").styleTable();
27 73
74 + $("#comments-button").click(function() {
75 + showComments(local_data.local_id);
76 + });
28 77 }
29 78
30 79 function showLocalInfo(local_id) {