From 20e635712767e8a433c4ca1a427402c840037d9e Mon Sep 17 00:00:00 2001 From: SDE Date: Sat, 23 Sep 2023 16:32:30 +0300 Subject: [PATCH] 0.7.45 reformat datetime picker --- RoutesApp/funcs.py | 3 +- static/js/datarangepicker.js | 98 +++++++++++++++++++++++++++++++----- 2 files changed, 87 insertions(+), 14 deletions(-) diff --git a/RoutesApp/funcs.py b/RoutesApp/funcs.py index 4652cbe..21c4bed 100644 --- a/RoutesApp/funcs.py +++ b/RoutesApp/funcs.py @@ -199,10 +199,11 @@ def get_routes_Dict(user=None, data=None): elif to_el: routes = routes[:to_el] else: + to_el = 25 routes = routes[:25] last_block_routes = False - if to_el and to_el >= routes_count: + if not to_el or to_el >= routes_count: last_block_routes = True diff --git a/static/js/datarangepicker.js b/static/js/datarangepicker.js index 009c13a..7d83d44 100644 --- a/static/js/datarangepicker.js +++ b/static/js/datarangepicker.js @@ -17,24 +17,94 @@ } (this, function (t, e) { var a = function (a, i, s) { - if (this.parentEl = "body", this.element = e(a), this.startDate = t().startOf("day"), this.endDate = t().endOf("day"), this.minDate = !1, this.maxDate = !1, this.maxSpan = !1, this.autoApply = !1, this.singleDatePicker = !1, this.showDropdowns = !1, this.minYear = t().subtract(100, "year").format("YYYY"), this.maxYear = t().add(100, "year").format("YYYY"), this.showWeekNumbers = !1, this.showISOWeekNumbers = !1, this.showCustomRangeLabel = !0, this.timePicker = !1, this.timePicker24Hour = !1, this.timePickerIncrement = 1, this.timePickerSeconds = !1, this.linkedCalendars = !0, this.autoUpdateInput = !0, this.alwaysShowCalendars = !1, this.ranges = {}, this.opens = "right", this.element.hasClass("pull-right") && (this.opens = "left"), this.drops = "down", this.element.hasClass("dropup") && (this.drops = "up"), this.buttonClasses = "btn btn-sm", this.applyButtonClasses = "btn-primary", this.cancelButtonClasses = "btn-default", this.locale = { - direction: "ltr", - format: t.localeData().longDateFormat("L"), - separator: " - ", - applyLabel: "Apply", - cancelLabel: "Cancel", - weekLabel: "W", - customRangeLabel: "Custom Range", - daysOfWeek: t.weekdaysMin(), - monthNames: t.monthsShort(), - firstDay: t.localeData().firstDayOfWeek() + if (this.parentEl = "body", + this.element = e(a), + this.startDate = t().startOf("day"), + this.endDate = t().endOf("day"), + this.minDate = !1, + this.maxDate = !1, + this.maxSpan = !1, + this.autoApply = 1, + this.singleDatePicker = !1, + this.showDropdowns = !1, + this.minYear = t().subtract(100, "year").format("YYYY"), + this.maxYear = t().add(100, "year").format("YYYY"), + this.showWeekNumbers = !1, + this.showISOWeekNumbers = !1, + this.showCustomRangeLabel = !0, + this.timePicker = !1, + this.timePicker24Hour = !1, + this.timePickerIncrement = 1, + this.timePickerSeconds = !1, + this.linkedCalendars = !0, + this.autoUpdateInput = 0, + this.alwaysShowCalendars = !1, + this.ranges = {}, + this.opens = "right", + this.element.hasClass("pull-right") && (this.opens = "left"), + this.drops = "down", + this.element.hasClass("dropup") && (this.drops = "up"), + this.buttonClasses = "btn btn-sm", + this.applyButtonClasses = "btn-primary", + this.cancelButtonClasses = "btn-default", + this.locale = { + direction: "ltr", + format: t.localeData().longDateFormat("L"), + separator: " - ", + applyLabel: "Apply", + cancelLabel: "Cancel", + weekLabel: "W", + customRangeLabel: "Custom Range", + daysOfWeek: t.weekdaysMin(), + monthNames: t.monthsShort(), + firstDay: t.localeData().firstDayOfWeek() }, this.callback = function () { }, this.isShowing = !1, this.leftCalendar = {}, this.rightCalendar = {}, "object" == typeof i && null !== i || (i = {}), "string" == typeof (i = e.extend(this.element.data(), i)).template || i.template instanceof e || (i.template = '
'), this.parentEl = i.parentEl && e(i.parentEl).length ? e(i.parentEl) : e(this.parentEl), this.container = e(i.template).appendTo(this.parentEl), "object" == typeof i.locale && ("string" == typeof i.locale.direction && (this.locale.direction = i.locale.direction), "string" == typeof i.locale.format && (this.locale.format = i.locale.format), "string" == typeof i.locale.separator && (this.locale.separator = i.locale.separator), "object" == typeof i.locale.daysOfWeek && (this.locale.daysOfWeek = i.locale.daysOfWeek.slice()), "object" == typeof i.locale.monthNames && (this.locale.monthNames = i.locale.monthNames.slice()), "number" == typeof i.locale.firstDay && (this.locale.firstDay = i.locale.firstDay), "string" == typeof i.locale.applyLabel && (this.locale.applyLabel = i.locale.applyLabel), "string" == typeof i.locale.cancelLabel && (this.locale.cancelLabel = i.locale.cancelLabel), "string" == typeof i.locale.weekLabel && (this.locale.weekLabel = i.locale.weekLabel), "string" == typeof i.locale.customRangeLabel)) { (p = document.createElement("textarea")).innerHTML = i.locale.customRangeLabel; var n = p.value; this.locale.customRangeLabel = n } - if (this.container.addClass(this.locale.direction), "string" == typeof i.startDate && (this.startDate = t(i.startDate, this.locale.format)), "string" == typeof i.endDate && (this.endDate = t(i.endDate, this.locale.format)), "string" == typeof i.minDate && (this.minDate = t(i.minDate, this.locale.format)), "string" == typeof i.maxDate && (this.maxDate = t(i.maxDate, this.locale.format)), "object" == typeof i.startDate && (this.startDate = t(i.startDate)), "object" == typeof i.endDate && (this.endDate = t(i.endDate)), "object" == typeof i.minDate && (this.minDate = t(i.minDate)), "object" == typeof i.maxDate && (this.maxDate = t(i.maxDate)), this.minDate && this.startDate.isBefore(this.minDate) && (this.startDate = this.minDate.clone()), this.maxDate && this.endDate.isAfter(this.maxDate) && (this.endDate = this.maxDate.clone()), "string" == typeof i.applyButtonClasses && (this.applyButtonClasses = i.applyButtonClasses), "string" == typeof i.applyClass && (this.applyButtonClasses = i.applyClass), "string" == typeof i.cancelButtonClasses && (this.cancelButtonClasses = i.cancelButtonClasses), "string" == typeof i.cancelClass && (this.cancelButtonClasses = i.cancelClass), "object" == typeof i.maxSpan && (this.maxSpan = i.maxSpan), "object" == typeof i.dateLimit && (this.maxSpan = i.dateLimit), "string" == typeof i.opens && (this.opens = i.opens), "string" == typeof i.drops && (this.drops = i.drops), "boolean" == typeof i.showWeekNumbers && (this.showWeekNumbers = i.showWeekNumbers), "boolean" == typeof i.showISOWeekNumbers && (this.showISOWeekNumbers = i.showISOWeekNumbers), "string" == typeof i.buttonClasses && (this.buttonClasses = i.buttonClasses), "object" == typeof i.buttonClasses && (this.buttonClasses = i.buttonClasses.join(" ")), "boolean" == typeof i.showDropdowns && (this.showDropdowns = i.showDropdowns), "number" == typeof i.minYear && (this.minYear = i.minYear), "number" == typeof i.maxYear && (this.maxYear = i.maxYear), "boolean" == typeof i.showCustomRangeLabel && (this.showCustomRangeLabel = i.showCustomRangeLabel), "boolean" == typeof i.singleDatePicker && (this.singleDatePicker = i.singleDatePicker, this.singleDatePicker && (this.endDate = this.startDate.clone())), "boolean" == typeof i.timePicker && (this.timePicker = i.timePicker), "boolean" == typeof i.timePickerSeconds && (this.timePickerSeconds = i.timePickerSeconds), "number" == typeof i.timePickerIncrement && (this.timePickerIncrement = i.timePickerIncrement), "boolean" == typeof i.timePicker24Hour && (this.timePicker24Hour = i.timePicker24Hour), "boolean" == typeof i.autoApply && (this.autoApply = i.autoApply), "boolean" == typeof i.autoUpdateInput && (this.autoUpdateInput = i.autoUpdateInput), "boolean" == typeof i.linkedCalendars && (this.linkedCalendars = i.linkedCalendars), "function" == typeof i.isInvalidDate && (this.isInvalidDate = i.isInvalidDate), "function" == typeof i.isCustomDate && (this.isCustomDate = i.isCustomDate), "boolean" == typeof i.alwaysShowCalendars && (this.alwaysShowCalendars = i.alwaysShowCalendars), 0 != this.locale.firstDay) for (var r = this.locale.firstDay; r > 0;) this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift()), r--; + if (this.container.addClass(this.locale.direction), + "string" == typeof i.startDate && (this.startDate = t(i.startDate, this.locale.format)), + "string" == typeof i.endDate && (this.endDate = t(i.endDate, this.locale.format)), + "string" == typeof i.minDate && (this.minDate = t(i.minDate, this.locale.format)), + "string" == typeof i.maxDate && (this.maxDate = t(i.maxDate, this.locale.format)), + "object" == typeof i.startDate && (this.startDate = t(i.startDate)), + "object" == typeof i.endDate && (this.endDate = t(i.endDate)), + "object" == typeof i.minDate && (this.minDate = t(i.minDate)), + "object" == typeof i.maxDate && (this.maxDate = t(i.maxDate)), + this.minDate && this.startDate.isBefore(this.minDate) && (this.startDate = this.minDate.clone()), + this.maxDate && this.endDate.isAfter(this.maxDate) && (this.endDate = this.maxDate.clone()), + "string" == typeof i.applyButtonClasses && (this.applyButtonClasses = i.applyButtonClasses), + "string" == typeof i.applyClass && (this.applyButtonClasses = i.applyClass), + "string" == typeof i.cancelButtonClasses && (this.cancelButtonClasses = i.cancelButtonClasses), + "string" == typeof i.cancelClass && (this.cancelButtonClasses = i.cancelClass), + "object" == typeof i.maxSpan && (this.maxSpan = i.maxSpan), + "object" == typeof i.dateLimit && (this.maxSpan = i.dateLimit), + "string" == typeof i.opens && (this.opens = i.opens), + "string" == typeof i.drops && (this.drops = i.drops), + "boolean" == typeof i.showWeekNumbers && (this.showWeekNumbers = i.showWeekNumbers), + "boolean" == typeof i.showISOWeekNumbers && (this.showISOWeekNumbers = i.showISOWeekNumbers), + "string" == typeof i.buttonClasses && (this.buttonClasses = i.buttonClasses), + "object" == typeof i.buttonClasses && (this.buttonClasses = i.buttonClasses.join(" ")), + "boolean" == typeof i.showDropdowns && (this.showDropdowns = i.showDropdowns), + "number" == typeof i.minYear && (this.minYear = i.minYear), + "number" == typeof i.maxYear && (this.maxYear = i.maxYear), + "boolean" == typeof i.showCustomRangeLabel && (this.showCustomRangeLabel = i.showCustomRangeLabel), + "boolean" == typeof i.singleDatePicker && (this.singleDatePicker = i.singleDatePicker, this.singleDatePicker && (this.endDate = this.startDate.clone())), + "boolean" == typeof i.timePicker && (this.timePicker = i.timePicker), + "boolean" == typeof i.timePickerSeconds && (this.timePickerSeconds = i.timePickerSeconds), + "number" == typeof i.timePickerIncrement && (this.timePickerIncrement = i.timePickerIncrement), + "boolean" == typeof i.timePicker24Hour && (this.timePicker24Hour = i.timePicker24Hour), + "boolean" == typeof i.autoApply && (this.autoApply = i.autoApply), + "boolean" == typeof i.autoUpdateInput && (this.autoUpdateInput = i.autoUpdateInput), + "boolean" == typeof i.linkedCalendars && (this.linkedCalendars = i.linkedCalendars), + "function" == typeof i.isInvalidDate && (this.isInvalidDate = i.isInvalidDate), + "function" == typeof i.isCustomDate && (this.isCustomDate = i.isCustomDate), + "boolean" == typeof i.alwaysShowCalendars && (this.alwaysShowCalendars = i.alwaysShowCalendars), + 0 != this.locale.firstDay) + for (var r = this.locale.firstDay; r > 0;) this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift() + ), r--; var o, h, l; if (void 0 === i.startDate && void 0 === i.endDate && e(this.element).is(":text")) { var c = e(this.element).val(), d = c.split(this.locale.separator); @@ -42,7 +112,9 @@ } if ("object" == typeof i.ranges) { for (l in i.ranges) { - o = "string" == typeof i.ranges[l][0] ? t(i.ranges[l][0], this.locale.format) : t(i.ranges[l][0]), h = "string" == typeof i.ranges[l][1] ? t(i.ranges[l][1], this.locale.format) : t(i.ranges[l][1]), this.minDate && o.isBefore(this.minDate) && (o = this.minDate.clone()); + o = "string" == typeof i.ranges[l][0] ? t(i.ranges[l][0], this.locale.format) : t(i.ranges[l][0]), + h = "string" == typeof i.ranges[l][1] ? t(i.ranges[l][1], this.locale.format) : t(i.ranges[l][1]), + this.minDate && o.isBefore(this.minDate) && (o = this.minDate.clone()); var m = this.maxDate; if (this.maxSpan && m && o.clone().add(this.maxSpan).isAfter(m) && (m = o.clone().add(this.maxSpan)), m && h.isAfter(m) && (h = m.clone()), !(this.minDate && h.isBefore(this.minDate, this.timepicker ? "minute" : "day") || m && o.isAfter(m, this.timepicker ? "minute" : "day"))) { var p;