Commit f06d0c2a6f4f23c0ee9970e91b1be0bcbe34e39c

Authored by Felipe Bormann
1 parent 8cc2a2f3

transfered update cycle to click of a button and introduced disabled routine

dashboards/static/dashboards/js/logbehavior.js
... ... @@ -10,19 +10,26 @@ $(document).ready(function(){
10 10 });
11 11 $("#init_date").on("dp.change", function (e) {
12 12 $('#end_date').data("DateTimePicker").minDate(e.date);
13   - end_date = $("#end_date").data("DateTimePicker").date();
14   - log.refresh_log_data(e.date, end_date);
  13 + $('#search').removeClass("disabled");
15 14 });
16 15 $("#end_date").on("dp.change", function (e) {
17 16 $('#init_date').data("DateTimePicker").maxDate(e.date);
18   - //when the user updates the second one we build the log table
19   - init_date = $("#init_date").data("DateTimePicker").date();
20   - log.refresh_log_data(init_date, e.date);
  17 + $('#search').removeClass("disabled");
21 18 });
22 19 //initialize the table with log from last 30 days
23 20 init_date = $("#init_date").data("DateTimePicker").date();
24 21 end_date = $("#end_date").data("DateTimePicker").date();
25 22 log.refresh_log_data(init_date, end_date);
  23 +
  24 + $("#search").click(function(){
  25 + if (!$("#search").hasClass("disabled")){
  26 + init_date = $("#init_date").data("DateTimePicker").date();
  27 + end_date = $("#end_date").data("DateTimePicker").date();
  28 + log.refresh_log_data(init_date, end_date);
  29 + $('#search').addClass("disabled");
  30 + }
  31 +
  32 + });
26 33 });
27 34  
28 35  
... ...
dashboards/templates/dashboards/log.html
... ... @@ -25,7 +25,7 @@
25 25 </div>
26 26 </div>
27 27 </div>
28   - <button class="btn btn-success btn-lg">{% trans "search" %}</button>
  28 + <button id="search" class="btn btn-success btn-lg">{% trans "search" %}</button>
29 29 </div>
30 30 <header id="general-report-header">
31 31 <h3>{% trans "Amadeus Report" %}</h3>
... ...