|
@@ -1043,74 +1043,79 @@ function init_IonRangeSlider() {
|
|
|
}))
|
|
|
}
|
|
|
function init_daterangepicker() {
|
|
|
- if ("undefined" != typeof $.fn.daterangepicker) {
|
|
|
- console.log("init_daterangepicker");
|
|
|
- var a = function(a, b, c) {
|
|
|
- console.log(a.toISOString(), b.toISOString(), c),
|
|
|
- $("#reportrange span").html(a.format("MMMM D, YYYY") + " - " + b.format("MMMM D, YYYY"))
|
|
|
- }
|
|
|
- , b = {
|
|
|
- startDate: moment().subtract(29, "days"),
|
|
|
- endDate: moment(),
|
|
|
- minDate: "01/01/2012",
|
|
|
- maxDate: "12/31/2015",
|
|
|
- dateLimit: {
|
|
|
- days: 60
|
|
|
- },
|
|
|
- showDropdowns: !0,
|
|
|
- showWeekNumbers: !0,
|
|
|
- timePicker: !1,
|
|
|
- timePickerIncrement: 1,
|
|
|
- timePicker12Hour: !0,
|
|
|
- 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",
|
|
|
- buttonClasses: ["btn btn-default"],
|
|
|
- applyClass: "btn-small btn-primary",
|
|
|
- cancelClass: "btn-small",
|
|
|
- format: "MM/DD/YYYY",
|
|
|
- separator: " to ",
|
|
|
- locale: {
|
|
|
- applyLabel: "Submit",
|
|
|
- cancelLabel: "Clear",
|
|
|
- fromLabel: "From",
|
|
|
- toLabel: "To",
|
|
|
- customRangeLabel: "Custom",
|
|
|
- daysOfWeek: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
|
- monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
|
|
- firstDay: 1
|
|
|
- }
|
|
|
- };
|
|
|
- $("#reportrange span").html(moment().subtract(29, "days").format("MMMM D, YYYY") + " - " + moment().format("MMMM D, YYYY")),
|
|
|
- $("#reportrange").daterangepicker(b, a),
|
|
|
- $("#reportrange").on("show.daterangepicker", function() {
|
|
|
- console.log("show event fired")
|
|
|
- }),
|
|
|
- $("#reportrange").on("hide.daterangepicker", function() {
|
|
|
- console.log("hide event fired")
|
|
|
- }),
|
|
|
- $("#reportrange").on("apply.daterangepicker", function(a, b) {
|
|
|
- console.log("apply event fired, start/end dates are " + b.startDate.format("MMMM D, YYYY") + " to " + b.endDate.format("MMMM D, YYYY"))
|
|
|
- }),
|
|
|
- $("#reportrange").on("cancel.daterangepicker", function(a, b) {
|
|
|
- console.log("cancel event fired")
|
|
|
- }),
|
|
|
- $("#options1").click(function() {
|
|
|
- $("#reportrange").data("daterangepicker").setOptions(b, a)
|
|
|
- }),
|
|
|
- $("#options2").click(function() {
|
|
|
- $("#reportrange").data("daterangepicker").setOptions(optionSet2, a)
|
|
|
- }),
|
|
|
- $("#destroy").click(function() {
|
|
|
- $("#reportrange").data("daterangepicker").remove()
|
|
|
- })
|
|
|
+
|
|
|
+ if (typeof ($.fn.daterangepicker) === 'undefined') {
|
|
|
+ return;
|
|
|
}
|
|
|
+ console.log('init_daterangepicker');
|
|
|
+
|
|
|
+ var cb = function (start, end, label) {
|
|
|
+ console.log(start.toISOString(), end.toISOString(), label);
|
|
|
+ $('#reportrange span').html(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD'));
|
|
|
+ };
|
|
|
+ var optionSet1 = {
|
|
|
+ startDate: moment().subtract(29, 'days'),
|
|
|
+ endDate: moment(),
|
|
|
+ minDate: '2012-01-01',
|
|
|
+ maxDate: nowString(),
|
|
|
+ dateLimit: {
|
|
|
+ days: 60
|
|
|
+ },
|
|
|
+ showDropdowns: true,
|
|
|
+ showWeekNumbers: true,
|
|
|
+ timePicker: false,
|
|
|
+ timePickerIncrement: 1,
|
|
|
+ timePicker12Hour: true,
|
|
|
+ ranges: {
|
|
|
+ '今天': [moment(), moment()],
|
|
|
+ '昨天': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
|
|
+ '最近7天': [moment().subtract(6, 'days'), moment()],
|
|
|
+ '最近30天': [moment().subtract(29, 'days'), moment()],
|
|
|
+ '当月': [moment().startOf('month'), moment().endOf('month')],
|
|
|
+ '上个月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
|
|
+ },
|
|
|
+ opens: 'left',
|
|
|
+ buttonClasses: ['btn btn-default'],
|
|
|
+ applyClass: 'btn-small btn-primary',
|
|
|
+ cancelClass: 'btn-small',
|
|
|
+ format: 'YYYY-MM-DD',
|
|
|
+ separator: ' to ',
|
|
|
+ locale: {
|
|
|
+ applyLabel: '确定',
|
|
|
+ cancelLabel: '取消',
|
|
|
+ fromLabel: 'From',
|
|
|
+ toLabel: 'To',
|
|
|
+ customRangeLabel: '自定义',
|
|
|
+ daysOfWeek: ['天', '一', '二', '三', '四', '五', '六'],
|
|
|
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
|
|
+ firstDay: 1
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $('#reportrange span').html(moment().subtract(29, 'days').format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
|
|
|
+ $('#reportrange').daterangepicker(optionSet1, cb);
|
|
|
+ $('#reportrange').on('show.daterangepicker', function () {
|
|
|
+ console.log("show event fired");
|
|
|
+ });
|
|
|
+ $('#reportrange').on('hide.daterangepicker', function () {
|
|
|
+ console.log("hide event fired");
|
|
|
+ });
|
|
|
+ $('#reportrange').on('apply.daterangepicker', function (ev, picker) {
|
|
|
+ console.log("apply event fired, start/end dates are " + picker.startDate.format('YYYY-MM-DD') + " to " + picker.endDate.format('YYYY-MM-DD'));
|
|
|
+ });
|
|
|
+ $('#reportrange').on('cancel.daterangepicker', function (ev, picker) {
|
|
|
+ console.log("cancel event fired");
|
|
|
+ });
|
|
|
+ $('#options1').click(function () {
|
|
|
+ $('#reportrange').data('daterangepicker').setOptions(optionSet1, cb);
|
|
|
+ });
|
|
|
+ $('#options2').click(function () {
|
|
|
+ $('#reportrange').data('daterangepicker').setOptions(optionSet2, cb);
|
|
|
+ });
|
|
|
+ $('#destroy').click(function () {
|
|
|
+ $('#reportrange').data('daterangepicker').remove();
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
function init_daterangepicker_right() {
|
|
|
if ("undefined" != typeof $.fn.daterangepicker) {
|