Commit f06d0c2a6f4f23c0ee9970e91b1be0bcbe34e39c
1 parent
8cc2a2f3
Exists in
master
and in
2 other branches
transfered update cycle to click of a button and introduced disabled routine
Showing
2 changed files
with
13 additions
and
6 deletions
Show diff stats
dashboards/static/dashboards/js/logbehavior.js
| @@ -10,19 +10,26 @@ $(document).ready(function(){ | @@ -10,19 +10,26 @@ $(document).ready(function(){ | ||
| 10 | }); | 10 | }); |
| 11 | $("#init_date").on("dp.change", function (e) { | 11 | $("#init_date").on("dp.change", function (e) { |
| 12 | $('#end_date').data("DateTimePicker").minDate(e.date); | 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 | $("#end_date").on("dp.change", function (e) { | 15 | $("#end_date").on("dp.change", function (e) { |
| 17 | $('#init_date').data("DateTimePicker").maxDate(e.date); | 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 | //initialize the table with log from last 30 days | 19 | //initialize the table with log from last 30 days |
| 23 | init_date = $("#init_date").data("DateTimePicker").date(); | 20 | init_date = $("#init_date").data("DateTimePicker").date(); |
| 24 | end_date = $("#end_date").data("DateTimePicker").date(); | 21 | end_date = $("#end_date").data("DateTimePicker").date(); |
| 25 | log.refresh_log_data(init_date, end_date); | 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,7 +25,7 @@ | ||
| 25 | </div> | 25 | </div> |
| 26 | </div> | 26 | </div> |
| 27 | </div> | 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 | </div> | 29 | </div> |
| 30 | <header id="general-report-header"> | 30 | <header id="general-report-header"> |
| 31 | <h3>{% trans "Amadeus Report" %}</h3> | 31 | <h3>{% trans "Amadeus Report" %}</h3> |