├── LICENSE ├── README.md ├── apexplugin.json ├── images ├── preview_daterange_translations.jpg ├── preview_demo.gif ├── preview_helptext.gif └── preview_quickpicks.gif ├── plugin_install.sql ├── server ├── daterangepicker.js ├── moment.min.js ├── pretiusapexdaterangepicker.css └── pretiusapexdaterangepicker.js └── src ├── PRETIUS_APEX_DATE_RANGE.plb ├── PRETIUS_APEX_DATE_RANGE.sql ├── daterangepicker.js ├── item_type_plugin_pretius_apex_range_date.sql ├── moment.min.js ├── pretiusapexdaterangepicker.css └── pretiusapexdaterangepicker.js /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2016 Dan Grossman 4 | Copyright 2016 Pretius 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pretius Date Range Picker 2 | 3 | The plugin is Oracle APEX item plugin providing new date picker supporting range of dates. The plugin is dedicated to work with Oracle APEX Universal Theme. Behaviour and appeareance of the plugin can be changed with various settings. 4 | 5 | The plugin is implemented on top of the [Dan Grossman's](http://www.dangrossman.info/) javascript plugin "[Date Range Picker](http://www.daterangepicker.com/)". Not all functionalities of the original plugin were implemented in Pretius Date Range Picker plugin. 6 | 7 | ## Table of Contents 8 | - [Preview](#preview) 9 | - [License](#license) 10 | - [Features at glance](#features-at-glance) 11 | - [Roadmap](#roadmap) 12 | - [Installation](#installation) 13 | - [Installation procedure](#installation-procedure) 14 | - [Usage guide & Demo application](#usage-guide-demo-application) 15 | - [Free support](#free-support) 16 | - [Bug reporting and change requests](#bug-reporting-and-change-requests) 17 | - [Implementation issues](#implementation-issues) 18 | - [Become a contributor](#become-a-contributor) 19 | - [Comercial support](#comercial-support) 20 | - [Changelog](#changelog) 21 | - [Known issues](#known-issues) 22 | - [About Author](#about-author) 23 | - [About Pretius](#about-pretius) 24 | 25 | ## Preview 26 | 27 | ![Preview gif](images/preview_demo.gif?raw=true "Preview") 28 | 29 | 30 | ## License 31 | 32 | MIT 33 | 34 | ## Features at Glance 35 | 36 | * compatible with Oracle APEX 5.1, 18.x, 19.x 37 | * support for 38 | * single and double items to store start and end date 39 | * PL/SQL date format masks 40 | * dynamic dates using apex syntax ( +1d, +1w etc ) 41 | * min/max date 42 | * limiting no. of days in range 43 | * single/double calendars 44 | * definable quick picks 45 | 46 | 47 | ## Roadmap 48 | * [ ] Built-in validation on submit 49 | * [ ] Support for HTML template instead of APEX item(s) 50 | * [ ] Theme Roller integration 51 | * [ ] Support for RTL 52 | 53 | ## Installation 54 | 55 | ### Installation procedure 56 | 57 | To successfully install/update the plugin follow those steps: 58 | 59 | 1. Install the plugin file `dynamic_action_plugin_pretius_apex_date_ranger.sql` using Oracle APEX plugin import wizard 60 | 1. Configure application level componenets of the plugin 61 | 62 | ## Usage guide & Demo application 63 | 64 | ### Single APEX item 65 | 66 | 1. Create APEX item and set type to `Pretius Date Range Picker [Plug-In]` 67 | 1. Configure the plugin behaviour and appearance with available attributes 68 | 1. Save and run the page 69 | 70 | ### Double APEX items 71 | 72 | 1. Create two APEX items 73 | 1. ```PX_DATE_FROM``` with type set to ```Pretius Date Range Picker [Plug-In]``` 74 | 1. ```PX_DATE_TO``` with type set to ```Text field``` 75 | 1. For ```PX_DATE_FROM``` set 76 | 1. ```Mode``` to ```Two fields for dates``` or ```Two fields for dates - alternative``` 77 | 1. ```Date to item``` to ```PX_DATE_TO``` 78 | 1. Save and run the page 79 | 80 | ### Demo application 81 | Check different plugin configurations and use cases in our [Live Demo](http://apex.pretius.com/apex/f?p=PLUGINS:DATERANGE) 82 | 83 | ## Free support 84 | Pretius provides free support for the plugins at the GitHub platform. 85 | We monitor raised issues, prepare fixes, and answer your questions. However, please note that we deliver the plug-ins free of charge, and therefore we will not always be able to help you immediately. 86 | 87 | Interested in better support? 88 | * [Become a contributor!](#become-a-contributor) We always prioritize the issues raised by our contributors and fix them for free. 89 | * [Consider comercial support.](#comercial-support) Options and benefits are described in the chapter below. 90 | 91 | ### Bug reporting and change requests 92 | Have you found a bug or have an idea of additional features that the plugin could cover? Firstly, please check the Roadmap and Known issues sections. If your case is not on the lists, please open an issue on a GitHub page following these rules: 93 | * issue should contain login credentials to the application at apex.oracle.com where the problem is reproduced; 94 | * issue should include steps to reproduce the case in the demo application; 95 | * issue should contain description about its nature. 96 | 97 | ### Implementation issues 98 | If you encounter a problem during the plug-in implementation, please check out our demo application. We do our best to describe each possible use case precisely. If you can not find a solution or your problem is different, contact us: apex-plugins@pretius.com. 99 | 100 | ## Become a contributor! 101 | We consider our plugins as genuine open source products, and we encourage you to become a contributor. Help us improve plugins by fixing bugs and developing extra features. Comment one of the opened issues or register a new one, to let others know what you are working on. When you finish, create a new pull request. We will review your code and add the changes to the repository. 102 | 103 | By contributing to this repository, you help to build a strong APEX community. We will prioritize any issues raised by you in this and any other plugins. 104 | 105 | ## Comercial support 106 | We are happy to share our experience for free, but we also realize that sometimes response time, quick implementation, SLA, and instant release for the latest version are crucial. That’s why if you need extended support for our plug-ins, please contact us at apex-plugins@pretius.com. 107 | We offer: 108 | * enterprise-level assistance; 109 | * support in plug-ins implementation and utilization; 110 | * dedicated contact channel to our developers; 111 | * SLA at the level your organization require; 112 | * priority update to next APEX releases and features listed in the roadmap. 113 | 114 | ## Changelog 115 | 116 | ### 1.2.1 117 | 118 | * ```PL/SQL``` support for `mm` and `yy` format mask 119 | * ```PL/SQL``` support for `\` as format separator 120 | 121 | ### 1.2.0 122 | 123 | * ```PL/SQL``` the plugin source has been extracted as external package 124 | * ```PL/SQL``` input attributes such as ```size```, ```length``` etc are derivied by ```APEX_PLUGIN_UTIL.get_element_attributes``` function 125 | * ```PL/SQL``` When APEX item is in ```readonly``` state it is rendering value only 126 | * ```PL/SQL``` plugin rendering function has been changed to procedural API 127 | * ```Plugin``` The plugin is now compatibile with APEX 5.1, 18.x and 19.x 128 | * ```Plugin``` Support for ```Warn on Unsaved Changes``` has been added 129 | * ```Plugin``` input reacts to APEX item template options such as ```Size```, ```Strech Form Item``` 130 | * ```Plugin``` input supports ```Floating``` template 131 | * ```Plugin``` Support for ```Warn on Unsaved Changes``` has been added 132 | * ```JS``` debugging messages has been added at 3 levels: ```DEBUG```, ```LEVEL6``` and ```LEVEL9``` 133 | 134 | ### 1.1.0 135 | 136 | * Calendar `z-index` is set to `700`. Calendar's div is on higher layer than Interactive Report headers and APEX left sidebar position. 137 | * Hovering non-selectable calendar elements (week day names, week numbers) do not change cursor style. 138 | * Creating range of dates from session values is fixed. 139 | * Applying date value triggers Change event on APEX item. 140 | * When ```Show days of other months``` is not checked, the hidden dates are not clickable. 141 | * ```Plugin attributes``` Days names of the calendar are not shifted. Calendar renders day names in valid sequence in correlation to the real date. Translation string ```PRETIUS_DATERANGEPICKER_DAYS``` is changed from ```Mo,Tu,We,Th,Fr,Sa,Su``` to ```Su,Mo,Tu,We,Th,Fr,Sa``` - Sunday must be the first day of the week in the trasnlation list. 142 | 143 | ### 1.0.0 144 | 145 | Initial release 146 | 147 | ## Known issues 148 | 149 | * Date format mask `DY`, `Dy` return invalid string for selected date 150 | 151 | ## About Author 152 | Author | Github | Twitter | E-mail 153 | -------|--------|---------|------- 154 | Bartosz Ostrowski | [@bostrowski](https://github.com/bostrowski) | [@bostrowsk1](https://twitter.com/bostrowsk1) | bostrowski@pretius.com 155 | 156 | ## About Pretius 157 | Pretius Sp. z o.o. Sp. K. 158 | 159 | Pretius is a software company specialized in Java-based and low-code applications, with a dedicated team of over 25 Oracle APEX developers. 160 | Members of our APEX team are technical experts, have excellent communication skills, and work directly with end-users / business owners of the software. Some of them are also well-known APEX community members, winners of APEX competitions, and speakers at international conferences. 161 | We are the authors of the translate-apex.com project and some of the best APEX plug-ins available at the apex.world. 162 | We are located in Poland, but working globally. If you need the APEX support, contact us right now. 163 | 164 | Address | Website | E-mail 165 | --------|---------|------- 166 | Żwirki i Wigury 16A, 02-092 Warsaw, Poland | [http://www.pretius.com](http://www.pretius.com) | [office@pretius.com](mailto:office@pretius.com) 167 | -------------------------------------------------------------------------------- /apexplugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Pretius Date Range Picker", 3 | "version" : "1.2.1", 4 | "description" : "The plugin is Oracle APEX item plugin providing new date picker supporting range of dates. The plugin is dedicated to work with Oracle APEX Universal Theme. Behaviour and appeareance of the plugin can be changed with various settings.", 5 | "keywords" : ["date", "range", "picker", "UT"], 6 | "homepage" : "https://github.com/Pretius/apex-date-range", 7 | "bugs" : { 8 | "url" : "https://github.com/Pretius/apex-date-range/issues", 9 | "email" : "apex-plugins@pretius.com", 10 | }, 11 | "license" : "MIT", 12 | "commercial" : "No", 13 | "commercially_supported":"Yes", 14 | "author" : { 15 | "name" : "Pretius", 16 | "email" : "apex-plugins@pretius.com", 17 | "url" : "http://www.pretius.com", 18 | "twitter": "PretiusSoftware" 19 | }, 20 | "repository" : { 21 | "type" : "git", 22 | "url" : "https://github.com/Pretius/apex-date-range.git" 23 | }, 24 | "oracle" : { 25 | "versions" : [ 26 | "11.2.0.1", 27 | "12.1.0.1", 28 | "12.2.0.1", 29 | "18.0.0.0" 30 | ], 31 | "apex" : { 32 | "versions" : [ 33 | "5.1.0", 34 | "18.1.0", 35 | "18.2.0", 36 | "19.1.0", 37 | "19.2.0", 38 | "20.1.0" 39 | ], 40 | "plugin" : { 41 | "internalName" : "apex.date.range", 42 | "type" : "item", 43 | "demo" : "http://apex.pretius.com/apex/f?p=PLUGINS:DATERANGE", 44 | "previewImage" : "https://raw.githubusercontent.com/Pretius/apex-date-range/master/images/preview_demo.gif" 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /images/preview_daterange_translations.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pretius/apex-date-range/140ef7dea8935af2e36bb38265756930cbc12648/images/preview_daterange_translations.jpg -------------------------------------------------------------------------------- /images/preview_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pretius/apex-date-range/140ef7dea8935af2e36bb38265756930cbc12648/images/preview_demo.gif -------------------------------------------------------------------------------- /images/preview_helptext.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pretius/apex-date-range/140ef7dea8935af2e36bb38265756930cbc12648/images/preview_helptext.gif -------------------------------------------------------------------------------- /images/preview_quickpicks.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pretius/apex-date-range/140ef7dea8935af2e36bb38265756930cbc12648/images/preview_quickpicks.gif -------------------------------------------------------------------------------- /server/moment.min.js: -------------------------------------------------------------------------------- 1 | //! moment.js 2 | //! version : 2.13.0 3 | //! authors : Tim Wood, Iskren Chernev, Moment.js contributors 4 | //! license : MIT 5 | //! momentjs.com 6 | !function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return fd.apply(null,arguments)}function b(a){fd=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c0)for(c in hd)d=hd[c],e=b[d],m(e)||(a[d]=e);return a}function o(b){n(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),id===!1&&(id=!0,a.updateOffset(this),id=!1)}function p(a){return a instanceof o||null!=a&&null!=a._isAMomentObject}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=q(b)),c}function s(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&r(a[d])!==r(b[d]))&&g++;return g+f}function t(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function u(b,c){var d=!0;return g(function(){return null!=a.deprecationHandler&&a.deprecationHandler(null,b),d&&(t(b+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),d=!1),c.apply(this,arguments)},c)}function v(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),jd[b]||(t(c),jd[b]=!0)}function w(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function x(a){return"[object Object]"===Object.prototype.toString.call(a)}function y(a){var b,c;for(c in a)b=a[c],w(b)?this[c]=b:this["_"+c]=b;this._config=a,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function z(a,b){var c,d=g({},a);for(c in b)f(b,c)&&(x(a[c])&&x(b[c])?(d[c]={},g(d[c],a[c]),g(d[c],b[c])):null!=b[c]?d[c]=b[c]:delete d[c]);return d}function A(a){null!=a&&this.set(a)}function B(a){return a?a.toLowerCase().replace("_","-"):a}function C(a){for(var b,c,d,e,f=0;f0;){if(d=D(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&s(e,c,!0)>=b-1)break;b--}f++}return null}function D(a){var b=null;if(!nd[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=ld._abbr,require("./locale/"+a),E(b)}catch(c){}return nd[a]}function E(a,b){var c;return a&&(c=m(b)?H(a):F(a,b),c&&(ld=c)),ld._abbr}function F(a,b){return null!==b?(b.abbr=a,null!=nd[a]?(v("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),b=z(nd[a]._config,b)):null!=b.parentLocale&&(null!=nd[b.parentLocale]?b=z(nd[b.parentLocale]._config,b):v("parentLocaleUndefined","specified parentLocale is not defined yet")),nd[a]=new A(b),E(a),nd[a]):(delete nd[a],null)}function G(a,b){if(null!=b){var c;null!=nd[a]&&(b=z(nd[a]._config,b)),c=new A(b),c.parentLocale=nd[a],nd[a]=c,E(a)}else null!=nd[a]&&(null!=nd[a].parentLocale?nd[a]=nd[a].parentLocale:null!=nd[a]&&delete nd[a]);return nd[a]}function H(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return ld;if(!c(a)){if(b=D(a))return b;a=[a]}return C(a)}function I(){return kd(nd)}function J(a,b){var c=a.toLowerCase();od[c]=od[c+"s"]=od[b]=a}function K(a){return"string"==typeof a?od[a]||od[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)f(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(b,c){return function(d){return null!=d?(O(this,b,d),a.updateOffset(this,c),this):N(this,b)}}function N(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function O(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function P(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=K(a),w(this[a]))return this[a](b);return this}function Q(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function R(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(sd[a]=e),b&&(sd[b[0]]=function(){return Q(e.apply(this,arguments),b[1],b[2])}),c&&(sd[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function S(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function T(a){var b,c,d=a.match(pd);for(b=0,c=d.length;c>b;b++)sd[d[b]]?d[b]=sd[d[b]]:d[b]=S(d[b]);return function(b){var e,f="";for(e=0;c>e;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}}function U(a,b){return a.isValid()?(b=V(b,a.localeData()),rd[b]=rd[b]||T(b),rd[b](a)):a.localeData().invalidDate()}function V(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(qd.lastIndex=0;d>=0&&qd.test(a);)a=a.replace(qd,c),qd.lastIndex=0,d-=1;return a}function W(a,b,c){Kd[a]=w(b)?b:function(a,d){return a&&c?c:b}}function X(a,b){return f(Kd,a)?Kd[a](b._strict,b._locale):new RegExp(Y(a))}function Y(a){return Z(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function Z(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=r(a)}),c=0;cd;++d)f=h([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=md.call(this._shortMonthsParse,g),-1!==e?e:null):(e=md.call(this._longMonthsParse,g),-1!==e?e:null):"MMM"===b?(e=md.call(this._shortMonthsParse,g),-1!==e?e:(e=md.call(this._longMonthsParse,g),-1!==e?e:null)):(e=md.call(this._longMonthsParse,g),-1!==e?e:(e=md.call(this._shortMonthsParse,g),-1!==e?e:null))}function fa(a,b,c){var d,e,f;if(this._monthsParseExact)return ea.call(this,a,b,c);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function ga(a,b){var c;if(!a.isValid())return a;if("string"==typeof b)if(/^\d+$/.test(b))b=r(b);else if(b=a.localeData().monthsParse(b),"number"!=typeof b)return a;return c=Math.min(a.date(),ba(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ha(b){return null!=b?(ga(this,b),a.updateOffset(this,!0),this):N(this,"Month")}function ia(){return ba(this.year(),this.month())}function ja(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex}function ka(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex}function la(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;12>b;b++)c=h([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(d.sort(a),e.sort(a),f.sort(a),b=0;12>b;b++)d[b]=Z(d[b]),e[b]=Z(e[b]),f[b]=Z(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")}function ma(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[Nd]<0||c[Nd]>11?Nd:c[Od]<1||c[Od]>ba(c[Md],c[Nd])?Od:c[Pd]<0||c[Pd]>24||24===c[Pd]&&(0!==c[Qd]||0!==c[Rd]||0!==c[Sd])?Pd:c[Qd]<0||c[Qd]>59?Qd:c[Rd]<0||c[Rd]>59?Rd:c[Sd]<0||c[Sd]>999?Sd:-1,j(a)._overflowDayOfYear&&(Md>b||b>Od)&&(b=Od),j(a)._overflowWeeks&&-1===b&&(b=Td),j(a)._overflowWeekday&&-1===b&&(b=Ud),j(a).overflow=b),a}function na(a){var b,c,d,e,f,g,h=a._i,i=$d.exec(h)||_d.exec(h);if(i){for(j(a).iso=!0,b=0,c=be.length;c>b;b++)if(be[b][1].exec(i[1])){e=be[b][0],d=be[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=ce.length;c>b;b++)if(ce[b][1].exec(i[3])){f=(i[2]||" ")+ce[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!ae.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),Ca(a)}else a._isValid=!1}function oa(b){var c=de.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(na(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function pa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 100>a&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function qa(a){var b=new Date(Date.UTC.apply(null,arguments));return 100>a&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ra(a){return sa(a)?366:365}function sa(a){return a%4===0&&a%100!==0||a%400===0}function ta(){return sa(this.year())}function ua(a,b,c){var d=7+b-c,e=(7+qa(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return 0>=j?(f=a-1,g=ra(f)+j):j>ra(a)?(f=a+1,g=j-ra(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return 1>g?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(ra(a)-d+e)/7}function ya(a,b,c){return null!=a?a:null!=b?b:c}function za(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function Aa(a){var b,c,d,e,f=[];if(!a._d){for(d=za(a),a._w&&null==a._a[Od]&&null==a._a[Nd]&&Ba(a),a._dayOfYear&&(e=ya(a._a[Md],d[Md]),a._dayOfYear>ra(e)&&(j(a)._overflowDayOfYear=!0),c=qa(e,0,a._dayOfYear),a._a[Nd]=c.getUTCMonth(),a._a[Od]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[Pd]&&0===a._a[Qd]&&0===a._a[Rd]&&0===a._a[Sd]&&(a._nextDay=!0,a._a[Pd]=0),a._d=(a._useUTC?qa:pa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Pd]=24)}}function Ba(a){var b,c,d,e,f,g,h,i;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=ya(b.GG,a._a[Md],wa(Ka(),1,4).year),d=ya(b.W,1),e=ya(b.E,1),(1>e||e>7)&&(i=!0)):(f=a._locale._week.dow,g=a._locale._week.doy,c=ya(b.gg,a._a[Md],wa(Ka(),f,g).year),d=ya(b.w,1),null!=b.d?(e=b.d,(0>e||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f),1>d||d>xa(c,f,g)?j(a)._overflowWeeks=!0:null!=i?j(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[Md]=h.year,a._dayOfYear=h.dayOfYear)}function Ca(b){if(b._f===a.ISO_8601)return void na(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=V(b._f,b._locale).match(pd)||[],c=0;c0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),sd[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),aa(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[Pd]<=12&&b._a[Pd]>0&&(j(b).bigHour=void 0),j(b).parsedDateParts=b._a.slice(0),j(b).meridiem=b._meridiem,b._a[Pd]=Da(b._locale,b._a[Pd],b._meridiem),Aa(b),ma(b)}function Da(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function Ea(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ef)&&(d=f,c=b));g(a,c||b)}function Fa(a){if(!a._d){var b=L(a._i);a._a=e([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),Aa(a)}}function Ga(a){var b=new o(ma(Ha(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Ha(a){var b=a._i,e=a._f;return a._locale=a._locale||H(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),p(b)?new o(ma(b)):(c(e)?Ea(a):e?Ca(a):d(b)?a._d=b:Ia(a),k(a)||(a._d=null),a))}function Ia(b){var f=b._i;void 0===f?b._d=new Date(a.now()):d(f)?b._d=new Date(f.valueOf()):"string"==typeof f?oa(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),Aa(b)):"object"==typeof f?Fa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ja(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,Ga(f)}function Ka(a,b,c,d){return Ja(a,b,c,d,!1)}function La(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Ka();for(d=b[0],e=1;ea&&(a=-a,c="-"),c+Q(~~(a/60),2)+b+Q(~~a%60,2)})}function Ra(a,b){var c=(b||"").match(a)||[],d=c[c.length-1]||[],e=(d+"").match(ie)||["-",0,0],f=+(60*e[1])+r(e[2]);return"+"===e[0]?f:-f}function Sa(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(p(b)||d(b)?b.valueOf():Ka(b).valueOf())-e.valueOf(),e._d.setTime(e._d.valueOf()+f),a.updateOffset(e,!1),e):Ka(b).local()}function Ta(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ua(b,c){var d,e=this._offset||0;return this.isValid()?null!=b?("string"==typeof b?b=Ra(Hd,b):Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ta(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?jb(this,db(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ta(this):null!=b?this:NaN}function Va(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Wa(a){return this.utcOffset(0,a)}function Xa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ta(this),"m")),this}function Ya(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ra(Gd,this._i)),this}function Za(a){return this.isValid()?(a=a?Ka(a).utcOffset():0,(this.utcOffset()-a)%60===0):!1}function $a(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function _a(){if(!m(this._isDSTShifted))return this._isDSTShifted;var a={};if(n(a,this),a=Ha(a),a._a){var b=a._isUTC?h(a._a):Ka(a._a);this._isDSTShifted=this.isValid()&&s(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function ab(){return this.isValid()?!this._isUTC:!1}function bb(){return this.isValid()?this._isUTC:!1}function cb(){return this.isValid()?this._isUTC&&0===this._offset:!1}function db(a,b){var c,d,e,g=a,h=null;return Pa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=je.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:r(h[Od])*c,h:r(h[Pd])*c,m:r(h[Qd])*c,s:r(h[Rd])*c,ms:r(h[Sd])*c}):(h=ke.exec(a))?(c="-"===h[1]?-1:1,g={y:eb(h[2],c),M:eb(h[3],c),w:eb(h[4],c),d:eb(h[5],c),h:eb(h[6],c),m:eb(h[7],c),s:eb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=gb(Ka(g.from),Ka(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Oa(g),Pa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function eb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function fb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function gb(a,b){var c;return a.isValid()&&b.isValid()?(b=Sa(b,a),a.isBefore(b)?c=fb(a,b):(c=fb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function hb(a){return 0>a?-1*Math.round(-1*a):Math.round(a)}function ib(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(v(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=db(c,d),jb(this,e,a),this}}function jb(b,c,d,e){var f=c._milliseconds,g=hb(c._days),h=hb(c._months);b.isValid()&&(e=null==e?!0:e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&O(b,"Date",N(b,"Date")+g*d),h&&ga(b,N(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function kb(a,b){var c=a||Ka(),d=Sa(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse",g=b&&(w(b[f])?b[f]():b[f]);return this.format(g||this.localeData().calendar(f,this,Ka(c)))}function lb(){return new o(this)}function mb(a,b){var c=p(a)?a:Ka(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function ub(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function vb(){var a=this.clone().utc();return 0f&&(b=f),Vb.call(this,a,b,c,d,e))}function Vb(a,b,c,d,e){var f=va(a,b,c,d,e),g=qa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Wb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Xb(a){return wa(a,this._week.dow,this._week.doy).week}function Yb(){return this._week.dow}function Zb(){return this._week.doy}function $b(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function _b(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function ac(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function bc(a,b){return c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]}function cc(a){return this._weekdaysShort[a.day()]}function dc(a){return this._weekdaysMin[a.day()]}function ec(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;7>d;++d)f=h([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=md.call(this._weekdaysParse,g),-1!==e?e:null):"ddd"===b?(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:null):(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null):"dddd"===b?(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null))):"ddd"===b?(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null))):(e=md.call(this._minWeekdaysParse,g),-1!==e?e:(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:null)))}function fc(a,b,c){var d,e,f;if(this._weekdaysParseExact)return ec.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;7>d;d++){if(e=h([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function gc(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=ac(a,this.localeData()),this.add(a-b,"d")):b}function hc(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function ic(a){return this.isValid()?null==a?this.day()||7:this.day(this.day()%7?a:a-7):null!=a?this:NaN}function jc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex}function kc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}function lc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}function mc(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],i=[],j=[],k=[];for(b=0;7>b;b++)c=h([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),i.push(e),j.push(f),k.push(d),k.push(e),k.push(f);for(g.sort(a),i.sort(a),j.sort(a),k.sort(a),b=0;7>b;b++)i[b]=Z(i[b]),j[b]=Z(j[b]),k[b]=Z(k[b]);this._weekdaysRegex=new RegExp("^("+k.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function nc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function oc(){return this.hours()%12||12}function pc(){return this.hours()||24}function qc(a,b){R(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function rc(a,b){return b._meridiemParse}function sc(a){return"p"===(a+"").toLowerCase().charAt(0)}function tc(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function uc(a,b){b[Sd]=r(1e3*("0."+a))}function vc(){return this._isUTC?"UTC":""}function wc(){return this._isUTC?"Coordinated Universal Time":""}function xc(a){return Ka(1e3*a)}function yc(){return Ka.apply(null,arguments).parseZone()}function zc(a,b,c){var d=this._calendar[a];return w(d)?d.call(b,c):d}function Ac(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function Bc(){return this._invalidDate}function Cc(a){return this._ordinal.replace("%d",a)}function Dc(a){return a}function Ec(a,b,c,d){var e=this._relativeTime[c];return w(e)?e(a,b,c,d):e.replace(/%d/i,a)}function Fc(a,b){var c=this._relativeTime[a>0?"future":"past"];return w(c)?c(b):c.replace(/%s/i,b)}function Gc(a,b,c,d){var e=H(),f=h().set(d,b);return e[c](f,a)}function Hc(a,b,c){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return Gc(a,b,c,"month");var d,e=[];for(d=0;12>d;d++)e[d]=Gc(a,d,c,"month");return e}function Ic(a,b,c,d){"boolean"==typeof a?("number"==typeof b&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,"number"==typeof b&&(c=b,b=void 0),b=b||"");var e=H(),f=a?e._week.dow:0;if(null!=c)return Gc(b,(c+f)%7,d,"day");var g,h=[];for(g=0;7>g;g++)h[g]=Gc(b,(g+f)%7,d,"day");return h}function Jc(a,b){return Hc(a,b,"months")}function Kc(a,b){return Hc(a,b,"monthsShort")}function Lc(a,b,c){return Ic(a,b,c,"weekdays")}function Mc(a,b,c){return Ic(a,b,c,"weekdaysShort")}function Nc(a,b,c){return Ic(a,b,c,"weekdaysMin")}function Oc(){var a=this._data;return this._milliseconds=Le(this._milliseconds),this._days=Le(this._days),this._months=Le(this._months),a.milliseconds=Le(a.milliseconds),a.seconds=Le(a.seconds),a.minutes=Le(a.minutes),a.hours=Le(a.hours),a.months=Le(a.months),a.years=Le(a.years),this}function Pc(a,b,c,d){var e=db(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Qc(a,b){return Pc(this,a,b,1)}function Rc(a,b){return Pc(this,a,b,-1)}function Sc(a){return 0>a?Math.floor(a):Math.ceil(a)}function Tc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*Sc(Vc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=q(f/1e3),i.seconds=a%60,b=q(a/60),i.minutes=b%60,c=q(b/60),i.hours=c%24,g+=q(c/24),e=q(Uc(g)),h+=e,g-=Sc(Vc(e)),d=q(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function Uc(a){return 4800*a/146097}function Vc(a){return 146097*a/4800}function Wc(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+Uc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(Vc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function Xc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*r(this._months/12)}function Yc(a){return function(){return this.as(a)}}function Zc(a){ 7 | return a=K(a),this[a+"s"]()}function $c(a){return function(){return this._data[a]}}function _c(){return q(this.days()/7)}function ad(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function bd(a,b,c){var d=db(a).abs(),e=_e(d.as("s")),f=_e(d.as("m")),g=_e(d.as("h")),h=_e(d.as("d")),i=_e(d.as("M")),j=_e(d.as("y")),k=e=f&&["m"]||f=g&&["h"]||g=h&&["d"]||h=i&&["M"]||i=j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,ad.apply(null,k)}function cd(a,b){return void 0===af[a]?!1:void 0===b?af[a]:(af[a]=b,!0)}function dd(a){var b=this.localeData(),c=bd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function ed(){var a,b,c,d=bf(this._milliseconds)/1e3,e=bf(this._days),f=bf(this._months);a=q(d/60),b=q(a/60),d%=60,a%=60,c=q(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var fd,gd;gd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;c>d;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var hd=a.momentProperties=[],id=!1,jd={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var kd;kd=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)f(a,b)&&c.push(b);return c};var ld,md,nd={},od={},pd=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,qd=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,rd={},sd={},td=/\d/,ud=/\d\d/,vd=/\d{3}/,wd=/\d{4}/,xd=/[+-]?\d{6}/,yd=/\d\d?/,zd=/\d\d\d\d?/,Ad=/\d\d\d\d\d\d?/,Bd=/\d{1,3}/,Cd=/\d{1,4}/,Dd=/[+-]?\d{1,6}/,Ed=/\d+/,Fd=/[+-]?\d+/,Gd=/Z|[+-]\d\d:?\d\d/gi,Hd=/Z|[+-]\d\d(?::?\d\d)?/gi,Id=/[+-]?\d+(\.\d{1,3})?/,Jd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Kd={},Ld={},Md=0,Nd=1,Od=2,Pd=3,Qd=4,Rd=5,Sd=6,Td=7,Ud=8;md=Array.prototype.indexOf?Array.prototype.indexOf:function(a){var b;for(b=0;b=a?""+a:"+"+a}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),J("year","y"),W("Y",Fd),W("YY",yd,ud),W("YYYY",Cd,wd),W("YYYYY",Dd,xd),W("YYYYYY",Dd,xd),$(["YYYYY","YYYYYY"],Md),$("YYYY",function(b,c){c[Md]=2===b.length?a.parseTwoDigitYear(b):r(b)}),$("YY",function(b,c){c[Md]=a.parseTwoDigitYear(b)}),$("Y",function(a,b){b[Md]=parseInt(a,10)}),a.parseTwoDigitYear=function(a){return r(a)+(r(a)>68?1900:2e3)};var ee=M("FullYear",!0);a.ISO_8601=function(){};var fe=u("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?this>a?this:a:l()}),ge=u("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:l()}),he=function(){return Date.now?Date.now():+new Date};Qa("Z",":"),Qa("ZZ",""),W("Z",Hd),W("ZZ",Hd),$(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ra(Hd,a)});var ie=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var je=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,ke=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;db.fn=Oa.prototype;var le=ib(1,"add"),me=ib(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ne=u("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Pb("gggg","weekYear"),Pb("ggggg","weekYear"),Pb("GGGG","isoWeekYear"),Pb("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),W("G",Fd),W("g",Fd),W("GG",yd,ud),W("gg",yd,ud),W("GGGG",Cd,wd),W("gggg",Cd,wd),W("GGGGG",Dd,xd),W("ggggg",Dd,xd),_(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=r(a)}),_(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),R("Q",0,"Qo","quarter"),J("quarter","Q"),W("Q",td),$("Q",function(a,b){b[Nd]=3*(r(a)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),W("w",yd),W("ww",yd,ud),W("W",yd),W("WW",yd,ud),_(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=r(a)});var oe={dow:0,doy:6};R("D",["DD",2],"Do","date"),J("date","D"),W("D",yd),W("DD",yd,ud),W("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),$(["D","DD"],Od),$("Do",function(a,b){b[Od]=r(a.match(yd)[0],10)});var pe=M("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),R("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),R("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),W("d",yd),W("e",yd),W("E",yd),W("dd",function(a,b){return b.weekdaysMinRegex(a)}),W("ddd",function(a,b){return b.weekdaysShortRegex(a)}),W("dddd",function(a,b){return b.weekdaysRegex(a)}),_(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:j(c).invalidWeekday=a}),_(["d","e","E"],function(a,b,c,d){b[d]=r(a)});var qe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),re="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),se="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),te=Jd,ue=Jd,ve=Jd;R("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),W("DDD",Bd),W("DDDD",vd),$(["DDD","DDDD"],function(a,b,c){c._dayOfYear=r(a)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,oc),R("k",["kk",2],0,pc),R("hmm",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)}),R("hmmss",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)+Q(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+Q(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+Q(this.minutes(),2)+Q(this.seconds(),2)}),qc("a",!0),qc("A",!1),J("hour","h"),W("a",rc),W("A",rc),W("H",yd),W("h",yd),W("HH",yd,ud),W("hh",yd,ud),W("hmm",zd),W("hmmss",Ad),W("Hmm",zd),W("Hmmss",Ad),$(["H","HH"],Pd),$(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),$(["h","hh"],function(a,b,c){b[Pd]=r(a),j(c).bigHour=!0}),$("hmm",function(a,b,c){var d=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d)),j(c).bigHour=!0}),$("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d,2)),b[Rd]=r(a.substr(e)),j(c).bigHour=!0}),$("Hmm",function(a,b,c){var d=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d))}),$("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d,2)),b[Rd]=r(a.substr(e))});var we=/[ap]\.?m?\.?/i,xe=M("Hours",!0);R("m",["mm",2],0,"minute"),J("minute","m"),W("m",yd),W("mm",yd,ud),$(["m","mm"],Qd);var ye=M("Minutes",!1);R("s",["ss",2],0,"second"),J("second","s"),W("s",yd),W("ss",yd,ud),$(["s","ss"],Rd);var ze=M("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),W("S",Bd,td),W("SS",Bd,ud),W("SSS",Bd,vd);var Ae;for(Ae="SSSS";Ae.length<=9;Ae+="S")W(Ae,Ed);for(Ae="S";Ae.length<=9;Ae+="S")$(Ae,uc);var Be=M("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var Ce=o.prototype;Ce.add=le,Ce.calendar=kb,Ce.clone=lb,Ce.diff=sb,Ce.endOf=Eb,Ce.format=wb,Ce.from=xb,Ce.fromNow=yb,Ce.to=zb,Ce.toNow=Ab,Ce.get=P,Ce.invalidAt=Nb,Ce.isAfter=mb,Ce.isBefore=nb,Ce.isBetween=ob,Ce.isSame=pb,Ce.isSameOrAfter=qb,Ce.isSameOrBefore=rb,Ce.isValid=Lb,Ce.lang=ne,Ce.locale=Bb,Ce.localeData=Cb,Ce.max=ge,Ce.min=fe,Ce.parsingFlags=Mb,Ce.set=P,Ce.startOf=Db,Ce.subtract=me,Ce.toArray=Ib,Ce.toObject=Jb,Ce.toDate=Hb,Ce.toISOString=vb,Ce.toJSON=Kb,Ce.toString=ub,Ce.unix=Gb,Ce.valueOf=Fb,Ce.creationData=Ob,Ce.year=ee,Ce.isLeapYear=ta,Ce.weekYear=Qb,Ce.isoWeekYear=Rb,Ce.quarter=Ce.quarters=Wb,Ce.month=ha,Ce.daysInMonth=ia,Ce.week=Ce.weeks=$b,Ce.isoWeek=Ce.isoWeeks=_b,Ce.weeksInYear=Tb,Ce.isoWeeksInYear=Sb,Ce.date=pe,Ce.day=Ce.days=gc,Ce.weekday=hc,Ce.isoWeekday=ic,Ce.dayOfYear=nc,Ce.hour=Ce.hours=xe,Ce.minute=Ce.minutes=ye,Ce.second=Ce.seconds=ze,Ce.millisecond=Ce.milliseconds=Be,Ce.utcOffset=Ua,Ce.utc=Wa,Ce.local=Xa,Ce.parseZone=Ya,Ce.hasAlignedHourOffset=Za,Ce.isDST=$a,Ce.isDSTShifted=_a,Ce.isLocal=ab,Ce.isUtcOffset=bb,Ce.isUtc=cb,Ce.isUTC=cb,Ce.zoneAbbr=vc,Ce.zoneName=wc,Ce.dates=u("dates accessor is deprecated. Use date instead.",pe),Ce.months=u("months accessor is deprecated. Use month instead",ha),Ce.years=u("years accessor is deprecated. Use year instead",ee),Ce.zone=u("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Va);var De=Ce,Ee={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Fe={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Ge="Invalid date",He="%d",Ie=/\d{1,2}/,Je={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Ke=A.prototype;Ke._calendar=Ee,Ke.calendar=zc,Ke._longDateFormat=Fe,Ke.longDateFormat=Ac,Ke._invalidDate=Ge,Ke.invalidDate=Bc,Ke._ordinal=He,Ke.ordinal=Cc,Ke._ordinalParse=Ie,Ke.preparse=Dc,Ke.postformat=Dc,Ke._relativeTime=Je,Ke.relativeTime=Ec,Ke.pastFuture=Fc,Ke.set=y,Ke.months=ca,Ke._months=Wd,Ke.monthsShort=da,Ke._monthsShort=Xd,Ke.monthsParse=fa,Ke._monthsRegex=Zd,Ke.monthsRegex=ka,Ke._monthsShortRegex=Yd,Ke.monthsShortRegex=ja,Ke.week=Xb,Ke._week=oe,Ke.firstDayOfYear=Zb,Ke.firstDayOfWeek=Yb,Ke.weekdays=bc,Ke._weekdays=qe,Ke.weekdaysMin=dc,Ke._weekdaysMin=se,Ke.weekdaysShort=cc,Ke._weekdaysShort=re,Ke.weekdaysParse=fc,Ke._weekdaysRegex=te,Ke.weekdaysRegex=jc,Ke._weekdaysShortRegex=ue,Ke.weekdaysShortRegex=kc,Ke._weekdaysMinRegex=ve,Ke.weekdaysMinRegex=lc,Ke.isPM=sc,Ke._meridiemParse=we,Ke.meridiem=tc,E("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===r(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=u("moment.lang is deprecated. Use moment.locale instead.",E),a.langData=u("moment.langData is deprecated. Use moment.localeData instead.",H);var Le=Math.abs,Me=Yc("ms"),Ne=Yc("s"),Oe=Yc("m"),Pe=Yc("h"),Qe=Yc("d"),Re=Yc("w"),Se=Yc("M"),Te=Yc("y"),Ue=$c("milliseconds"),Ve=$c("seconds"),We=$c("minutes"),Xe=$c("hours"),Ye=$c("days"),Ze=$c("months"),$e=$c("years"),_e=Math.round,af={s:45,m:45,h:22,d:26,M:11},bf=Math.abs,cf=Oa.prototype;cf.abs=Oc,cf.add=Qc,cf.subtract=Rc,cf.as=Wc,cf.asMilliseconds=Me,cf.asSeconds=Ne,cf.asMinutes=Oe,cf.asHours=Pe,cf.asDays=Qe,cf.asWeeks=Re,cf.asMonths=Se,cf.asYears=Te,cf.valueOf=Xc,cf._bubble=Tc,cf.get=Zc,cf.milliseconds=Ue,cf.seconds=Ve,cf.minutes=We,cf.hours=Xe,cf.days=Ye,cf.weeks=_c,cf.months=Ze,cf.years=$e,cf.humanize=dd,cf.toISOString=ed,cf.toString=ed,cf.toJSON=ed,cf.locale=Bb,cf.localeData=Cb,cf.toIsoString=u("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ed),cf.lang=ne,R("X",0,0,"unix"),R("x",0,0,"valueOf"),W("x",Fd),W("X",Id),$("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),$("x",function(a,b,c){c._d=new Date(r(a))}),a.version="2.13.0",b(Ka),a.fn=De,a.min=Ma,a.max=Na,a.now=he,a.utc=h,a.unix=xc,a.months=Jc,a.isDate=d,a.locale=E,a.invalid=l,a.duration=db,a.isMoment=p,a.weekdays=Lc,a.parseZone=yc,a.localeData=H,a.isDuration=Pa,a.monthsShort=Kc,a.weekdaysMin=Nc,a.defineLocale=F,a.updateLocale=G,a.locales=I,a.weekdaysShort=Mc,a.normalizeUnits=K,a.relativeTimeThreshold=cd,a.prototype=De;var df=a;return df}); -------------------------------------------------------------------------------- /server/pretiusapexdaterangepicker.css: -------------------------------------------------------------------------------- 1 | .daterangepicker.dropup { 2 | margin-top: -5px; 3 | } 4 | .daterangepicker.dropup:before { 5 | top: initial; 6 | bottom: -7px; 7 | border-bottom: initial; 8 | border-top: 7px solid #ccc; 9 | } 10 | .daterangepicker.dropup:after { 11 | top: initial; 12 | bottom: -6px; 13 | border-bottom: initial; 14 | border-top: 6px solid #fff; 15 | } 16 | 17 | button.pretius-apexdaterangepicker.disabled { 18 | opacity: 0.5; 19 | } 20 | /* 21 | 22 | */ 23 | 24 | .daterangepicker { 25 | position: absolute; 26 | color: #393939; 27 | background: #fff; 28 | border-radius: 2px; 29 | display: none; 30 | /*width: 278px;*/ 31 | padding: 8px; 32 | margin-top: 1px; 33 | top: -100%; 34 | left: -100%; 35 | z-index: 700; 36 | } 37 | 38 | .daterangepicker.hideRightCalendar .calendar.right { 39 | display: none; 40 | } 41 | 42 | .daterangepicker.hideRightCalendar.hasRanges .ranges { 43 | padding-left: 8px; 44 | } 45 | 46 | .daterangepicker.hideRightCalendar .calendar.left { 47 | margin-right: 0px; 48 | } 49 | 50 | .daterangepicker.hideRightCalendar .daterangepicker_input { 51 | display: inline-block; 52 | } 53 | 54 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateFrom { 55 | margin-right: 0px; 56 | } 57 | 58 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateFrom, 59 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateTo, 60 | .daterangepicker.hideRightCalendar.hasShowWeekNumbers .daterangepicker_input.dateFrom, 61 | .daterangepicker.hideRightCalendar.hasShowWeekNumbers .daterangepicker_input.dateTo{ 62 | width: 103px; 63 | } 64 | 65 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateFrom { 66 | margin-left: 16px; 67 | } 68 | 69 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateTo, 70 | .daterangepicker.hideRightCalendar.hasShowWeekNumbers .daterangepicker_input.dateTo { 71 | margin-left: 8px; 72 | } 73 | 74 | .daterangepicker.hasAutoApply .range_inputs { 75 | display: none; 76 | } 77 | 78 | 79 | .daterangepicker.monthsDiffersMoreThanOne .calendar.left { 80 | margin-right: 0px; 81 | padding-right: 7px; 82 | border-right: 2px solid rgba(37, 120, 207, 0.3); 83 | border-right: 2px solid transparent !important; 84 | } 85 | 86 | .daterangepicker.monthsDiffersMoreThanOne .calendar.right { 87 | padding-left: 1px; 88 | margin-left: 0px; 89 | } 90 | 91 | .daterangepicker.hideCalendarDateInputs .daterangepicker_input { 92 | display: none; 93 | } 94 | 95 | .daterangepicker.hasShowWeekNumbers .daterangepicker_input { 96 | margin-left: 28px; 97 | } 98 | 99 | .daterangepicker.hasRanges .ranges { 100 | float: right; 101 | padding: 0; 102 | margin: 0; 103 | padding-left: 8px; 104 | padding-top: 8px; 105 | clear: none; 106 | } 107 | 108 | .calendar { 109 | display: none; 110 | float: left; 111 | } 112 | .calendar.right { 113 | margin-left: 2px; 114 | } 115 | .calendar.left { 116 | margin-right: 8px; 117 | } 118 | 119 | .calendar table.table-condensed { 120 | width: 242px; 121 | } 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | /* 130 | * RANGES 131 | */ 132 | 133 | .daterangepicker .ranges { 134 | font-size: 11px; 135 | float: none; 136 | margin: 4px; 137 | text-align: left; 138 | padding: 4px; 139 | clear: both; 140 | float: none; 141 | } 142 | .daterangepicker .ranges ul { 143 | list-style: none; 144 | margin: 0 auto; 145 | padding: 0; 146 | width: 100%; 147 | } 148 | .daterangepicker .ranges li { 149 | color: #383838; 150 | background-color: #f8f8f8; 151 | margin-bottom: 8px; 152 | cursor: pointer; 153 | font-size: 11px; 154 | line-height: 20px; 155 | padding-left: 8px; 156 | padding-right: 8px; 157 | margin-bottom: 8px; 158 | border: 1px solid rgba(0,0,0,.125); 159 | } 160 | 161 | .daterangepicker .ranges li.active { 162 | background: #2578cf; 163 | border: 1px solid #08c; 164 | color: #fff; 165 | } 166 | 167 | .daterangepicker .ranges li:hover { 168 | background: #4992de; 169 | color: #fff; 170 | } 171 | 172 | /* 173 | Natywne CSS 174 | */ 175 | 176 | .daterangepicker.show-calendar .calendar { 177 | display: block; 178 | } 179 | 180 | .daterangepicker.dropdown-menu { 181 | box-shadow: 0 2px 6px rgba(0,0,0,.05); 182 | border: 1px solid #ebebeb; 183 | } 184 | 185 | .daterangepicker.dropdown-menu:hover { 186 | box-shadow: 0 2px 6px rgba(0,0,0,.1); 187 | border: 1px solid #d4d4d4 188 | } 189 | 190 | 191 | .daterangepicker:before, 192 | .daterangepicker:after { 193 | position: absolute; 194 | display: inline-block; 195 | border-bottom-color: rgba(0, 0, 0, 0.2); 196 | content: ''; 197 | } 198 | .daterangepicker:before { 199 | top: -7px; 200 | border-right: 7px solid transparent; 201 | border-left: 7px solid transparent; 202 | border-bottom: 7px solid #ccc; 203 | } 204 | .daterangepicker:after { 205 | top: -6px; 206 | border-right: 6px solid transparent; 207 | border-bottom: 6px solid #fff; 208 | border-left: 6px solid transparent; 209 | } 210 | .daterangepicker.opensleft:before { 211 | right: 9px; 212 | } 213 | .daterangepicker.opensleft:after { 214 | right: 10px; 215 | } 216 | .daterangepicker.openscenter:before { 217 | left: 0; 218 | right: 0; 219 | width: 0; 220 | margin-left: auto; 221 | margin-right: auto; 222 | } 223 | .daterangepicker.openscenter:after { 224 | left: 0; 225 | right: 0; 226 | width: 0; 227 | margin-left: auto; 228 | margin-right: auto; 229 | } 230 | .daterangepicker.opensright:before { 231 | left: 9px; 232 | } 233 | .daterangepicker.opensright:after { 234 | left: 10px; 235 | } 236 | 237 | .dropdown-menu.pull-right { 238 | right: 0; 239 | left: auto 240 | } 241 | .dropdown-menu .divider { 242 | height: 1px; 243 | margin: 9px 0; 244 | overflow: hidden; 245 | background-color: #e5e5e5 246 | } 247 | .dropdown-menu>li>a { 248 | display: block; 249 | padding: 3px 20px; 250 | clear: both; 251 | font-weight: 400; 252 | line-height: 1.42857143; 253 | color: #333; 254 | white-space: nowrap 255 | } 256 | .dropdown-menu > li > a:focus, 257 | .dropdown-menu > li > a:hover { 258 | color: #262626; 259 | text-decoration: none; 260 | background-color: #f5f5f5 261 | } 262 | .dropdown-menu>.active>a, 263 | .dropdown-menu>.active>a:focus, 264 | .dropdown-menu>.active>a:hover { 265 | color: #fff; 266 | text-decoration: none; 267 | background-color: #337ab7; 268 | outline: 0 269 | } 270 | .dropdown-menu>.disabled>a, 271 | .dropdown-menu>.disabled>a:focus, 272 | .dropdown-menu>.disabled>a:hover { 273 | color: #777 274 | } 275 | .dropdown-menu>.disabled>a:focus, 276 | .dropdown-menu>.disabled>a:hover { 277 | text-decoration: none; 278 | cursor: not-allowed; 279 | background-color: transparent; 280 | background-image: none; 281 | filter: progid: DXImageTransform.Microsoft.gradient(enabled=false) 282 | } 283 | 284 | 285 | 286 | /**/ 287 | 288 | /**/ 289 | .daterangepicker .input-mini { 290 | font-size: 12px; 291 | line-height: 23px; 292 | border: 1px solid #ccc; 293 | border-radius: 4px; 294 | color: #555; 295 | display: block; 296 | vertical-align: middle; 297 | margin: 0; 298 | padding: 0 6px 0 28px; 299 | width: 100%; 300 | } 301 | .daterangepicker .input-mini.active { 302 | border: 1px solid rgba(0, 136, 204, 0.51); 303 | border-radius: 4px; 304 | } 305 | 306 | .daterangepicker .daterangepicker_input { 307 | margin: 0px; 308 | padding: 0px; 309 | position: relative; 310 | margin-top: 8px; 311 | } 312 | .daterangepicker .daterangepicker_input i { 313 | position: absolute; 314 | left: 8px; 315 | top: 6px; 316 | } 317 | 318 | .daterangepicker tr:nth-child(2) th { 319 | font-size: 11px; 320 | font-weight: 400; 321 | color: gray; 322 | border-bottom: 1px solid rgba(0,0,0,.1); 323 | padding: 4px 8px 8px 8px; 324 | } 325 | 326 | .daterangepicker td.week, 327 | .daterangepicker th.week{ 328 | font-size: 80%; 329 | font-weight: 400; 330 | color: rgba(0,0,0, 0.5); 331 | border-right: 1px solid rgba(0,0,0,.05); 332 | 333 | } 334 | 335 | 336 | .daterangepicker table { 337 | border-spacing: 0px 338 | } 339 | 340 | .daterangepicker th.prev, 341 | .daterangepicker th.next, 342 | .daterangepicker th.month { 343 | padding: 8px 0px; 344 | 345 | } 346 | 347 | .daterangepicker th.prev { 348 | text-align:left; 349 | padding-left: 16px; 350 | } 351 | 352 | .daterangepicker th.next { 353 | text-align:right; 354 | padding-right: 8px; 355 | } 356 | 357 | .daterangepicker th.month { 358 | color:rgb(61, 61, 61); 359 | font-family:"Helvetica Neue", Helvetica, Arial, sans-serif; 360 | font-size:16px; 361 | font-weight:200; 362 | text-align:center; 363 | text-size-adjust:100%; 364 | visibility:visible; 365 | -webkit-border-horizontal-spacing:0px; 366 | -webkit-border-vertical-spacing:0px; 367 | } 368 | 369 | .daterangepicker th.month select.monthselect { 370 | margin-right:4px; 371 | } 372 | 373 | .daterangepicker th.month select.monthselect, 374 | .daterangepicker th.month select.yearselect { 375 | border: 1px solid rgba(0,0,0,0.1); 376 | } 377 | 378 | 379 | .daterangepicker td, 380 | .daterangepicker th { 381 | font-size: 11px; 382 | line-height: 20px; 383 | padding: 8px; 384 | text-align: right; 385 | white-space: nowrap; 386 | border: none; 387 | } 388 | 389 | .daterangepicker td, 390 | .daterangepicker th.prev, 391 | .daterangepicker th.next { 392 | cursor: pointer; 393 | } 394 | 395 | 396 | .daterangepicker td.disabled { 397 | text-decoration: line-through; 398 | cursor: not-allowed; 399 | } 400 | 401 | 402 | 403 | .daterangepicker td.off:hover, 404 | .daterangepicker td.available:hover { 405 | font-weight: normal; 406 | font-size: 11px; 407 | background: #f2f2f2; 408 | } 409 | 410 | .daterangepicker td.in-range { 411 | background: rgba(37, 120, 207, 0.2); 412 | } 413 | 414 | .daterangepicker td.in-range:hover { 415 | background: rgba(37, 120, 207, 0.33); 416 | } 417 | 418 | .daterangepicker td.off:hover { 419 | color: #393939; 420 | } 421 | 422 | 423 | /* poczatek i koniec zakresu */ 424 | .daterangepicker td.active.start-date, 425 | .daterangepicker td.active.end-date, 426 | .daterangepicker td.active.start-date:hover, 427 | .daterangepicker td.active.end-date:hover { 428 | color: #fff; 429 | background-color: #2578cf; 430 | } 431 | 432 | .daterangepicker td.active.start-date { 433 | border-radius: 4px 0px 0px 0px; 434 | } 435 | 436 | .daterangepicker td.active.end-date { 437 | border-radius: 0px 0px 4px 0px; 438 | } 439 | 440 | .daterangepicker td.active.start-date.end-date { 441 | border-radius: 4px; 442 | } 443 | 444 | .daterangepicker th, 445 | .daterangepicker td.otherMonth, 446 | .daterangepicker td.week { 447 | cursor: default; 448 | } 449 | 450 | .daterangepicker td.otherMonth.in-range { 451 | background: transparent; 452 | } 453 | 454 | .daterangepicker td.off, 455 | .daterangepicker td.off.in-range, 456 | .daterangepicker td.off.start-date, 457 | .daterangepicker td.off.end-date { 458 | color: rgba(0,0,0, 0.3); 459 | background-color: rgba(0,0,0,0.02); 460 | } 461 | 462 | 463 | 464 | .daterangepicker .calendar-time { 465 | text-align: left; 466 | margin: 5px auto; 467 | line-height: 30px; 468 | position: relative; 469 | padding-left: 28px; 470 | } 471 | 472 | .daterangepicker .calendar-time i { 473 | top: 9px; 474 | } 475 | 476 | /* dropdown*/ 477 | 478 | .daterangepicker.forceOneColumn .calendar, 479 | .daterangepicker.forceOneColumn .ranges { 480 | float: none !important; 481 | margin: 0 !important; 482 | margin-bottom: 8px !important; 483 | } 484 | 485 | /* 486 | @media (max-width: 730px) { 487 | .daterangepicker .calendar, 488 | .daterangepicker .ranges { 489 | float: none !important; 490 | margin: 0 !important; 491 | margin-bottom: 8px !important; 492 | } 493 | } 494 | */ -------------------------------------------------------------------------------- /server/pretiusapexdaterangepicker.js: -------------------------------------------------------------------------------- 1 | $.widget('pretius.apexdaterangepicker', { 2 | options: { 3 | pretius: { 4 | // 5 | }, 6 | daterangepicker: { 7 | // 8 | } 9 | }, 10 | C_LOG_DEBUG : apex.debug.LOG_LEVEL.INFO, 11 | C_LOG_WARNING : apex.debug.LOG_LEVEL.WARN, 12 | C_LOG_ERROR : apex.debug.LOG_LEVEL.ERROR, 13 | C_LOG_LEVEL6 : apex.debug.LOG_LEVEL.APP_TRACE, 14 | C_LOG_LEVEL9 : apex.debug.LOG_LEVEL.ENGINE_TRACE, 15 | 16 | _create: function(){ 17 | this.logPrefix = '# ('+this.element.get(0).id+') ';//+this.options.plugin.name+':'; 18 | 19 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, '_create', 'this.options', this.options ); 20 | 21 | //required for fixing position 22 | this.orginal = { 23 | opens: this.options.daterangepicker.opens, 24 | drops: this.options.daterangepicker.drops 25 | }; 26 | 27 | this.apex = { 28 | item: this.element, 29 | datepickerButton: this.element.nextAll( 'button' ).first() 30 | }; 31 | 32 | this.dateTo = { 33 | item: $(this.options.pretius.dateToItem), 34 | datepickerButton: null 35 | }; 36 | 37 | //should display custom range label? 38 | if ( this._hasCustomRangeLabel() ) { 39 | this.options.daterangepicker.showCustomRangeLabel = this._hasCustomRangeLabel(); 40 | delete this.options.daterangepicker.ranges.Custom; 41 | } 42 | 43 | //check ranges 44 | if ( this.options.pretius.onlyOneCalendar ) { 45 | this.options.daterangepicker.linkedCalendars = false; 46 | } 47 | 48 | 49 | //create dateTo button as clone of apex datepicker buttom 50 | this.dateTo.datepickerButton = this.apex.datepickerButton.clone(); 51 | //insert dateTo button after dateTo item 52 | this.dateTo.datepickerButton.insertAfter( this.dateTo.item ); 53 | 54 | if ( this.options.pretius.overlay && this.dateTo.item.length == 0 ) { 55 | throw "Nie znalazl wymaganego itema data do"; 56 | } 57 | 58 | //min & max date 59 | this.options.daterangepicker.minDate = this.options.daterangepicker.minDate != undefined ? this.getMinMaxDateFromString( this.options.daterangepicker.minDate ) : undefined; 60 | this.options.daterangepicker.maxDate = this.options.daterangepicker.maxDate != undefined ? this.getMinMaxDateFromString( this.options.daterangepicker.maxDate ) : undefined; 61 | 62 | //date range picker init 63 | this.apex.item.daterangepicker( this.options.daterangepicker, function(start, end, label){ 64 | //console.log('---Callback function---'); 65 | }); 66 | 67 | this.picker = this.apex.item.data('daterangepicker'); 68 | 69 | this.apex.item 70 | .on( 'show.daterangepicker' , $.proxy( this._commonShow , this , 'dateFrom' ) ) 71 | .on( 'showCalendar.daterangepicker' , $.proxy( this._commonShow , this , 'dateFrom' ) ) 72 | 73 | .on( 'hide.daterangepicker' , $.proxy( this._commonHide , this , 'dateFrom' ) ) 74 | .on( 'calendarUpdated.apex' , $.proxy( this._common_calerndarUpdate , this , 'dateFrom' ) ); 75 | 76 | if ( this.options.daterangepicker.showMethod == 'onIconClick' ) { 77 | 78 | this.apex.item 79 | .off( 'click.daterangepicker' ) 80 | .off( 'focus.daterangepicker' ); 81 | 82 | this.apex.datepickerButton.on( 'click' , $.proxy(this._nativeShowPickerOnButtonClick, this) ); 83 | 84 | if ( this.options.pretius.overlay ) { 85 | this.dateTo.datepickerButton.on( 'click' , $.proxy(this._overlay_showPickerOnButtonClick, this) ); 86 | } 87 | 88 | } 89 | else if ( this.options.daterangepicker.showMethod == 'onFocus' ) { 90 | 91 | if ( this.options.pretius.overlay ) { 92 | this.dateTo.item.on( 'focus' , $.proxy( this._overlay_focusOnDateTo, this)); 93 | } 94 | 95 | } 96 | else if ( this.options.daterangepicker.showMethod == 'both' ) { 97 | this.apex.datepickerButton.on( 'click' , $.proxy( this._nativeShowPickerOnButtonClick, this ) ); 98 | 99 | if ( this.options.pretius.overlay ) { 100 | this.dateTo.datepickerButton.on( 'click' , $.proxy( this._overlay_showPickerOnButtonClick , this ) ); 101 | this.dateTo.item .on( 'focus' , $.proxy( this._overlay_focusOnDateTo , this ) ); 102 | } 103 | 104 | } 105 | else { 106 | throw "Unknown this.options.daterangepicker.showMethod = '"+this.options.daterangepicker.showMethod+"'"; 107 | } 108 | 109 | if ( this.options.pretius.overlay ) { 110 | 111 | this.apex.item 112 | .on('apply.daterangepicker' , $.proxy( this._overlayApply, this ) ) 113 | .on('cancel.daterangepicker' , $.proxy( this._overlayCancel, this ) ) 114 | .on('focus' , $.proxy( this._overlayFocus, this ) ) 115 | 116 | this.dateTo.item 117 | .on('show.daterangepicker ' , $.proxy( this._commonShow , this , 'dateTo' ) ) 118 | .on('showCalendar.daterangepicker' , $.proxy( this._commonShow , this , 'dateTo' ) ) 119 | .on('hide.daterangepicker' , $.proxy( this._overlay_dateToHide , this ) ) 120 | .on('hide.daterangepicker' , $.proxy( this._commonHide , this , 'dateTo' ) ) 121 | .on('calendarUpdated.apex' , $.proxy( this._common_calerndarUpdate , this , 'dateTo' ) ); 122 | 123 | this.dateTo.item.data('parentItem', this.apex.item); 124 | this._apex_da( this.dateTo.item ); 125 | 126 | } 127 | else { 128 | this.apex.item 129 | .on('apply.daterangepicker' , $.proxy( this._nativeApply , this ) ) 130 | .on('cancel.daterangepicker', $.proxy( this._nativeCancel , this ) ) 131 | .on('focus.daterangepicker' , $.proxy( this._nativeFocus , this ) ) 132 | } 133 | 134 | this._apex_da( this.apex.item ); 135 | 136 | }, 137 | _destroy: function(){ 138 | 139 | }, 140 | _overlayFocus: function(){ 141 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlayFocus' ); 142 | 143 | var startDate, endDate; 144 | 145 | if ( this.apex.item.val().trim().length == 0 && this.dateTo.item.val().trim().length == 0 ) { 146 | startDate = moment().startOf('day'); 147 | endDate = moment().endOf('day'); 148 | 149 | } 150 | else if ( this.apex.item.val().trim().length > 0 && this.dateTo.item.val().trim().length == 0 ) { 151 | startDate = moment( this.apex.item.val(), this.options.daterangepicker.locale.format ); 152 | endDate = startDate.endOf('day'); 153 | 154 | } 155 | else if ( this.apex.item.val().trim().length == 0 && this.dateTo.item.val().trim().length > 0 ) { 156 | endDate = moment( this.dateTo.item.val(), this.options.daterangepicker.locale.format ); 157 | startDate = endDate.startOf('day'); 158 | 159 | } 160 | else { // >0 > 0 161 | startDate = moment( this.apex.item.val(), this.options.daterangepicker.locale.format ); 162 | endDate = moment( this.dateTo.item.val(), this.options.daterangepicker.locale.format ); 163 | 164 | } 165 | 166 | this.picker.setStartDate( startDate ); 167 | this.picker.setEndDate( endDate ); 168 | 169 | this.picker.updateView(); 170 | 171 | }, 172 | _nativeFocus: function(){ 173 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_nativeFocus' ); 174 | 175 | if ( this.picker.endDate.isValid() == false || this.picker.startDate.isValid() == false) { 176 | this.picker.endDate = moment().startOf('day'); 177 | this.picker.startDate = moment().endOf('day'); 178 | 179 | //this.picker.hide(); 180 | //this.picker.show(); 181 | this.picker.updateView(); 182 | } 183 | }, 184 | // 185 | //------------------------------------------------------------------------------------------------- 186 | // 187 | 188 | _setOption: function( key, value ) { 189 | apex.debug.message( this.C_LOG_LEVEL9, this.logPrefix, '_setOption' ); 190 | 191 | if ( key === "value" ) { 192 | value = this._constrain( value ); 193 | } 194 | 195 | this._super( key, value ); 196 | }, 197 | // 198 | //------------------------------------------------------------------------------------------------- 199 | // 200 | 201 | _setOptions: function( options ) { 202 | apex.debug.message( this.C_LOG_LEVEL9, this.logPrefix, '_setOptions' ); 203 | 204 | options.daterangepicker.minDate = options.daterangepicker.minDate != undefined ? this.getMinMaxDateFromString( options.daterangepicker.minDate ) : undefined; 205 | options.daterangepicker.maxDate = options.daterangepicker.maxDate != undefined ? this.getMinMaxDateFromString( options.daterangepicker.maxDate ) : undefined; 206 | 207 | this._super( options ); 208 | }, 209 | _hasCustomRangeLabel: function(){ 210 | apex.debug.message( this.C_LOG_LEVEL9, this.logPrefix, '_hasCustomRangeLabel' ); 211 | 212 | try { 213 | return this.options.daterangepicker.ranges.Custom === true 214 | } catch(error) { 215 | return false; 216 | } 217 | 218 | }, 219 | 220 | enable: function( elem ){ 221 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'enable' ); 222 | 223 | 224 | 225 | if ( elem.get(0) == this.apex.item.get(0) ) { 226 | this.apex.item.removeAttr('disabled'); 227 | this.apex.datepickerButton.removeClass('disabled'); 228 | } 229 | else if ( elem.get(0) == this.dateTo.item.get(0) ) { 230 | this.dateTo.item.removeAttr('disabled'); 231 | this.dateTo.datepickerButton.removeClass('disabled'); 232 | } 233 | else { 234 | throw "Unknown item to disable: "+elem.attr('id'); 235 | } 236 | 237 | }, 238 | disable: function( elem ){ 239 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'disable' ); 240 | 241 | if ( elem.get(0) == this.apex.item.get(0) ) { 242 | this.apex.item.prop('disabled', true); 243 | this.apex.datepickerButton.addClass('disabled'); 244 | } 245 | else if ( elem.get(0) == this.dateTo.item.get(0) ) { 246 | this.dateTo.item.prop('disabled', true); 247 | this.dateTo.datepickerButton.addClass('disabled'); 248 | } 249 | else { 250 | throw "Unknown item to disable: "+elem.attr('id'); 251 | } 252 | 253 | }, 254 | setDateRange: function( pDateRange ){ 255 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'setDateRange' ); 256 | 257 | var 258 | dateRange = pDateRange.split( ' - ' ), 259 | dateFrom = dateRange[0], 260 | dateTo = dateRange[1]; 261 | 262 | this.picker.setStartDate( dateFrom ); 263 | this.picker.setEndDate( dateTo ); 264 | 265 | }, 266 | _apex_da: function( daElem ) { 267 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_apex_da' ); 268 | 269 | var 270 | pName = daElem.attr('id'), 271 | pOptions = { 272 | setValue: function( pValue, pDisplayValue ) { 273 | var daItem = $(this.node); 274 | var pluginItem = undefined; 275 | 276 | if ( daItem.data('parentItem') != undefined ) { 277 | //dateTo item 278 | pluginItem = daItem.data('parentItem'); 279 | } 280 | else { 281 | //plugin item 282 | pluginItem = daItem; 283 | } 284 | 285 | if ( pluginItem.apexdaterangepicker('option', 'pretius').overlay == false ) { 286 | daItem.val( pValue ); 287 | pluginItem.apexdaterangepicker('setDateRange', pValue); 288 | } 289 | else { 290 | if ( pValue.trim().length == 0 ) { 291 | daItem.val(""); 292 | } 293 | else { 294 | 295 | if ( /([\+-]{1}\d{1,}[y|m|d|w]{1})/g.test( pValue ) ) { 296 | daItem.val( pluginItem.apexdaterangepicker('calculateMomentFromPattern', pValue, true) ); 297 | } 298 | else { 299 | daItem.val( pValue ); 300 | } 301 | 302 | } 303 | 304 | } 305 | 306 | }, 307 | //Specify a value that to be used to determine if the item is null. 308 | //This is used when the item supports definition of a List of Values, 309 | //where a developer can define a Null Return Value for the item and 310 | //where the default item handling needs to know this in order to assert if the item is null or empty. 311 | nullValue: "", 312 | enable: function() { 313 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'enable' ); 314 | 315 | var 316 | daItem = $(this.node), 317 | pluginItem = undefined; 318 | 319 | if ( daItem.data('parentItem') != undefined ) { 320 | //dateTo item 321 | pluginItem = daItem.data('parentItem'); 322 | } 323 | else { 324 | //plugin item 325 | pluginItem = daItem; 326 | } 327 | 328 | pluginItem.apexdaterangepicker('enable', daItem); 329 | }, 330 | disable: function() { 331 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'disable' ); 332 | 333 | var 334 | daItem = $(this.node), 335 | pluginItem = undefined; 336 | 337 | if ( daItem.data('parentItem') != undefined ) { 338 | //dateTo item 339 | pluginItem = daItem.data('parentItem'); 340 | } 341 | else { 342 | //plugin item 343 | pluginItem = daItem; 344 | } 345 | 346 | pluginItem.apexdaterangepicker('disable', daItem); 347 | }, 348 | afterModify: function(){ 349 | // code to always fire after the item has been modified (value set, enabled, etc.) 350 | }, 351 | loadingIndicator: function( pLoadingIndicator$ ){ 352 | // code to add the loading indicator in the best place for the item 353 | return pLoadingIndicator$; 354 | } 355 | 356 | 357 | /* 358 | //setFocusTo: $( "" ), 359 | setFocusTo: function(){ 360 | 361 | var daItem = $(this.node); 362 | 363 | }, 364 | setStyleTo: $( "" ), 365 | getValue: function() { 366 | 367 | var daItem = $(this.node); 368 | return daItem.val(); 369 | }, 370 | show: function() { 371 | 372 | // code that shows the item type 373 | }, 374 | hide: function() { 375 | 376 | // code that hides the item type 377 | }, 378 | addValue: function( pValue ) { 379 | 380 | // code that adds pValue to the values already in the item type 381 | }, 382 | 383 | */ 384 | 385 | }; 386 | 387 | apex.widget.initPageItem( pName, pOptions); 388 | }, 389 | /* 390 | * 391 | * NATIVE 392 | * 393 | */ 394 | // 395 | //------------------------------------------------------------------------------------------------- 396 | // 397 | 398 | // 399 | //------------------------------------------------------------------------------------------------- 400 | // 401 | 402 | _nativeApply: function(pEvent) { 403 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_nativeApply' ); 404 | 405 | var 406 | format = this.options.daterangepicker.locale.format, 407 | value = this.picker.startDate.format( format ) + ' - ' + this.picker.endDate.format( format ); 408 | 409 | this.element.val( value ).trigger('change'); 410 | }, 411 | // 412 | //------------------------------------------------------------------------------------------------- 413 | // 414 | 415 | _nativeCancel: function(pEvent) { 416 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_nativeCancel' ); 417 | 418 | this.element.val(''); 419 | }, 420 | // 421 | //------------------------------------------------------------------------------------------------- 422 | // 423 | 424 | _nativeShowPickerOnButtonClick: function(){ 425 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_nativeShowPickerOnButtonClick' ); 426 | 427 | if ( this.apex.datepickerButton.is('.disabled') ) { 428 | return false; 429 | } 430 | 431 | this.picker.show(); 432 | }, 433 | 434 | /* 435 | * 436 | * COMMON 437 | * 438 | */ 439 | 440 | // 441 | //------------------------------------------------------------------------------------------------- 442 | // 443 | 444 | _common_hideOtherMonthDays: function(){ 445 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_common_hideOtherMonthDays' ); 446 | 447 | var 448 | leftCalendar = this.picker.container.find('.calendar.left'), 449 | rightCalendar = this.picker.container.find('.calendar.right'), 450 | rightTds, 451 | resultTds, 452 | tr2remove; 453 | resultTds = leftCalendar.find('td.off').filter($.proxy(function(index, elem){ 454 | if ( this._getDateFromCalendar( $(elem), leftCalendar ).month() != this.picker.leftCalendar.month.month() ) { 455 | return true; 456 | } 457 | else { 458 | return false; 459 | } 460 | }, this)); 461 | 462 | resultTds 463 | 464 | if ( this.options.pretius.onlyOneCalendar == false ) { 465 | rightTds = rightCalendar.find('td.off').filter($.proxy(function(index, elem){ 466 | if ( this._getDateFromCalendar( $(elem), rightCalendar ).month() != this.picker.rightCalendar.month.month() ) { 467 | return true; 468 | } 469 | else { 470 | return false; 471 | } 472 | 473 | }, this)); 474 | 475 | resultTds = resultTds.add(rightTds); 476 | } 477 | 478 | resultTds.empty().removeAttr('class').addClass('otherMonth').bind('click mousedown mouseenter mouseleave', function(e){ 479 | e.preventDefault(); 480 | e.stopImmediatePropagation(); 481 | }); 482 | 483 | 484 | 485 | tr2remove = this.picker.container.find('.calendar tr').filter(function( index, elem){ 486 | return $(elem).children('.otherMonth').length == 7 ? true : false; 487 | }); 488 | 489 | tr2remove.remove(); 490 | 491 | }, 492 | // 493 | //------------------------------------------------------------------------------------------------- 494 | // 495 | _common_showMonthsDistance: function(){ 496 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_common_showMonthsDistance' ); 497 | 498 | if ( 499 | this.picker.leftCalendar.month.format('YYYY-MM') == this.picker.rightCalendar.month.format('YYYY-MM') 500 | || this.picker.leftCalendar.month.clone().add(1, 'month').format('YYYY-MM') == this.picker.rightCalendar.month.format('YYYY-MM') 501 | ) { 502 | this.picker.container.removeClass('monthsDiffersMoreThanOne'); 503 | } 504 | else { 505 | this.picker.container.addClass('monthsDiffersMoreThanOne'); 506 | } 507 | }, 508 | _common_calerndarUpdate: function( pTriggeringElement ){ 509 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_common_calerndarUpdate', 'triggeringElement', pTriggeringElement ); 510 | 511 | //replace icons 512 | this.picker.container.find('.next i').removeAttr('class').addClass('ui-icon ui-icon-circle-triangle-e'); 513 | this.picker.container.find('.prev i').removeAttr('class').addClass('ui-icon ui-icon-circle-triangle-w'); 514 | 515 | 516 | if ( this.options.pretius.hideOtherMonthDays ) { 517 | this._common_hideOtherMonthDays(); 518 | } 519 | 520 | if ( 521 | this.options.daterangepicker.linkedCalendars == false 522 | && this.options.pretius.onlyOneCalendar == false 523 | ) { 524 | this._common_showMonthsDistance(); 525 | } 526 | 527 | if ( pTriggeringElement == 'dateTo' && this.options.pretius.altDateToSelect ) { 528 | 529 | if ( this.picker.element == this.dateTo.item ) { 530 | 531 | this.picker.container.find('.dateFrom :input').removeClass('active'); 532 | this.picker.container.find('.dateTo :input').addClass('active'); 533 | 534 | //this.picker.container.find('.calendar').off('mouseenter.daterangepicker'); 535 | this.picker.container.find('.calendar td').not('.week').bind('mouseenter.daterangepicker', $.proxy( this._overlay_updateDateTo_input, this )); 536 | 537 | } 538 | 539 | this.picker.container.find('.calendar td').bind('mousedown.test click.test', $.proxy( this._overlay_dateToShow_forceDateToSelection, this ) ); 540 | 541 | } 542 | }, 543 | 544 | /* 545 | * 546 | * OVERLAY 547 | * 548 | */ 549 | 550 | _overlay_dateToHide: function(){ 551 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_dateToHide' ); 552 | 553 | this.dateTo.item.blur(); 554 | this.picker.element = this.element; 555 | }, 556 | // 557 | //------------------------------------------------------------------------------------------------- 558 | // 559 | _moveRanges: function( ){ 560 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_moveRanges' ); 561 | 562 | var 563 | container = this.picker.container, 564 | left = this.picker.container.find('.calendar.left'), 565 | right = this.picker.container.find('.calendar.right'), 566 | ranges = this.picker.container.find('.ranges'), 567 | bodyWidth = $('body').outerWidth(); 568 | 569 | ranges = ranges.detach(); 570 | 571 | right.after( ranges ); 572 | 573 | }, 574 | _isOneLine: function(){ 575 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_isOneLine' ); 576 | 577 | var 578 | container = this.picker.container, 579 | //te odwolania wypadaloby zmergowac do _create i odwolywac sie do juz istniejacych instancji 580 | left = this.picker.container.find('.calendar.left'), 581 | right = this.picker.container.find('.calendar.right'), 582 | ranges = this.picker.container.find('.ranges'); 583 | 584 | if ( 585 | //pojedynczy i wlaczone ranges 586 | this.options.pretius.onlyOneCalendar == true && this.options.daterangepicker.ranges != undefined && left.offset().top == ranges.offset().top 587 | //pojedynczy i ranges jako pierwsze 588 | || this.options.pretius.onlyOneCalendar == true && this.options.daterangepicker.alwaysShowCalendars == false && !left.is(':visible') 589 | //pojedynczy i wylaczone ranges 590 | || this.options.pretius.onlyOneCalendar == true && this.options.daterangepicker.ranges == undefined 591 | //podwojny i wlaczone ranges 592 | || this.options.pretius.onlyOneCalendar == false && left.offset().top == right.offset().top && left.offset().top == ranges.offset().top 593 | //podwojny i wylaczone ranges 594 | || this.options.pretius.onlyOneCalendar == false && left.offset().top == right.offset().top && this.options.daterangepicker.ranges == undefined 595 | //podwojny i ranges jako pierwsze 596 | || this.options.pretius.onlyOneCalendar == false && this.options.daterangepicker.alwaysShowCalendars == false && !left.is(':visible') && !right.is(':visible') 597 | ){ 598 | return true; 599 | } 600 | else { 601 | return false; 602 | } 603 | }, 604 | fixCalendarPositionVertical: function(){ 605 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'fixCalendarPositionVertical' ); 606 | 607 | //pomocnicze 608 | var fixedNavBarHeight = $('.t-Body-content').length > 0 ? parseInt($('.t-Body-content').css('marginTop')) : 0; 609 | 610 | var item = this.picker.element; 611 | //a offset top item 612 | var itemOffsetTop = item.offset().top - fixedNavBarHeight; 613 | //c ile jest przewinieta strona 614 | var windowScrollHeight = $(window).scrollTop();//$('body').scrollTop(); 615 | //d wysokosc okna przegladarki 616 | var windowHeight = $(window).outerHeight(); 617 | //e wysokosc item 618 | var itemHeight = item.outerHeight(); 619 | //b = a - c // ile zostalo miejsca ponad item 620 | var spaceAboveItem = itemOffsetTop - windowScrollHeight; 621 | //f = d-b-e //ile zostalo miejsca pod item 622 | var spaceBeloweItem = windowHeight - spaceAboveItem - itemHeight; 623 | //g wysokosc kotnenera kalendarzy //jesli 624 | var calendarHeight = this.picker.container.outerHeight(); 625 | //i offset top kalendarzy 626 | var calendarOffsetTop = this.picker.container.offset().top; 627 | //h = i - c //ile zostalo miejsca nad kalendarzem 628 | var spaceAboceCalendar = calendarOffsetTop - windowScrollHeight; 629 | //j jesli wiekszy od zera to wystaje powyzej 630 | var calendarOverflowAboveHeight = windowScrollHeight - calendarOffsetTop; 631 | //jesli wiekszy od zera to wystaje ponizej 632 | var calendarOverflowBelowHeight = (calendarHeight + calendarOffsetTop) - (windowScrollHeight + windowHeight); 633 | 634 | if ( calendarOverflowAboveHeight >= 0 ) { 635 | //always drop down if calendar is cut from above 636 | this.picker.container.removeClass('dropup'); 637 | this.picker.drops = 'down'; 638 | this.picker.move(); 639 | } 640 | else if ( calendarOverflowBelowHeight >= 0 ) { 641 | //cut from down 642 | if ( spaceAboveItem >= calendarHeight ) { 643 | this.picker.container.addClass('dropup'); 644 | this.picker.drops = 'up'; 645 | this.picker.move(); 646 | } 647 | else { 648 | //there is no space above, scroll the broswer 649 | null; 650 | } 651 | } 652 | }, 653 | fixCalendarPositionHorizontal: function(){ 654 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'fixCalendarPositionHorizontal' ); 655 | 656 | var 657 | opens = this.picker.opens, 658 | openerOffset = this.picker.element.offset(); 659 | 660 | if ( this._isOneLine() == false && !this.picker.container.is('.forceOneColumn')) { 661 | //when calendars and ranges are not in the same line; 662 | //right --> left --> center --> force one column 663 | //left --> right --> center --> force one column 664 | //center --> right --> left --> force one column 665 | 666 | if ( this.orginal.opens == 'right' ) { 667 | //when popup should be opened in right position 668 | if ( opens == 'right' ) { 669 | this.picker.container.removeClass('opensright').addClass('opensleft'); 670 | this.picker.opens = 'left'; 671 | this.picker.move(); 672 | } 673 | else if ( opens == 'left' ) { 674 | this.picker.container.removeClass('opensleft').addClass('opensleft'); 675 | this.picker.opens = 'center'; 676 | this.picker.move(); 677 | } 678 | else { 679 | this.picker.container.addClass('forceOneColumn') 680 | } 681 | } 682 | else if ( this.orginal.opens == 'left' ) { 683 | //when popup should be opened in left position 684 | if ( opens == 'left' ) { 685 | this.picker.container.removeClass('opensleft').addClass('opensright'); 686 | this.picker.opens = 'right'; 687 | this.picker.move(); 688 | } 689 | else if ( opens == 'right' ) { 690 | this.picker.container.removeClass('opensright').addClass('openscenter'); 691 | this.picker.opens = 'center'; 692 | this.picker.move(); 693 | } 694 | else { 695 | this.picker.container.addClass('forceOneColumn') 696 | } 697 | } 698 | else { 699 | //when popup should be opened in center position 700 | if ( opens == 'center' ) { 701 | this.picker.container.removeClass('openscenter').addClass('opensright'); 702 | this.picker.opens = 'right'; 703 | this.picker.move(); 704 | } 705 | else if ( opens == 'right' ) { 706 | this.picker.container.removeClass('opensright').addClass('opensleft'); 707 | this.picker.opens = 'left'; 708 | this.picker.move(); 709 | } 710 | else { 711 | this.picker.container.addClass('forceOneColumn') 712 | } 713 | 714 | } 715 | 716 | this.fixCalendarPositionHorizontal(); 717 | 718 | } 719 | else { 720 | //exception for right/center position 721 | if ( 722 | this.orginal.opens == 'right' && parseInt( this.picker.container.css('right') ) == 0 723 | || this.orginal.opens == 'center' && parseInt( this.picker.container.css('right') ) == 0 724 | ) { 725 | 726 | this.picker.container.removeClass('opensright openscenter').addClass('opensleft'); 727 | this.picker.opens = 'left'; 728 | this.picker.move(); 729 | this.fixCalendarPositionHorizontal(); 730 | return; 731 | } 732 | 733 | this.picker.move(); 734 | } 735 | 736 | }, 737 | _commonHide: function() { 738 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_commonHide' ); 739 | 740 | this.picker.drops = this.orginal.drops; 741 | this.picker.opens = this.orginal.opens; 742 | this.picker.container.removeClass('forceOneColumn'); 743 | 744 | }, 745 | _commonShow: function(){ 746 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_commonShow' ); 747 | 748 | var rightInput = this.picker.container.find('.calendar.right .daterangepicker_input').addClass('dateTo'); 749 | var leftInput = this.picker.container.find('.calendar.left .daterangepicker_input').addClass('dateFrom'); 750 | 751 | this._moveRanges(); 752 | 753 | if ( this.options.pretius.onlyOneCalendar ) { 754 | this.picker.container.removeClass('hideRightCalendar ').addClass( 'hideRightCalendar' ); 755 | 756 | rightInput.detach(); 757 | rightInput.insertAfter( leftInput ); 758 | } 759 | 760 | if ( this.options.daterangepicker.autoApply ) { 761 | this.picker.container.addClass('hasAutoApply'); 762 | } 763 | 764 | if ( this.options.daterangepicker.showWeekNumbers ) { 765 | this.picker.container.addClass('hasShowWeekNumbers'); 766 | } 767 | 768 | if ( this.options.daterangepicker.ranges ) { 769 | this.picker.container.addClass('hasRanges'); 770 | } 771 | 772 | if ( this.options.pretius.hideCalendarDateInputs ) { 773 | this.picker.container.addClass('hideCalendarDateInputs'); 774 | } 775 | 776 | this.fixCalendarPositionHorizontal(); 777 | this.fixCalendarPositionVertical(); 778 | 779 | 780 | 781 | }, 782 | 783 | // 784 | //------------------------------------------------------------------------------------------------- 785 | // 786 | _overlay_showPickerOnButtonClick: function(){ 787 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_showPickerOnButtonClick' ); 788 | 789 | if ( this.dateTo.datepickerButton.is('.disabled') ) { 790 | return false; 791 | } 792 | 793 | this._overlay_focusOnDateTo(); 794 | }, 795 | 796 | // 797 | //------------------------------------------------------------------------------------------------- 798 | // 799 | _overlay_focusOnDateTo: function(){ 800 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_focusOnDateTo' ); 801 | 802 | 803 | var 804 | targetEndDate, 805 | targetStartDate; 806 | 807 | //jesli data od jest pusta 808 | if ( this.element.val().trim().length == 0 ) { 809 | //wymus pokazanie najpierw daty od 810 | //this.picker.show(); 811 | this.picker.startDate = moment().startOf('day'); 812 | this.apex.item.focus(); 813 | } 814 | //jesli data od nie jest pusta 815 | else { 816 | this.picker.element = this.dateTo.item; 817 | this.picker.show(); 818 | 819 | targetStartDate = this.getMomentFromStringLocaleFormat( this.element.val() ); 820 | targetEndDate = this.getMomentFromStringLocaleFormat( this.dateTo.item.val().trim().length == 0 ? this.element.val() : this.dateTo.item.val() ); 821 | 822 | this.picker.setStartDate( targetStartDate ); 823 | this.picker.setEndDate( targetEndDate ); 824 | //this.picker.updateView(); 825 | 826 | this._updateCalendarView( targetStartDate, targetEndDate ); 827 | 828 | 829 | } 830 | }, 831 | 832 | // 833 | //------------------------------------------------------------------------------------------------- 834 | // 835 | _updateCalendarView: function( pTargetStartDate, pTargetEndDate ) { 836 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_updateCalendarView', 'parameters('+arguments.length+')' ); 837 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_updateCalendarView', 'pTargetStartDate', pTargetStartDate ); 838 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_updateCalendarView', 'pTargetEndDate', pTargetEndDate ); 839 | 840 | 841 | if ( this.options.pretius.onlyOneCalendar ) { 842 | //when using only one calendar 843 | this.picker.leftCalendar.month.set( 'year', pTargetEndDate.year() ); 844 | this.picker.leftCalendar.month.set( 'month', pTargetEndDate.month() ); 845 | } 846 | else { 847 | //when using two calendars 848 | if ( this.options.daterangepicker.linkedCalendars ) { 849 | //when calendars are linked 850 | if ( 851 | pTargetStartDate.month() == pTargetEndDate.month() 852 | && pTargetStartDate.year() == pTargetEndDate.year() 853 | ) { 854 | //when start and end date are in the same month 855 | this.picker.leftCalendar.month.set('year', pTargetEndDate.clone().year() ) 856 | this.picker.leftCalendar.month.set('month', pTargetEndDate.clone().month() ) 857 | 858 | this.picker.rightCalendar.month.set('year', pTargetEndDate.clone().add(1, 'month').year() ) 859 | this.picker.rightCalendar.month.set('month', pTargetEndDate.clone().add(1, 'month').month() ) 860 | 861 | } 862 | else { 863 | //when start and and date are in different months 864 | this.picker.leftCalendar.month.set('year', pTargetEndDate.clone().subtract(1, 'month').year() ) 865 | this.picker.leftCalendar.month.set('month', pTargetEndDate.clone().subtract(1, 'month').month() ) 866 | 867 | this.picker.rightCalendar.month.set('year', pTargetEndDate.year() ) 868 | this.picker.rightCalendar.month.set('month', pTargetEndDate.month() ) 869 | } 870 | } 871 | else { 872 | //when calendars are not linked 873 | 874 | if ( 875 | pTargetStartDate.month() == pTargetEndDate.month() 876 | && pTargetStartDate.year() == pTargetEndDate.year() 877 | ) { 878 | //when start and end date are in the same month 879 | this.picker.leftCalendar.month.set('year', pTargetEndDate.clone().year() ) 880 | this.picker.leftCalendar.month.set('month', pTargetEndDate.clone().month() ) 881 | 882 | this.picker.rightCalendar.month.set('year', pTargetEndDate.clone().add(1, 'month').year() ) 883 | this.picker.rightCalendar.month.set('month', pTargetEndDate.clone().add(1, 'month').month() ) 884 | 885 | } 886 | else { 887 | //when start and and date are in different months 888 | this.picker.leftCalendar.month.set('year', pTargetStartDate.year() ) 889 | this.picker.leftCalendar.month.set('month', pTargetStartDate.month() ) 890 | 891 | this.picker.rightCalendar.month.set('year', pTargetEndDate.year() ) 892 | this.picker.rightCalendar.month.set('month', pTargetEndDate.month() ) 893 | 894 | } 895 | 896 | } 897 | } 898 | 899 | this.picker.renderCalendar('left'); 900 | this.picker.renderCalendar('right'); 901 | 902 | }, 903 | 904 | // 905 | //------------------------------------------------------------------------------------------------- 906 | // 907 | _overlay_updateDateTo_input: function( pEvent ) { 908 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_updateDateTo_input', 'pEvent', pEvent ); 909 | 910 | var 911 | date = this._getDateFromCalendar( $(pEvent.target) ), 912 | format = this.options.daterangepicker.locale.format; 913 | 914 | this.picker.container.find('.dateTo :input').val( date.format( format ) ); 915 | 916 | pEvent.preventDefault(); 917 | pEvent.stopImmediatePropagation(); 918 | 919 | }, 920 | _overlay_dateToShow_forceDateToSelection: function( pEvent ){ 921 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_dateToShow_forceDateToSelection', 'pEvent', pEvent ); 922 | 923 | var 924 | targetStartDate = this.getMomentFromStringLocaleFormat( this.element.val() ), 925 | targetEndDate = this._getDateFromCalendar( $(pEvent.target) ); 926 | 927 | pEvent.preventDefault(); 928 | pEvent.stopImmediatePropagation(); 929 | 930 | if ( targetEndDate.isBefore( targetStartDate ) ) { 931 | //workaround at the moment. Should be changed in next versions 932 | $(pEvent.target).addClass('odd disabled'); 933 | return; 934 | } 935 | else { 936 | apex.debug.message( this.C_LOG_WARNING, this.logPrefix, 'Selected date is after current date', 'pEvent', pEvent ); 937 | } 938 | 939 | this.picker.setStartDate( targetStartDate ); 940 | this.picker.setEndDate( targetEndDate ); 941 | 942 | this._updateCalendarView( targetStartDate, targetEndDate ); 943 | 944 | this.picker.renderCalendar('left'); 945 | this.picker.renderCalendar('right'); 946 | 947 | this.picker.container.find('.calendar td').not('.week') 948 | .bind( 'mousedown.test click.test' , $.proxy( this._overlay_dateToShow_forceDateToSelection , this ) ) 949 | .bind( 'mouseenter.daterangepicker' , $.proxy( this._overlay_updateDateTo_input , this ) ); 950 | 951 | if ( this.options.daterangepicker.autoApply ) { 952 | this.picker.calculateChosenLabel(); 953 | this.picker.clickApply(); 954 | } 955 | }, 956 | 957 | // 958 | //------------------------------------------------------------------------------------------------- 959 | // 960 | _overlayApply: function(pEvent) { 961 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, '_overlayApply', 'pEvent', pEvent ); 962 | 963 | var 964 | format = this.options.daterangepicker.locale.format; 965 | 966 | this.element.val( this.picker.startDate.format( format ) ).trigger('change'); 967 | this.dateTo.item.val( this.picker.endDate.format( format ) ).trigger('change'); 968 | }, 969 | // 970 | //------------------------------------------------------------------------------------------------- 971 | // 972 | _overlayCancel: function(pEvent) { 973 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, '_overlayCancel', 'pEvent', pEvent ); 974 | // 975 | }, 976 | 977 | // 978 | //------------------------------------------------------------------------------------------------- 979 | // 980 | getMomentFromStringLocaleFormat: function( pString ){ 981 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'getMomentFromStringLocaleFormat', 'pString', pString ); 982 | 983 | return moment( pString , this.options.daterangepicker.locale.format ); 984 | }, 985 | 986 | _getDateFromCalendar: function( pElem, pCalendar ) { 987 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_getDateFromCalendar', 'parameters = "'+arguments.length+'"'); 988 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_getDateFromCalendar', 'pElem', pElem); 989 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_getDateFromCalendar', 'pCalendar', pCalendar); 990 | 991 | var 992 | tdClicked = pElem, 993 | title = tdClicked.attr('data-title'), 994 | row = title.substr(1, 1), 995 | col = title.substr(3, 1), 996 | cal = pCalendar == undefined ? tdClicked.parents('.calendar') : pCalendar, 997 | date = cal.hasClass('left') ? this.picker.leftCalendar.calendar[row][col] : this.picker.rightCalendar.calendar[row][col]; 998 | 999 | return date.clone(); 1000 | }, 1001 | 1002 | getMinMaxDateFromString: function( pStringToDate ){ 1003 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'getMinMaxDateFromString', 'pStringToDate', pStringToDate); 1004 | 1005 | var formatedDate; 1006 | 1007 | if ( pStringToDate == 'today' ) { 1008 | formatedDate = moment(); 1009 | } 1010 | else if ( /\d{4}-\d{2}-\d{2}/.test( pStringToDate ) ) { 1011 | formatedDate = moment( pStringToDate, 'YYYY-MM-DD' ); 1012 | } 1013 | else { 1014 | formatedDate = this.calculateMomentFromPattern( pStringToDate ); 1015 | } 1016 | 1017 | return formatedDate; 1018 | }, 1019 | 1020 | calculateMomentFromPattern: function( pString, pReturnInFormat ) { 1021 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'calculateMomentFromPattern', 'parameters="'+arguments.length+'"'); 1022 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'calculateMomentFromPattern', 'pString', pString); 1023 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'calculateMomentFromPattern', 'pReturnInFormat', pReturnInFormat); 1024 | 1025 | var 1026 | re = /([\+-]{1}\d{1,}[y|m|d|w]{1})/g, 1027 | matches, 1028 | matched = [], 1029 | destDate = moment().startOf('day'), 1030 | expression, 1031 | operation, 1032 | howMany, 1033 | unit; 1034 | 1035 | while ((matches = re.exec(pString)) != null) { 1036 | matched.push(matches[1]); 1037 | } 1038 | 1039 | for ( var i = 0; i < matched.length; i++) { 1040 | expression = matched[i]; 1041 | operation = expression.substr(0, 1), 1042 | howMany = parseInt( expression.substr(1, expression.length) ), 1043 | unit = expression.substr(-1, expression.length); 1044 | 1045 | if ( unit == 'm' ) { 1046 | unit = 'M'; 1047 | } 1048 | 1049 | if ( operation == '+' ) { 1050 | destDate.add( howMany, unit ); 1051 | }else { 1052 | destDate.subtract( howMany, unit ); 1053 | } 1054 | } 1055 | 1056 | if ( pReturnInFormat == false || pReturnInFormat == undefined ) { 1057 | return destDate; 1058 | } 1059 | else { 1060 | return destDate.format( this.options.daterangepicker.locale.format ) 1061 | } 1062 | 1063 | }, 1064 | // 1065 | //-----------------------DO UTYLIZACJI 1066 | // 1067 | 1068 | 1069 | }); -------------------------------------------------------------------------------- /src/PRETIUS_APEX_DATE_RANGE.plb: -------------------------------------------------------------------------------- 1 | create or replace package body PRETIUS_APEX_DATE_RANGE as 2 | 3 | function formatExceptions( 4 | pi_format in varchar2, 5 | pi_mode in varchar2 default 'decode' 6 | ) return varchar2 is 7 | v_temp_format varchar2(200); 8 | begin 9 | v_temp_format := pi_format; 10 | 11 | if pi_mode = 'encode' then 12 | v_temp_format := replace( v_temp_format, 'fmMonth', 'fmM0nth'); --fmMonth nie ma sensu 13 | v_temp_format := replace( v_temp_format, 'fmDD', 'fm0AY' ); 14 | v_temp_format := replace( v_temp_format, 'fmDay', 'fm0ay' ); --tu nie ma sensu fm, usunac? 15 | v_temp_format := replace( v_temp_format, 'DD', '0AY' ); 16 | v_temp_format := replace( v_temp_format, 'MONTH', 'M@ONTH' ); 17 | v_temp_format := replace( v_temp_format, 'HH24', 'H@H24' ); 18 | else 19 | v_temp_format := replace( v_temp_format, 'fmM0nth', 'fmMonth'); 20 | v_temp_format := replace( v_temp_format, 'fm0ay', 'fmDay' ); 21 | v_temp_format := replace( v_temp_format, 'fm0AY', 'fmDD' ); 22 | v_temp_format := replace( v_temp_format, '0AY', 'DD' ); 23 | v_temp_format := replace( v_temp_format, 'M@ONTH', 'MONTH' ); 24 | v_temp_format := replace( v_temp_format, 'H@H24', 'HH24' ); 25 | end if; 26 | 27 | return v_temp_format; 28 | end; 29 | 30 | function translateOracleJs( 31 | pi_format in varchar2 32 | ) return varchar2 is 33 | v_temp_format varchar2(200); 34 | begin 35 | --encode exceptions 36 | v_temp_format := formatExceptions( pi_format, 'encode' ); 37 | 38 | v_temp_format := replace( v_temp_format, 'DAY', 'dddd' ); --MON -> Mon 39 | v_temp_format := replace( v_temp_format, 'Day', 'dddd' ); --Mon -> Mon 40 | v_temp_format := replace( v_temp_format, 'HH24', 'HH' ); 41 | v_temp_format := replace( v_temp_format, 'HH12', 'hh' ); 42 | v_temp_format := replace( v_temp_format, 'HH', 'hh' ); 43 | v_temp_format := replace( v_temp_format, 'MI', 'mm' ); 44 | v_temp_format := replace( v_temp_format, 'SS', 'ss' ); 45 | v_temp_format := replace( v_temp_format, 'fmMM', 'M' ); 46 | v_temp_format := replace( v_temp_format, 'MM', 'MM' ); 47 | v_temp_format := replace( v_temp_format, 'WW', 'w' ); 48 | v_temp_format := replace( v_temp_format, 'IW', 'W' ); 49 | v_temp_format := replace( v_temp_format, 'DAY', 'dd' ); 50 | v_temp_format := replace( v_temp_format, 'D', 'E' ); 51 | v_temp_format := replace( v_temp_format, 'AM', 'A' ); 52 | v_temp_format := replace( v_temp_format, 'PM', 'A' ); 53 | v_temp_format := replace( v_temp_format, 'RR', 'YY' ); 54 | v_temp_format := replace( v_temp_format, 'yy', 'YY' ); 55 | v_temp_format := replace( v_temp_format, 'mm', 'MM' ); 56 | 57 | --restore exceptions 58 | v_temp_format := formatExceptions( v_temp_format, 'decode' ); 59 | 60 | --decode exceptions 61 | --v_temp_format := replace( v_temp_format, 'DD', 'DD' ); 62 | v_temp_format := replace( v_temp_format, 'MONTH', 'MMMM' ); --JANUARY -> January 63 | v_temp_format := replace( v_temp_format, 'fmMonth', 'MMMM' ); --January -> January 64 | v_temp_format := replace( v_temp_format, 'Month', 'MMMM' ); --January -> January 65 | v_temp_format := replace( v_temp_format, 'MON', 'MMM' ); --JAN -> Jan 66 | v_temp_format := replace( v_temp_format, 'Mon', 'MMM' ); --Jan -> Jan 67 | v_temp_format := replace( v_temp_format, 'HH24', 'HH' ); 68 | v_temp_format := replace( v_temp_format, 'fmDD', 'D' ); 69 | v_temp_format := replace( v_temp_format, 'fmDay', 'dddd' ); 70 | 71 | --moment.js don't support "\" as separator 72 | --it should be treated as "text" and because of that line below is needed 73 | v_temp_format := replace( v_temp_format, '\', '[\]' ); 74 | 75 | return v_temp_format; 76 | end; 77 | 78 | function getTranslation( 79 | pi_lang_text in varchar2, 80 | pi_plugin_default in varchar2 81 | ) return varchar2 82 | is 83 | begin 84 | return replace( APEX_LANG.MESSAGE( pi_lang_text ), pi_lang_text, pi_plugin_default ); 85 | end; 86 | 87 | procedure json_write_array( 88 | pi_array_string in varchar2, 89 | pi_separator in varchar2 default ',' 90 | ) 91 | is 92 | v_array APEX_APPLICATION_GLOBAL.VC_ARR2; 93 | v_result_array_elements varchar2(4000); 94 | 95 | begin 96 | v_array := APEX_UTIL.STRING_TO_TABLE(pi_array_string, ','); 97 | 98 | for i in 1..v_array.count LOOP 99 | apex_json.write( v_array(i) ); 100 | end loop; 101 | end; 102 | 103 | function getJSON( 104 | p_item in apex_plugin.t_page_item, 105 | p_plugin in apex_plugin.t_plugin 106 | ) return clob 107 | is 108 | --translateable 109 | lang_month_names varchar2(4000) := getTranslation('PRETIUS_DATERANGEPICKER_MONTHS' , 'January,February,March,April,May,June,July,August,September,October,November,December'); 110 | lang_app_days_of_week varchar2(200) := getTranslation('PRETIUS_DATERANGEPICKER_DAYS' , 'Su,Mo,Tu,We,Th,Fr,Sa'); 111 | lang_apply_label varchar2(50) := getTranslation('PRETIUS_DATERANGEPICKER_APPLYLABEL' , 'Apply'); 112 | lang_cancel_label varchar2(50) := getTranslation('PRETIUS_DATERANGEPICKER_CANCELLABEL' , 'Cancel'); 113 | lang_app_custom_range_label varchar2(100) := getTranslation('PRETIUS_DATERANGEPICKER_CUSTOM_RANGE' , 'Custom'); 114 | lang_app_week_label varchar2(10) := getTranslation('PRETIUS_DATERANGEPICKER_WEEK_LABEL' , 'W'); 115 | 116 | --plugin application scope attributes 117 | --JavaScript uses index starting from 0, and PL/SQL from 1 118 | attr_app_first_day number := p_plugin.attribute_03-1; 119 | attr_app_btn_class varchar2(100) := p_plugin.attribute_04; 120 | attr_app_btn_apply_class varchar2(100) := p_plugin.attribute_05; 121 | attr_app_btn_cancel_class varchar2(100) := p_plugin.attribute_06; 122 | 123 | --plugin custom attributes 124 | attr_mode varchar2(5) := p_item.attribute_01; 125 | -- p_item.attribute_02; 126 | -- p_item.attribute_03; 127 | attr_min_date varchar2(200) := p_item.attribute_04; 128 | attr_max_date varchar2(200) := p_item.attribute_05; 129 | attr_settings varchar2(4000) := p_item.attribute_06; 130 | attr_display_options varchar2(2) := p_item.attribute_07; 131 | attr_date_limit number := p_item.attribute_08; 132 | 133 | attr_appearance varchar2(4000) := p_item.attribute_10; 134 | -- p_item.attribute_11; 135 | -- p_item.attribute_12; 136 | -- p_item.attribute_13; 137 | attr_dateto_item varchar2(200) := APEX_PLUGIN_UTIL.PAGE_ITEM_NAMES_TO_JQUERY( p_item.attribute_14 ); 138 | attr_showMethod varchar2(15) := p_item.attribute_15; 139 | 140 | --do wywalenia, zastapione bedzie przez atrybut 1 141 | attr_settings_altDateToSelect boolean := case when attr_mode = 'PDPA' then true else false end; 142 | attr_settings_overlay boolean := case when instr(attr_mode, 'PDP') > 0 then true else false end; 143 | -- 144 | 145 | attr_settings_autoApply boolean := case when instr(attr_settings, 'autoApply') > 0 then true else false end; 146 | attr_settings_ranges boolean := case when instr(attr_settings, 'ranges') > 0 then true else false end; 147 | 148 | --wyglad 149 | attr_look_dropdowns boolean := case when instr(attr_appearance, 'showDropdowns') > 0 then true else false end; 150 | attr_look_isoWeeks boolean := case when instr(attr_appearance, 'showISOWeekNumbers') > 0 then true else false end; 151 | attr_look_weekNumber boolean := case when instr(attr_appearance, 'showWeekNumbers') > 0 then true else false end; 152 | attr_look_linkedCalendards boolean := case when instr(attr_appearance, 'linkedCalendars') > 0 then true else false end; 153 | attr_look_showCalendars boolean := case when instr(attr_appearance, 'alwaysShowCalendars') > 0 then false else true end; 154 | attr_look_onlyOneCalendar boolean := case when instr(attr_appearance, 'onlyOneCalendar') > 0 then true else false end; 155 | attr_look_showDateInputs boolean := case when instr(attr_appearance, 'hideCalendarDateInputs') > 0 then false else true end; 156 | attr_look_showOtherDays boolean := case when instr(attr_appearance, 'hideOtherMonthDays') > 0 then false else true end; 157 | 158 | 159 | attr_display_options_opens varchar2(9) := case when instr( attr_display_options, 'R' ) > 0 then 'right' when instr( attr_display_options, 'C' ) > 0 then 'center' else 'left' end; 160 | attr_display_options_drops varchar2(9) := case when instr( attr_display_options, 'U' ) > 0 then 'up' else 'down' end; 161 | 162 | attr_date_format varchar2(100) := NVL(p_item.format_mask, 'YYYY-MM-DD'); 163 | attr_date_format_timePicker boolean := case when instr(attr_date_format, 'HH') > 0 then true else false end; 164 | attr_date_format_timePicker24 boolean := case when instr(attr_date_format, 'HH24') > 0 then true else false end; 165 | attr_date_format_timePickerSS boolean := case when instr(attr_date_format, 'SS') > 0 then true else false end; 166 | 167 | v_json clob; 168 | begin 169 | --utworz obiekt 170 | apex_json.initialize_clob_output; 171 | apex_json.open_object(); 172 | apex_json.open_object('pretius'); 173 | apex_json.write( 'overlay', attr_settings_overlay ); 174 | apex_json.write( 'dateToItem', attr_dateto_item ); 175 | apex_json.write( 'applyRanges', attr_settings_ranges ); 176 | apex_json.write( 'onlyOneCalendar', attr_look_onlyOneCalendar ); 177 | apex_json.write( 'hideCalendarDateInputs', attr_look_showDateInputs ); 178 | apex_json.write( 'hideOtherMonthDays', attr_look_showOtherDays ); 179 | apex_json.write( 'altDateToSelect', attr_settings_altDateToSelect ); 180 | 181 | --apex_json.write( 'dateFromItem', v_jquery_base_item ); 182 | apex_json.close_object; --apex 183 | 184 | apex_json.open_object('daterangepicker'); 185 | --apex_json.write( 'startDate', ); 186 | --apex_json.write( 'endDate', ); 187 | apex_json.write( 'alwaysShowCalendars', attr_look_showCalendars ); 188 | apex_json.write( 'autoApply', attr_settings_autoApply ); 189 | apex_json.write( 'autoUpdateInput', false ); 190 | apex_json.write( 'applyClass', attr_app_btn_apply_class ); 191 | apex_json.write( 'buttonClasses', attr_app_btn_class ); 192 | apex_json.write( 'cancelClass', attr_app_btn_cancel_class ); 193 | apex_json.write( 'drops', attr_display_options_drops ); 194 | apex_json.write( 'linkedCalendars', attr_look_linkedCalendards ); 195 | apex_json.write( 'minDate', attr_min_date ); 196 | apex_json.write( 'maxDate', attr_max_date ); 197 | apex_json.write( 'opens', attr_display_options_opens ); 198 | apex_json.write( 'singleDatePicker', false ); 199 | apex_json.write( 'showMethod', attr_showMethod ); 200 | apex_json.write( 'showDropdowns', attr_look_dropdowns ); 201 | 202 | apex_json.write( 'showWeekNumbers', attr_look_weekNumber ); 203 | apex_json.write( 'showISOWeekNumbers', attr_look_isoWeeks ); 204 | 205 | --timepicker to be dont as application component 206 | apex_json.write( 'timePicker', attr_date_format_timePicker ); 207 | apex_json.write( 'timePicker24Hour', attr_date_format_timePicker24 ); 208 | apex_json.write( 'timePickerSeconds', attr_date_format_timePickerSS ); 209 | apex_json.write( 'showCustomRangeLabel', false ); 210 | 211 | apex_json.open_object('locale'); 212 | apex_json.write( 'applyLabel', lang_apply_label ); 213 | apex_json.write( 'cancelLabel', lang_cancel_label ); 214 | apex_json.write( 'customRangeLabel', lang_app_custom_range_label); 215 | apex_json.open_array('daysOfWeek'); 216 | json_write_array( lang_app_days_of_week ); 217 | apex_json.close_array; 218 | apex_json.write( 'firstDay', attr_app_first_day); 219 | apex_json.write( 'format', translateOracleJs( attr_date_format ) ); 220 | --js reference not exists 221 | apex_json.write( 'fromLabel', 'From' ); 222 | --js reference not exists 223 | apex_json.write( 'toLabel', 'To' ); 224 | apex_json.open_array('monthNames'); 225 | json_write_array( lang_month_names ); 226 | apex_json.close_array; 227 | apex_json.write( 'weekLabel', lang_app_week_label ); 228 | apex_json.close_object; 229 | 230 | --if maximum no of days is limited 231 | if instr(attr_settings, 'dateLimit') > 0 then 232 | apex_json.open_object('dateLimit'); 233 | apex_json.write( 'days', attr_date_limit ); 234 | apex_json.close_object; 235 | end if; 236 | 237 | apex_json.close_object; --daterangepicker 238 | apex_json.close_object; 239 | 240 | v_json := apex_json.get_clob_output; 241 | 242 | apex_json.free_output; 243 | 244 | return v_json; 245 | end; 246 | 247 | procedure render_daterange ( 248 | p_item in apex_plugin.t_item, 249 | p_plugin in apex_plugin.t_plugin, 250 | p_param in apex_plugin.t_item_render_param, 251 | p_result in out nocopy apex_plugin.t_item_render_result 252 | ) is 253 | v_escaped_value varchar2(32767) := wwv_flow_escape.html(p_param.value); 254 | attr_ranges varchar2(4000) := case when p_item.attribute_09 is null then '{}' else '{"daterangepicker": {"ranges": '||p_item.attribute_09||'}}' end; 255 | v_jquery_base_item varchar2(200) := APEX_PLUGIN_UTIL.PAGE_ITEM_NAMES_TO_JQUERY(p_item.name); 256 | v_json clob; 257 | begin 258 | 259 | if p_param.value_set_by_controller and p_param.is_readonly then 260 | return; 261 | end if; 262 | 263 | apex_plugin_util.debug_page_item ( 264 | p_plugin => p_plugin, 265 | p_page_item => p_item 266 | ); 267 | 268 | if p_param.is_readonly or p_param.is_printer_friendly then 269 | 270 | APEX_PLUGIN_UTIL.print_hidden_if_readonly ( 271 | p_item => p_item, 272 | p_param => p_param 273 | ); 274 | 275 | wwv_flow_plugin_util.print_display_only ( 276 | p_item => p_item, 277 | p_display_value => p_param.value, 278 | p_show_line_breaks => false, 279 | p_escape => true 280 | ); 281 | else 282 | 283 | htp.p(' 284 | p_item, 289 | p_name => apex_plugin.get_input_name_for_page_item(p_is_multi_value => false), 290 | p_default_class => 'text_field apex-item-text pretius_date_range', 291 | p_add_id => true, 292 | p_add_labelledby => true 293 | )|| 294 | 295 | 'size="'||p_item.element_width||'" '|| 296 | 'maxlength="'||p_item.element_max_length||'" '|| 297 | --'value="'||htf.escape_sc(p_value)||'">'|| 298 | 'value="'||v_escaped_value||'">'|| 299 | ' 302 | '); 303 | 304 | --tbd 305 | --p_result.is_navigable := true; 306 | 307 | v_json := getJSON( 308 | p_item => p_item, 309 | p_plugin => p_plugin 310 | ); 311 | 312 | apex_javascript.add_onload_code( 313 | p_code => ' 314 | $("'||v_jquery_base_item||'").apexdaterangepicker('||v_json||', '||attr_ranges||'); 315 | ', 316 | p_key => 'apexdaterangepicker_'||p_item.name 317 | ); 318 | 319 | end if; 320 | 321 | end; 322 | 323 | end; 324 | -------------------------------------------------------------------------------- /src/PRETIUS_APEX_DATE_RANGE.sql: -------------------------------------------------------------------------------- 1 | create or replace package PRETIUS_APEX_DATE_RANGE as 2 | 3 | procedure render_daterange ( 4 | p_item in apex_plugin.t_item, 5 | p_plugin in apex_plugin.t_plugin, 6 | p_param in apex_plugin.t_item_render_param, 7 | p_result in out nocopy apex_plugin.t_item_render_result 8 | ); 9 | 10 | end; 11 | -------------------------------------------------------------------------------- /src/moment.min.js: -------------------------------------------------------------------------------- 1 | //! moment.js 2 | //! version : 2.13.0 3 | //! authors : Tim Wood, Iskren Chernev, Moment.js contributors 4 | //! license : MIT 5 | //! momentjs.com 6 | !function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return fd.apply(null,arguments)}function b(a){fd=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c0)for(c in hd)d=hd[c],e=b[d],m(e)||(a[d]=e);return a}function o(b){n(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),id===!1&&(id=!0,a.updateOffset(this),id=!1)}function p(a){return a instanceof o||null!=a&&null!=a._isAMomentObject}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=q(b)),c}function s(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&r(a[d])!==r(b[d]))&&g++;return g+f}function t(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function u(b,c){var d=!0;return g(function(){return null!=a.deprecationHandler&&a.deprecationHandler(null,b),d&&(t(b+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),d=!1),c.apply(this,arguments)},c)}function v(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),jd[b]||(t(c),jd[b]=!0)}function w(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function x(a){return"[object Object]"===Object.prototype.toString.call(a)}function y(a){var b,c;for(c in a)b=a[c],w(b)?this[c]=b:this["_"+c]=b;this._config=a,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function z(a,b){var c,d=g({},a);for(c in b)f(b,c)&&(x(a[c])&&x(b[c])?(d[c]={},g(d[c],a[c]),g(d[c],b[c])):null!=b[c]?d[c]=b[c]:delete d[c]);return d}function A(a){null!=a&&this.set(a)}function B(a){return a?a.toLowerCase().replace("_","-"):a}function C(a){for(var b,c,d,e,f=0;f0;){if(d=D(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&s(e,c,!0)>=b-1)break;b--}f++}return null}function D(a){var b=null;if(!nd[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=ld._abbr,require("./locale/"+a),E(b)}catch(c){}return nd[a]}function E(a,b){var c;return a&&(c=m(b)?H(a):F(a,b),c&&(ld=c)),ld._abbr}function F(a,b){return null!==b?(b.abbr=a,null!=nd[a]?(v("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),b=z(nd[a]._config,b)):null!=b.parentLocale&&(null!=nd[b.parentLocale]?b=z(nd[b.parentLocale]._config,b):v("parentLocaleUndefined","specified parentLocale is not defined yet")),nd[a]=new A(b),E(a),nd[a]):(delete nd[a],null)}function G(a,b){if(null!=b){var c;null!=nd[a]&&(b=z(nd[a]._config,b)),c=new A(b),c.parentLocale=nd[a],nd[a]=c,E(a)}else null!=nd[a]&&(null!=nd[a].parentLocale?nd[a]=nd[a].parentLocale:null!=nd[a]&&delete nd[a]);return nd[a]}function H(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return ld;if(!c(a)){if(b=D(a))return b;a=[a]}return C(a)}function I(){return kd(nd)}function J(a,b){var c=a.toLowerCase();od[c]=od[c+"s"]=od[b]=a}function K(a){return"string"==typeof a?od[a]||od[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)f(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(b,c){return function(d){return null!=d?(O(this,b,d),a.updateOffset(this,c),this):N(this,b)}}function N(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function O(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function P(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=K(a),w(this[a]))return this[a](b);return this}function Q(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function R(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(sd[a]=e),b&&(sd[b[0]]=function(){return Q(e.apply(this,arguments),b[1],b[2])}),c&&(sd[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function S(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function T(a){var b,c,d=a.match(pd);for(b=0,c=d.length;c>b;b++)sd[d[b]]?d[b]=sd[d[b]]:d[b]=S(d[b]);return function(b){var e,f="";for(e=0;c>e;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}}function U(a,b){return a.isValid()?(b=V(b,a.localeData()),rd[b]=rd[b]||T(b),rd[b](a)):a.localeData().invalidDate()}function V(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(qd.lastIndex=0;d>=0&&qd.test(a);)a=a.replace(qd,c),qd.lastIndex=0,d-=1;return a}function W(a,b,c){Kd[a]=w(b)?b:function(a,d){return a&&c?c:b}}function X(a,b){return f(Kd,a)?Kd[a](b._strict,b._locale):new RegExp(Y(a))}function Y(a){return Z(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function Z(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=r(a)}),c=0;cd;++d)f=h([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=md.call(this._shortMonthsParse,g),-1!==e?e:null):(e=md.call(this._longMonthsParse,g),-1!==e?e:null):"MMM"===b?(e=md.call(this._shortMonthsParse,g),-1!==e?e:(e=md.call(this._longMonthsParse,g),-1!==e?e:null)):(e=md.call(this._longMonthsParse,g),-1!==e?e:(e=md.call(this._shortMonthsParse,g),-1!==e?e:null))}function fa(a,b,c){var d,e,f;if(this._monthsParseExact)return ea.call(this,a,b,c);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function ga(a,b){var c;if(!a.isValid())return a;if("string"==typeof b)if(/^\d+$/.test(b))b=r(b);else if(b=a.localeData().monthsParse(b),"number"!=typeof b)return a;return c=Math.min(a.date(),ba(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ha(b){return null!=b?(ga(this,b),a.updateOffset(this,!0),this):N(this,"Month")}function ia(){return ba(this.year(),this.month())}function ja(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex}function ka(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex}function la(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;12>b;b++)c=h([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(d.sort(a),e.sort(a),f.sort(a),b=0;12>b;b++)d[b]=Z(d[b]),e[b]=Z(e[b]),f[b]=Z(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")}function ma(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[Nd]<0||c[Nd]>11?Nd:c[Od]<1||c[Od]>ba(c[Md],c[Nd])?Od:c[Pd]<0||c[Pd]>24||24===c[Pd]&&(0!==c[Qd]||0!==c[Rd]||0!==c[Sd])?Pd:c[Qd]<0||c[Qd]>59?Qd:c[Rd]<0||c[Rd]>59?Rd:c[Sd]<0||c[Sd]>999?Sd:-1,j(a)._overflowDayOfYear&&(Md>b||b>Od)&&(b=Od),j(a)._overflowWeeks&&-1===b&&(b=Td),j(a)._overflowWeekday&&-1===b&&(b=Ud),j(a).overflow=b),a}function na(a){var b,c,d,e,f,g,h=a._i,i=$d.exec(h)||_d.exec(h);if(i){for(j(a).iso=!0,b=0,c=be.length;c>b;b++)if(be[b][1].exec(i[1])){e=be[b][0],d=be[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=ce.length;c>b;b++)if(ce[b][1].exec(i[3])){f=(i[2]||" ")+ce[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!ae.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),Ca(a)}else a._isValid=!1}function oa(b){var c=de.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(na(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function pa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 100>a&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function qa(a){var b=new Date(Date.UTC.apply(null,arguments));return 100>a&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ra(a){return sa(a)?366:365}function sa(a){return a%4===0&&a%100!==0||a%400===0}function ta(){return sa(this.year())}function ua(a,b,c){var d=7+b-c,e=(7+qa(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return 0>=j?(f=a-1,g=ra(f)+j):j>ra(a)?(f=a+1,g=j-ra(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return 1>g?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(ra(a)-d+e)/7}function ya(a,b,c){return null!=a?a:null!=b?b:c}function za(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function Aa(a){var b,c,d,e,f=[];if(!a._d){for(d=za(a),a._w&&null==a._a[Od]&&null==a._a[Nd]&&Ba(a),a._dayOfYear&&(e=ya(a._a[Md],d[Md]),a._dayOfYear>ra(e)&&(j(a)._overflowDayOfYear=!0),c=qa(e,0,a._dayOfYear),a._a[Nd]=c.getUTCMonth(),a._a[Od]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[Pd]&&0===a._a[Qd]&&0===a._a[Rd]&&0===a._a[Sd]&&(a._nextDay=!0,a._a[Pd]=0),a._d=(a._useUTC?qa:pa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Pd]=24)}}function Ba(a){var b,c,d,e,f,g,h,i;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=ya(b.GG,a._a[Md],wa(Ka(),1,4).year),d=ya(b.W,1),e=ya(b.E,1),(1>e||e>7)&&(i=!0)):(f=a._locale._week.dow,g=a._locale._week.doy,c=ya(b.gg,a._a[Md],wa(Ka(),f,g).year),d=ya(b.w,1),null!=b.d?(e=b.d,(0>e||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f),1>d||d>xa(c,f,g)?j(a)._overflowWeeks=!0:null!=i?j(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[Md]=h.year,a._dayOfYear=h.dayOfYear)}function Ca(b){if(b._f===a.ISO_8601)return void na(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=V(b._f,b._locale).match(pd)||[],c=0;c0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),sd[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),aa(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[Pd]<=12&&b._a[Pd]>0&&(j(b).bigHour=void 0),j(b).parsedDateParts=b._a.slice(0),j(b).meridiem=b._meridiem,b._a[Pd]=Da(b._locale,b._a[Pd],b._meridiem),Aa(b),ma(b)}function Da(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function Ea(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ef)&&(d=f,c=b));g(a,c||b)}function Fa(a){if(!a._d){var b=L(a._i);a._a=e([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),Aa(a)}}function Ga(a){var b=new o(ma(Ha(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Ha(a){var b=a._i,e=a._f;return a._locale=a._locale||H(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),p(b)?new o(ma(b)):(c(e)?Ea(a):e?Ca(a):d(b)?a._d=b:Ia(a),k(a)||(a._d=null),a))}function Ia(b){var f=b._i;void 0===f?b._d=new Date(a.now()):d(f)?b._d=new Date(f.valueOf()):"string"==typeof f?oa(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),Aa(b)):"object"==typeof f?Fa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ja(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,Ga(f)}function Ka(a,b,c,d){return Ja(a,b,c,d,!1)}function La(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Ka();for(d=b[0],e=1;ea&&(a=-a,c="-"),c+Q(~~(a/60),2)+b+Q(~~a%60,2)})}function Ra(a,b){var c=(b||"").match(a)||[],d=c[c.length-1]||[],e=(d+"").match(ie)||["-",0,0],f=+(60*e[1])+r(e[2]);return"+"===e[0]?f:-f}function Sa(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(p(b)||d(b)?b.valueOf():Ka(b).valueOf())-e.valueOf(),e._d.setTime(e._d.valueOf()+f),a.updateOffset(e,!1),e):Ka(b).local()}function Ta(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ua(b,c){var d,e=this._offset||0;return this.isValid()?null!=b?("string"==typeof b?b=Ra(Hd,b):Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ta(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?jb(this,db(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ta(this):null!=b?this:NaN}function Va(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Wa(a){return this.utcOffset(0,a)}function Xa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ta(this),"m")),this}function Ya(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ra(Gd,this._i)),this}function Za(a){return this.isValid()?(a=a?Ka(a).utcOffset():0,(this.utcOffset()-a)%60===0):!1}function $a(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function _a(){if(!m(this._isDSTShifted))return this._isDSTShifted;var a={};if(n(a,this),a=Ha(a),a._a){var b=a._isUTC?h(a._a):Ka(a._a);this._isDSTShifted=this.isValid()&&s(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function ab(){return this.isValid()?!this._isUTC:!1}function bb(){return this.isValid()?this._isUTC:!1}function cb(){return this.isValid()?this._isUTC&&0===this._offset:!1}function db(a,b){var c,d,e,g=a,h=null;return Pa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=je.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:r(h[Od])*c,h:r(h[Pd])*c,m:r(h[Qd])*c,s:r(h[Rd])*c,ms:r(h[Sd])*c}):(h=ke.exec(a))?(c="-"===h[1]?-1:1,g={y:eb(h[2],c),M:eb(h[3],c),w:eb(h[4],c),d:eb(h[5],c),h:eb(h[6],c),m:eb(h[7],c),s:eb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=gb(Ka(g.from),Ka(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Oa(g),Pa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function eb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function fb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function gb(a,b){var c;return a.isValid()&&b.isValid()?(b=Sa(b,a),a.isBefore(b)?c=fb(a,b):(c=fb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function hb(a){return 0>a?-1*Math.round(-1*a):Math.round(a)}function ib(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(v(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=db(c,d),jb(this,e,a),this}}function jb(b,c,d,e){var f=c._milliseconds,g=hb(c._days),h=hb(c._months);b.isValid()&&(e=null==e?!0:e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&O(b,"Date",N(b,"Date")+g*d),h&&ga(b,N(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function kb(a,b){var c=a||Ka(),d=Sa(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse",g=b&&(w(b[f])?b[f]():b[f]);return this.format(g||this.localeData().calendar(f,this,Ka(c)))}function lb(){return new o(this)}function mb(a,b){var c=p(a)?a:Ka(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function ub(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function vb(){var a=this.clone().utc();return 0f&&(b=f),Vb.call(this,a,b,c,d,e))}function Vb(a,b,c,d,e){var f=va(a,b,c,d,e),g=qa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Wb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Xb(a){return wa(a,this._week.dow,this._week.doy).week}function Yb(){return this._week.dow}function Zb(){return this._week.doy}function $b(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function _b(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function ac(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function bc(a,b){return c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]}function cc(a){return this._weekdaysShort[a.day()]}function dc(a){return this._weekdaysMin[a.day()]}function ec(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;7>d;++d)f=h([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=md.call(this._weekdaysParse,g),-1!==e?e:null):"ddd"===b?(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:null):(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null):"dddd"===b?(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null))):"ddd"===b?(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null))):(e=md.call(this._minWeekdaysParse,g),-1!==e?e:(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:null)))}function fc(a,b,c){var d,e,f;if(this._weekdaysParseExact)return ec.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;7>d;d++){if(e=h([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function gc(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=ac(a,this.localeData()),this.add(a-b,"d")):b}function hc(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function ic(a){return this.isValid()?null==a?this.day()||7:this.day(this.day()%7?a:a-7):null!=a?this:NaN}function jc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex}function kc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}function lc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}function mc(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],i=[],j=[],k=[];for(b=0;7>b;b++)c=h([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),i.push(e),j.push(f),k.push(d),k.push(e),k.push(f);for(g.sort(a),i.sort(a),j.sort(a),k.sort(a),b=0;7>b;b++)i[b]=Z(i[b]),j[b]=Z(j[b]),k[b]=Z(k[b]);this._weekdaysRegex=new RegExp("^("+k.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function nc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function oc(){return this.hours()%12||12}function pc(){return this.hours()||24}function qc(a,b){R(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function rc(a,b){return b._meridiemParse}function sc(a){return"p"===(a+"").toLowerCase().charAt(0)}function tc(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function uc(a,b){b[Sd]=r(1e3*("0."+a))}function vc(){return this._isUTC?"UTC":""}function wc(){return this._isUTC?"Coordinated Universal Time":""}function xc(a){return Ka(1e3*a)}function yc(){return Ka.apply(null,arguments).parseZone()}function zc(a,b,c){var d=this._calendar[a];return w(d)?d.call(b,c):d}function Ac(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function Bc(){return this._invalidDate}function Cc(a){return this._ordinal.replace("%d",a)}function Dc(a){return a}function Ec(a,b,c,d){var e=this._relativeTime[c];return w(e)?e(a,b,c,d):e.replace(/%d/i,a)}function Fc(a,b){var c=this._relativeTime[a>0?"future":"past"];return w(c)?c(b):c.replace(/%s/i,b)}function Gc(a,b,c,d){var e=H(),f=h().set(d,b);return e[c](f,a)}function Hc(a,b,c){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return Gc(a,b,c,"month");var d,e=[];for(d=0;12>d;d++)e[d]=Gc(a,d,c,"month");return e}function Ic(a,b,c,d){"boolean"==typeof a?("number"==typeof b&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,"number"==typeof b&&(c=b,b=void 0),b=b||"");var e=H(),f=a?e._week.dow:0;if(null!=c)return Gc(b,(c+f)%7,d,"day");var g,h=[];for(g=0;7>g;g++)h[g]=Gc(b,(g+f)%7,d,"day");return h}function Jc(a,b){return Hc(a,b,"months")}function Kc(a,b){return Hc(a,b,"monthsShort")}function Lc(a,b,c){return Ic(a,b,c,"weekdays")}function Mc(a,b,c){return Ic(a,b,c,"weekdaysShort")}function Nc(a,b,c){return Ic(a,b,c,"weekdaysMin")}function Oc(){var a=this._data;return this._milliseconds=Le(this._milliseconds),this._days=Le(this._days),this._months=Le(this._months),a.milliseconds=Le(a.milliseconds),a.seconds=Le(a.seconds),a.minutes=Le(a.minutes),a.hours=Le(a.hours),a.months=Le(a.months),a.years=Le(a.years),this}function Pc(a,b,c,d){var e=db(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Qc(a,b){return Pc(this,a,b,1)}function Rc(a,b){return Pc(this,a,b,-1)}function Sc(a){return 0>a?Math.floor(a):Math.ceil(a)}function Tc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*Sc(Vc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=q(f/1e3),i.seconds=a%60,b=q(a/60),i.minutes=b%60,c=q(b/60),i.hours=c%24,g+=q(c/24),e=q(Uc(g)),h+=e,g-=Sc(Vc(e)),d=q(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function Uc(a){return 4800*a/146097}function Vc(a){return 146097*a/4800}function Wc(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+Uc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(Vc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function Xc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*r(this._months/12)}function Yc(a){return function(){return this.as(a)}}function Zc(a){ 7 | return a=K(a),this[a+"s"]()}function $c(a){return function(){return this._data[a]}}function _c(){return q(this.days()/7)}function ad(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function bd(a,b,c){var d=db(a).abs(),e=_e(d.as("s")),f=_e(d.as("m")),g=_e(d.as("h")),h=_e(d.as("d")),i=_e(d.as("M")),j=_e(d.as("y")),k=e=f&&["m"]||f=g&&["h"]||g=h&&["d"]||h=i&&["M"]||i=j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,ad.apply(null,k)}function cd(a,b){return void 0===af[a]?!1:void 0===b?af[a]:(af[a]=b,!0)}function dd(a){var b=this.localeData(),c=bd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function ed(){var a,b,c,d=bf(this._milliseconds)/1e3,e=bf(this._days),f=bf(this._months);a=q(d/60),b=q(a/60),d%=60,a%=60,c=q(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var fd,gd;gd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;c>d;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var hd=a.momentProperties=[],id=!1,jd={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var kd;kd=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)f(a,b)&&c.push(b);return c};var ld,md,nd={},od={},pd=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,qd=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,rd={},sd={},td=/\d/,ud=/\d\d/,vd=/\d{3}/,wd=/\d{4}/,xd=/[+-]?\d{6}/,yd=/\d\d?/,zd=/\d\d\d\d?/,Ad=/\d\d\d\d\d\d?/,Bd=/\d{1,3}/,Cd=/\d{1,4}/,Dd=/[+-]?\d{1,6}/,Ed=/\d+/,Fd=/[+-]?\d+/,Gd=/Z|[+-]\d\d:?\d\d/gi,Hd=/Z|[+-]\d\d(?::?\d\d)?/gi,Id=/[+-]?\d+(\.\d{1,3})?/,Jd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Kd={},Ld={},Md=0,Nd=1,Od=2,Pd=3,Qd=4,Rd=5,Sd=6,Td=7,Ud=8;md=Array.prototype.indexOf?Array.prototype.indexOf:function(a){var b;for(b=0;b=a?""+a:"+"+a}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),J("year","y"),W("Y",Fd),W("YY",yd,ud),W("YYYY",Cd,wd),W("YYYYY",Dd,xd),W("YYYYYY",Dd,xd),$(["YYYYY","YYYYYY"],Md),$("YYYY",function(b,c){c[Md]=2===b.length?a.parseTwoDigitYear(b):r(b)}),$("YY",function(b,c){c[Md]=a.parseTwoDigitYear(b)}),$("Y",function(a,b){b[Md]=parseInt(a,10)}),a.parseTwoDigitYear=function(a){return r(a)+(r(a)>68?1900:2e3)};var ee=M("FullYear",!0);a.ISO_8601=function(){};var fe=u("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?this>a?this:a:l()}),ge=u("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:l()}),he=function(){return Date.now?Date.now():+new Date};Qa("Z",":"),Qa("ZZ",""),W("Z",Hd),W("ZZ",Hd),$(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ra(Hd,a)});var ie=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var je=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,ke=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;db.fn=Oa.prototype;var le=ib(1,"add"),me=ib(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ne=u("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Pb("gggg","weekYear"),Pb("ggggg","weekYear"),Pb("GGGG","isoWeekYear"),Pb("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),W("G",Fd),W("g",Fd),W("GG",yd,ud),W("gg",yd,ud),W("GGGG",Cd,wd),W("gggg",Cd,wd),W("GGGGG",Dd,xd),W("ggggg",Dd,xd),_(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=r(a)}),_(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),R("Q",0,"Qo","quarter"),J("quarter","Q"),W("Q",td),$("Q",function(a,b){b[Nd]=3*(r(a)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),W("w",yd),W("ww",yd,ud),W("W",yd),W("WW",yd,ud),_(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=r(a)});var oe={dow:0,doy:6};R("D",["DD",2],"Do","date"),J("date","D"),W("D",yd),W("DD",yd,ud),W("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),$(["D","DD"],Od),$("Do",function(a,b){b[Od]=r(a.match(yd)[0],10)});var pe=M("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),R("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),R("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),W("d",yd),W("e",yd),W("E",yd),W("dd",function(a,b){return b.weekdaysMinRegex(a)}),W("ddd",function(a,b){return b.weekdaysShortRegex(a)}),W("dddd",function(a,b){return b.weekdaysRegex(a)}),_(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:j(c).invalidWeekday=a}),_(["d","e","E"],function(a,b,c,d){b[d]=r(a)});var qe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),re="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),se="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),te=Jd,ue=Jd,ve=Jd;R("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),W("DDD",Bd),W("DDDD",vd),$(["DDD","DDDD"],function(a,b,c){c._dayOfYear=r(a)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,oc),R("k",["kk",2],0,pc),R("hmm",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)}),R("hmmss",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)+Q(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+Q(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+Q(this.minutes(),2)+Q(this.seconds(),2)}),qc("a",!0),qc("A",!1),J("hour","h"),W("a",rc),W("A",rc),W("H",yd),W("h",yd),W("HH",yd,ud),W("hh",yd,ud),W("hmm",zd),W("hmmss",Ad),W("Hmm",zd),W("Hmmss",Ad),$(["H","HH"],Pd),$(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),$(["h","hh"],function(a,b,c){b[Pd]=r(a),j(c).bigHour=!0}),$("hmm",function(a,b,c){var d=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d)),j(c).bigHour=!0}),$("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d,2)),b[Rd]=r(a.substr(e)),j(c).bigHour=!0}),$("Hmm",function(a,b,c){var d=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d))}),$("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d,2)),b[Rd]=r(a.substr(e))});var we=/[ap]\.?m?\.?/i,xe=M("Hours",!0);R("m",["mm",2],0,"minute"),J("minute","m"),W("m",yd),W("mm",yd,ud),$(["m","mm"],Qd);var ye=M("Minutes",!1);R("s",["ss",2],0,"second"),J("second","s"),W("s",yd),W("ss",yd,ud),$(["s","ss"],Rd);var ze=M("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),W("S",Bd,td),W("SS",Bd,ud),W("SSS",Bd,vd);var Ae;for(Ae="SSSS";Ae.length<=9;Ae+="S")W(Ae,Ed);for(Ae="S";Ae.length<=9;Ae+="S")$(Ae,uc);var Be=M("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var Ce=o.prototype;Ce.add=le,Ce.calendar=kb,Ce.clone=lb,Ce.diff=sb,Ce.endOf=Eb,Ce.format=wb,Ce.from=xb,Ce.fromNow=yb,Ce.to=zb,Ce.toNow=Ab,Ce.get=P,Ce.invalidAt=Nb,Ce.isAfter=mb,Ce.isBefore=nb,Ce.isBetween=ob,Ce.isSame=pb,Ce.isSameOrAfter=qb,Ce.isSameOrBefore=rb,Ce.isValid=Lb,Ce.lang=ne,Ce.locale=Bb,Ce.localeData=Cb,Ce.max=ge,Ce.min=fe,Ce.parsingFlags=Mb,Ce.set=P,Ce.startOf=Db,Ce.subtract=me,Ce.toArray=Ib,Ce.toObject=Jb,Ce.toDate=Hb,Ce.toISOString=vb,Ce.toJSON=Kb,Ce.toString=ub,Ce.unix=Gb,Ce.valueOf=Fb,Ce.creationData=Ob,Ce.year=ee,Ce.isLeapYear=ta,Ce.weekYear=Qb,Ce.isoWeekYear=Rb,Ce.quarter=Ce.quarters=Wb,Ce.month=ha,Ce.daysInMonth=ia,Ce.week=Ce.weeks=$b,Ce.isoWeek=Ce.isoWeeks=_b,Ce.weeksInYear=Tb,Ce.isoWeeksInYear=Sb,Ce.date=pe,Ce.day=Ce.days=gc,Ce.weekday=hc,Ce.isoWeekday=ic,Ce.dayOfYear=nc,Ce.hour=Ce.hours=xe,Ce.minute=Ce.minutes=ye,Ce.second=Ce.seconds=ze,Ce.millisecond=Ce.milliseconds=Be,Ce.utcOffset=Ua,Ce.utc=Wa,Ce.local=Xa,Ce.parseZone=Ya,Ce.hasAlignedHourOffset=Za,Ce.isDST=$a,Ce.isDSTShifted=_a,Ce.isLocal=ab,Ce.isUtcOffset=bb,Ce.isUtc=cb,Ce.isUTC=cb,Ce.zoneAbbr=vc,Ce.zoneName=wc,Ce.dates=u("dates accessor is deprecated. Use date instead.",pe),Ce.months=u("months accessor is deprecated. Use month instead",ha),Ce.years=u("years accessor is deprecated. Use year instead",ee),Ce.zone=u("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Va);var De=Ce,Ee={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Fe={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Ge="Invalid date",He="%d",Ie=/\d{1,2}/,Je={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Ke=A.prototype;Ke._calendar=Ee,Ke.calendar=zc,Ke._longDateFormat=Fe,Ke.longDateFormat=Ac,Ke._invalidDate=Ge,Ke.invalidDate=Bc,Ke._ordinal=He,Ke.ordinal=Cc,Ke._ordinalParse=Ie,Ke.preparse=Dc,Ke.postformat=Dc,Ke._relativeTime=Je,Ke.relativeTime=Ec,Ke.pastFuture=Fc,Ke.set=y,Ke.months=ca,Ke._months=Wd,Ke.monthsShort=da,Ke._monthsShort=Xd,Ke.monthsParse=fa,Ke._monthsRegex=Zd,Ke.monthsRegex=ka,Ke._monthsShortRegex=Yd,Ke.monthsShortRegex=ja,Ke.week=Xb,Ke._week=oe,Ke.firstDayOfYear=Zb,Ke.firstDayOfWeek=Yb,Ke.weekdays=bc,Ke._weekdays=qe,Ke.weekdaysMin=dc,Ke._weekdaysMin=se,Ke.weekdaysShort=cc,Ke._weekdaysShort=re,Ke.weekdaysParse=fc,Ke._weekdaysRegex=te,Ke.weekdaysRegex=jc,Ke._weekdaysShortRegex=ue,Ke.weekdaysShortRegex=kc,Ke._weekdaysMinRegex=ve,Ke.weekdaysMinRegex=lc,Ke.isPM=sc,Ke._meridiemParse=we,Ke.meridiem=tc,E("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===r(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=u("moment.lang is deprecated. Use moment.locale instead.",E),a.langData=u("moment.langData is deprecated. Use moment.localeData instead.",H);var Le=Math.abs,Me=Yc("ms"),Ne=Yc("s"),Oe=Yc("m"),Pe=Yc("h"),Qe=Yc("d"),Re=Yc("w"),Se=Yc("M"),Te=Yc("y"),Ue=$c("milliseconds"),Ve=$c("seconds"),We=$c("minutes"),Xe=$c("hours"),Ye=$c("days"),Ze=$c("months"),$e=$c("years"),_e=Math.round,af={s:45,m:45,h:22,d:26,M:11},bf=Math.abs,cf=Oa.prototype;cf.abs=Oc,cf.add=Qc,cf.subtract=Rc,cf.as=Wc,cf.asMilliseconds=Me,cf.asSeconds=Ne,cf.asMinutes=Oe,cf.asHours=Pe,cf.asDays=Qe,cf.asWeeks=Re,cf.asMonths=Se,cf.asYears=Te,cf.valueOf=Xc,cf._bubble=Tc,cf.get=Zc,cf.milliseconds=Ue,cf.seconds=Ve,cf.minutes=We,cf.hours=Xe,cf.days=Ye,cf.weeks=_c,cf.months=Ze,cf.years=$e,cf.humanize=dd,cf.toISOString=ed,cf.toString=ed,cf.toJSON=ed,cf.locale=Bb,cf.localeData=Cb,cf.toIsoString=u("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ed),cf.lang=ne,R("X",0,0,"unix"),R("x",0,0,"valueOf"),W("x",Fd),W("X",Id),$("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),$("x",function(a,b,c){c._d=new Date(r(a))}),a.version="2.13.0",b(Ka),a.fn=De,a.min=Ma,a.max=Na,a.now=he,a.utc=h,a.unix=xc,a.months=Jc,a.isDate=d,a.locale=E,a.invalid=l,a.duration=db,a.isMoment=p,a.weekdays=Lc,a.parseZone=yc,a.localeData=H,a.isDuration=Pa,a.monthsShort=Kc,a.weekdaysMin=Nc,a.defineLocale=F,a.updateLocale=G,a.locales=I,a.weekdaysShort=Mc,a.normalizeUnits=K,a.relativeTimeThreshold=cd,a.prototype=De;var df=a;return df}); -------------------------------------------------------------------------------- /src/pretiusapexdaterangepicker.css: -------------------------------------------------------------------------------- 1 | .daterangepicker.dropup { 2 | margin-top: -5px; 3 | } 4 | .daterangepicker.dropup:before { 5 | top: initial; 6 | bottom: -7px; 7 | border-bottom: initial; 8 | border-top: 7px solid #ccc; 9 | } 10 | .daterangepicker.dropup:after { 11 | top: initial; 12 | bottom: -6px; 13 | border-bottom: initial; 14 | border-top: 6px solid #fff; 15 | } 16 | 17 | button.pretius-apexdaterangepicker.disabled { 18 | opacity: 0.5; 19 | } 20 | /* 21 | 22 | */ 23 | 24 | .daterangepicker { 25 | position: absolute; 26 | color: #393939; 27 | background: #fff; 28 | border-radius: 2px; 29 | display: none; 30 | /*width: 278px;*/ 31 | padding: 8px; 32 | margin-top: 1px; 33 | top: -100%; 34 | left: -100%; 35 | z-index: 700; 36 | } 37 | 38 | .daterangepicker.hideRightCalendar .calendar.right { 39 | display: none; 40 | } 41 | 42 | .daterangepicker.hideRightCalendar.hasRanges .ranges { 43 | padding-left: 8px; 44 | } 45 | 46 | .daterangepicker.hideRightCalendar .calendar.left { 47 | margin-right: 0px; 48 | } 49 | 50 | .daterangepicker.hideRightCalendar .daterangepicker_input { 51 | display: inline-block; 52 | } 53 | 54 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateFrom { 55 | margin-right: 0px; 56 | } 57 | 58 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateFrom, 59 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateTo, 60 | .daterangepicker.hideRightCalendar.hasShowWeekNumbers .daterangepicker_input.dateFrom, 61 | .daterangepicker.hideRightCalendar.hasShowWeekNumbers .daterangepicker_input.dateTo{ 62 | width: 103px; 63 | } 64 | 65 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateFrom { 66 | margin-left: 16px; 67 | } 68 | 69 | .daterangepicker.hideRightCalendar .daterangepicker_input.dateTo, 70 | .daterangepicker.hideRightCalendar.hasShowWeekNumbers .daterangepicker_input.dateTo { 71 | margin-left: 8px; 72 | } 73 | 74 | .daterangepicker.hasAutoApply .range_inputs { 75 | display: none; 76 | } 77 | 78 | 79 | .daterangepicker.monthsDiffersMoreThanOne .calendar.left { 80 | margin-right: 0px; 81 | padding-right: 7px; 82 | border-right: 2px solid rgba(37, 120, 207, 0.3); 83 | border-right: 2px solid transparent !important; 84 | } 85 | 86 | .daterangepicker.monthsDiffersMoreThanOne .calendar.right { 87 | padding-left: 1px; 88 | margin-left: 0px; 89 | } 90 | 91 | .daterangepicker.hideCalendarDateInputs .daterangepicker_input { 92 | display: none; 93 | } 94 | 95 | .daterangepicker.hasShowWeekNumbers .daterangepicker_input { 96 | margin-left: 28px; 97 | } 98 | 99 | .daterangepicker.hasRanges .ranges { 100 | float: right; 101 | padding: 0; 102 | margin: 0; 103 | padding-left: 8px; 104 | padding-top: 8px; 105 | clear: none; 106 | } 107 | 108 | .calendar { 109 | display: none; 110 | float: left; 111 | } 112 | .calendar.right { 113 | margin-left: 2px; 114 | } 115 | .calendar.left { 116 | margin-right: 8px; 117 | } 118 | 119 | .calendar table.table-condensed { 120 | width: 242px; 121 | } 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | /* 130 | * RANGES 131 | */ 132 | 133 | .daterangepicker .ranges { 134 | font-size: 11px; 135 | float: none; 136 | margin: 4px; 137 | text-align: left; 138 | padding: 4px; 139 | clear: both; 140 | float: none; 141 | } 142 | .daterangepicker .ranges ul { 143 | list-style: none; 144 | margin: 0 auto; 145 | padding: 0; 146 | width: 100%; 147 | } 148 | .daterangepicker .ranges li { 149 | color: #383838; 150 | background-color: #f8f8f8; 151 | margin-bottom: 8px; 152 | cursor: pointer; 153 | font-size: 11px; 154 | line-height: 20px; 155 | padding-left: 8px; 156 | padding-right: 8px; 157 | margin-bottom: 8px; 158 | border: 1px solid rgba(0,0,0,.125); 159 | } 160 | 161 | .daterangepicker .ranges li.active { 162 | background: #2578cf; 163 | border: 1px solid #08c; 164 | color: #fff; 165 | } 166 | 167 | .daterangepicker .ranges li:hover { 168 | background: #4992de; 169 | color: #fff; 170 | } 171 | 172 | /* 173 | Natywne CSS 174 | */ 175 | 176 | .daterangepicker.show-calendar .calendar { 177 | display: block; 178 | } 179 | 180 | .daterangepicker.dropdown-menu { 181 | box-shadow: 0 2px 6px rgba(0,0,0,.05); 182 | border: 1px solid #ebebeb; 183 | } 184 | 185 | .daterangepicker.dropdown-menu:hover { 186 | box-shadow: 0 2px 6px rgba(0,0,0,.1); 187 | border: 1px solid #d4d4d4 188 | } 189 | 190 | 191 | .daterangepicker:before, 192 | .daterangepicker:after { 193 | position: absolute; 194 | display: inline-block; 195 | border-bottom-color: rgba(0, 0, 0, 0.2); 196 | content: ''; 197 | } 198 | .daterangepicker:before { 199 | top: -7px; 200 | border-right: 7px solid transparent; 201 | border-left: 7px solid transparent; 202 | border-bottom: 7px solid #ccc; 203 | } 204 | .daterangepicker:after { 205 | top: -6px; 206 | border-right: 6px solid transparent; 207 | border-bottom: 6px solid #fff; 208 | border-left: 6px solid transparent; 209 | } 210 | .daterangepicker.opensleft:before { 211 | right: 9px; 212 | } 213 | .daterangepicker.opensleft:after { 214 | right: 10px; 215 | } 216 | .daterangepicker.openscenter:before { 217 | left: 0; 218 | right: 0; 219 | width: 0; 220 | margin-left: auto; 221 | margin-right: auto; 222 | } 223 | .daterangepicker.openscenter:after { 224 | left: 0; 225 | right: 0; 226 | width: 0; 227 | margin-left: auto; 228 | margin-right: auto; 229 | } 230 | .daterangepicker.opensright:before { 231 | left: 9px; 232 | } 233 | .daterangepicker.opensright:after { 234 | left: 10px; 235 | } 236 | 237 | .dropdown-menu.pull-right { 238 | right: 0; 239 | left: auto 240 | } 241 | .dropdown-menu .divider { 242 | height: 1px; 243 | margin: 9px 0; 244 | overflow: hidden; 245 | background-color: #e5e5e5 246 | } 247 | .dropdown-menu>li>a { 248 | display: block; 249 | padding: 3px 20px; 250 | clear: both; 251 | font-weight: 400; 252 | line-height: 1.42857143; 253 | color: #333; 254 | white-space: nowrap 255 | } 256 | .dropdown-menu > li > a:focus, 257 | .dropdown-menu > li > a:hover { 258 | color: #262626; 259 | text-decoration: none; 260 | background-color: #f5f5f5 261 | } 262 | .dropdown-menu>.active>a, 263 | .dropdown-menu>.active>a:focus, 264 | .dropdown-menu>.active>a:hover { 265 | color: #fff; 266 | text-decoration: none; 267 | background-color: #337ab7; 268 | outline: 0 269 | } 270 | .dropdown-menu>.disabled>a, 271 | .dropdown-menu>.disabled>a:focus, 272 | .dropdown-menu>.disabled>a:hover { 273 | color: #777 274 | } 275 | .dropdown-menu>.disabled>a:focus, 276 | .dropdown-menu>.disabled>a:hover { 277 | text-decoration: none; 278 | cursor: not-allowed; 279 | background-color: transparent; 280 | background-image: none; 281 | filter: progid: DXImageTransform.Microsoft.gradient(enabled=false) 282 | } 283 | 284 | 285 | 286 | /**/ 287 | 288 | /**/ 289 | .daterangepicker .input-mini { 290 | font-size: 12px; 291 | line-height: 23px; 292 | border: 1px solid #ccc; 293 | border-radius: 4px; 294 | color: #555; 295 | display: block; 296 | vertical-align: middle; 297 | margin: 0; 298 | padding: 0 6px 0 28px; 299 | width: 100%; 300 | } 301 | .daterangepicker .input-mini.active { 302 | border: 1px solid rgba(0, 136, 204, 0.51); 303 | border-radius: 4px; 304 | } 305 | 306 | .daterangepicker .daterangepicker_input { 307 | margin: 0px; 308 | padding: 0px; 309 | position: relative; 310 | margin-top: 8px; 311 | } 312 | .daterangepicker .daterangepicker_input i { 313 | position: absolute; 314 | left: 8px; 315 | top: 6px; 316 | } 317 | 318 | .daterangepicker tr:nth-child(2) th { 319 | font-size: 11px; 320 | font-weight: 400; 321 | color: gray; 322 | border-bottom: 1px solid rgba(0,0,0,.1); 323 | padding: 4px 8px 8px 8px; 324 | } 325 | 326 | .daterangepicker td.week, 327 | .daterangepicker th.week{ 328 | font-size: 80%; 329 | font-weight: 400; 330 | color: rgba(0,0,0, 0.5); 331 | border-right: 1px solid rgba(0,0,0,.05); 332 | 333 | } 334 | 335 | 336 | .daterangepicker table { 337 | border-spacing: 0px 338 | } 339 | 340 | .daterangepicker th.prev, 341 | .daterangepicker th.next, 342 | .daterangepicker th.month { 343 | padding: 8px 0px; 344 | 345 | } 346 | 347 | .daterangepicker th.prev { 348 | text-align:left; 349 | padding-left: 16px; 350 | } 351 | 352 | .daterangepicker th.next { 353 | text-align:right; 354 | padding-right: 8px; 355 | } 356 | 357 | .daterangepicker th.month { 358 | color:rgb(61, 61, 61); 359 | font-family:"Helvetica Neue", Helvetica, Arial, sans-serif; 360 | font-size:16px; 361 | font-weight:200; 362 | text-align:center; 363 | text-size-adjust:100%; 364 | visibility:visible; 365 | -webkit-border-horizontal-spacing:0px; 366 | -webkit-border-vertical-spacing:0px; 367 | } 368 | 369 | .daterangepicker th.month select.monthselect { 370 | margin-right:4px; 371 | } 372 | 373 | .daterangepicker th.month select.monthselect, 374 | .daterangepicker th.month select.yearselect { 375 | border: 1px solid rgba(0,0,0,0.1); 376 | } 377 | 378 | 379 | .daterangepicker td, 380 | .daterangepicker th { 381 | font-size: 11px; 382 | line-height: 20px; 383 | padding: 8px; 384 | text-align: right; 385 | white-space: nowrap; 386 | border: none; 387 | } 388 | 389 | .daterangepicker td, 390 | .daterangepicker th.prev, 391 | .daterangepicker th.next { 392 | cursor: pointer; 393 | } 394 | 395 | 396 | .daterangepicker td.disabled { 397 | text-decoration: line-through; 398 | cursor: not-allowed; 399 | } 400 | 401 | 402 | 403 | .daterangepicker td.off:hover, 404 | .daterangepicker td.available:hover { 405 | font-weight: normal; 406 | font-size: 11px; 407 | background: #f2f2f2; 408 | } 409 | 410 | .daterangepicker td.in-range { 411 | background: rgba(37, 120, 207, 0.2); 412 | } 413 | 414 | .daterangepicker td.in-range:hover { 415 | background: rgba(37, 120, 207, 0.33); 416 | } 417 | 418 | .daterangepicker td.off:hover { 419 | color: #393939; 420 | } 421 | 422 | 423 | /* poczatek i koniec zakresu */ 424 | .daterangepicker td.active.start-date, 425 | .daterangepicker td.active.end-date, 426 | .daterangepicker td.active.start-date:hover, 427 | .daterangepicker td.active.end-date:hover { 428 | color: #fff; 429 | background-color: #2578cf; 430 | } 431 | 432 | .daterangepicker td.active.start-date { 433 | border-radius: 4px 0px 0px 0px; 434 | } 435 | 436 | .daterangepicker td.active.end-date { 437 | border-radius: 0px 0px 4px 0px; 438 | } 439 | 440 | .daterangepicker td.active.start-date.end-date { 441 | border-radius: 4px; 442 | } 443 | 444 | .daterangepicker th, 445 | .daterangepicker td.otherMonth, 446 | .daterangepicker td.week { 447 | cursor: default; 448 | } 449 | 450 | .daterangepicker td.otherMonth.in-range { 451 | background: transparent; 452 | } 453 | 454 | .daterangepicker td.off, 455 | .daterangepicker td.off.in-range, 456 | .daterangepicker td.off.start-date, 457 | .daterangepicker td.off.end-date { 458 | color: rgba(0,0,0, 0.3); 459 | background-color: rgba(0,0,0,0.02); 460 | } 461 | 462 | 463 | 464 | .daterangepicker .calendar-time { 465 | text-align: left; 466 | margin: 5px auto; 467 | line-height: 30px; 468 | position: relative; 469 | padding-left: 28px; 470 | } 471 | 472 | .daterangepicker .calendar-time i { 473 | top: 9px; 474 | } 475 | 476 | /* dropdown*/ 477 | 478 | .daterangepicker.forceOneColumn .calendar, 479 | .daterangepicker.forceOneColumn .ranges { 480 | float: none !important; 481 | margin: 0 !important; 482 | margin-bottom: 8px !important; 483 | } 484 | 485 | /* 486 | @media (max-width: 730px) { 487 | .daterangepicker .calendar, 488 | .daterangepicker .ranges { 489 | float: none !important; 490 | margin: 0 !important; 491 | margin-bottom: 8px !important; 492 | } 493 | } 494 | */ -------------------------------------------------------------------------------- /src/pretiusapexdaterangepicker.js: -------------------------------------------------------------------------------- 1 | $.widget('pretius.apexdaterangepicker', { 2 | options: { 3 | pretius: { 4 | // 5 | }, 6 | daterangepicker: { 7 | // 8 | } 9 | }, 10 | C_LOG_DEBUG : apex.debug.LOG_LEVEL.INFO, 11 | C_LOG_WARNING : apex.debug.LOG_LEVEL.WARN, 12 | C_LOG_ERROR : apex.debug.LOG_LEVEL.ERROR, 13 | C_LOG_LEVEL6 : apex.debug.LOG_LEVEL.APP_TRACE, 14 | C_LOG_LEVEL9 : apex.debug.LOG_LEVEL.ENGINE_TRACE, 15 | 16 | _create: function(){ 17 | this.logPrefix = '# ('+this.element.get(0).id+') ';//+this.options.plugin.name+':'; 18 | 19 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, '_create', 'this.options', this.options ); 20 | 21 | //required for fixing position 22 | this.orginal = { 23 | opens: this.options.daterangepicker.opens, 24 | drops: this.options.daterangepicker.drops 25 | }; 26 | 27 | this.apex = { 28 | item: this.element, 29 | datepickerButton: this.element.nextAll( 'button' ).first() 30 | }; 31 | 32 | this.dateTo = { 33 | item: $(this.options.pretius.dateToItem), 34 | datepickerButton: null 35 | }; 36 | 37 | //should display custom range label? 38 | if ( this._hasCustomRangeLabel() ) { 39 | this.options.daterangepicker.showCustomRangeLabel = this._hasCustomRangeLabel(); 40 | delete this.options.daterangepicker.ranges.Custom; 41 | } 42 | 43 | //check ranges 44 | if ( this.options.pretius.onlyOneCalendar ) { 45 | this.options.daterangepicker.linkedCalendars = false; 46 | } 47 | 48 | 49 | //create dateTo button as clone of apex datepicker buttom 50 | this.dateTo.datepickerButton = this.apex.datepickerButton.clone(); 51 | //insert dateTo button after dateTo item 52 | this.dateTo.datepickerButton.insertAfter( this.dateTo.item ); 53 | 54 | if ( this.options.pretius.overlay && this.dateTo.item.length == 0 ) { 55 | throw "Nie znalazl wymaganego itema data do"; 56 | } 57 | 58 | //min & max date 59 | this.options.daterangepicker.minDate = this.options.daterangepicker.minDate != undefined ? this.getMinMaxDateFromString( this.options.daterangepicker.minDate ) : undefined; 60 | this.options.daterangepicker.maxDate = this.options.daterangepicker.maxDate != undefined ? this.getMinMaxDateFromString( this.options.daterangepicker.maxDate ) : undefined; 61 | 62 | //date range picker init 63 | this.apex.item.daterangepicker( this.options.daterangepicker, function(start, end, label){ 64 | //console.log('---Callback function---'); 65 | }); 66 | 67 | this.picker = this.apex.item.data('daterangepicker'); 68 | 69 | this.apex.item 70 | .on( 'show.daterangepicker' , $.proxy( this._commonShow , this , 'dateFrom' ) ) 71 | .on( 'showCalendar.daterangepicker' , $.proxy( this._commonShow , this , 'dateFrom' ) ) 72 | 73 | .on( 'hide.daterangepicker' , $.proxy( this._commonHide , this , 'dateFrom' ) ) 74 | .on( 'calendarUpdated.apex' , $.proxy( this._common_calerndarUpdate , this , 'dateFrom' ) ); 75 | 76 | if ( this.options.daterangepicker.showMethod == 'onIconClick' ) { 77 | 78 | this.apex.item 79 | .off( 'click.daterangepicker' ) 80 | .off( 'focus.daterangepicker' ); 81 | 82 | this.apex.datepickerButton.on( 'click' , $.proxy(this._nativeShowPickerOnButtonClick, this) ); 83 | 84 | if ( this.options.pretius.overlay ) { 85 | this.dateTo.datepickerButton.on( 'click' , $.proxy(this._overlay_showPickerOnButtonClick, this) ); 86 | } 87 | 88 | } 89 | else if ( this.options.daterangepicker.showMethod == 'onFocus' ) { 90 | 91 | if ( this.options.pretius.overlay ) { 92 | this.dateTo.item.on( 'focus' , $.proxy( this._overlay_focusOnDateTo, this)); 93 | } 94 | 95 | } 96 | else if ( this.options.daterangepicker.showMethod == 'both' ) { 97 | this.apex.datepickerButton.on( 'click' , $.proxy( this._nativeShowPickerOnButtonClick, this ) ); 98 | 99 | if ( this.options.pretius.overlay ) { 100 | this.dateTo.datepickerButton.on( 'click' , $.proxy( this._overlay_showPickerOnButtonClick , this ) ); 101 | this.dateTo.item .on( 'focus' , $.proxy( this._overlay_focusOnDateTo , this ) ); 102 | } 103 | 104 | } 105 | else { 106 | throw "Unknown this.options.daterangepicker.showMethod = '"+this.options.daterangepicker.showMethod+"'"; 107 | } 108 | 109 | if ( this.options.pretius.overlay ) { 110 | 111 | this.apex.item 112 | .on('apply.daterangepicker' , $.proxy( this._overlayApply, this ) ) 113 | .on('cancel.daterangepicker' , $.proxy( this._overlayCancel, this ) ) 114 | .on('focus' , $.proxy( this._overlayFocus, this ) ) 115 | 116 | this.dateTo.item 117 | .on('show.daterangepicker ' , $.proxy( this._commonShow , this , 'dateTo' ) ) 118 | .on('showCalendar.daterangepicker' , $.proxy( this._commonShow , this , 'dateTo' ) ) 119 | .on('hide.daterangepicker' , $.proxy( this._overlay_dateToHide , this ) ) 120 | .on('hide.daterangepicker' , $.proxy( this._commonHide , this , 'dateTo' ) ) 121 | .on('calendarUpdated.apex' , $.proxy( this._common_calerndarUpdate , this , 'dateTo' ) ); 122 | 123 | this.dateTo.item.data('parentItem', this.apex.item); 124 | this._apex_da( this.dateTo.item ); 125 | 126 | } 127 | else { 128 | this.apex.item 129 | .on('apply.daterangepicker' , $.proxy( this._nativeApply , this ) ) 130 | .on('cancel.daterangepicker', $.proxy( this._nativeCancel , this ) ) 131 | .on('focus.daterangepicker' , $.proxy( this._nativeFocus , this ) ) 132 | } 133 | 134 | this._apex_da( this.apex.item ); 135 | 136 | }, 137 | _destroy: function(){ 138 | 139 | }, 140 | _overlayFocus: function(){ 141 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlayFocus' ); 142 | 143 | var startDate, endDate; 144 | 145 | if ( this.apex.item.val().trim().length == 0 && this.dateTo.item.val().trim().length == 0 ) { 146 | startDate = moment().startOf('day'); 147 | endDate = moment().endOf('day'); 148 | 149 | } 150 | else if ( this.apex.item.val().trim().length > 0 && this.dateTo.item.val().trim().length == 0 ) { 151 | startDate = moment( this.apex.item.val(), this.options.daterangepicker.locale.format ); 152 | endDate = startDate.endOf('day'); 153 | 154 | } 155 | else if ( this.apex.item.val().trim().length == 0 && this.dateTo.item.val().trim().length > 0 ) { 156 | endDate = moment( this.dateTo.item.val(), this.options.daterangepicker.locale.format ); 157 | startDate = endDate.startOf('day'); 158 | 159 | } 160 | else { // >0 > 0 161 | startDate = moment( this.apex.item.val(), this.options.daterangepicker.locale.format ); 162 | endDate = moment( this.dateTo.item.val(), this.options.daterangepicker.locale.format ); 163 | 164 | } 165 | 166 | this.picker.setStartDate( startDate ); 167 | this.picker.setEndDate( endDate ); 168 | 169 | this.picker.updateView(); 170 | 171 | }, 172 | _nativeFocus: function(){ 173 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_nativeFocus' ); 174 | 175 | if ( this.picker.endDate.isValid() == false || this.picker.startDate.isValid() == false) { 176 | this.picker.endDate = moment().startOf('day'); 177 | this.picker.startDate = moment().endOf('day'); 178 | 179 | //this.picker.hide(); 180 | //this.picker.show(); 181 | this.picker.updateView(); 182 | } 183 | }, 184 | // 185 | //------------------------------------------------------------------------------------------------- 186 | // 187 | 188 | _setOption: function( key, value ) { 189 | apex.debug.message( this.C_LOG_LEVEL9, this.logPrefix, '_setOption' ); 190 | 191 | if ( key === "value" ) { 192 | value = this._constrain( value ); 193 | } 194 | 195 | this._super( key, value ); 196 | }, 197 | // 198 | //------------------------------------------------------------------------------------------------- 199 | // 200 | 201 | _setOptions: function( options ) { 202 | apex.debug.message( this.C_LOG_LEVEL9, this.logPrefix, '_setOptions' ); 203 | 204 | options.daterangepicker.minDate = options.daterangepicker.minDate != undefined ? this.getMinMaxDateFromString( options.daterangepicker.minDate ) : undefined; 205 | options.daterangepicker.maxDate = options.daterangepicker.maxDate != undefined ? this.getMinMaxDateFromString( options.daterangepicker.maxDate ) : undefined; 206 | 207 | this._super( options ); 208 | }, 209 | _hasCustomRangeLabel: function(){ 210 | apex.debug.message( this.C_LOG_LEVEL9, this.logPrefix, '_hasCustomRangeLabel' ); 211 | 212 | try { 213 | return this.options.daterangepicker.ranges.Custom === true 214 | } catch(error) { 215 | return false; 216 | } 217 | 218 | }, 219 | 220 | enable: function( elem ){ 221 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'enable' ); 222 | 223 | 224 | 225 | if ( elem.get(0) == this.apex.item.get(0) ) { 226 | this.apex.item.removeAttr('disabled'); 227 | this.apex.datepickerButton.removeClass('disabled'); 228 | } 229 | else if ( elem.get(0) == this.dateTo.item.get(0) ) { 230 | this.dateTo.item.removeAttr('disabled'); 231 | this.dateTo.datepickerButton.removeClass('disabled'); 232 | } 233 | else { 234 | throw "Unknown item to disable: "+elem.attr('id'); 235 | } 236 | 237 | }, 238 | disable: function( elem ){ 239 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'disable' ); 240 | 241 | if ( elem.get(0) == this.apex.item.get(0) ) { 242 | this.apex.item.prop('disabled', true); 243 | this.apex.datepickerButton.addClass('disabled'); 244 | } 245 | else if ( elem.get(0) == this.dateTo.item.get(0) ) { 246 | this.dateTo.item.prop('disabled', true); 247 | this.dateTo.datepickerButton.addClass('disabled'); 248 | } 249 | else { 250 | throw "Unknown item to disable: "+elem.attr('id'); 251 | } 252 | 253 | }, 254 | setDateRange: function( pDateRange ){ 255 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'setDateRange' ); 256 | 257 | var 258 | dateRange = pDateRange.split( ' - ' ), 259 | dateFrom = dateRange[0], 260 | dateTo = dateRange[1]; 261 | 262 | this.picker.setStartDate( dateFrom ); 263 | this.picker.setEndDate( dateTo ); 264 | 265 | }, 266 | _apex_da: function( daElem ) { 267 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_apex_da' ); 268 | 269 | var 270 | pName = daElem.attr('id'), 271 | pOptions = { 272 | setValue: function( pValue, pDisplayValue ) { 273 | var daItem = $(this.node); 274 | var pluginItem = undefined; 275 | 276 | if ( daItem.data('parentItem') != undefined ) { 277 | //dateTo item 278 | pluginItem = daItem.data('parentItem'); 279 | } 280 | else { 281 | //plugin item 282 | pluginItem = daItem; 283 | } 284 | 285 | if ( pluginItem.apexdaterangepicker('option', 'pretius').overlay == false ) { 286 | daItem.val( pValue ); 287 | pluginItem.apexdaterangepicker('setDateRange', pValue); 288 | } 289 | else { 290 | if ( pValue.trim().length == 0 ) { 291 | daItem.val(""); 292 | } 293 | else { 294 | 295 | if ( /([\+-]{1}\d{1,}[y|m|d|w]{1})/g.test( pValue ) ) { 296 | daItem.val( pluginItem.apexdaterangepicker('calculateMomentFromPattern', pValue, true) ); 297 | } 298 | else { 299 | daItem.val( pValue ); 300 | } 301 | 302 | } 303 | 304 | } 305 | 306 | }, 307 | //Specify a value that to be used to determine if the item is null. 308 | //This is used when the item supports definition of a List of Values, 309 | //where a developer can define a Null Return Value for the item and 310 | //where the default item handling needs to know this in order to assert if the item is null or empty. 311 | nullValue: "", 312 | enable: function() { 313 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'enable' ); 314 | 315 | var 316 | daItem = $(this.node), 317 | pluginItem = undefined; 318 | 319 | if ( daItem.data('parentItem') != undefined ) { 320 | //dateTo item 321 | pluginItem = daItem.data('parentItem'); 322 | } 323 | else { 324 | //plugin item 325 | pluginItem = daItem; 326 | } 327 | 328 | pluginItem.apexdaterangepicker('enable', daItem); 329 | }, 330 | disable: function() { 331 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'disable' ); 332 | 333 | var 334 | daItem = $(this.node), 335 | pluginItem = undefined; 336 | 337 | if ( daItem.data('parentItem') != undefined ) { 338 | //dateTo item 339 | pluginItem = daItem.data('parentItem'); 340 | } 341 | else { 342 | //plugin item 343 | pluginItem = daItem; 344 | } 345 | 346 | pluginItem.apexdaterangepicker('disable', daItem); 347 | }, 348 | afterModify: function(){ 349 | // code to always fire after the item has been modified (value set, enabled, etc.) 350 | }, 351 | loadingIndicator: function( pLoadingIndicator$ ){ 352 | // code to add the loading indicator in the best place for the item 353 | return pLoadingIndicator$; 354 | } 355 | 356 | 357 | /* 358 | //setFocusTo: $( "" ), 359 | setFocusTo: function(){ 360 | 361 | var daItem = $(this.node); 362 | 363 | }, 364 | setStyleTo: $( "" ), 365 | getValue: function() { 366 | 367 | var daItem = $(this.node); 368 | return daItem.val(); 369 | }, 370 | show: function() { 371 | 372 | // code that shows the item type 373 | }, 374 | hide: function() { 375 | 376 | // code that hides the item type 377 | }, 378 | addValue: function( pValue ) { 379 | 380 | // code that adds pValue to the values already in the item type 381 | }, 382 | 383 | */ 384 | 385 | }; 386 | 387 | apex.widget.initPageItem( pName, pOptions); 388 | }, 389 | /* 390 | * 391 | * NATIVE 392 | * 393 | */ 394 | // 395 | //------------------------------------------------------------------------------------------------- 396 | // 397 | 398 | // 399 | //------------------------------------------------------------------------------------------------- 400 | // 401 | 402 | _nativeApply: function(pEvent) { 403 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_nativeApply' ); 404 | 405 | var 406 | format = this.options.daterangepicker.locale.format, 407 | value = this.picker.startDate.format( format ) + ' - ' + this.picker.endDate.format( format ); 408 | 409 | this.element.val( value ).trigger('change'); 410 | }, 411 | // 412 | //------------------------------------------------------------------------------------------------- 413 | // 414 | 415 | _nativeCancel: function(pEvent) { 416 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_nativeCancel' ); 417 | 418 | this.element.val(''); 419 | }, 420 | // 421 | //------------------------------------------------------------------------------------------------- 422 | // 423 | 424 | _nativeShowPickerOnButtonClick: function(){ 425 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_nativeShowPickerOnButtonClick' ); 426 | 427 | if ( this.apex.datepickerButton.is('.disabled') ) { 428 | return false; 429 | } 430 | 431 | this.picker.show(); 432 | }, 433 | 434 | /* 435 | * 436 | * COMMON 437 | * 438 | */ 439 | 440 | // 441 | //------------------------------------------------------------------------------------------------- 442 | // 443 | 444 | _common_hideOtherMonthDays: function(){ 445 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_common_hideOtherMonthDays' ); 446 | 447 | var 448 | leftCalendar = this.picker.container.find('.calendar.left'), 449 | rightCalendar = this.picker.container.find('.calendar.right'), 450 | rightTds, 451 | resultTds, 452 | tr2remove; 453 | resultTds = leftCalendar.find('td.off').filter($.proxy(function(index, elem){ 454 | if ( this._getDateFromCalendar( $(elem), leftCalendar ).month() != this.picker.leftCalendar.month.month() ) { 455 | return true; 456 | } 457 | else { 458 | return false; 459 | } 460 | }, this)); 461 | 462 | resultTds 463 | 464 | if ( this.options.pretius.onlyOneCalendar == false ) { 465 | rightTds = rightCalendar.find('td.off').filter($.proxy(function(index, elem){ 466 | if ( this._getDateFromCalendar( $(elem), rightCalendar ).month() != this.picker.rightCalendar.month.month() ) { 467 | return true; 468 | } 469 | else { 470 | return false; 471 | } 472 | 473 | }, this)); 474 | 475 | resultTds = resultTds.add(rightTds); 476 | } 477 | 478 | resultTds.empty().removeAttr('class').addClass('otherMonth').bind('click mousedown mouseenter mouseleave', function(e){ 479 | e.preventDefault(); 480 | e.stopImmediatePropagation(); 481 | }); 482 | 483 | 484 | 485 | tr2remove = this.picker.container.find('.calendar tr').filter(function( index, elem){ 486 | return $(elem).children('.otherMonth').length == 7 ? true : false; 487 | }); 488 | 489 | tr2remove.remove(); 490 | 491 | }, 492 | // 493 | //------------------------------------------------------------------------------------------------- 494 | // 495 | _common_showMonthsDistance: function(){ 496 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_common_showMonthsDistance' ); 497 | 498 | if ( 499 | this.picker.leftCalendar.month.format('YYYY-MM') == this.picker.rightCalendar.month.format('YYYY-MM') 500 | || this.picker.leftCalendar.month.clone().add(1, 'month').format('YYYY-MM') == this.picker.rightCalendar.month.format('YYYY-MM') 501 | ) { 502 | this.picker.container.removeClass('monthsDiffersMoreThanOne'); 503 | } 504 | else { 505 | this.picker.container.addClass('monthsDiffersMoreThanOne'); 506 | } 507 | }, 508 | _common_calerndarUpdate: function( pTriggeringElement ){ 509 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_common_calerndarUpdate', 'triggeringElement', pTriggeringElement ); 510 | 511 | //replace icons 512 | this.picker.container.find('.next i').removeAttr('class').addClass('ui-icon ui-icon-circle-triangle-e'); 513 | this.picker.container.find('.prev i').removeAttr('class').addClass('ui-icon ui-icon-circle-triangle-w'); 514 | 515 | 516 | if ( this.options.pretius.hideOtherMonthDays ) { 517 | this._common_hideOtherMonthDays(); 518 | } 519 | 520 | if ( 521 | this.options.daterangepicker.linkedCalendars == false 522 | && this.options.pretius.onlyOneCalendar == false 523 | ) { 524 | this._common_showMonthsDistance(); 525 | } 526 | 527 | if ( pTriggeringElement == 'dateTo' && this.options.pretius.altDateToSelect ) { 528 | 529 | if ( this.picker.element == this.dateTo.item ) { 530 | 531 | this.picker.container.find('.dateFrom :input').removeClass('active'); 532 | this.picker.container.find('.dateTo :input').addClass('active'); 533 | 534 | //this.picker.container.find('.calendar').off('mouseenter.daterangepicker'); 535 | this.picker.container.find('.calendar td').not('.week').bind('mouseenter.daterangepicker', $.proxy( this._overlay_updateDateTo_input, this )); 536 | 537 | } 538 | 539 | this.picker.container.find('.calendar td').bind('mousedown.test click.test', $.proxy( this._overlay_dateToShow_forceDateToSelection, this ) ); 540 | 541 | } 542 | }, 543 | 544 | /* 545 | * 546 | * OVERLAY 547 | * 548 | */ 549 | 550 | _overlay_dateToHide: function(){ 551 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_dateToHide' ); 552 | 553 | this.dateTo.item.blur(); 554 | this.picker.element = this.element; 555 | }, 556 | // 557 | //------------------------------------------------------------------------------------------------- 558 | // 559 | _moveRanges: function( ){ 560 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_moveRanges' ); 561 | 562 | var 563 | container = this.picker.container, 564 | left = this.picker.container.find('.calendar.left'), 565 | right = this.picker.container.find('.calendar.right'), 566 | ranges = this.picker.container.find('.ranges'), 567 | bodyWidth = $('body').outerWidth(); 568 | 569 | ranges = ranges.detach(); 570 | 571 | right.after( ranges ); 572 | 573 | }, 574 | _isOneLine: function(){ 575 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_isOneLine' ); 576 | 577 | var 578 | container = this.picker.container, 579 | //te odwolania wypadaloby zmergowac do _create i odwolywac sie do juz istniejacych instancji 580 | left = this.picker.container.find('.calendar.left'), 581 | right = this.picker.container.find('.calendar.right'), 582 | ranges = this.picker.container.find('.ranges'); 583 | 584 | if ( 585 | //pojedynczy i wlaczone ranges 586 | this.options.pretius.onlyOneCalendar == true && this.options.daterangepicker.ranges != undefined && left.offset().top == ranges.offset().top 587 | //pojedynczy i ranges jako pierwsze 588 | || this.options.pretius.onlyOneCalendar == true && this.options.daterangepicker.alwaysShowCalendars == false && !left.is(':visible') 589 | //pojedynczy i wylaczone ranges 590 | || this.options.pretius.onlyOneCalendar == true && this.options.daterangepicker.ranges == undefined 591 | //podwojny i wlaczone ranges 592 | || this.options.pretius.onlyOneCalendar == false && left.offset().top == right.offset().top && left.offset().top == ranges.offset().top 593 | //podwojny i wylaczone ranges 594 | || this.options.pretius.onlyOneCalendar == false && left.offset().top == right.offset().top && this.options.daterangepicker.ranges == undefined 595 | //podwojny i ranges jako pierwsze 596 | || this.options.pretius.onlyOneCalendar == false && this.options.daterangepicker.alwaysShowCalendars == false && !left.is(':visible') && !right.is(':visible') 597 | ){ 598 | return true; 599 | } 600 | else { 601 | return false; 602 | } 603 | }, 604 | fixCalendarPositionVertical: function(){ 605 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'fixCalendarPositionVertical' ); 606 | 607 | //pomocnicze 608 | var fixedNavBarHeight = $('.t-Body-content').length > 0 ? parseInt($('.t-Body-content').css('marginTop')) : 0; 609 | 610 | var item = this.picker.element; 611 | //a offset top item 612 | var itemOffsetTop = item.offset().top - fixedNavBarHeight; 613 | //c ile jest przewinieta strona 614 | var windowScrollHeight = $(window).scrollTop();//$('body').scrollTop(); 615 | //d wysokosc okna przegladarki 616 | var windowHeight = $(window).outerHeight(); 617 | //e wysokosc item 618 | var itemHeight = item.outerHeight(); 619 | //b = a - c // ile zostalo miejsca ponad item 620 | var spaceAboveItem = itemOffsetTop - windowScrollHeight; 621 | //f = d-b-e //ile zostalo miejsca pod item 622 | var spaceBeloweItem = windowHeight - spaceAboveItem - itemHeight; 623 | //g wysokosc kotnenera kalendarzy //jesli 624 | var calendarHeight = this.picker.container.outerHeight(); 625 | //i offset top kalendarzy 626 | var calendarOffsetTop = this.picker.container.offset().top; 627 | //h = i - c //ile zostalo miejsca nad kalendarzem 628 | var spaceAboceCalendar = calendarOffsetTop - windowScrollHeight; 629 | //j jesli wiekszy od zera to wystaje powyzej 630 | var calendarOverflowAboveHeight = windowScrollHeight - calendarOffsetTop; 631 | //jesli wiekszy od zera to wystaje ponizej 632 | var calendarOverflowBelowHeight = (calendarHeight + calendarOffsetTop) - (windowScrollHeight + windowHeight); 633 | 634 | if ( calendarOverflowAboveHeight >= 0 ) { 635 | //always drop down if calendar is cut from above 636 | this.picker.container.removeClass('dropup'); 637 | this.picker.drops = 'down'; 638 | this.picker.move(); 639 | } 640 | else if ( calendarOverflowBelowHeight >= 0 ) { 641 | //cut from down 642 | if ( spaceAboveItem >= calendarHeight ) { 643 | this.picker.container.addClass('dropup'); 644 | this.picker.drops = 'up'; 645 | this.picker.move(); 646 | } 647 | else { 648 | //there is no space above, scroll the broswer 649 | null; 650 | } 651 | } 652 | }, 653 | fixCalendarPositionHorizontal: function(){ 654 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'fixCalendarPositionHorizontal' ); 655 | 656 | var 657 | opens = this.picker.opens, 658 | openerOffset = this.picker.element.offset(); 659 | 660 | if ( this._isOneLine() == false && !this.picker.container.is('.forceOneColumn')) { 661 | //when calendars and ranges are not in the same line; 662 | //right --> left --> center --> force one column 663 | //left --> right --> center --> force one column 664 | //center --> right --> left --> force one column 665 | 666 | if ( this.orginal.opens == 'right' ) { 667 | //when popup should be opened in right position 668 | if ( opens == 'right' ) { 669 | this.picker.container.removeClass('opensright').addClass('opensleft'); 670 | this.picker.opens = 'left'; 671 | this.picker.move(); 672 | } 673 | else if ( opens == 'left' ) { 674 | this.picker.container.removeClass('opensleft').addClass('opensleft'); 675 | this.picker.opens = 'center'; 676 | this.picker.move(); 677 | } 678 | else { 679 | this.picker.container.addClass('forceOneColumn') 680 | } 681 | } 682 | else if ( this.orginal.opens == 'left' ) { 683 | //when popup should be opened in left position 684 | if ( opens == 'left' ) { 685 | this.picker.container.removeClass('opensleft').addClass('opensright'); 686 | this.picker.opens = 'right'; 687 | this.picker.move(); 688 | } 689 | else if ( opens == 'right' ) { 690 | this.picker.container.removeClass('opensright').addClass('openscenter'); 691 | this.picker.opens = 'center'; 692 | this.picker.move(); 693 | } 694 | else { 695 | this.picker.container.addClass('forceOneColumn') 696 | } 697 | } 698 | else { 699 | //when popup should be opened in center position 700 | if ( opens == 'center' ) { 701 | this.picker.container.removeClass('openscenter').addClass('opensright'); 702 | this.picker.opens = 'right'; 703 | this.picker.move(); 704 | } 705 | else if ( opens == 'right' ) { 706 | this.picker.container.removeClass('opensright').addClass('opensleft'); 707 | this.picker.opens = 'left'; 708 | this.picker.move(); 709 | } 710 | else { 711 | this.picker.container.addClass('forceOneColumn') 712 | } 713 | 714 | } 715 | 716 | this.fixCalendarPositionHorizontal(); 717 | 718 | } 719 | else { 720 | //exception for right/center position 721 | if ( 722 | this.orginal.opens == 'right' && parseInt( this.picker.container.css('right') ) == 0 723 | || this.orginal.opens == 'center' && parseInt( this.picker.container.css('right') ) == 0 724 | ) { 725 | 726 | this.picker.container.removeClass('opensright openscenter').addClass('opensleft'); 727 | this.picker.opens = 'left'; 728 | this.picker.move(); 729 | this.fixCalendarPositionHorizontal(); 730 | return; 731 | } 732 | 733 | this.picker.move(); 734 | } 735 | 736 | }, 737 | _commonHide: function() { 738 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_commonHide' ); 739 | 740 | this.picker.drops = this.orginal.drops; 741 | this.picker.opens = this.orginal.opens; 742 | this.picker.container.removeClass('forceOneColumn'); 743 | 744 | }, 745 | _commonShow: function(){ 746 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_commonShow' ); 747 | 748 | var rightInput = this.picker.container.find('.calendar.right .daterangepicker_input').addClass('dateTo'); 749 | var leftInput = this.picker.container.find('.calendar.left .daterangepicker_input').addClass('dateFrom'); 750 | 751 | this._moveRanges(); 752 | 753 | if ( this.options.pretius.onlyOneCalendar ) { 754 | this.picker.container.removeClass('hideRightCalendar ').addClass( 'hideRightCalendar' ); 755 | 756 | rightInput.detach(); 757 | rightInput.insertAfter( leftInput ); 758 | } 759 | 760 | if ( this.options.daterangepicker.autoApply ) { 761 | this.picker.container.addClass('hasAutoApply'); 762 | } 763 | 764 | if ( this.options.daterangepicker.showWeekNumbers ) { 765 | this.picker.container.addClass('hasShowWeekNumbers'); 766 | } 767 | 768 | if ( this.options.daterangepicker.ranges ) { 769 | this.picker.container.addClass('hasRanges'); 770 | } 771 | 772 | if ( this.options.pretius.hideCalendarDateInputs ) { 773 | this.picker.container.addClass('hideCalendarDateInputs'); 774 | } 775 | 776 | this.fixCalendarPositionHorizontal(); 777 | this.fixCalendarPositionVertical(); 778 | 779 | 780 | 781 | }, 782 | 783 | // 784 | //------------------------------------------------------------------------------------------------- 785 | // 786 | _overlay_showPickerOnButtonClick: function(){ 787 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_showPickerOnButtonClick' ); 788 | 789 | if ( this.dateTo.datepickerButton.is('.disabled') ) { 790 | return false; 791 | } 792 | 793 | this._overlay_focusOnDateTo(); 794 | }, 795 | 796 | // 797 | //------------------------------------------------------------------------------------------------- 798 | // 799 | _overlay_focusOnDateTo: function(){ 800 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_focusOnDateTo' ); 801 | 802 | 803 | var 804 | targetEndDate, 805 | targetStartDate; 806 | 807 | //jesli data od jest pusta 808 | if ( this.element.val().trim().length == 0 ) { 809 | //wymus pokazanie najpierw daty od 810 | //this.picker.show(); 811 | this.picker.startDate = moment().startOf('day'); 812 | this.apex.item.focus(); 813 | } 814 | //jesli data od nie jest pusta 815 | else { 816 | this.picker.element = this.dateTo.item; 817 | this.picker.show(); 818 | 819 | targetStartDate = this.getMomentFromStringLocaleFormat( this.element.val() ); 820 | targetEndDate = this.getMomentFromStringLocaleFormat( this.dateTo.item.val().trim().length == 0 ? this.element.val() : this.dateTo.item.val() ); 821 | 822 | this.picker.setStartDate( targetStartDate ); 823 | this.picker.setEndDate( targetEndDate ); 824 | //this.picker.updateView(); 825 | 826 | this._updateCalendarView( targetStartDate, targetEndDate ); 827 | 828 | 829 | } 830 | }, 831 | 832 | // 833 | //------------------------------------------------------------------------------------------------- 834 | // 835 | _updateCalendarView: function( pTargetStartDate, pTargetEndDate ) { 836 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_updateCalendarView', 'parameters('+arguments.length+')' ); 837 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_updateCalendarView', 'pTargetStartDate', pTargetStartDate ); 838 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_updateCalendarView', 'pTargetEndDate', pTargetEndDate ); 839 | 840 | 841 | if ( this.options.pretius.onlyOneCalendar ) { 842 | //when using only one calendar 843 | this.picker.leftCalendar.month.set( 'year', pTargetEndDate.year() ); 844 | this.picker.leftCalendar.month.set( 'month', pTargetEndDate.month() ); 845 | } 846 | else { 847 | //when using two calendars 848 | if ( this.options.daterangepicker.linkedCalendars ) { 849 | //when calendars are linked 850 | if ( 851 | pTargetStartDate.month() == pTargetEndDate.month() 852 | && pTargetStartDate.year() == pTargetEndDate.year() 853 | ) { 854 | //when start and end date are in the same month 855 | this.picker.leftCalendar.month.set('year', pTargetEndDate.clone().year() ) 856 | this.picker.leftCalendar.month.set('month', pTargetEndDate.clone().month() ) 857 | 858 | this.picker.rightCalendar.month.set('year', pTargetEndDate.clone().add(1, 'month').year() ) 859 | this.picker.rightCalendar.month.set('month', pTargetEndDate.clone().add(1, 'month').month() ) 860 | 861 | } 862 | else { 863 | //when start and and date are in different months 864 | this.picker.leftCalendar.month.set('year', pTargetEndDate.clone().subtract(1, 'month').year() ) 865 | this.picker.leftCalendar.month.set('month', pTargetEndDate.clone().subtract(1, 'month').month() ) 866 | 867 | this.picker.rightCalendar.month.set('year', pTargetEndDate.year() ) 868 | this.picker.rightCalendar.month.set('month', pTargetEndDate.month() ) 869 | } 870 | } 871 | else { 872 | //when calendars are not linked 873 | 874 | if ( 875 | pTargetStartDate.month() == pTargetEndDate.month() 876 | && pTargetStartDate.year() == pTargetEndDate.year() 877 | ) { 878 | //when start and end date are in the same month 879 | this.picker.leftCalendar.month.set('year', pTargetEndDate.clone().year() ) 880 | this.picker.leftCalendar.month.set('month', pTargetEndDate.clone().month() ) 881 | 882 | this.picker.rightCalendar.month.set('year', pTargetEndDate.clone().add(1, 'month').year() ) 883 | this.picker.rightCalendar.month.set('month', pTargetEndDate.clone().add(1, 'month').month() ) 884 | 885 | } 886 | else { 887 | //when start and and date are in different months 888 | this.picker.leftCalendar.month.set('year', pTargetStartDate.year() ) 889 | this.picker.leftCalendar.month.set('month', pTargetStartDate.month() ) 890 | 891 | this.picker.rightCalendar.month.set('year', pTargetEndDate.year() ) 892 | this.picker.rightCalendar.month.set('month', pTargetEndDate.month() ) 893 | 894 | } 895 | 896 | } 897 | } 898 | 899 | this.picker.renderCalendar('left'); 900 | this.picker.renderCalendar('right'); 901 | 902 | }, 903 | 904 | // 905 | //------------------------------------------------------------------------------------------------- 906 | // 907 | _overlay_updateDateTo_input: function( pEvent ) { 908 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_updateDateTo_input', 'pEvent', pEvent ); 909 | 910 | var 911 | date = this._getDateFromCalendar( $(pEvent.target) ), 912 | format = this.options.daterangepicker.locale.format; 913 | 914 | this.picker.container.find('.dateTo :input').val( date.format( format ) ); 915 | 916 | pEvent.preventDefault(); 917 | pEvent.stopImmediatePropagation(); 918 | 919 | }, 920 | _overlay_dateToShow_forceDateToSelection: function( pEvent ){ 921 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_overlay_dateToShow_forceDateToSelection', 'pEvent', pEvent ); 922 | 923 | var 924 | targetStartDate = this.getMomentFromStringLocaleFormat( this.element.val() ), 925 | targetEndDate = this._getDateFromCalendar( $(pEvent.target) ); 926 | 927 | pEvent.preventDefault(); 928 | pEvent.stopImmediatePropagation(); 929 | 930 | if ( targetEndDate.isBefore( targetStartDate ) ) { 931 | //workaround at the moment. Should be changed in next versions 932 | $(pEvent.target).addClass('odd disabled'); 933 | return; 934 | } 935 | else { 936 | apex.debug.message( this.C_LOG_WARNING, this.logPrefix, 'Selected date is after current date', 'pEvent', pEvent ); 937 | } 938 | 939 | this.picker.setStartDate( targetStartDate ); 940 | this.picker.setEndDate( targetEndDate ); 941 | 942 | this._updateCalendarView( targetStartDate, targetEndDate ); 943 | 944 | this.picker.renderCalendar('left'); 945 | this.picker.renderCalendar('right'); 946 | 947 | this.picker.container.find('.calendar td').not('.week') 948 | .bind( 'mousedown.test click.test' , $.proxy( this._overlay_dateToShow_forceDateToSelection , this ) ) 949 | .bind( 'mouseenter.daterangepicker' , $.proxy( this._overlay_updateDateTo_input , this ) ); 950 | 951 | if ( this.options.daterangepicker.autoApply ) { 952 | this.picker.calculateChosenLabel(); 953 | this.picker.clickApply(); 954 | } 955 | }, 956 | 957 | // 958 | //------------------------------------------------------------------------------------------------- 959 | // 960 | _overlayApply: function(pEvent) { 961 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, '_overlayApply', 'pEvent', pEvent ); 962 | 963 | var 964 | format = this.options.daterangepicker.locale.format; 965 | 966 | this.element.val( this.picker.startDate.format( format ) ).trigger('change'); 967 | this.dateTo.item.val( this.picker.endDate.format( format ) ).trigger('change'); 968 | }, 969 | // 970 | //------------------------------------------------------------------------------------------------- 971 | // 972 | _overlayCancel: function(pEvent) { 973 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, '_overlayCancel', 'pEvent', pEvent ); 974 | // 975 | }, 976 | 977 | // 978 | //------------------------------------------------------------------------------------------------- 979 | // 980 | getMomentFromStringLocaleFormat: function( pString ){ 981 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'getMomentFromStringLocaleFormat', 'pString', pString ); 982 | 983 | return moment( pString , this.options.daterangepicker.locale.format ); 984 | }, 985 | 986 | _getDateFromCalendar: function( pElem, pCalendar ) { 987 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_getDateFromCalendar', 'parameters = "'+arguments.length+'"'); 988 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_getDateFromCalendar', 'pElem', pElem); 989 | apex.debug.message( this.C_LOG_LEVEL6, this.logPrefix, '_getDateFromCalendar', 'pCalendar', pCalendar); 990 | 991 | var 992 | tdClicked = pElem, 993 | title = tdClicked.attr('data-title'), 994 | row = title.substr(1, 1), 995 | col = title.substr(3, 1), 996 | cal = pCalendar == undefined ? tdClicked.parents('.calendar') : pCalendar, 997 | date = cal.hasClass('left') ? this.picker.leftCalendar.calendar[row][col] : this.picker.rightCalendar.calendar[row][col]; 998 | 999 | return date.clone(); 1000 | }, 1001 | 1002 | getMinMaxDateFromString: function( pStringToDate ){ 1003 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'getMinMaxDateFromString', 'pStringToDate', pStringToDate); 1004 | 1005 | var formatedDate; 1006 | 1007 | if ( pStringToDate == 'today' ) { 1008 | formatedDate = moment(); 1009 | } 1010 | else if ( /\d{4}-\d{2}-\d{2}/.test( pStringToDate ) ) { 1011 | formatedDate = moment( pStringToDate, 'YYYY-MM-DD' ); 1012 | } 1013 | else { 1014 | formatedDate = this.calculateMomentFromPattern( pStringToDate ); 1015 | } 1016 | 1017 | return formatedDate; 1018 | }, 1019 | 1020 | calculateMomentFromPattern: function( pString, pReturnInFormat ) { 1021 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'calculateMomentFromPattern', 'parameters="'+arguments.length+'"'); 1022 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'calculateMomentFromPattern', 'pString', pString); 1023 | apex.debug.message( this.C_LOG_DEBUG, this.logPrefix, 'calculateMomentFromPattern', 'pReturnInFormat', pReturnInFormat); 1024 | 1025 | var 1026 | re = /([\+-]{1}\d{1,}[y|m|d|w]{1})/g, 1027 | matches, 1028 | matched = [], 1029 | destDate = moment().startOf('day'), 1030 | expression, 1031 | operation, 1032 | howMany, 1033 | unit; 1034 | 1035 | while ((matches = re.exec(pString)) != null) { 1036 | matched.push(matches[1]); 1037 | } 1038 | 1039 | for ( var i = 0; i < matched.length; i++) { 1040 | expression = matched[i]; 1041 | operation = expression.substr(0, 1), 1042 | howMany = parseInt( expression.substr(1, expression.length) ), 1043 | unit = expression.substr(-1, expression.length); 1044 | 1045 | if ( unit == 'm' ) { 1046 | unit = 'M'; 1047 | } 1048 | 1049 | if ( operation == '+' ) { 1050 | destDate.add( howMany, unit ); 1051 | }else { 1052 | destDate.subtract( howMany, unit ); 1053 | } 1054 | } 1055 | 1056 | if ( pReturnInFormat == false || pReturnInFormat == undefined ) { 1057 | return destDate; 1058 | } 1059 | else { 1060 | return destDate.format( this.options.daterangepicker.locale.format ) 1061 | } 1062 | 1063 | }, 1064 | // 1065 | //-----------------------DO UTYLIZACJI 1066 | // 1067 | 1068 | 1069 | }); --------------------------------------------------------------------------------