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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* ------------------------------------------------------------------------------
*
* # Navbar components
*
* Specific JS code additions for navbar_components.html page
*
* Version: 1.0
* Latest update: Aug 1, 2015
*
* ---------------------------------------------------------------------------- */
$(function() {
// Select2 selects
// ------------------------------
// Fixed width
$('.select').select2({
minimumResultsForSearch: Infinity,
width: '200px',
dropdownCssClass: 'border-info-700'
});
// Full width
$('.select-full').select2({
minimumResultsForSearch: Infinity
});
// Date range pickers
// ------------------------------
//
// Custom display
//
// Initialize
$('.daterange-ranges-button').daterangepicker(
{
startDate: moment().subtract(29, 'days'),
endDate: moment(),
minDate: '01/01/2014',
maxDate: '12/31/2018',
dateLimit: {
days: 60
},
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
opens: 'left',
applyClass: 'btn-small btn-primary btn-block',
cancelClass: 'btn-small btn-default btn-block',
format: 'MM/DD/YYYY'
},
function(start, end) {
$('.daterange-ranges-button span').html(start.format('MMM D, YY') + ' - ' + end.format('MMM D, YY'));
}
);
// Format results
$('.daterange-ranges-button span').html(moment().subtract(29, 'days').format('MMM D, YY') + ' - ' + moment().format('MMM D, YY'));
//
// Attached to button
//
// Initialize
$('.daterange-ranges').daterangepicker(
{
startDate: moment().subtract(29, 'days'),
endDate: moment(),
minDate: '01/01/2014',
maxDate: '12/31/2018',
dateLimit: { days: 60 },
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
opens: 'right',
applyClass: 'btn-small btn-primary btn-block',
cancelClass: 'btn-small btn-default btn-block',
format: 'MM/DD/YYYY'
},
function(start, end) {
$('.daterange-ranges span').html(start.format('MMM D, YY') + ' - ' + end.format('MMM D, YY'));
}
);
// Format results
$('.daterange-ranges span').html(moment().subtract(29, 'days').format('MMM D, YY') + ' - ' + moment().format('MMM D, YY'));
// Form components
// ------------------------------
// Switchery toggles
var elems = Array.prototype.slice.call(document.querySelectorAll('.navbar-switch'));
elems.forEach(function(html) {
var switchery = new Switchery(html, {color: '#006064', secondaryColor: '#fff'});
});
// Multiselect
$('.multiselect').multiselect({
buttonWidth: 200,
onChange: function() {
$.uniform.update();
}
});
// Styled checkboxes, radios
$(".styled, .multiselect-container input").uniform({
radioClass: 'choice'
});
// Styled file input
$(".file-styled").uniform({
fileButtonClass: 'action btn btn-default btn-icon',
fileButtonHtml: '<i class="icon-upload"></i>'
});
});