1 | (function($, Chart) { |
||
2 | $(document).ready(function() { |
||
3 | var past_checkin_dates = JSON.parse(document.getElementById('past-checkin-dates').innerHTML) |
||
4 | .map(function(date) { |
||
5 | return new Date(date) |
||
6 | }) |
||
7 | |||
8 | |||
9 | var pie_data = JSON.parse(document.getElementById('pie-chart-data').innerHTML) |
||
10 | if(pie_data.labels.length) { |
||
11 | Chart.defaults.global.responsive = true |
||
12 | Chart.defaults.global.scaleBeginAtZero = true |
||
13 | var pie_ctx = document.getElementById('category-pie-chart').getContext('2d') |
||
14 | var pieChart = new Chart(pie_ctx, { |
||
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
15 | type: 'pie', |
||
16 | data: pie_data, |
||
17 | options: { |
||
18 | legend: { |
||
19 | display: false |
||
20 | } |
||
21 | } |
||
22 | }) |
||
23 | } |
||
24 | |||
25 | $( '#datepicker' ).click(function() { |
||
26 | $(this).pickadate({ |
||
27 | |||
28 | // The title label to use for the month nav buttons |
||
29 | labelMonthNext: 'Next month', |
||
30 | labelMonthPrev: 'Previous month', |
||
31 | |||
32 | // The title label to use for the dropdown selectors |
||
33 | labelMonthSelect: 'Select a month', |
||
34 | labelYearSelect: 'Select a year', |
||
35 | |||
36 | // Months and weekdays |
||
37 | monthsFull: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ], |
||
38 | monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ], |
||
39 | weekdaysFull: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ], |
||
40 | weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ], |
||
41 | |||
42 | // Today and clear |
||
43 | today: 'Today', |
||
44 | clear: 'Clear', |
||
45 | close: 'Close', |
||
46 | |||
47 | // Close on a user action |
||
48 | closeOnSelect: true, |
||
49 | closeOnClear: true, |
||
50 | |||
51 | // The format to show on the `input` element |
||
52 | format: 'yyyy-mm-dd', |
||
53 | formatSubmit: 'yyyy-mm-dd', |
||
54 | hiddenName: true, |
||
55 | |||
56 | onSet: function(obj) { |
||
57 | // we only want to redirect them if they've selected a date |
||
58 | if(obj.hasOwnProperty('select')) { |
||
59 | location.href = "/checkin/view/"+this.get() |
||
60 | } |
||
61 | }, |
||
62 | |||
63 | // only show specific dates |
||
64 | disable: [ |
||
65 | true // disable all except the following |
||
66 | ].concat(past_checkin_dates, [new Date()]) |
||
67 | |||
68 | }) |
||
69 | }) |
||
70 | }) |
||
71 | })(jQuery, Chart) |
||
72 |