Commit 343e2f74 by nabil el mahiri

nginx new conf

parent 9bdaeea2
Pipeline #520 passed with stages
in 8 minutes 53 seconds
{
"name": "angular-daterangepicker",
"version": "0.3.0",
"homepage": "https://github.com/fragaria/angular-daterangepicker",
"main": "js/angular-daterangepicker.js",
"authors": [
"Filip Vařecha <filip.varecha@fragaria.cz>",
"Tibor Kulčár <tibor.kulcar@fragaria.cz>",
"Lukáš Marek <lukas.marek@fragaria.cz>"
],
"description": "Angular.js wrapper for Dan Grosmann's bootstrap date range picker (https://github.com/dangrossman/bootstrap-daterangepicker).",
"license": "MIT",
"private": false,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "^1.3.20",
"bootstrap-daterangepicker": "^3.0.3"
},
"devDependencies": {
"angular-messages": "^1.3.20"
},
"_release": "0.3.0",
"_resolution": {
"type": "version",
"tag": "0.3.0",
"commit": "178fa5f450b8be592ce3825777fc69d1357c9f54"
},
"_source": "https://github.com/fragaria/angular-daterangepicker.git",
"_target": "^0.3.0",
"_originalSource": "angular-daterangepicker",
"_direct": true
}
\ No newline at end of file
# Contributors
Many thanks to following folks (ordered by date of contribution):
* [Ray Gerrard](https://github.com/raygerrard)
* [Will Wu](https://github.com/wubin1989)
* [Matt Traynham](https://github.com/mtraynham) (upgrade to Bootstrap Daterange picker 2.0)!
* [Wojciech Frącz](https://github.com/fracz)
* [Ondřej Plšek](https://github.com/ondrs)
* [Ryan Dale](https://github.com/RyanDale)
* [Steven](https://github.com/tcooc)
* [Moshe Bildner](https://github.com/mbildner)
* [klam](https://github.com/klam)
* [Marcelo Eduardo de Andrade Jr.](https://github.com/marcelinhov2)
* [Elmar](https://github.com/elm-)
* [Eric Byers](https://github.com/EricByers)
* [Chris Parton](https://github.com/chrisparton1991)
* [Dawid Dominiak](https://github.com/dawiddominiak)
* [Lior Chen](https://github.com/liorch88)
* [Hung Le](https://github.com/lexhung)
* [Adam Segal](https://github.com/phazei)
module.exports = (grunt) ->
require('load-grunt-tasks')(grunt)
# Project configuration.
grunt.initConfig
pkg: grunt.file.readJSON("package.json")
coffeelint:
options:
configFile: 'coffeelint.json'
source: ['coffee/angular-daterangepicker.coffee']
coffee:
compileJoined:
options:
join: true
files:
'js/angular-daterangepicker.js': ['coffee/angular-daterangepicker.coffee']
watch:
files: ['example.html', 'coffee/*.coffee']
tasks: ['default']
uglify:
options:
sourceMap: true
target:
files:
'js/angular-daterangepicker.min.js': ['js/angular-daterangepicker.js']
wiredep:
target:
src: [
'./example.html'
]
ngAnnotate:
options:
singleQuotes: true
daterangepicker:
files:
'js/angular-daterangepicker.js': ['js/angular-daterangepicker.js']
# Default task(s).
grunt.registerTask "default", ["coffeelint", "coffee"]
grunt.registerTask "develop", ["default", "watch"]
grunt.registerTask "dist", ["default", "ngAnnotate", "uglify"]
The MIT License (MIT)
Copyright (c) 2015 Fragaria, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# Date Range Picker for Angular and Bootstrap
![Dependencies](https://david-dm.org/fragaria/angular-daterangepicker.png)
Angular.js directive for Dan Grossmans's [Bootstrap Datepicker](https://github.com/dangrossman/bootstrap-daterangepicker).
## Maintainer needed!
Hello, as you may noticed, we have troubles maintaining this repo. So if there is somebody willing to help merging PRs, testing and releasing, please contact me at lukas.marek(at)fragaria.cz.
Thank you!
[DEMO](http://fragaria.github.io/angular-daterangepicker/)
**Beware: Use [Bootstrap Datepicker](https://github.com/dangrossman/bootstrap-daterangepicker) v 3.0.3 and newer!**
![Date Range Picker screenshot](http://i.imgur.com/zDjBqiS.png)
## Installation via Bower
The easiest way to install the picker is:
```
bower install angular-daterangepicker --save
```
## Manual installation
This directive depends on [Bootstrap Datepicker](https://github.com/dangrossman/bootstrap-daterangepicker), [Bootstrap](http://getbootstrap.com), [Moment.js](http://momentjs.com/) and [jQuery](http://jquery.com/).
Download dependencies above and then use [minified](js/angular-daterangepicker.min.js) or [normal](angular-daterangepicker.js) version.
## Basic usage
Assuming that bower installation directory is `bower_components`. In case of other installation directory, please update paths accordingly.
```
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/momentjs/moment.js"></script>
<script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="bower_components/angular-daterangepicker/js/angular-daterangepicker.js"></script>
<link rel="stylesheet" href="bower_components/bootstrap-daterangepicker/daterangepicker.css"/>
```
Declare dependency:
```
App = angular.module('app', ['daterangepicker']);
```
Prepare model in your controller. The model **must** have `startDate` and `endDate` attributes:
```
exampleApp.controller('TestCtrl', function ($scope) {
$scope.datePicker = { date: {startDate: null, endDate: null} };
}
```
Then in your HTML just add attribute `date-range-picker` to any input and bind it to model.
```
<div ng-controller="TestCtrl">
<input date-range-picker class="form-control date-picker" type="text" ng-model="datePicker.date" />
</div>
```
See `example.html` for working demo.
### Mind the dot!
Do not forget to add a dot (.) in your model object to avoid [issues with scope inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes). E.g. use `$scope.datePicker.date` instead of `$scope.date`.
## Advanced usage
####**Extra Options**
These are options beyond those provided in daterangepicker.
`pickerClasses` : **string**
-- additional classesadded to picker dropdown element
`cancelOnOutsideClick` : **boolean** (default: true) <sup><sub>(only applicable when autoApply==false)</sub></sup>
If true, then clicking outside of the picker, after value has been changed on calendar,
will trigger clicking cancel rather than applying value to model.
If false, apply will be triggered.
`changeCallback` : **function(startDate, endDate, label)**
This will be called in the second $.daterangepicker callback parameter
####**Optional Attributes**
`picker` : **object**
-- object to assign dateRangePicker data object to
`options` : **object** (watched)
-- all dateRangePicker options
`clearable` : **boolean** (watched)
-- will change cancel button to clear and use `options.locale.clearLabel` for text
`min` & `max` : **moment** || *date string* (watched)
-- sets min/max date values for picker
`picker-classes` : **string**
-- additional classes added to picker dropdown element
## Example element
```
<input date-range-picker class="form-control date-picker" type="text"
ng-model="datePicker.date"
picker="datePicker.picker"
picker-classes="extra-class-names"
min="'2014-02-23'"
max="datePicker.maxDate"
options="datePicker.options"
options="{locale: {separator: ":"}}"
/>
```
## Example options
```
$scope.dateRangePicker = {
date: {startDate: moment().subtract(1, 'years'), endDate: moment().add(1, 'years')}
picker: null,
options: {
pickerClasses: 'custom-display', //angular-daterangepicker extra
buttonClasses: 'btn',
applyButtonClasses: 'btn-primary',
cancelButtonClasses: 'btn-danger',
locale: {
applyLabel: "Apply",
cancelLabel: 'Cancel',
customRangeLabel: 'Custom range',
separator: ' - ',
format: "YYYY-MM-DD", //will give you 2017-01-06
//format: "D-MMM-YY", //will give you 6-Jan-17
//format: "D-MMMM-YY", //will give you 6-January-17
},
ranges: {
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()]
},
eventHandlers: {
'apply.daterangepicker': function(event, picker) { console.log('applied'); }
}
}
};
```
## Events
Optionally, event handlers can be passed in through the `eventHandlers` attribute of `options`.
```
<input date-range-picker class="form-control date-picker" type="text" ng-model="date"
options="{eventHandlers: {'show.daterangepicker': function(ev, picker) { ... }}}"/>
```
All event handlers from the Bootstrap daterangepicker are supported. For reference, the complete list is below:
`show.daterangepicker`: Triggered when the picker is shown
`hide.daterangepicker`: Triggered when the picker is hidden
`showCalendar.daterangepicker`: Triggered when the calendar is shown
`hideCalendar.daterangepicker`: Triggered when the calendar is hidden
`apply.daterangepicker`: Triggered when the apply button is clicked
`cancel.daterangepicker`: Triggered when the cancel button is clicked
## Compatibility
Version > 0.3.0 requires [Bootstrap Datepicker](https://github.com/dangrossman/bootstrap-daterangepicker) 3.0.3 and newer.
Version > 0.2.0 requires [Bootstrap Datepicker](https://github.com/dangrossman/bootstrap-daterangepicker) 2.0.0 and newer.
Version > 0.1.1 requires [Bootstrap Datepicker](https://github.com/dangrossman/bootstrap-daterangepicker) 1.3.3 and newer.
## Changes of note
####0.3.0
`cancelOnOutsideClick` - enabled by default, was previously unhandled
## Links
See [original documentation](https://github.com/dangrossman/bootstrap-daterangepicker).
## Issues and Pull Requests
The PRs are more than welcome – thank you for those.
Please send me PRs only for `*.coffee` code. **Please, do not include Javascript and minified Javascript into PRs.**
Javascript and minified Javascript will be generated later with `grunt dist` command
just before the release.
[![Throughput Graph](https://graphs.waffle.io/fragaria/angular-daterangepicker/throughput.svg)](https://waffle.io/fragaria/angular-daterangepicker/metrics)
## Contributors
See [CONTRIBUTORS.md](https://github.com/fragaria/angular-daterangepicker/blob/master/CONTRIBUTORS.md) for all the great folks who contributed to this repo!
Thank you, guys!
{
"name": "angular-daterangepicker",
"version": "0.3.0",
"homepage": "https://github.com/fragaria/angular-daterangepicker",
"main": "js/angular-daterangepicker.js",
"authors": [
"Filip Vařecha <filip.varecha@fragaria.cz>",
"Tibor Kulčár <tibor.kulcar@fragaria.cz>",
"Lukáš Marek <lukas.marek@fragaria.cz>"
],
"description": "Angular.js wrapper for Dan Grosmann's bootstrap date range picker (https://github.com/dangrossman/bootstrap-daterangepicker).",
"license": "MIT",
"private": false,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "^1.3.20",
"bootstrap-daterangepicker": "^3.0.3"
},
"devDependencies": {
"angular-messages": "^1.3.20"
}
}
pickerModule = angular.module('daterangepicker', [])
pickerModule.constant('dateRangePickerConfig',
cancelOnOutsideClick: true
locale:
separator: ' - '
format: 'YYYY-MM-DD'
clearLabel: 'Clear'
)
pickerModule.directive 'dateRangePicker', ($compile, $timeout, $parse, dateRangePickerConfig) ->
require: 'ngModel'
restrict: 'A'
scope:
min: '='
max: '='
picker: '=?'
model: '=ngModel'
opts: '=options'
clearable: '='
link: ($scope, element, attrs, modelCtrl) ->
# Custom angular extend function to extend locales, so they are merged instead of overwritten
# angular.merge removes prototypes...
_mergeOpts = () ->
localeExtend = angular.extend.apply(angular,
Array.prototype.slice.call(arguments).map((opt) -> opt?.locale).filter((opt) -> !!opt))
extend = angular.extend.apply(angular, arguments)
extend.locale = localeExtend
extend
el = $(element)
# can interfere with local.separator & $parsers if startDate is empty
el.attr('ng-trim','false')
attrs.ngTrim = 'false'
allowInvalid = false
do setModelOptions = ->
# must only update on change, otherwise in the middle of typing it will update the $viewValue
if (modelCtrl.$options && typeof modelCtrl.$options.getOption == 'function')
updateOn = modelCtrl.$options.getOption('updateOn')
allowInvalid = !!modelCtrl.$options.getOption('allowInvalid')
else # angular < 1.6
updateOn = (modelCtrl.$options && modelCtrl.$options.updateOn) || ""
allowInvalid = !!(modelCtrl.$options && modelCtrl.$options.allowInvalid)
if (!updateOn.includes("change"))
if (typeof modelCtrl.$overrideModelOptions == 'function')
updateOn += " change"
modelCtrl.$overrideModelOptions({'*':'$inherit', updateOn})
else
# angular < 1.6
updateOn += " change"
updateOn.replace(/default/g,' ')
options = angular.copy(modelCtrl.$options) || {}
options.updateOn = updateOn
options.updateOnDefault = false
modelCtrl.$options = options
customOpts = $scope.opts
opts = _mergeOpts({}, angular.copy(dateRangePickerConfig), customOpts)
_picker = null
_clear = ->
# if no initial value given this will be called in $render before picker
if (_picker)
_picker.setStartDate()
_picker.setEndDate()
_setDatePoint = (setter) ->
(newValue) ->
if (newValue && (!moment.isMoment(newValue) || newValue.isValid()))
newValue = moment(newValue)
else
# keep previous value if invalid
# set newValue = {} to default it
return
if _picker
setter(newValue)
_setStartDate = _setDatePoint (date) ->
if (date && _picker.endDate < date)
# end's before start, so push end date out to start date
_picker.setEndDate(date)
_picker.setStartDate(date)
opts.startDate = _picker.startDate #picker would have adjusted it to match max/mins
_setEndDate = _setDatePoint (date) ->
# this just flips start and end if they are reverse chronological
if (date && _picker.startDate > date)
# daterangepicker will set the end date to a clone of the start date if it's before start
# so end will become what the start date is currently anyway
_picker.setEndDate(_picker.startDate)
opts.endDate = _picker.endDate #will be previous start date
# the new start date is actually this lesser date
_picker.setStartDate(date)
opts.startDate = _picker.startDate #picker would have adjusted it to match max/mins
else
_picker.setEndDate(date)
opts.endDate = _picker.endDate
getViewValue =(model) ->
f = (date) ->
if not moment.isMoment(date)
then moment(date).format(opts.locale.format)
else date.format(opts.locale.format)
if opts.singleDatePicker and model
viewValue = f(model)
else if model and (model.startDate || model.endDate)
viewValue = [f(model.startDate), f(model.endDate)].join(opts.locale.separator)
else
viewValue = ''
return viewValue
# Formatter should return just the string value of the input
# It is used for comparison of if we should re-render
modelCtrl.$formatters.push (modelValue) ->
getViewValue(modelValue)
# Render should update the date picker start/end dates as necessary
# It should also set the input element's val with $viewValue as we don't let the rangepicker do this
modelCtrl.$renderOriginal = modelCtrl.$render
modelCtrl.$render = () ->
# Update the calendars
if modelCtrl.$modelValue and opts.singleDatePicker
_setStartDate(modelCtrl.$modelValue)
_setEndDate(modelCtrl.$modelValue)
else if modelCtrl.$modelValue and (modelCtrl.$modelValue.startDate || modelCtrl.$modelValue.endDate)
_setStartDate(modelCtrl.$modelValue.startDate)
_setEndDate(modelCtrl.$modelValue.endDate)
else _clear()
if (modelCtrl.$valid)
# Update the input with the $viewValue (generated from $formatters)
modelCtrl.$renderOriginal()
# This should parse the string input into an updated model object
modelCtrl.$parsers.push (viewValue) ->
# Parse the string value
f = (value) ->
date = moment(value, opts.locale.format)
return (date.isValid() && date) || null
objValue = if opts.singleDatePicker then null else
startDate: null
endDate: null
if angular.isString(viewValue) and viewValue.length > 0
if opts.singleDatePicker
objValue = f(viewValue)
else
x = viewValue.split(opts.locale.separator).map(f)
# Use startOf/endOf day to comply with how daterangepicker works
objValue.startDate = if x[0] then x[0].startOf('day') else null
# selected value will always be 999ms off due to:
# https://github.com/dangrossman/daterangepicker/issues/1890
# can fix by adding .startOf('second') but then initial value will be off by 999ms
objValue.endDate = if x[1] then x[1].endOf('day') else null
return objValue
modelCtrl.$isEmpty = (val) ->
# modelCtrl is empty if val is empty string
not (angular.isString(val) and val.length > 0)
# _init has to be called anytime we make changes to the date picker options
_init = ->
# disable autoUpdateInput, can't handle empty values without it. Our callback here will
# update our $viewValue, which triggers the $parsers
el.daterangepicker angular.extend(opts, {autoUpdateInput: false}), (startDate, endDate, label) ->
$scope.$apply () ->
# this callback is triggered any time the calendar is changed, even if it wasn't applied
# so a range is changed, but not applied and then clicked out of, this triggers when outsideClick calls hide
# therefore can't assign to model here
# https://github.com/dangrossman/daterangepicker/issues/1156
# $scope.model = if opts.singleDatePicker then startDate else {startDate, endDate, label}
if (typeof opts.changeCallback == "function")
opts.changeCallback.apply(this, arguments)
# Needs to be after daterangerpicker has been created, otherwise
# watchers that reinit will be attached to old daterangepicker instance.
_picker = el.data('daterangepicker')
$scope.picker = _picker
# to set initial dropdown to inline hide for when default display isn't hidden (eg display: flex/grid)
_picker.container.hide()
_picker.container.addClass((opts.pickerClasses || "") + " " + (attrs['pickerClasses'] || ""))
el.on 'show.daterangepicker', (ev, picker) ->
el.addClass('picker-open')
# there are some cases where daterangepicker is buggy and the date won't match
# make sure it does here
# (if doing it here, does it really need to be set in the $render? probably for consistency)
$scope.$apply ->
if (opts.singleDatePicker)
if (!picker.startDate.isSame($scope.model))
_setStartDate($scope.model)
_setEndDate($scope.model)
else
if ($scope.model && !picker.startDate.isSame($scope.model.startDate))
_setStartDate($scope.model.startDate)
if ($scope.model && !picker.endDate.isSame($scope.model.endDate))
_setEndDate($scope.model.endDate)
picker.updateView()
return
el.on 'hide.daterangepicker', (ev, picker) ->
el.removeClass('picker-open')
el.on 'apply.daterangepicker', (ev, picker) ->
$scope.$apply ->
if opts.singleDatePicker
if !picker.startDate
$scope.model = null
else if !picker.startDate.isSame($scope.model)
$scope.model = picker.startDate
else if ( !picker.startDate.isSame(picker.oldStartDate) || !picker.endDate.isSame(picker.oldEndDate) ||
!$scope.model ||
!picker.startDate.isSame($scope.model.startDate) || !picker.endDate.isSame($scope.model.endDate)
)
$scope.model = {
startDate: picker.startDate
endDate: picker.endDate
label: picker.chosenLabel
}
return
el.on 'outsideClick.daterangepicker', (ev, picker) ->
if opts.cancelOnOutsideClick
$scope.$apply ->
# need to prevent clearing if option is on
picker.cancelingClick = true
picker.clickCancel()
else
picker.clickApply()
# Ability to attach event handlers. See https://github.com/fragaria/angular-daterangepicker/pull/62
# Revised
for eventType of opts.eventHandlers
el.on eventType, (ev, picker) ->
eventName = ev.type + '.' + ev.namespace
$scope.$evalAsync(opts.eventHandlers[eventName])
# if model was already created and validation case changed this will catch that
# and update the model if it was null from previous but no longer invalid
modelCtrl.$validate()
if (!$scope.model)
el.trigger('change')
# init will be called by opt watcher
# _init()
# Since model is an object whose parameters might not change while the value does,
# need to handle what ngModelWatch doesn't
$scope.$watch (-> getViewValue($scope.model)) , (viewValue) ->
# if (modelCtrl.$invalid)
# modelCtrl.$viewValue = null
if (typeof modelCtrl.$processModelValue == "function")
modelCtrl.$processModelValue()
# will skip render if view wasn't updated, but view is skipped
# the first time after a validation error since it's still $invalid
# so need to make sure it's run again just in case
modelCtrl.$render()
else
# maintain angular compatibility with < 1.7
if (typeof modelCtrl.$$updateEmptyClasses == "function")
modelCtrl.$$updateEmptyClasses(viewValue)
# maintain angular compatibility with < 1.6
modelCtrl.$viewValue = modelCtrl.$$lastCommittedViewValue = viewValue
modelCtrl.$render()
modelCtrl.$validators['invalid'] =(value, viewValue) ->
applicable = attrs.required && !modelCtrl.$isEmpty(viewValue)
if opts.singleDatePicker
check = value && value.isValid()
else
check = value && value.startDate && value.startDate.isValid() && value.endDate && value.endDate.isValid()
return !applicable || !!check
# Validation for our min/max
_validateRange = (date, min, max) ->
if date and (min or max)
[date, min, max] = [date, min, max].map (d) ->
if (d)
moment(d)
else d
return (!min or min.isBefore(date) or min.isSame(date, 'day')) and
(!max or max.isSame(date, 'day') or max.isAfter(date))
else true
# Add validation/watchers for our min/max fields
_initBoundaryField = (field, validator, modelField, optName) ->
modelCtrl.$validators[field] = (value) ->
# always have validator so if min/max change, this works
# just return true if not set
if (!opts[optName])
return true
if (opts.singleDatePicker)
if field == 'min'
!value || validator(value, opts['minDate'], value)
else if field == 'max'
!value || validator(value, value, opts['maxDate'])
else
value and validator(value[modelField], opts['minDate'], opts['maxDate'])
if attrs[field]
$scope.$watch field, (date) ->
opts[optName] = if date then moment(date) else false
if (_picker)
_picker[optName] = opts[optName]
$timeout -> modelCtrl.$validate()
_initBoundaryField('min', _validateRange, 'startDate', 'minDate')
_initBoundaryField('max', _validateRange, 'endDate', 'maxDate')
# Watch our options
$scope.$watch 'opts', (newOpts = {}) ->
opts = _mergeOpts(opts, newOpts)
_init()
, true
# Watch clearable flag
if attrs.clearable
$scope.$watch 'clearable', (newClearable) ->
if newClearable
opts = _mergeOpts(opts, {locale: {cancelLabel: opts.locale.clearLabel}})
_init()
if newClearable
el.on 'cancel.daterangepicker', (ev, picker) ->
if (!picker.cancelingClick)
$scope.model = if opts.singleDatePicker then null else {startDate: null, endDate: null}
el.val("")
picker.cancelingClick = null
$timeout -> $scope.$apply()
$scope.$on '$destroy', ->
_picker?.remove()
{
"arrow_spacing": {
"level": "ignore"
},
"braces_spacing": {
"level": "ignore",
"spaces": 0
},
"camel_case_classes": {
"level": "error"
},
"coffeescript_error": {
"level": "error"
},
"colon_assignment_spacing": {
"level": "ignore",
"spacing": {
"left": 0,
"right": 0
}
},
"cyclomatic_complexity": {
"value": 10,
"level": "ignore"
},
"duplicate_key": {
"level": "error"
},
"empty_constructor_needs_parens": {
"level": "ignore"
},
"ensure_comprehensions": {
"level": "warn"
},
"indentation": {
"value": 2,
"level": "error"
},
"line_endings": {
"level": "ignore",
"value": "unix"
},
"max_line_length": {
"value": 120,
"level": "error",
"limitComments": true
},
"missing_fat_arrows": {
"level": "ignore"
},
"newlines_after_classes": {
"value": 3,
"level": "ignore"
},
"no_backticks": {
"level": "error"
},
"no_debugger": {
"level": "warn"
},
"no_empty_functions": {
"level": "ignore"
},
"no_empty_param_list": {
"level": "ignore"
},
"no_implicit_braces": {
"level": "ignore",
"strict": true
},
"no_implicit_parens": {
"strict": true,
"level": "ignore"
},
"no_interpolation_in_single_quotes": {
"level": "ignore"
},
"no_plusplus": {
"level": "ignore"
},
"no_stand_alone_at": {
"level": "ignore"
},
"no_tabs": {
"level": "error"
},
"no_throwing_strings": {
"level": "error"
},
"no_trailing_semicolons": {
"level": "error"
},
"no_trailing_whitespace": {
"level": "error",
"allowed_in_comments": false,
"allowed_in_empty_lines": true
},
"no_unnecessary_double_quotes": {
"level": "ignore"
},
"no_unnecessary_fat_arrows": {
"level": "warn"
},
"non_empty_constructor_needs_parens": {
"level": "ignore"
},
"prefer_english_operator": {
"level": "ignore",
"doubleNotLevel": "ignore"
},
"space_operators": {
"level": "ignore"
},
"spacing_after_comma": {
"level": "ignore"
},
"transform_messes_up_line_numbers": {
"level": "warn"
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Daterange picker example</title>
<!-- bower:css -->
<link rel="stylesheet" href="lib/bootstrap-daterangepicker/daterangepicker.css" />
<!-- endbower -->
<style type="text/css">
.form-group {
display: flex;
padding-bottom: 5px;
margin-bottom: 20px;
border-bottom: 1px solid lightblue;
}
.form-group > label {
flex: 0 0 30%;
display: inline-block;
padding-right: 10px;
cursor: pointer;
}
.form-group > label + div {
flex-grow: 1;
}
.form-group div label {
display: block;
font-size: smaller;
}
form input, form button {
padding: 10px;
border-radius: 5px;
width: calc(100% - 40px);
max-width: 300px;
margin: 0;
}
button:not(:disabled) {
cursor: pointer;
}
.has-error input {
color: red;
border-color: red;
}
.daterangepicker.fancy-border {
border: 2px solid rebeccapurple;
box-shadow: 0 4px 15px 0px #888888;
}
.daterangepicker.fancy-border:before {
border-bottom: 5px solid rebeccapurple;
}
.help-block p {
margin: 0 0 10px 0;
padding: 0;
font-size: smaller;
color: red;
}
#dateSimple.picker-open {
background: black;
color: white;
}
</style>
</head>
<body>
<!-- bower:js -->
<script src="lib/jquery/dist/jquery.js"></script>
<script src="lib/angular/angular.js"></script>
<script src="lib/angular-messages/angular-messages.js"></script>
<script src="lib/moment/moment.js"></script>
<script src="lib/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- endbower -->
<script src="js/angular-daterangepicker.js"></script>
<div class="container">
<h1>Daterange picker example</h1>
<div ng-controller="TestCtrl">
<form name="dateForm" class="form-horizontal">
<div class="form-group" ng-class="{'has-error': dateForm.dateSimple.$invalid}">
<label for="dateSimple" class="control-label">Simple picker</label>
<div>
<input date-range-picker id="dateSimple" name="dateSimple" class="form-control date-picker" type="text"
ng-model="date"
ng-model-options="{ allowInvalid: true }"
ng-required="page.required"/>
<div class="help-block" ng-messages="dateForm.dateSimple.$error">
<p ng-message="invalid">Invalid date.</p>
<p ng-message="required">Range is required.</p>
</div>
<div><label>date:</label> {{date}}</div>
{{dateForm.dateSimple.$error}}
</div>
</div>
<div class="form-group" ng-class="{'has-error': dateForm.drpMinMax.$invalid}">
<label for="daterange2" class="control-label">Picker with attribute min and max date</label>
<div>
<input date-range-picker id="daterange2" name="drpMinMax" class="form-control date-picker" type="text"
ng-model="dateMinMax"
ng-model-options="{ allowInvalid: true }"
picker="page.pickerMinMax"
min="'2018-12-20'" max="page.attributeMax"
required/>
<div class="help-block" ng-messages="dateForm.drpMinMax.$error">
<p ng-message="min">Start date must be at least {{page.pickerMinMax.minDate}}.</p>
<p ng-message="max">End date must be at most {{page.pickerMinMax.maxDate}}.</p>
<p ng-message="invalid">Invalid date.</p>
<p ng-message="required">Range is required.</p>
</div>
<div><label>dateMinMax:</label> {{dateMinMax}}</div>
</div>
</div>
<div class="form-group">
<label for="daterangeValidate" class="control-label">Option validation</label>
<div>
<input date-range-picker id="daterangeValidate" name="daterangeValidate" class="form-control date-picker" type="text"
ng-model="optsValidation.date"
ng-model-options="{ allowInvalid: true }"
options="optsValidation.options"
ng-required="true"/>
<div class="help-block" ng-messages="dateForm.daterangeValidate.$error">
<p ng-message="min">Start date must be at least {{optsValidation.options.minDate}}.</p>
<p ng-message="max">End date must be at most {{optsValidation.options.maxDate}}.</p>
<p ng-message="required">Range is required.</p>
</div>
<div><label>date2:</label> {{optsValidation.date}}</div>
<div><label>errors:</label> {{dateForm.daterangeValidate.$error}}</div>
</div>
</div>
<div class="form-group">
<label for="optsCustom" class="control-label">Picker with custom locale & extra picker class</label>
<div>
<input date-range-picker id="optsCustom" name="optsCustom" class="form-control date-picker" type="text"
ng-model="date2"
options="optsCustom" required/>
<div><label>date2:</label> {{date2}}</div>
</div>
</div>
<div class="form-group">
<label for="daterangeClear" class="control-label">Clearable picker</label>
<div>
<input date-range-picker id="daterangeClear" name="daterangeClear" class="form-control date-picker" type="text"
ng-model="date2"
clearable="true" required/>
<div><label>date2:</label> {{date2}}</div>
</div>
</div>
<div class="form-group">
<label for="daterangeUnlinked" class="control-label">Unlinked calendars w/validation</label>
<div>
<input date-range-picker id="daterangeUnlinked" name="daterangeUnlinked" class="form-control date-picker" type="text"
ng-model="date2"
options="optsUnlinked" required/>
<div class="help-block" ng-messages="dateForm.daterangeUnlinked.$error">
<p ng-message="min">Start date must be at least {{optsUnlinked.minDate}}.</p>
<p ng-message="max">End date must be at most {{optsUnlinked.maxDate}}.</p>
<p ng-message="required">Range is required.</p>
</div>
<div><label>date2:</label> {{date2}}</div>
</div>
</div>
<div class="form-group">
<button type="button" class="btn" ng-click="setStartDate()">Set Start Date2</button>
<button type="button" class="btn" ng-click="setRange()">Set Range Date2</button>
</div>
<div class="form-group">
<label for="dateSingle" class="control-label">Single picker w/validation</label>
<div>
<input date-range-picker id="dateSingle" name="dateSingle" class="form-control date-picker" type="text"
ng-model="dateSingle"
ng-model-options="{ allowInvalid: true }"
options="optsSingle" required/>
<div class="help-block" ng-messages="dateForm.dateSingle.$error">
<p ng-message="min">To low. Date must be between {{optsSingle.minDate}} && {{optsSingle.maxDate}}.</p>
<p ng-message="max">To high. Date must be between {{optsSingle.minDate}} && {{optsSingle.maxDate}}.</p>
<p ng-message="required">Range is required.</p>
<p ng-message="invalid">Date is invalid.</p>
</div>
<div><label>dateSingle:</label> {{dateSingle}}</div>
</div>
</div>
<div class="form-group">
<label for="dateFormatted" class="control-label">Picker with custom format & apply when clicking out of calendar</label>
<div>
<input date-range-picker id="dateFormatted" name="dateFormatted" class="form-control date-picker" type="text"
ng-model="dateFormatted"
options="{cancelOnOutsideClick: false, locale: {format: 'MMMM D, YYYY'}}" required/>
<div><label>dateFormatted:</label> {{dateFormatted}}</div>
</div>
</div>
</form>
</div>
</div>
</body>
<script>
exampleApp = angular.module('example', ['ngMessages', 'daterangepicker']);
exampleApp.controller('TestCtrl', function($scope) {
// $scope.dateFormatted = {};
$scope.page = { required: true, attributeMax: '2020-12-30' };
$scope.ranges = {
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()]
};
$scope.date = {
startDate: moment().subtract(1, "days").startOf('day'),
endDate: moment().endOf('day')
};
$scope.date2 = {
startDate: moment().subtract(1, "days").startOf('day'),
endDate: moment().add(1,'week').endOf('day')
};
$scope.dateMinMax = {
startDate: moment().subtract(1, "days").startOf('day'),
endDate: moment().add(10,"years").endOf('day')
};
$scope.optsCustom = {
pickerClasses: 'fancy-border',
locale: {
applyClass: 'btn-green',
applyLabel: "Použít",
fromLabel: "Od",
toLabel: "Do",
cancelLabel: 'Zrušit',
customRangeLabel: 'Vlastní rozsah',
daysOfWeek: ['Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'],
firstDay: 1,
monthNames: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září',
'Říjen', 'Listopad', 'Prosinec'
]
},
ranges: $scope.ranges
};
$scope.optsValidation = {
date: {
startDate: moment().subtract(1, "days").startOf('day'),
endDate: moment().add(1,"week").endOf('day')
},
options: {
minDate: moment().subtract(1, "year"),
maxDate: moment().add(2, "weeks"),
}
};
$scope.optsUnlinked = {
minDate: moment().startOf('day').subtract(4, 'months'),
maxDate: moment().endOf('day').add(2, 'months'),
linkedCalendars: false
};
$scope.dateSingle = moment();
$scope.optsSingle = {
singleDatePicker: true,
minDate: moment().startOf('day').subtract(4, 'months'),
maxDate: moment().endOf('day').add(2, 'months'),
ranges: $scope.ranges
};
$scope.setStartDate = function () {
$scope.date2.startDate = moment().subtract(4, "days");
};
$scope.setRange = function () {
$scope.date2 = {
startDate: moment().subtract(5, "days"),
endDate: moment().add(1, "days")
};
};
$scope.modelOptions = {
// updateOn: ""
};
//Watch for date changes
$scope.$watch('date', function(newDate) {
console.log('New date set: ', newDate);
}, false);
});
angular.bootstrap(document, ['example']);</script>
</html>
require('./js/angular-daterangepicker.js');
module.exports = 'daterangepicker'
(function() {
var pickerModule;
pickerModule = angular.module('daterangepicker', []);
pickerModule.constant('dateRangePickerConfig', {
cancelOnOutsideClick: true,
locale: {
separator: ' - ',
format: 'YYYY-MM-DD',
clearLabel: 'Clear'
}
});
pickerModule.directive('dateRangePicker', ['$compile', '$timeout', '$parse', 'dateRangePickerConfig', function($compile, $timeout, $parse, dateRangePickerConfig) {
return {
require: 'ngModel',
restrict: 'A',
scope: {
min: '=',
max: '=',
picker: '=?',
model: '=ngModel',
opts: '=options',
clearable: '='
},
link: function($scope, element, attrs, modelCtrl) {
var _clear, _init, _initBoundaryField, _mergeOpts, _picker, _setDatePoint, _setEndDate, _setStartDate, _validateRange, allowInvalid, customOpts, el, getViewValue, opts, setModelOptions;
_mergeOpts = function() {
var extend, localeExtend;
localeExtend = angular.extend.apply(angular, Array.prototype.slice.call(arguments).map(function(opt) {
return opt != null ? opt.locale : void 0;
}).filter(function(opt) {
return !!opt;
}));
extend = angular.extend.apply(angular, arguments);
extend.locale = localeExtend;
return extend;
};
el = $(element);
el.attr('ng-trim', 'false');
attrs.ngTrim = 'false';
allowInvalid = false;
(setModelOptions = function() {
var options, updateOn;
if (modelCtrl.$options && typeof modelCtrl.$options.getOption === 'function') {
updateOn = modelCtrl.$options.getOption('updateOn');
allowInvalid = !!modelCtrl.$options.getOption('allowInvalid');
} else {
updateOn = (modelCtrl.$options && modelCtrl.$options.updateOn) || "";
allowInvalid = !!(modelCtrl.$options && modelCtrl.$options.allowInvalid);
}
if (!updateOn.includes("change")) {
if (typeof modelCtrl.$overrideModelOptions === 'function') {
updateOn += " change";
return modelCtrl.$overrideModelOptions({
'*': '$inherit',
updateOn: updateOn
});
} else {
updateOn += " change";
updateOn.replace(/default/g, ' ');
options = angular.copy(modelCtrl.$options) || {};
options.updateOn = updateOn;
options.updateOnDefault = false;
return modelCtrl.$options = options;
}
}
})();
customOpts = $scope.opts;
opts = _mergeOpts({}, angular.copy(dateRangePickerConfig), customOpts);
_picker = null;
_clear = function() {
if (_picker) {
_picker.setStartDate();
return _picker.setEndDate();
}
};
_setDatePoint = function(setter) {
return function(newValue) {
if (newValue && (!moment.isMoment(newValue) || newValue.isValid())) {
newValue = moment(newValue);
} else {
return;
}
if (_picker) {
return setter(newValue);
}
};
};
_setStartDate = _setDatePoint(function(date) {
if (date && _picker.endDate < date) {
_picker.setEndDate(date);
}
_picker.setStartDate(date);
return opts.startDate = _picker.startDate;
});
_setEndDate = _setDatePoint(function(date) {
if (date && _picker.startDate > date) {
_picker.setEndDate(_picker.startDate);
opts.endDate = _picker.endDate;
_picker.setStartDate(date);
return opts.startDate = _picker.startDate;
} else {
_picker.setEndDate(date);
return opts.endDate = _picker.endDate;
}
});
getViewValue = function(model) {
var f, viewValue;
f = function(date) {
if (!moment.isMoment(date)) {
return moment(date).format(opts.locale.format);
} else {
return date.format(opts.locale.format);
}
};
if (opts.singleDatePicker && model) {
viewValue = f(model);
} else if (model && (model.startDate || model.endDate)) {
viewValue = [f(model.startDate), f(model.endDate)].join(opts.locale.separator);
} else {
viewValue = '';
}
return viewValue;
};
modelCtrl.$formatters.push(function(modelValue) {
return getViewValue(modelValue);
});
modelCtrl.$renderOriginal = modelCtrl.$render;
modelCtrl.$render = function() {
if (modelCtrl.$modelValue && opts.singleDatePicker) {
_setStartDate(modelCtrl.$modelValue);
_setEndDate(modelCtrl.$modelValue);
} else if (modelCtrl.$modelValue && (modelCtrl.$modelValue.startDate || modelCtrl.$modelValue.endDate)) {
_setStartDate(modelCtrl.$modelValue.startDate);
_setEndDate(modelCtrl.$modelValue.endDate);
} else {
_clear();
}
if (modelCtrl.$valid) {
return modelCtrl.$renderOriginal();
}
};
modelCtrl.$parsers.push(function(viewValue) {
var f, objValue, x;
f = function(value) {
var date;
date = moment(value, opts.locale.format);
return (date.isValid() && date) || null;
};
objValue = opts.singleDatePicker ? null : {
startDate: null,
endDate: null
};
if (angular.isString(viewValue) && viewValue.length > 0) {
if (opts.singleDatePicker) {
objValue = f(viewValue);
} else {
x = viewValue.split(opts.locale.separator).map(f);
objValue.startDate = x[0] ? x[0].startOf('day') : null;
objValue.endDate = x[1] ? x[1].endOf('day') : null;
}
}
return objValue;
});
modelCtrl.$isEmpty = function(val) {
return !(angular.isString(val) && val.length > 0);
};
_init = function() {
var eventType;
el.daterangepicker(angular.extend(opts, {
autoUpdateInput: false
}), function(startDate, endDate, label) {
return $scope.$apply(function() {
if (typeof opts.changeCallback === "function") {
return opts.changeCallback.apply(this, arguments);
}
});
});
_picker = el.data('daterangepicker');
$scope.picker = _picker;
_picker.container.hide();
_picker.container.addClass((opts.pickerClasses || "") + " " + (attrs['pickerClasses'] || ""));
el.on('show.daterangepicker', function(ev, picker) {
el.addClass('picker-open');
return $scope.$apply(function() {
if (opts.singleDatePicker) {
if (!picker.startDate.isSame($scope.model)) {
_setStartDate($scope.model);
_setEndDate($scope.model);
}
} else {
if ($scope.model && !picker.startDate.isSame($scope.model.startDate)) {
_setStartDate($scope.model.startDate);
}
if ($scope.model && !picker.endDate.isSame($scope.model.endDate)) {
_setEndDate($scope.model.endDate);
}
}
picker.updateView();
});
});
el.on('hide.daterangepicker', function(ev, picker) {
return el.removeClass('picker-open');
});
el.on('apply.daterangepicker', function(ev, picker) {
return $scope.$apply(function() {
if (opts.singleDatePicker) {
if (!picker.startDate) {
$scope.model = null;
} else if (!picker.startDate.isSame($scope.model)) {
$scope.model = picker.startDate;
}
} else if (!picker.startDate.isSame(picker.oldStartDate) || !picker.endDate.isSame(picker.oldEndDate) || !$scope.model || !picker.startDate.isSame($scope.model.startDate) || !picker.endDate.isSame($scope.model.endDate)) {
$scope.model = {
startDate: picker.startDate,
endDate: picker.endDate,
label: picker.chosenLabel
};
}
});
});
el.on('outsideClick.daterangepicker', function(ev, picker) {
if (opts.cancelOnOutsideClick) {
return $scope.$apply(function() {
picker.cancelingClick = true;
return picker.clickCancel();
});
} else {
return picker.clickApply();
}
});
for (eventType in opts.eventHandlers) {
el.on(eventType, function(ev, picker) {
var eventName;
eventName = ev.type + '.' + ev.namespace;
return $scope.$evalAsync(opts.eventHandlers[eventName]);
});
}
modelCtrl.$validate();
if (!$scope.model) {
return el.trigger('change');
}
};
$scope.$watch((function() {
return getViewValue($scope.model);
}), function(viewValue) {
if (typeof modelCtrl.$processModelValue === "function") {
modelCtrl.$processModelValue();
return modelCtrl.$render();
} else {
if (typeof modelCtrl.$$updateEmptyClasses === "function") {
modelCtrl.$$updateEmptyClasses(viewValue);
}
modelCtrl.$viewValue = modelCtrl.$$lastCommittedViewValue = viewValue;
return modelCtrl.$render();
}
});
_validateRange = function(date, min, max) {
var ref;
if (date && (min || max)) {
ref = [date, min, max].map(function(d) {
if (d) {
return moment(d);
} else {
return d;
}
}), date = ref[0], min = ref[1], max = ref[2];
return (!min || min.isBefore(date) || min.isSame(date, 'day')) && (!max || max.isSame(date, 'day') || max.isAfter(date));
} else {
return true;
}
};
_initBoundaryField = function(field, validator, modelField, optName) {
modelCtrl.$validators[field] = function(value) {
if (!opts[optName]) {
return true;
}
if (opts.singleDatePicker) {
if (field === 'min') {
return !value || validator(value, opts['minDate'], value);
} else if (field === 'max') {
return !value || validator(value, value, opts['maxDate']);
}
} else {
return value && validator(value[modelField], opts['minDate'], opts['maxDate']);
}
};
if (attrs[field]) {
return $scope.$watch(field, function(date) {
opts[optName] = date ? moment(date) : false;
if (_picker) {
_picker[optName] = opts[optName];
return $timeout(function() {
return modelCtrl.$validate();
});
}
});
}
};
_initBoundaryField('min', _validateRange, 'startDate', 'minDate');
_initBoundaryField('max', _validateRange, 'endDate', 'maxDate');
$scope.$watch('opts', function(newOpts) {
if (newOpts == null) {
newOpts = {};
}
opts = _mergeOpts(opts, newOpts);
return _init();
}, true);
if (attrs.clearable) {
$scope.$watch('clearable', function(newClearable) {
if (newClearable) {
opts = _mergeOpts(opts, {
locale: {
cancelLabel: opts.locale.clearLabel
}
});
}
_init();
if (newClearable) {
return el.on('cancel.daterangepicker', function(ev, picker) {
if (!picker.cancelingClick) {
$scope.model = opts.singleDatePicker ? null : {
startDate: null,
endDate: null
};
el.val("");
}
picker.cancelingClick = null;
return $timeout(function() {
return $scope.$apply();
});
});
}
});
}
return $scope.$on('$destroy', function() {
return _picker != null ? _picker.remove() : void 0;
});
}
};
}]);
}).call(this);
(function(){var a;a=angular.module("daterangepicker",[]),a.constant("dateRangePickerConfig",{cancelOnOutsideClick:!0,locale:{separator:" - ",format:"YYYY-MM-DD",clearLabel:"Clear"}}),a.directive("dateRangePicker",["$compile","$timeout","$parse","dateRangePickerConfig",function(a,b,c,d){return{require:"ngModel",restrict:"A",scope:{min:"=",max:"=",picker:"=?",model:"=ngModel",opts:"=options",clearable:"="},link:function(a,c,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s,t;return j=function(){var a,b;return b=angular.extend.apply(angular,Array.prototype.slice.call(arguments).map(function(a){return null!=a?a.locale:void 0}).filter(function(a){return!!a})),a=angular.extend.apply(angular,arguments),a.locale=b,a},r=$(c),r.attr("ng-trim","false"),e.ngTrim="false",p=!1,function(){var a,b;if(f.$options&&"function"==typeof f.$options.getOption?(b=f.$options.getOption("updateOn"),p=!!f.$options.getOption("allowInvalid")):(b=f.$options&&f.$options.updateOn||"",p=!(!f.$options||!f.$options.allowInvalid)),!b.includes("change"))return"function"==typeof f.$overrideModelOptions?(b+=" change",f.$overrideModelOptions({"*":"$inherit",updateOn:b})):(b+=" change",b.replace(/default/g," "),a=angular.copy(f.$options)||{},a.updateOn=b,a.updateOnDefault=!1,f.$options=a)}(),q=a.opts,t=j({},angular.copy(d),q),k=null,g=function(){if(k)return k.setStartDate(),k.setEndDate()},l=function(a){return function(b){if(b&&(!moment.isMoment(b)||b.isValid()))return b=moment(b),k?a(b):void 0}},n=l(function(a){return a&&k.endDate<a&&k.setEndDate(a),k.setStartDate(a),t.startDate=k.startDate}),m=l(function(a){return a&&k.startDate>a?(k.setEndDate(k.startDate),t.endDate=k.endDate,k.setStartDate(a),t.startDate=k.startDate):(k.setEndDate(a),t.endDate=k.endDate)}),s=function(a){var b;return b=function(a){return moment.isMoment(a)?a.format(t.locale.format):moment(a).format(t.locale.format)},t.singleDatePicker&&a?b(a):a&&(a.startDate||a.endDate)?[b(a.startDate),b(a.endDate)].join(t.locale.separator):""},f.$formatters.push(function(a){return s(a)}),f.$renderOriginal=f.$render,f.$render=function(){if(f.$modelValue&&t.singleDatePicker?(n(f.$modelValue),m(f.$modelValue)):f.$modelValue&&(f.$modelValue.startDate||f.$modelValue.endDate)?(n(f.$modelValue.startDate),m(f.$modelValue.endDate)):g(),f.$valid)return f.$renderOriginal()},f.$parsers.push(function(a){var b,c,d;return b=function(a){var b;return b=moment(a,t.locale.format),b.isValid()&&b||null},c=t.singleDatePicker?null:{startDate:null,endDate:null},angular.isString(a)&&a.length>0&&(t.singleDatePicker?c=b(a):(d=a.split(t.locale.separator).map(b),c.startDate=d[0]?d[0].startOf("day"):null,c.endDate=d[1]?d[1].endOf("day"):null)),c}),f.$isEmpty=function(a){return!(angular.isString(a)&&a.length>0)},h=function(){var b;r.daterangepicker(angular.extend(t,{autoUpdateInput:!1}),function(b,c,d){return a.$apply(function(){if("function"==typeof t.changeCallback)return t.changeCallback.apply(this,arguments)})}),k=r.data("daterangepicker"),a.picker=k,k.container.hide(),k.container.addClass((t.pickerClasses||"")+" "+(e.pickerClasses||"")),r.on("show.daterangepicker",function(b,c){return r.addClass("picker-open"),a.$apply(function(){t.singleDatePicker?c.startDate.isSame(a.model)||(n(a.model),m(a.model)):(a.model&&!c.startDate.isSame(a.model.startDate)&&n(a.model.startDate),a.model&&!c.endDate.isSame(a.model.endDate)&&m(a.model.endDate)),c.updateView()})}),r.on("hide.daterangepicker",function(a,b){return r.removeClass("picker-open")}),r.on("apply.daterangepicker",function(b,c){return a.$apply(function(){t.singleDatePicker?c.startDate?c.startDate.isSame(a.model)||(a.model=c.startDate):a.model=null:c.startDate.isSame(c.oldStartDate)&&c.endDate.isSame(c.oldEndDate)&&a.model&&c.startDate.isSame(a.model.startDate)&&c.endDate.isSame(a.model.endDate)||(a.model={startDate:c.startDate,endDate:c.endDate,label:c.chosenLabel})})}),r.on("outsideClick.daterangepicker",function(b,c){return t.cancelOnOutsideClick?a.$apply(function(){return c.cancelingClick=!0,c.clickCancel()}):c.clickApply()});for(b in t.eventHandlers)r.on(b,function(b,c){var d;return d=b.type+"."+b.namespace,a.$evalAsync(t.eventHandlers[d])});if(f.$validate(),!a.model)return r.trigger("change")},a.$watch(function(){return s(a.model)},function(a){return"function"==typeof f.$processModelValue?(f.$processModelValue(),f.$render()):("function"==typeof f.$$updateEmptyClasses&&f.$$updateEmptyClasses(a),f.$viewValue=f.$$lastCommittedViewValue=a,f.$render())}),o=function(a,b,c){var d;return!a||!b&&!c||(d=[a,b,c].map(function(a){return a?moment(a):a}),a=d[0],b=d[1],c=d[2],(!b||b.isBefore(a)||b.isSame(a,"day"))&&(!c||c.isSame(a,"day")||c.isAfter(a)))},i=function(c,d,g,h){if(f.$validators[c]=function(a){return!t[h]||(t.singleDatePicker?"min"===c?!a||d(a,t.minDate,a):"max"===c?!a||d(a,a,t.maxDate):void 0:a&&d(a[g],t.minDate,t.maxDate))},e[c])return a.$watch(c,function(a){if(t[h]=!!a&&moment(a),k)return k[h]=t[h],b(function(){return f.$validate()})})},i("min",o,"startDate","minDate"),i("max",o,"endDate","maxDate"),a.$watch("opts",function(a){return null==a&&(a={}),t=j(t,a),h()},!0),e.clearable&&a.$watch("clearable",function(c){if(c&&(t=j(t,{locale:{cancelLabel:t.locale.clearLabel}})),h(),c)return r.on("cancel.daterangepicker",function(c,d){return d.cancelingClick||(a.model=t.singleDatePicker?null:{startDate:null,endDate:null},r.val("")),d.cancelingClick=null,b(function(){return a.$apply()})})}),a.$on("$destroy",function(){return null!=k?k.remove():void 0})}}}])}).call(this);
//# sourceMappingURL=angular-daterangepicker.min.js.map
\ No newline at end of file
{"version":3,"sources":["angular-daterangepicker.js"],"names":["pickerModule","angular","module","constant","cancelOnOutsideClick","locale","separator","format","clearLabel","directive","$compile","$timeout","$parse","dateRangePickerConfig","require","restrict","scope","min","max","picker","model","opts","clearable","link","$scope","element","attrs","modelCtrl","_clear","_init","_initBoundaryField","_mergeOpts","_picker","_setDatePoint","_setEndDate","_setStartDate","_validateRange","allowInvalid","customOpts","el","getViewValue","extend","localeExtend","apply","Array","prototype","slice","call","arguments","map","opt","filter","$","attr","ngTrim","options","updateOn","$options","getOption","includes","$overrideModelOptions","*","replace","copy","updateOnDefault","setStartDate","setEndDate","setter","newValue","moment","isMoment","isValid","date","endDate","startDate","f","singleDatePicker","join","$formatters","push","modelValue","$renderOriginal","$render","$modelValue","$valid","$parsers","viewValue","objValue","x","value","isString","length","split","startOf","endOf","$isEmpty","val","eventType","daterangepicker","autoUpdateInput","label","$apply","changeCallback","this","data","container","hide","addClass","pickerClasses","on","ev","isSame","updateView","removeClass","oldStartDate","oldEndDate","chosenLabel","cancelingClick","clickCancel","clickApply","eventHandlers","eventName","type","namespace","$evalAsync","$validate","trigger","$watch","$processModelValue","$$updateEmptyClasses","$viewValue","$$lastCommittedViewValue","$validators","applicable","check","required","ref","d","isBefore","isAfter","field","validator","modelField","optName","newOpts","newClearable","cancelLabel","$on","remove"],"mappings":"CAAA,WACE,GAAIA,EAEJA,GAAeC,QAAQC,OAAO,sBAE9BF,EAAaG,SAAS,yBACpBC,sBAAsB,EACtBC,QACEC,UAAW,MACXC,OAAQ,aACRC,WAAY,WAIhBR,EAAaS,UAAU,mBAAoB,WAAY,WAAY,SAAU,wBAAyB,SAASC,EAAUC,EAAUC,EAAQC,GACzI,OACEC,QAAS,UACTC,SAAU,IACVC,OACEC,IAAK,IACLC,IAAK,IACLC,OAAQ,KACRC,MAAO,WACPC,KAAM,WACNC,UAAW,KAEbC,KAAM,SAASC,EAAQC,EAASC,EAAOC,GACrC,GAAIC,GAAQC,EAAOC,EAAoBC,EAAYC,EAASC,EAAeC,EAAaC,EAAeC,EAAgBC,EAAcC,EAAYC,EAAIC,EAAcnB,CAgUnK,OA/TAU,GAAa,WACX,GAAIU,GAAQC,CAQZ,OAPAA,GAAezC,QAAQwC,OAAOE,MAAM1C,QAAS2C,MAAMC,UAAUC,MAAMC,KAAKC,WAAWC,IAAI,SAASC,GAC9F,MAAc,OAAPA,EAAcA,EAAI7C,WAAS,KACjC8C,OAAO,SAASD,GACjB,QAASA,KAEXT,EAASxC,QAAQwC,OAAOE,MAAM1C,QAAS+C,WACvCP,EAAOpC,OAASqC,EACTD,GAETF,EAAKa,EAAE3B,GACPc,EAAGc,KAAK,UAAW,SACnB3B,EAAM4B,OAAS,QACfjB,GAAe,EACI,WACjB,GAAIkB,GAASC,CAQb,IAPI7B,EAAU8B,UAAoD,kBAAjC9B,GAAU8B,SAASC,WAClDF,EAAW7B,EAAU8B,SAASC,UAAU,YACxCrB,IAAiBV,EAAU8B,SAASC,UAAU,kBAE9CF,EAAY7B,EAAU8B,UAAY9B,EAAU8B,SAASD,UAAa,GAClEnB,KAAkBV,EAAU8B,WAAY9B,EAAU8B,SAASpB,gBAExDmB,EAASG,SAAS,UACrB,MAA+C,kBAApChC,GAAUiC,uBACnBJ,GAAY,UACL7B,EAAUiC,uBACfC,IAAK,WACLL,SAAUA,MAGZA,GAAY,UACZA,EAASM,QAAQ,WAAY,KAC7BP,EAAUtD,QAAQ8D,KAAKpC,EAAU8B,cACjCF,EAAQC,SAAWA,EACnBD,EAAQS,iBAAkB,EACnBrC,EAAU8B,SAAWF,MAIlCjB,EAAad,EAAOH,KACpBA,EAAOU,KAAe9B,QAAQ8D,KAAKlD,GAAwByB,GAC3DN,EAAU,KACVJ,EAAS,WACP,GAAII,EAEF,MADAA,GAAQiC,eACDjC,EAAQkC,cAGnBjC,EAAgB,SAASkC,GACvB,MAAO,UAASC,GACd,GAAIA,KAAcC,OAAOC,SAASF,IAAaA,EAASG,WAKxD,MAJEH,GAAWC,OAAOD,GAIhBpC,EACKmC,EAAOC,OADhB,KAKJjC,EAAgBF,EAAc,SAASuC,GAKrC,MAJIA,IAAQxC,EAAQyC,QAAUD,GAC5BxC,EAAQkC,WAAWM,GAErBxC,EAAQiC,aAAaO,GACdnD,EAAKqD,UAAY1C,EAAQ0C,YAElCxC,EAAcD,EAAc,SAASuC,GACnC,MAAIA,IAAQxC,EAAQ0C,UAAYF,GAC9BxC,EAAQkC,WAAWlC,EAAQ0C,WAC3BrD,EAAKoD,QAAUzC,EAAQyC,QACvBzC,EAAQiC,aAAaO,GACdnD,EAAKqD,UAAY1C,EAAQ0C,YAEhC1C,EAAQkC,WAAWM,GACZnD,EAAKoD,QAAUzC,EAAQyC,WAGlCjC,EAAe,SAASpB,GACtB,GAAIuD,EAeJ,OAdAA,GAAI,SAASH,GACX,MAAKH,QAAOC,SAASE,GAGZA,EAAKjE,OAAOc,EAAKhB,OAAOE,QAFxB8D,OAAOG,GAAMjE,OAAOc,EAAKhB,OAAOE,SAKvCc,EAAKuD,kBAAoBxD,EACfuD,EAAEvD,GACLA,IAAUA,EAAMsD,WAAatD,EAAMqD,UAC/BE,EAAEvD,EAAMsD,WAAYC,EAAEvD,EAAMqD,UAAUI,KAAKxD,EAAKhB,OAAOC,WAExD,IAIhBqB,EAAUmD,YAAYC,KAAK,SAASC,GAClC,MAAOxC,GAAawC,KAEtBrD,EAAUsD,gBAAkBtD,EAAUuD,QACtCvD,EAAUuD,QAAU,WAUlB,GATIvD,EAAUwD,aAAe9D,EAAKuD,kBAChCzC,EAAcR,EAAUwD,aACxBjD,EAAYP,EAAUwD,cACbxD,EAAUwD,cAAgBxD,EAAUwD,YAAYT,WAAa/C,EAAUwD,YAAYV,UAC5FtC,EAAcR,EAAUwD,YAAYT,WACpCxC,EAAYP,EAAUwD,YAAYV,UAElC7C,IAEED,EAAUyD,OACZ,MAAOzD,GAAUsD,mBAGrBtD,EAAU0D,SAASN,KAAK,SAASO,GAC/B,GAAIX,GAAGY,EAAUC,CAmBjB,OAlBAb,GAAI,SAASc,GACX,GAAIjB,EAEJ,OADAA,GAAOH,OAAOoB,EAAOpE,EAAKhB,OAAOE,QACzBiE,EAAKD,WAAaC,GAAS,MAErCe,EAAWlE,EAAKuD,iBAAmB,MACjCF,UAAW,KACXD,QAAS,MAEPxE,QAAQyF,SAASJ,IAAcA,EAAUK,OAAS,IAChDtE,EAAKuD,iBACPW,EAAWZ,EAAEW,IAEbE,EAAIF,EAAUM,MAAMvE,EAAKhB,OAAOC,WAAW2C,IAAI0B,GAC/CY,EAASb,UAAYc,EAAE,GAAKA,EAAE,GAAGK,QAAQ,OAAS,KAClDN,EAASd,QAAUe,EAAE,GAAKA,EAAE,GAAGM,MAAM,OAAS,OAG3CP,IAET5D,EAAUoE,SAAW,SAASC,GAC5B,QAAS/F,QAAQyF,SAASM,IAAQA,EAAIL,OAAS,IAEjD9D,EAAQ,WACN,GAAIoE,EACJ1D,GAAG2D,gBAAgBjG,QAAQwC,OAAOpB,GAChC8E,iBAAiB,IACf,SAASzB,EAAWD,EAAS2B,GAC/B,MAAO5E,GAAO6E,OAAO,WACnB,GAAmC,kBAAxBhF,GAAKiF,eACd,MAAOjF,GAAKiF,eAAe3D,MAAM4D,KAAMvD,eAI7ChB,EAAUO,EAAGiE,KAAK,mBAClBhF,EAAOL,OAASa,EAChBA,EAAQyE,UAAUC,OAClB1E,EAAQyE,UAAUE,UAAUtF,EAAKuF,eAAiB,IAAM,KAAOlF,EAAqB,eAAK,KACzFa,EAAGsE,GAAG,uBAAwB,SAASC,EAAI3F,GAEzC,MADAoB,GAAGoE,SAAS,eACLnF,EAAO6E,OAAO,WACfhF,EAAKuD,iBACFzD,EAAOuD,UAAUqC,OAAOvF,EAAOJ,SAClCe,EAAcX,EAAOJ,OACrBc,EAAYV,EAAOJ,SAGjBI,EAAOJ,QAAUD,EAAOuD,UAAUqC,OAAOvF,EAAOJ,MAAMsD,YACxDvC,EAAcX,EAAOJ,MAAMsD,WAEzBlD,EAAOJ,QAAUD,EAAOsD,QAAQsC,OAAOvF,EAAOJ,MAAMqD,UACtDvC,EAAYV,EAAOJ,MAAMqD,UAG7BtD,EAAO6F,iBAGXzE,EAAGsE,GAAG,uBAAwB,SAASC,EAAI3F,GACzC,MAAOoB,GAAG0E,YAAY,iBAExB1E,EAAGsE,GAAG,wBAAyB,SAASC,EAAI3F,GAC1C,MAAOK,GAAO6E,OAAO,WACfhF,EAAKuD,iBACFzD,EAAOuD,UAEAvD,EAAOuD,UAAUqC,OAAOvF,EAAOJ,SACzCI,EAAOJ,MAAQD,EAAOuD,WAFtBlD,EAAOJ,MAAQ,KAIPD,EAAOuD,UAAUqC,OAAO5F,EAAO+F,eAAkB/F,EAAOsD,QAAQsC,OAAO5F,EAAOgG,aAAgB3F,EAAOJ,OAAUD,EAAOuD,UAAUqC,OAAOvF,EAAOJ,MAAMsD,YAAevD,EAAOsD,QAAQsC,OAAOvF,EAAOJ,MAAMqD,WAChNjD,EAAOJ,OACLsD,UAAWvD,EAAOuD,UAClBD,QAAStD,EAAOsD,QAChB2B,MAAOjF,EAAOiG,kBAKtB7E,EAAGsE,GAAG,+BAAgC,SAASC,EAAI3F,GACjD,MAAIE,GAAKjB,qBACAoB,EAAO6E,OAAO,WAEnB,MADAlF,GAAOkG,gBAAiB,EACjBlG,EAAOmG,gBAGTnG,EAAOoG,cAGlB,KAAKtB,IAAa5E,GAAKmG,cACrBjF,EAAGsE,GAAGZ,EAAW,SAASa,EAAI3F,GAC5B,GAAIsG,EAEJ,OADAA,GAAYX,EAAGY,KAAO,IAAMZ,EAAGa,UACxBnG,EAAOoG,WAAWvG,EAAKmG,cAAcC,KAIhD,IADA9F,EAAUkG,aACLrG,EAAOJ,MACV,MAAOmB,GAAGuF,QAAQ,WAGtBtG,EAAOuG,OAAO,WACZ,MAAOvF,GAAahB,EAAOJ,QACzB,SAASkE,GACX,MAA4C,kBAAjC3D,GAAUqG,oBACnBrG,EAAUqG,qBACHrG,EAAUuD,YAE6B,kBAAnCvD,GAAUsG,sBACnBtG,EAAUsG,qBAAqB3C,GAEjC3D,EAAUuG,WAAavG,EAAUwG,yBAA2B7C,EACrD3D,EAAUuD,aAGrBvD,EAAUyG,YAAqB,QAAI,SAAS3C,EAAOH,GACjD,GAAI+C,GAAYC,CAOhB,OANAD,GAAa3G,EAAM6G,WAAa5G,EAAUoE,SAAST,GAEjDgD,EADEjH,EAAKuD,iBACCa,GAASA,EAAMlB,UAEfkB,GAASA,EAAMf,WAAae,EAAMf,UAAUH,WAAakB,EAAMhB,SAAWgB,EAAMhB,QAAQF,WAE1F8D,KAAgBC,GAE1BlG,EAAiB,SAASoC,EAAMvD,EAAKC,GACnC,GAAIsH,EACJ,QAAIhE,IAASvD,IAAOC,IAClBsH,GAAOhE,EAAMvD,EAAKC,GAAK+B,IAAI,SAASwF,GAClC,MAAIA,GACKpE,OAAOoE,GAEPA,IAEPjE,EAAOgE,EAAI,GAAIvH,EAAMuH,EAAI,GAAItH,EAAMsH,EAAI,KAClCvH,GAAOA,EAAIyH,SAASlE,IAASvD,EAAI8F,OAAOvC,EAAM,WAAatD,GAAOA,EAAI6F,OAAOvC,EAAM,QAAUtD,EAAIyH,QAAQnE,MAKtH1C,EAAqB,SAAS8G,EAAOC,EAAWC,EAAYC,GAe1D,GAdApH,EAAUyG,YAAYQ,GAAS,SAASnD,GACtC,OAAKpE,EAAK0H,KAGN1H,EAAKuD,iBACO,QAAVgE,GACMnD,GAASoD,EAAUpD,EAAOpE,EAAc,QAAGoE,GAChC,QAAVmD,GACDnD,GAASoD,EAAUpD,EAAOA,EAAOpE,EAAc,aADlD,GAIAoE,GAASoD,EAAUpD,EAAMqD,GAAazH,EAAc,QAAGA,EAAc,WAG5EK,EAAMkH,GACR,MAAOpH,GAAOuG,OAAOa,EAAO,SAASpE,GAEnC,GADAnD,EAAK0H,KAAWvE,GAAOH,OAAOG,GAC1BxC,EAEF,MADAA,GAAQ+G,GAAW1H,EAAK0H,GACjBpI,EAAS,WACd,MAAOgB,GAAUkG,iBAM3B/F,EAAmB,MAAOM,EAAgB,YAAa,WACvDN,EAAmB,MAAOM,EAAgB,UAAW,WACrDZ,EAAOuG,OAAO,OAAQ,SAASiB,GAK7B,MAJe,OAAXA,IACFA,MAEF3H,EAAOU,EAAWV,EAAM2H,GACjBnH,MACN,GACCH,EAAMJ,WACRE,EAAOuG,OAAO,YAAa,SAASkB,GASlC,GARIA,IACF5H,EAAOU,EAAWV,GAChBhB,QACE6I,YAAa7H,EAAKhB,OAAOG,eAI/BqB,IACIoH,EACF,MAAO1G,GAAGsE,GAAG,yBAA0B,SAASC,EAAI3F,GASlD,MARKA,GAAOkG,iBACV7F,EAAOJ,MAAQC,EAAKuD,iBAAmB,MACrCF,UAAW,KACXD,QAAS,MAEXlC,EAAGyD,IAAI,KAET7E,EAAOkG,eAAiB,KACjB1G,EAAS,WACd,MAAOa,GAAO6E,eAMjB7E,EAAO2H,IAAI,WAAY,WAC5B,MAAkB,OAAXnH,EAAkBA,EAAQoH,aAAW,YAMnDrG,KAAKwD","file":"angular-daterangepicker.min.js"}
\ No newline at end of file
{"version":3,"file":"angular-daterangepicker.min.js","sources":["angular-daterangepicker.js"],"names":["picker","angular","module","constant","separator","format","clearLabel","directive","$compile","$timeout","$parse","dateRangePickerConfig","require","restrict","scope","dateMin","dateMax","model","opts","clearable","link","$scope","element","attrs","modelCtrl","clear","customOpts","el","_formatted","_init","_picker","_setEndDate","_setStartDate","_validateMax","_validateMin","$","extend","setStartDate","setEndDate","val","newValue","m","moment","endDate","startDate","$watch","viewVal","f","date","isMoment","singleDatePicker","join","min","start","valid","isBefore","isSame","$setValidity","max","end","isAfter","$formatters","push","$parsers","isObject","hasOwnProperty","$modelValue","$isEmpty","$render","callbackFunction","eventType","locale","_ref","daterangepicker","$setViewValue","data","eventHandlers","on","cancelLabel","trigger","change","trim","options","newOpts","$on","remove","call","this"],"mappings":"CAAA,WACE,GAAIA,EAEJA,GAASC,QAAQC,OAAO,sBAExBF,EAAOG,SAAS,yBACdC,UAAW,MACXC,OAAQ,aACRC,WAAY,UAGdN,EAAOO,UAAU,mBAAoB,WAAY,WAAY,SAAU,wBAAyB,SAASC,EAAUC,EAAUC,EAAQC,GACnI,OACEC,QAAS,UACTC,SAAU,IACVC,OACEC,QAAS,OACTC,QAAS,OACTC,MAAO,WACPC,KAAM,WACNC,UAAW,KAEbC,KAAM,SAASC,EAAQC,EAASC,EAAOC,GACrC,GAAIC,GAAOC,EAAYC,EAAIT,EAAMU,EAAYC,EAAOC,EAASC,EAAaC,EAAeC,EAAcC,CA4LvG,OA3LAP,GAAKQ,EAAEb,GACPI,EAAaL,EAAOH,KACpBA,EAAOjB,QAAQmC,UAAWzB,EAAuBe,GACjDI,EAAU,KACVL,EAAQ,WAGN,MAFAK,GAAQO,eACRP,EAAQQ,aACDX,EAAGY,IAAI,KAEhBP,EAAgB,SAASQ,GACvB,MAAO/B,GAAS,WACd,GAAIgC,EACJ,OAAIX,GACGU,GAGHC,EAAIC,OAAOF,GACPV,EAAQa,QAAUF,GACpBX,EAAQQ,WAAWG,GAEdX,EAAQO,aAAaI,IANrBhB,IAFX,UAaJM,EAAc,SAASS,GACrB,MAAO/B,GAAS,WACd,GAAIgC,EACJ,OAAIX,GACGU,GAGHC,EAAIC,OAAOF,GACPV,EAAQc,UAAYH,GACtBX,EAAQO,aAAaI,GAEhBX,EAAQQ,WAAWG,IANnBhB,IAFX,UAaJJ,EAAOwB,OAAO,kBAAmB,SAASL,GACxC,MAAOR,GAAcQ,KAEvBnB,EAAOwB,OAAO,gBAAiB,SAASL,GACtC,MAAOT,GAAYS,KAErBZ,EAAa,SAASkB,GACpB,GAAIC,EAOJ,OANAA,GAAI,SAASC,GACX,MAAKN,QAAOO,SAASD,GAGdA,EAAK3C,OAAOa,EAAKb,QAFfqC,OAAOM,GAAM3C,OAAOa,EAAKb,SAIhCa,EAAKgC,iBACAH,EAAED,EAAQF,YAETG,EAAED,EAAQF,WAAYG,EAAED,EAAQH,UAAUQ,KAAKjC,EAAKd,YAGhE8B,EAAe,SAASkB,EAAKC,GAC3B,GAAIC,EAKJ,OAJAF,GAAMV,OAAOU,GACbC,EAAQX,OAAOW,GACfC,EAAQF,EAAIG,SAASF,IAAUD,EAAII,OAAOH,EAAO,OACjD7B,EAAUiC,aAAa,MAAOH,GACvBA,GAETrB,EAAe,SAASyB,EAAKC,GAC3B,GAAIL,EAKJ,OAJAI,GAAMhB,OAAOgB,GACbC,EAAMjB,OAAOiB,GACbL,EAAQI,EAAIE,QAAQD,IAAQD,EAAIF,OAAOG,EAAK,OAC5CnC,EAAUiC,aAAa,MAAOH,GACvBA,GAET9B,EAAUqC,YAAYC,KAAK,SAASvB,GAClC,MAAIA,IAAOA,EAAIK,WAAaL,EAAII,SAC9BX,EAAcO,EAAIK,WAClBb,EAAYQ,EAAII,SACTJ,GAEF,KAETf,EAAUuC,SAASD,KAAK,SAASvB,GAC/B,MAAKtC,SAAQ+D,SAASzB,IAAUA,EAAI0B,eAAe,cAAgB1B,EAAI0B,eAAe,YAGlF5C,EAAON,SAAWwB,EAAIK,UACxBV,EAAab,EAAON,QAASwB,EAAIK,WAEjCpB,EAAUiC,aAAa,OAAO,GAE5BpC,EAAOL,SAAWuB,EAAII,QACxBV,EAAaZ,EAAOL,QAASuB,EAAII,SAEjCnB,EAAUiC,aAAa,OAAO,GAEzBlB,GAZEf,EAAU0C,cAcrB1C,EAAU2C,SAAW,SAAS5B,GAC5B,OAAQA,GAAyB,OAAlBA,EAAIK,WAAsC,OAAhBL,EAAII,SAE/CnB,EAAU4C,QAAU,WAClB,MAAK5C,GAAU0C,YAGyB,OAApC1C,EAAU0C,YAAYtB,UACjBjB,EAAGY,IAAI,IAETZ,EAAGY,IAAIX,EAAWJ,EAAU0C,cAL1BvC,EAAGY,IAAI,KAOlBV,EAAQ,WACN,GAAIwC,GAAkBC,EAAWC,EAAQC,CACzC7C,GAAG8C,gBAAgBvD,EAAM,SAASmC,EAAOM,GAOvC,MANAlD,GAAS,WACP,MAAOe,GAAUkD,eACf9B,UAAWS,EACXV,QAASgB,MAGNnC,EAAU4C,YAEnBtC,EAAUH,EAAGgD,KAAK,mBAClBH,EAAOtD,EAAK0D,aACZ,KAAKN,IAAaE,GAChBH,EAAmBG,EAAKF,GACxB3C,EAAGkD,GAAGP,EAAWD,EAEf9C,GAAMJ,YACRoD,EAASrD,EAAKqD,WACdA,EAAOO,YAAc5D,EAAKZ,WAC1BY,EAAKqD,OAASA,EACd5C,EAAGkD,GAAG,yBAA0B,WAM9B,MALArD,GAAUkD,eACR9B,UAAW,KACXD,QAAS,OAEXnB,EAAU4C,UACHzC,EAAGoD,QAAQ,cAIxBlD,IACAF,EAAGqD,OAAO,WACR,MAAyB,KAArB7C,EAAE8C,KAAKtD,EAAGY,OACL9B,EAAS,WACd,MAAOe,GAAUkD,eACf9B,UAAW,KACXD,QAAS,SAJf,SASEpB,EAAM6B,KACR/B,EAAOwB,OAAO,UAAW,SAASG,GAShC,MARIA,IACGxB,EAAU2C,SAAS3C,EAAU0C,cAChChC,EAAac,EAAMxB,EAAU0C,YAAYtB,WAE3C1B,EAAc,QAAIwB,OAAOM,IAEzB9B,EAAc,SAAI,EAEbW,MAGPN,EAAMmC,KACRrC,EAAOwB,OAAO,UAAW,SAASG,GAShC,MARIA,IACGxB,EAAU2C,SAAS3C,EAAU0C,cAChCjC,EAAae,EAAMxB,EAAU0C,YAAYvB,SAE3CzB,EAAc,QAAIwB,OAAOM,IAEzB9B,EAAc,SAAI,EAEbW,MAGPN,EAAM2D,SACR7D,EAAOwB,OAAO,OAAQ,SAASsC,GAE7B,MADAjE,GAAOjB,QAAQmC,OAAOlB,EAAMiE,GACrBtD,MACN,GAEER,EAAO+D,IAAI,WAAY,WAC5B,MAAkB,OAAXtD,EAAkBA,EAAQuD,SAAW,gBAMnDC,KAAKC"}
\ No newline at end of file
{
"name": "angular-daterangepicker",
"version": "0.3.0",
"homepage": "https://github.com/fragaria/angular-daterangepicker",
"authors": [
"Filip Vařecha <filip.varecha@fragaria.cz>",
"Tibor Kulčár <tibor.kulcar@fragaria.cz>",
"Lukáš Marek <lukas.marek@fragaria.cz>",
"Adam Segal <phazei@gmail.com>"
],
"description": "Angular.js wrapper for Dan Grosmann's bootstrap date range picker (https://github.com/dangrossman/bootstrap-daterangepicker).",
"license": "MIT",
"private": false,
"dependencies": {
"angular": "^1.2.17",
"bootstrap-daterangepicker": "^3.0.3"
},
"main": "index.js",
"devDependencies": {
"coffeelint": "^1.12.1",
"grunt": "~0.4.1",
"grunt-coffeelint": "^0.0.13",
"grunt-contrib-coffee": "^0.13.0",
"grunt-contrib-uglify": "^0.9.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-ng-annotate": "^1.0.1",
"grunt-wiredep": "^2.0.0",
"load-grunt-tasks": "^3.3.0"
}
}
{
"name": "daterangepicker",
"main": [
"daterangepicker.js",
"daterangepicker.css"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"moment.js",
"moment.min.js"
],
"dependencies": {
"jquery": "1.9.1 - 3",
"moment": ">=2.9.0"
},
"homepage": "https://github.com/dangrossman/bootstrap-daterangepicker",
"version": "3.0.3",
"_release": "3.0.3",
"_resolution": {
"type": "version",
"tag": "v3.0.3",
"commit": "27110b918f9a72db0b14018bcedc1e6dcffc74ba"
},
"_source": "https://github.com/dangrossman/bootstrap-daterangepicker.git",
"_target": "^3.0.3",
"_originalSource": "bootstrap-daterangepicker"
}
\ No newline at end of file
# Date Range Picker
![Improvely.com](https://i.imgur.com/UTRlaar.png)
This date range picker component creates a dropdown menu from which a user can
select a range of dates. I created it while building the UI for [Improvely](http://www.improvely.com),
which needed a way to select date ranges for reports.
Features include limiting the selectable date range, localizable strings and date formats,
a single date picker mode, a time picker, and predefined date ranges.
## [Documentation and Live Usage Examples](http://www.daterangepicker.com)
## [See It In a Live Application](https://awio.iljmp.com/5/drpdemogh)
## License
The MIT License (MIT)
Copyright (c) 2012-2018 Dan Grossman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
{
"name": "daterangepicker",
"main": [
"daterangepicker.js",
"daterangepicker.css"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"moment.js",
"moment.min.js"
],
"dependencies": {
"jquery": "1.9.1 - 3",
"moment": ">=2.9.0"
}
}
.daterangepicker {
position: absolute;
color: inherit;
background-color: #fff;
border-radius: 4px;
border: 1px solid #ddd;
width: 278px;
max-width: none;
padding: 0;
margin-top: 7px;
top: 100px;
left: 20px;
z-index: 3001;
display: none;
font-family: arial;
font-size: 15px;
line-height: 1em;
}
.daterangepicker:before, .daterangepicker:after {
position: absolute;
display: inline-block;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker:before {
top: -7px;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-bottom: 7px solid #ccc;
}
.daterangepicker:after {
top: -6px;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
}
.daterangepicker.opensleft:before {
right: 9px;
}
.daterangepicker.opensleft:after {
right: 10px;
}
.daterangepicker.openscenter:before {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.openscenter:after {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.opensright:before {
left: 9px;
}
.daterangepicker.opensright:after {
left: 10px;
}
.daterangepicker.drop-up {
margin-top: -7px;
}
.daterangepicker.drop-up:before {
top: initial;
bottom: -7px;
border-bottom: initial;
border-top: 7px solid #ccc;
}
.daterangepicker.drop-up:after {
top: initial;
bottom: -6px;
border-bottom: initial;
border-top: 6px solid #fff;
}
.daterangepicker.single .daterangepicker .ranges, .daterangepicker.single .drp-calendar {
float: none;
}
.daterangepicker.single .drp-selected {
display: none;
}
.daterangepicker.show-calendar .drp-calendar {
display: block;
}
.daterangepicker.show-calendar .drp-buttons {
display: block;
}
.daterangepicker.auto-apply .drp-buttons {
display: none;
}
.daterangepicker .drp-calendar {
display: none;
max-width: 270px;
}
.daterangepicker .drp-calendar.left {
padding: 8px 0 8px 8px;
}
.daterangepicker .drp-calendar.right {
padding: 8px;
}
.daterangepicker .drp-calendar.single .calendar-table {
border: none;
}
.daterangepicker .calendar-table .next span, .daterangepicker .calendar-table .prev span {
color: #fff;
border: solid black;
border-width: 0 2px 2px 0;
border-radius: 0;
display: inline-block;
padding: 3px;
}
.daterangepicker .calendar-table .next span {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
.daterangepicker .calendar-table .prev span {
transform: rotate(135deg);
-webkit-transform: rotate(135deg);
}
.daterangepicker .calendar-table th, .daterangepicker .calendar-table td {
white-space: nowrap;
text-align: center;
vertical-align: middle;
min-width: 32px;
width: 32px;
height: 24px;
line-height: 24px;
font-size: 12px;
border-radius: 4px;
border: 1px solid transparent;
white-space: nowrap;
cursor: pointer;
}
.daterangepicker .calendar-table {
border: 1px solid #fff;
border-radius: 4px;
background-color: #fff;
}
.daterangepicker .calendar-table table {
width: 100%;
margin: 0;
border-spacing: 0;
border-collapse: collapse;
}
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
background-color: #eee;
border-color: transparent;
color: inherit;
}
.daterangepicker td.week, .daterangepicker th.week {
font-size: 80%;
color: #ccc;
}
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date {
background-color: #fff;
border-color: transparent;
color: #999;
}
.daterangepicker td.in-range {
background-color: #ebf4f8;
border-color: transparent;
color: #000;
border-radius: 0;
}
.daterangepicker td.start-date {
border-radius: 4px 0 0 4px;
}
.daterangepicker td.end-date {
border-radius: 0 4px 4px 0;
}
.daterangepicker td.start-date.end-date {
border-radius: 4px;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #357ebd;
border-color: transparent;
color: #fff;
}
.daterangepicker th.month {
width: auto;
}
.daterangepicker td.disabled, .daterangepicker option.disabled {
color: #999;
cursor: not-allowed;
text-decoration: line-through;
}
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;
padding: 1px;
height: auto;
margin: 0;
cursor: default;
}
.daterangepicker select.monthselect {
margin-right: 2%;
width: 56%;
}
.daterangepicker select.yearselect {
width: 40%;
}
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect {
width: 50px;
margin: 0 auto;
background: #eee;
border: 1px solid #eee;
padding: 2px;
outline: 0;
font-size: 12px;
}
.daterangepicker .calendar-time {
text-align: center;
margin: 4px auto 0 auto;
line-height: 30px;
position: relative;
}
.daterangepicker .calendar-time select.disabled {
color: #ccc;
cursor: not-allowed;
}
.daterangepicker .drp-buttons {
clear: both;
text-align: right;
padding: 8px;
border-top: 1px solid #ddd;
display: none;
line-height: 12px;
vertical-align: middle;
}
.daterangepicker .drp-selected {
display: inline-block;
font-size: 12px;
padding-right: 8px;
}
.daterangepicker .drp-buttons .btn {
margin-left: 8px;
font-size: 12px;
font-weight: bold;
padding: 4px 8px;
}
.daterangepicker.show-ranges .drp-calendar.left {
border-left: 1px solid #ddd;
}
.daterangepicker .ranges {
float: none;
text-align: left;
margin: 0;
}
.daterangepicker.show-calendar .ranges {
margin-top: 8px;
}
.daterangepicker .ranges ul {
list-style: none;
margin: 0 auto;
padding: 0;
width: 100%;
}
.daterangepicker .ranges li {
font-size: 12px;
padding: 8px 12px;
cursor: pointer;
}
.daterangepicker .ranges li:hover {
background-color: #eee;
}
.daterangepicker .ranges li.active {
background-color: #08c;
color: #fff;
}
/* Larger Screen Styling */
@media (min-width: 564px) {
.daterangepicker {
width: auto; }
.daterangepicker .ranges ul {
width: 140px; }
.daterangepicker.single .ranges ul {
width: 100%; }
.daterangepicker.single .drp-calendar.left {
clear: none; }
.daterangepicker.single.ltr .ranges, .daterangepicker.single.ltr .drp-calendar {
float: left; }
.daterangepicker.single.rtl .ranges, .daterangepicker.single.rtl .drp-calendar {
float: right; }
.daterangepicker.ltr {
direction: ltr;
text-align: left; }
.daterangepicker.ltr .drp-calendar.left {
clear: left;
margin-right: 0; }
.daterangepicker.ltr .drp-calendar.left .calendar-table {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0; }
.daterangepicker.ltr .drp-calendar.right {
margin-left: 0; }
.daterangepicker.ltr .drp-calendar.right .calendar-table {
border-left: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0; }
.daterangepicker.ltr .drp-calendar.left .calendar-table {
padding-right: 8px; }
.daterangepicker.ltr .ranges, .daterangepicker.ltr .drp-calendar {
float: left; }
.daterangepicker.rtl {
direction: rtl;
text-align: right; }
.daterangepicker.rtl .drp-calendar.left {
clear: right;
margin-left: 0; }
.daterangepicker.rtl .drp-calendar.left .calendar-table {
border-left: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0; }
.daterangepicker.rtl .drp-calendar.right {
margin-right: 0; }
.daterangepicker.rtl .drp-calendar.right .calendar-table {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0; }
.daterangepicker.rtl .drp-calendar.left .calendar-table {
padding-left: 12px; }
.daterangepicker.rtl .ranges, .daterangepicker.rtl .drp-calendar {
text-align: right;
float: right; } }
@media (min-width: 730px) {
.daterangepicker .ranges {
width: auto; }
.daterangepicker.ltr .ranges {
float: left; }
.daterangepicker.rtl .ranges {
float: right; }
.daterangepicker .drp-calendar.left {
clear: none !important; } }
/**
* @version: 3.0.3
* @author: Dan Grossman http://www.dangrossman.info/
* @copyright: Copyright (c) 2012-2018 Dan Grossman. All rights reserved.
* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
* @website: http://www.daterangepicker.com/
*/
// Following the UMD template https://github.com/umdjs/umd/blob/master/templates/returnExportsGlobal.js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Make globaly available as well
define(['moment', 'jquery'], function (moment, jquery) {
if (!jquery.fn) jquery.fn = {}; // webpack server rendering
if (typeof moment !== 'function' && moment.default) moment = moment.default
return factory(moment, jquery);
});
} else if (typeof module === 'object' && module.exports) {
// Node / Browserify
//isomorphic issue
var jQuery = (typeof window != 'undefined') ? window.jQuery : undefined;
if (!jQuery) {
jQuery = require('jquery');
if (!jQuery.fn) jQuery.fn = {};
}
var moment = (typeof window != 'undefined' && typeof window.moment != 'undefined') ? window.moment : require('moment');
module.exports = factory(moment, jQuery);
} else {
// Browser globals
root.daterangepicker = factory(root.moment, root.jQuery);
}
}(this, function(moment, $) {
var DateRangePicker = function(element, options, cb) {
//default settings for options
this.parentEl = 'body';
this.element = $(element);
this.startDate = moment().startOf('day');
this.endDate = moment().endOf('day');
this.minDate = false;
this.maxDate = false;
this.maxSpan = false;
this.autoApply = false;
this.singleDatePicker = false;
this.showDropdowns = false;
this.minYear = moment().subtract(100, 'year').format('YYYY');
this.maxYear = moment().add(100, 'year').format('YYYY');
this.showWeekNumbers = false;
this.showISOWeekNumbers = false;
this.showCustomRangeLabel = true;
this.timePicker = false;
this.timePicker24Hour = false;
this.timePickerIncrement = 1;
this.timePickerSeconds = false;
this.linkedCalendars = true;
this.autoUpdateInput = true;
this.alwaysShowCalendars = false;
this.ranges = {};
this.opens = 'right';
if (this.element.hasClass('pull-right'))
this.opens = 'left';
this.drops = 'down';
if (this.element.hasClass('dropup'))
this.drops = 'up';
this.buttonClasses = 'btn btn-sm';
this.applyButtonClasses = 'btn-primary';
this.cancelButtonClasses = 'btn-default';
this.locale = {
direction: 'ltr',
format: moment.localeData().longDateFormat('L'),
separator: ' - ',
applyLabel: 'Apply',
cancelLabel: 'Cancel',
weekLabel: 'W',
customRangeLabel: 'Custom Range',
daysOfWeek: moment.weekdaysMin(),
monthNames: moment.monthsShort(),
firstDay: moment.localeData().firstDayOfWeek()
};
this.callback = function() { };
//some state information
this.isShowing = false;
this.leftCalendar = {};
this.rightCalendar = {};
//custom options from user
if (typeof options !== 'object' || options === null)
options = {};
//allow setting options with data attributes
//data-api options will be overwritten with custom javascript options
options = $.extend(this.element.data(), options);
//html template for the picker UI
if (typeof options.template !== 'string' && !(options.template instanceof $))
options.template =
'<div class="daterangepicker">' +
'<div class="ranges"></div>' +
'<div class="drp-calendar left">' +
'<div class="calendar-table"></div>' +
'<div class="calendar-time"></div>' +
'</div>' +
'<div class="drp-calendar right">' +
'<div class="calendar-table"></div>' +
'<div class="calendar-time"></div>' +
'</div>' +
'<div class="drp-buttons">' +
'<span class="drp-selected"></span>' +
'<button class="cancelBtn" type="button"></button>' +
'<button class="applyBtn" disabled="disabled" type="button"></button> ' +
'</div>' +
'</div>';
this.parentEl = (options.parentEl && $(options.parentEl).length) ? $(options.parentEl) : $(this.parentEl);
this.container = $(options.template).appendTo(this.parentEl);
//
// handle all the possible options overriding defaults
//
if (typeof options.locale === 'object') {
if (typeof options.locale.direction === 'string')
this.locale.direction = options.locale.direction;
if (typeof options.locale.format === 'string')
this.locale.format = options.locale.format;
if (typeof options.locale.separator === 'string')
this.locale.separator = options.locale.separator;
if (typeof options.locale.daysOfWeek === 'object')
this.locale.daysOfWeek = options.locale.daysOfWeek.slice();
if (typeof options.locale.monthNames === 'object')
this.locale.monthNames = options.locale.monthNames.slice();
if (typeof options.locale.firstDay === 'number')
this.locale.firstDay = options.locale.firstDay;
if (typeof options.locale.applyLabel === 'string')
this.locale.applyLabel = options.locale.applyLabel;
if (typeof options.locale.cancelLabel === 'string')
this.locale.cancelLabel = options.locale.cancelLabel;
if (typeof options.locale.weekLabel === 'string')
this.locale.weekLabel = options.locale.weekLabel;
if (typeof options.locale.customRangeLabel === 'string'){
//Support unicode chars in the custom range name.
var elem = document.createElement('textarea');
elem.innerHTML = options.locale.customRangeLabel;
var rangeHtml = elem.value;
this.locale.customRangeLabel = rangeHtml;
}
}
this.container.addClass(this.locale.direction);
if (typeof options.startDate === 'string')
this.startDate = moment(options.startDate, this.locale.format);
if (typeof options.endDate === 'string')
this.endDate = moment(options.endDate, this.locale.format);
if (typeof options.minDate === 'string')
this.minDate = moment(options.minDate, this.locale.format);
if (typeof options.maxDate === 'string')
this.maxDate = moment(options.maxDate, this.locale.format);
if (typeof options.startDate === 'object')
this.startDate = moment(options.startDate);
if (typeof options.endDate === 'object')
this.endDate = moment(options.endDate);
if (typeof options.minDate === 'object')
this.minDate = moment(options.minDate);
if (typeof options.maxDate === 'object')
this.maxDate = moment(options.maxDate);
// sanity check for bad options
if (this.minDate && this.startDate.isBefore(this.minDate))
this.startDate = this.minDate.clone();
// sanity check for bad options
if (this.maxDate && this.endDate.isAfter(this.maxDate))
this.endDate = this.maxDate.clone();
if (typeof options.applyButtonClasses === 'string')
this.applyButtonClasses = options.applyButtonClasses;
if (typeof options.applyClass === 'string') //backwards compat
this.applyButtonClasses = options.applyClass;
if (typeof options.cancelButtonClasses === 'string')
this.cancelButtonClasses = options.cancelButtonClasses;
if (typeof options.cancelClass === 'string') //backwards compat
this.cancelButtonClasses = options.cancelClass;
if (typeof options.maxSpan === 'object')
this.maxSpan = options.maxSpan;
if (typeof options.dateLimit === 'object') //backwards compat
this.maxSpan = options.dateLimit;
if (typeof options.opens === 'string')
this.opens = options.opens;
if (typeof options.drops === 'string')
this.drops = options.drops;
if (typeof options.showWeekNumbers === 'boolean')
this.showWeekNumbers = options.showWeekNumbers;
if (typeof options.showISOWeekNumbers === 'boolean')
this.showISOWeekNumbers = options.showISOWeekNumbers;
if (typeof options.buttonClasses === 'string')
this.buttonClasses = options.buttonClasses;
if (typeof options.buttonClasses === 'object')
this.buttonClasses = options.buttonClasses.join(' ');
if (typeof options.showDropdowns === 'boolean')
this.showDropdowns = options.showDropdowns;
if (typeof options.minYear === 'number')
this.minYear = options.minYear;
if (typeof options.maxYear === 'number')
this.maxYear = options.maxYear;
if (typeof options.showCustomRangeLabel === 'boolean')
this.showCustomRangeLabel = options.showCustomRangeLabel;
if (typeof options.singleDatePicker === 'boolean') {
this.singleDatePicker = options.singleDatePicker;
if (this.singleDatePicker)
this.endDate = this.startDate.clone();
}
if (typeof options.timePicker === 'boolean')
this.timePicker = options.timePicker;
if (typeof options.timePickerSeconds === 'boolean')
this.timePickerSeconds = options.timePickerSeconds;
if (typeof options.timePickerIncrement === 'number')
this.timePickerIncrement = options.timePickerIncrement;
if (typeof options.timePicker24Hour === 'boolean')
this.timePicker24Hour = options.timePicker24Hour;
if (typeof options.autoApply === 'boolean')
this.autoApply = options.autoApply;
if (typeof options.autoUpdateInput === 'boolean')
this.autoUpdateInput = options.autoUpdateInput;
if (typeof options.linkedCalendars === 'boolean')
this.linkedCalendars = options.linkedCalendars;
if (typeof options.isInvalidDate === 'function')
this.isInvalidDate = options.isInvalidDate;
if (typeof options.isCustomDate === 'function')
this.isCustomDate = options.isCustomDate;
if (typeof options.alwaysShowCalendars === 'boolean')
this.alwaysShowCalendars = options.alwaysShowCalendars;
// update day names order to firstDay
if (this.locale.firstDay != 0) {
var iterator = this.locale.firstDay;
while (iterator > 0) {
this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift());
iterator--;
}
}
var start, end, range;
//if no start/end dates set, check if an input element contains initial values
if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') {
if ($(this.element).is(':text')) {
var val = $(this.element).val(),
split = val.split(this.locale.separator);
start = end = null;
if (split.length == 2) {
start = moment(split[0], this.locale.format);
end = moment(split[1], this.locale.format);
} else if (this.singleDatePicker && val !== "") {
start = moment(val, this.locale.format);
end = moment(val, this.locale.format);
}
if (start !== null && end !== null) {
this.setStartDate(start);
this.setEndDate(end);
}
}
}
if (typeof options.ranges === 'object') {
for (range in options.ranges) {
if (typeof options.ranges[range][0] === 'string')
start = moment(options.ranges[range][0], this.locale.format);
else
start = moment(options.ranges[range][0]);
if (typeof options.ranges[range][1] === 'string')
end = moment(options.ranges[range][1], this.locale.format);
else
end = moment(options.ranges[range][1]);
// If the start or end date exceed those allowed by the minDate or maxSpan
// options, shorten the range to the allowable period.
if (this.minDate && start.isBefore(this.minDate))
start = this.minDate.clone();
var maxDate = this.maxDate;
if (this.maxSpan && maxDate && start.clone().add(this.maxSpan).isAfter(maxDate))
maxDate = start.clone().add(this.maxSpan);
if (maxDate && end.isAfter(maxDate))
end = maxDate.clone();
// If the end of the range is before the minimum or the start of the range is
// after the maximum, don't display this range option at all.
if ((this.minDate && end.isBefore(this.minDate, this.timepicker ? 'minute' : 'day'))
|| (maxDate && start.isAfter(maxDate, this.timepicker ? 'minute' : 'day')))
continue;
//Support unicode chars in the range names.
var elem = document.createElement('textarea');
elem.innerHTML = range;
var rangeHtml = elem.value;
this.ranges[rangeHtml] = [start, end];
}
var list = '<ul>';
for (range in this.ranges) {
list += '<li data-range-key="' + range + '">' + range + '</li>';
}
if (this.showCustomRangeLabel) {
list += '<li data-range-key="' + this.locale.customRangeLabel + '">' + this.locale.customRangeLabel + '</li>';
}
list += '</ul>';
this.container.find('.ranges').prepend(list);
}
if (typeof cb === 'function') {
this.callback = cb;
}
if (!this.timePicker) {
this.startDate = this.startDate.startOf('day');
this.endDate = this.endDate.endOf('day');
this.container.find('.calendar-time').hide();
}
//can't be used together for now
if (this.timePicker && this.autoApply)
this.autoApply = false;
if (this.autoApply) {
this.container.addClass('auto-apply');
}
if (typeof options.ranges === 'object')
this.container.addClass('show-ranges');
if (this.singleDatePicker) {
this.container.addClass('single');
this.container.find('.drp-calendar.left').addClass('single');
this.container.find('.drp-calendar.left').show();
this.container.find('.drp-calendar.right').hide();
if (!this.timePicker) {
this.container.addClass('auto-apply');
}
}
if ((typeof options.ranges === 'undefined' && !this.singleDatePicker) || this.alwaysShowCalendars) {
this.container.addClass('show-calendar');
}
this.container.addClass('opens' + this.opens);
//apply CSS classes and labels to buttons
this.container.find('.applyBtn, .cancelBtn').addClass(this.buttonClasses);
if (this.applyButtonClasses.length)
this.container.find('.applyBtn').addClass(this.applyButtonClasses);
if (this.cancelButtonClasses.length)
this.container.find('.cancelBtn').addClass(this.cancelButtonClasses);
this.container.find('.applyBtn').html(this.locale.applyLabel);
this.container.find('.cancelBtn').html(this.locale.cancelLabel);
//
// event listeners
//
this.container.find('.drp-calendar')
.on('click.daterangepicker', '.prev', $.proxy(this.clickPrev, this))
.on('click.daterangepicker', '.next', $.proxy(this.clickNext, this))
.on('mousedown.daterangepicker', 'td.available', $.proxy(this.clickDate, this))
.on('mouseenter.daterangepicker', 'td.available', $.proxy(this.hoverDate, this))
.on('change.daterangepicker', 'select.yearselect', $.proxy(this.monthOrYearChanged, this))
.on('change.daterangepicker', 'select.monthselect', $.proxy(this.monthOrYearChanged, this))
.on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this))
this.container.find('.ranges')
.on('click.daterangepicker', 'li', $.proxy(this.clickRange, this))
this.container.find('.drp-buttons')
.on('click.daterangepicker', 'button.applyBtn', $.proxy(this.clickApply, this))
.on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this))
if (this.element.is('input') || this.element.is('button')) {
this.element.on({
'click.daterangepicker': $.proxy(this.show, this),
'focus.daterangepicker': $.proxy(this.show, this),
'keyup.daterangepicker': $.proxy(this.elementChanged, this),
'keydown.daterangepicker': $.proxy(this.keydown, this) //IE 11 compatibility
});
} else {
this.element.on('click.daterangepicker', $.proxy(this.toggle, this));
this.element.on('keydown.daterangepicker', $.proxy(this.toggle, this));
}
//
// if attached to a text input, set the initial value
//
this.updateElement();
};
DateRangePicker.prototype = {
constructor: DateRangePicker,
setStartDate: function(startDate) {
if (typeof startDate === 'string')
this.startDate = moment(startDate, this.locale.format);
if (typeof startDate === 'object')
this.startDate = moment(startDate);
if (!this.timePicker)
this.startDate = this.startDate.startOf('day');
if (this.timePicker && this.timePickerIncrement)
this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
if (this.minDate && this.startDate.isBefore(this.minDate)) {
this.startDate = this.minDate.clone();
if (this.timePicker && this.timePickerIncrement)
this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
}
if (this.maxDate && this.startDate.isAfter(this.maxDate)) {
this.startDate = this.maxDate.clone();
if (this.timePicker && this.timePickerIncrement)
this.startDate.minute(Math.floor(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
}
if (!this.isShowing)
this.updateElement();
this.updateMonthsInView();
},
setEndDate: function(endDate) {
if (typeof endDate === 'string')
this.endDate = moment(endDate, this.locale.format);
if (typeof endDate === 'object')
this.endDate = moment(endDate);
if (!this.timePicker)
this.endDate = this.endDate.add(1,'d').startOf('day').subtract(1,'second');
if (this.timePicker && this.timePickerIncrement)
this.endDate.minute(Math.round(this.endDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
if (this.endDate.isBefore(this.startDate))
this.endDate = this.startDate.clone();
if (this.maxDate && this.endDate.isAfter(this.maxDate))
this.endDate = this.maxDate.clone();
if (this.maxSpan && this.startDate.clone().add(this.maxSpan).isBefore(this.endDate))
this.endDate = this.startDate.clone().add(this.maxSpan);
this.previousRightTime = this.endDate.clone();
this.container.find('.drp-selected').html(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
if (!this.isShowing)
this.updateElement();
this.updateMonthsInView();
},
isInvalidDate: function() {
return false;
},
isCustomDate: function() {
return false;
},
updateView: function() {
if (this.timePicker) {
this.renderTimePicker('left');
this.renderTimePicker('right');
if (!this.endDate) {
this.container.find('.right .calendar-time select').attr('disabled', 'disabled').addClass('disabled');
} else {
this.container.find('.right .calendar-time select').removeAttr('disabled').removeClass('disabled');
}
}
if (this.endDate)
this.container.find('.drp-selected').html(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
this.updateMonthsInView();
this.updateCalendars();
this.updateFormInputs();
},
updateMonthsInView: function() {
if (this.endDate) {
//if both dates are visible already, do nothing
if (!this.singleDatePicker && this.leftCalendar.month && this.rightCalendar.month &&
(this.startDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.startDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
&&
(this.endDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.endDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
) {
return;
}
this.leftCalendar.month = this.startDate.clone().date(2);
if (!this.linkedCalendars && (this.endDate.month() != this.startDate.month() || this.endDate.year() != this.startDate.year())) {
this.rightCalendar.month = this.endDate.clone().date(2);
} else {
this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
}
} else {
if (this.leftCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM') && this.rightCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM')) {
this.leftCalendar.month = this.startDate.clone().date(2);
this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
}
}
if (this.maxDate && this.linkedCalendars && !this.singleDatePicker && this.rightCalendar.month > this.maxDate) {
this.rightCalendar.month = this.maxDate.clone().date(2);
this.leftCalendar.month = this.maxDate.clone().date(2).subtract(1, 'month');
}
},
updateCalendars: function() {
if (this.timePicker) {
var hour, minute, second;
if (this.endDate) {
hour = parseInt(this.container.find('.left .hourselect').val(), 10);
minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
if (!this.timePicker24Hour) {
var ampm = this.container.find('.left .ampmselect').val();
if (ampm === 'PM' && hour < 12)
hour += 12;
if (ampm === 'AM' && hour === 12)
hour = 0;
}
} else {
hour = parseInt(this.container.find('.right .hourselect').val(), 10);
minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
if (!this.timePicker24Hour) {
var ampm = this.container.find('.right .ampmselect').val();
if (ampm === 'PM' && hour < 12)
hour += 12;
if (ampm === 'AM' && hour === 12)
hour = 0;
}
}
this.leftCalendar.month.hour(hour).minute(minute).second(second);
this.rightCalendar.month.hour(hour).minute(minute).second(second);
}
this.renderCalendar('left');
this.renderCalendar('right');
//highlight any predefined range matching the current start and end dates
this.container.find('.ranges li').removeClass('active');
if (this.endDate == null) return;
this.calculateChosenLabel();
},
renderCalendar: function(side) {
//
// Build the matrix of dates that will populate the calendar
//
var calendar = side == 'left' ? this.leftCalendar : this.rightCalendar;
var month = calendar.month.month();
var year = calendar.month.year();
var hour = calendar.month.hour();
var minute = calendar.month.minute();
var second = calendar.month.second();
var daysInMonth = moment([year, month]).daysInMonth();
var firstDay = moment([year, month, 1]);
var lastDay = moment([year, month, daysInMonth]);
var lastMonth = moment(firstDay).subtract(1, 'month').month();
var lastYear = moment(firstDay).subtract(1, 'month').year();
var daysInLastMonth = moment([lastYear, lastMonth]).daysInMonth();
var dayOfWeek = firstDay.day();
//initialize a 6 rows x 7 columns array for the calendar
var calendar = [];
calendar.firstDay = firstDay;
calendar.lastDay = lastDay;
for (var i = 0; i < 6; i++) {
calendar[i] = [];
}
//populate the calendar with date objects
var startDay = daysInLastMonth - dayOfWeek + this.locale.firstDay + 1;
if (startDay > daysInLastMonth)
startDay -= 7;
if (dayOfWeek == this.locale.firstDay)
startDay = daysInLastMonth - 6;
var curDate = moment([lastYear, lastMonth, startDay, 12, minute, second]);
var col, row;
for (var i = 0, col = 0, row = 0; i < 42; i++, col++, curDate = moment(curDate).add(24, 'hour')) {
if (i > 0 && col % 7 === 0) {
col = 0;
row++;
}
calendar[row][col] = curDate.clone().hour(hour).minute(minute).second(second);
curDate.hour(12);
if (this.minDate && calendar[row][col].format('YYYY-MM-DD') == this.minDate.format('YYYY-MM-DD') && calendar[row][col].isBefore(this.minDate) && side == 'left') {
calendar[row][col] = this.minDate.clone();
}
if (this.maxDate && calendar[row][col].format('YYYY-MM-DD') == this.maxDate.format('YYYY-MM-DD') && calendar[row][col].isAfter(this.maxDate) && side == 'right') {
calendar[row][col] = this.maxDate.clone();
}
}
//make the calendar object available to hoverDate/clickDate
if (side == 'left') {
this.leftCalendar.calendar = calendar;
} else {
this.rightCalendar.calendar = calendar;
}
//
// Display the calendar
//
var minDate = side == 'left' ? this.minDate : this.startDate;
var maxDate = this.maxDate;
var selected = side == 'left' ? this.startDate : this.endDate;
var arrow = this.locale.direction == 'ltr' ? {left: 'chevron-left', right: 'chevron-right'} : {left: 'chevron-right', right: 'chevron-left'};
var html = '<table class="table-condensed">';
html += '<thead>';
html += '<tr>';
// add empty cell for week number
if (this.showWeekNumbers || this.showISOWeekNumbers)
html += '<th></th>';
if ((!minDate || minDate.isBefore(calendar.firstDay)) && (!this.linkedCalendars || side == 'left')) {
html += '<th class="prev available"><span></span></th>';
} else {
html += '<th></th>';
}
var dateHtml = this.locale.monthNames[calendar[1][1].month()] + calendar[1][1].format(" YYYY");
if (this.showDropdowns) {
var currentMonth = calendar[1][1].month();
var currentYear = calendar[1][1].year();
var maxYear = (maxDate && maxDate.year()) || (this.maxYear);
var minYear = (minDate && minDate.year()) || (this.minYear);
var inMinYear = currentYear == minYear;
var inMaxYear = currentYear == maxYear;
var monthHtml = '<select class="monthselect">';
for (var m = 0; m < 12; m++) {
if ((!inMinYear || m >= minDate.month()) && (!inMaxYear || m <= maxDate.month())) {
monthHtml += "<option value='" + m + "'" +
(m === currentMonth ? " selected='selected'" : "") +
">" + this.locale.monthNames[m] + "</option>";
} else {
monthHtml += "<option value='" + m + "'" +
(m === currentMonth ? " selected='selected'" : "") +
" disabled='disabled'>" + this.locale.monthNames[m] + "</option>";
}
}
monthHtml += "</select>";
var yearHtml = '<select class="yearselect">';
for (var y = minYear; y <= maxYear; y++) {
yearHtml += '<option value="' + y + '"' +
(y === currentYear ? ' selected="selected"' : '') +
'>' + y + '</option>';
}
yearHtml += '</select>';
dateHtml = monthHtml + yearHtml;
}
html += '<th colspan="5" class="month">' + dateHtml + '</th>';
if ((!maxDate || maxDate.isAfter(calendar.lastDay)) && (!this.linkedCalendars || side == 'right' || this.singleDatePicker)) {
html += '<th class="next available"><span></span></th>';
} else {
html += '<th></th>';
}
html += '</tr>';
html += '<tr>';
// add week number label
if (this.showWeekNumbers || this.showISOWeekNumbers)
html += '<th class="week">' + this.locale.weekLabel + '</th>';
$.each(this.locale.daysOfWeek, function(index, dayOfWeek) {
html += '<th>' + dayOfWeek + '</th>';
});
html += '</tr>';
html += '</thead>';
html += '<tbody>';
//adjust maxDate to reflect the maxSpan setting in order to
//grey out end dates beyond the maxSpan
if (this.endDate == null && this.maxSpan) {
var maxLimit = this.startDate.clone().add(this.maxSpan).endOf('day');
if (!maxDate || maxLimit.isBefore(maxDate)) {
maxDate = maxLimit;
}
}
for (var row = 0; row < 6; row++) {
html += '<tr>';
// add week number
if (this.showWeekNumbers)
html += '<td class="week">' + calendar[row][0].week() + '</td>';
else if (this.showISOWeekNumbers)
html += '<td class="week">' + calendar[row][0].isoWeek() + '</td>';
for (var col = 0; col < 7; col++) {
var classes = [];
//highlight today's date
if (calendar[row][col].isSame(new Date(), "day"))
classes.push('today');
//highlight weekends
if (calendar[row][col].isoWeekday() > 5)
classes.push('weekend');
//grey out the dates in other months displayed at beginning and end of this calendar
if (calendar[row][col].month() != calendar[1][1].month())
classes.push('off');
//don't allow selection of dates before the minimum date
if (this.minDate && calendar[row][col].isBefore(this.minDate, 'day'))
classes.push('off', 'disabled');
//don't allow selection of dates after the maximum date
if (maxDate && calendar[row][col].isAfter(maxDate, 'day'))
classes.push('off', 'disabled');
//don't allow selection of date if a custom function decides it's invalid
if (this.isInvalidDate(calendar[row][col]))
classes.push('off', 'disabled');
//highlight the currently selected start date
if (calendar[row][col].format('YYYY-MM-DD') == this.startDate.format('YYYY-MM-DD'))
classes.push('active', 'start-date');
//highlight the currently selected end date
if (this.endDate != null && calendar[row][col].format('YYYY-MM-DD') == this.endDate.format('YYYY-MM-DD'))
classes.push('active', 'end-date');
//highlight dates in-between the selected dates
if (this.endDate != null && calendar[row][col] > this.startDate && calendar[row][col] < this.endDate)
classes.push('in-range');
//apply custom classes for this date
var isCustom = this.isCustomDate(calendar[row][col]);
if (isCustom !== false) {
if (typeof isCustom === 'string')
classes.push(isCustom);
else
Array.prototype.push.apply(classes, isCustom);
}
var cname = '', disabled = false;
for (var i = 0; i < classes.length; i++) {
cname += classes[i] + ' ';
if (classes[i] == 'disabled')
disabled = true;
}
if (!disabled)
cname += 'available';
html += '<td class="' + cname.replace(/^\s+|\s+$/g, '') + '" data-title="' + 'r' + row + 'c' + col + '">' + calendar[row][col].date() + '</td>';
}
html += '</tr>';
}
html += '</tbody>';
html += '</table>';
this.container.find('.drp-calendar.' + side + ' .calendar-table').html(html);
},
renderTimePicker: function(side) {
// Don't bother updating the time picker if it's currently disabled
// because an end date hasn't been clicked yet
if (side == 'right' && !this.endDate) return;
var html, selected, minDate, maxDate = this.maxDate;
if (this.maxSpan && (!this.maxDate || this.startDate.clone().add(this.maxSpan).isAfter(this.maxDate)))
maxDate = this.startDate.clone().add(this.maxSpan);
if (side == 'left') {
selected = this.startDate.clone();
minDate = this.minDate;
} else if (side == 'right') {
selected = this.endDate.clone();
minDate = this.startDate;
//Preserve the time already selected
var timeSelector = this.container.find('.drp-calendar.right .calendar-time');
if (timeSelector.html() != '') {
selected.hour(selected.hour() || timeSelector.find('.hourselect option:selected').val());
selected.minute(selected.minute() || timeSelector.find('.minuteselect option:selected').val());
selected.second(selected.second() || timeSelector.find('.secondselect option:selected').val());
if (!this.timePicker24Hour) {
var ampm = timeSelector.find('.ampmselect option:selected').val();
if (ampm === 'PM' && selected.hour() < 12)
selected.hour(selected.hour() + 12);
if (ampm === 'AM' && selected.hour() === 12)
selected.hour(0);
}
}
if (selected.isBefore(this.startDate))
selected = this.startDate.clone();
if (maxDate && selected.isAfter(maxDate))
selected = maxDate.clone();
}
//
// hours
//
html = '<select class="hourselect">';
var start = this.timePicker24Hour ? 0 : 1;
var end = this.timePicker24Hour ? 23 : 12;
for (var i = start; i <= end; i++) {
var i_in_24 = i;
if (!this.timePicker24Hour)
i_in_24 = selected.hour() >= 12 ? (i == 12 ? 12 : i + 12) : (i == 12 ? 0 : i);
var time = selected.clone().hour(i_in_24);
var disabled = false;
if (minDate && time.minute(59).isBefore(minDate))
disabled = true;
if (maxDate && time.minute(0).isAfter(maxDate))
disabled = true;
if (i_in_24 == selected.hour() && !disabled) {
html += '<option value="' + i + '" selected="selected">' + i + '</option>';
} else if (disabled) {
html += '<option value="' + i + '" disabled="disabled" class="disabled">' + i + '</option>';
} else {
html += '<option value="' + i + '">' + i + '</option>';
}
}
html += '</select> ';
//
// minutes
//
html += ': <select class="minuteselect">';
for (var i = 0; i < 60; i += this.timePickerIncrement) {
var padded = i < 10 ? '0' + i : i;
var time = selected.clone().minute(i);
var disabled = false;
if (minDate && time.second(59).isBefore(minDate))
disabled = true;
if (maxDate && time.second(0).isAfter(maxDate))
disabled = true;
if (selected.minute() == i && !disabled) {
html += '<option value="' + i + '" selected="selected">' + padded + '</option>';
} else if (disabled) {
html += '<option value="' + i + '" disabled="disabled" class="disabled">' + padded + '</option>';
} else {
html += '<option value="' + i + '">' + padded + '</option>';
}
}
html += '</select> ';
//
// seconds
//
if (this.timePickerSeconds) {
html += ': <select class="secondselect">';
for (var i = 0; i < 60; i++) {
var padded = i < 10 ? '0' + i : i;
var time = selected.clone().second(i);
var disabled = false;
if (minDate && time.isBefore(minDate))
disabled = true;
if (maxDate && time.isAfter(maxDate))
disabled = true;
if (selected.second() == i && !disabled) {
html += '<option value="' + i + '" selected="selected">' + padded + '</option>';
} else if (disabled) {
html += '<option value="' + i + '" disabled="disabled" class="disabled">' + padded + '</option>';
} else {
html += '<option value="' + i + '">' + padded + '</option>';
}
}
html += '</select> ';
}
//
// AM/PM
//
if (!this.timePicker24Hour) {
html += '<select class="ampmselect">';
var am_html = '';
var pm_html = '';
if (minDate && selected.clone().hour(12).minute(0).second(0).isBefore(minDate))
am_html = ' disabled="disabled" class="disabled"';
if (maxDate && selected.clone().hour(0).minute(0).second(0).isAfter(maxDate))
pm_html = ' disabled="disabled" class="disabled"';
if (selected.hour() >= 12) {
html += '<option value="AM"' + am_html + '>AM</option><option value="PM" selected="selected"' + pm_html + '>PM</option>';
} else {
html += '<option value="AM" selected="selected"' + am_html + '>AM</option><option value="PM"' + pm_html + '>PM</option>';
}
html += '</select>';
}
this.container.find('.drp-calendar.' + side + ' .calendar-time').html(html);
},
updateFormInputs: function() {
if (this.singleDatePicker || (this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)))) {
this.container.find('button.applyBtn').removeAttr('disabled');
} else {
this.container.find('button.applyBtn').attr('disabled', 'disabled');
}
},
move: function() {
var parentOffset = { top: 0, left: 0 },
containerTop;
var parentRightEdge = $(window).width();
if (!this.parentEl.is('body')) {
parentOffset = {
top: this.parentEl.offset().top - this.parentEl.scrollTop(),
left: this.parentEl.offset().left - this.parentEl.scrollLeft()
};
parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left;
}
if (this.drops == 'up')
containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
else
containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
this.container[this.drops == 'up' ? 'addClass' : 'removeClass']('drop-up');
if (this.opens == 'left') {
this.container.css({
top: containerTop,
right: parentRightEdge - this.element.offset().left - this.element.outerWidth(),
left: 'auto'
});
if (this.container.offset().left < 0) {
this.container.css({
right: 'auto',
left: 9
});
}
} else if (this.opens == 'center') {
this.container.css({
top: containerTop,
left: this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2
- this.container.outerWidth() / 2,
right: 'auto'
});
if (this.container.offset().left < 0) {
this.container.css({
right: 'auto',
left: 9
});
}
} else {
this.container.css({
top: containerTop,
left: this.element.offset().left - parentOffset.left,
right: 'auto'
});
if (this.container.offset().left + this.container.outerWidth() > $(window).width()) {
this.container.css({
left: 'auto',
right: 0
});
}
}
},
show: function(e) {
if (this.isShowing) return;
// Create a click proxy that is private to this instance of datepicker, for unbinding
this._outsideClickProxy = $.proxy(function(e) { this.outsideClick(e); }, this);
// Bind global datepicker mousedown for hiding and
$(document)
.on('mousedown.daterangepicker', this._outsideClickProxy)
// also support mobile devices
.on('touchend.daterangepicker', this._outsideClickProxy)
// also explicitly play nice with Bootstrap dropdowns, which stopPropagation when clicking them
.on('click.daterangepicker', '[data-toggle=dropdown]', this._outsideClickProxy)
// and also close when focus changes to outside the picker (eg. tabbing between controls)
.on('focusin.daterangepicker', this._outsideClickProxy);
// Reposition the picker if the window is resized while it's open
$(window).on('resize.daterangepicker', $.proxy(function(e) { this.move(e); }, this));
this.oldStartDate = this.startDate.clone();
this.oldEndDate = this.endDate.clone();
this.previousRightTime = this.endDate.clone();
this.updateView();
this.container.show();
this.move();
this.element.trigger('show.daterangepicker', this);
this.isShowing = true;
},
hide: function(e) {
if (!this.isShowing) return;
//incomplete date selection, revert to last values
if (!this.endDate) {
this.startDate = this.oldStartDate.clone();
this.endDate = this.oldEndDate.clone();
}
//if a new date range was selected, invoke the user callback function
if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate))
this.callback(this.startDate.clone(), this.endDate.clone(), this.chosenLabel);
//if picker is attached to a text input, update it
this.updateElement();
$(document).off('.daterangepicker');
$(window).off('.daterangepicker');
this.container.hide();
this.element.trigger('hide.daterangepicker', this);
this.isShowing = false;
},
toggle: function(e) {
if (this.isShowing) {
this.hide();
} else {
this.show();
}
},
outsideClick: function(e) {
var target = $(e.target);
// if the page is clicked anywhere except within the daterangerpicker/button
// itself then call this.hide()
if (
// ie modal dialog fix
e.type == "focusin" ||
target.closest(this.element).length ||
target.closest(this.container).length ||
target.closest('.calendar-table').length
) return;
this.hide();
this.element.trigger('outsideClick.daterangepicker', this);
},
showCalendars: function() {
this.container.addClass('show-calendar');
this.move();
this.element.trigger('showCalendar.daterangepicker', this);
},
hideCalendars: function() {
this.container.removeClass('show-calendar');
this.element.trigger('hideCalendar.daterangepicker', this);
},
clickRange: function(e) {
var label = e.target.getAttribute('data-range-key');
this.chosenLabel = label;
if (label == this.locale.customRangeLabel) {
this.showCalendars();
} else {
var dates = this.ranges[label];
this.startDate = dates[0];
this.endDate = dates[1];
if (!this.timePicker) {
this.startDate.startOf('day');
this.endDate.endOf('day');
}
if (!this.alwaysShowCalendars)
this.hideCalendars();
this.clickApply();
}
},
clickPrev: function(e) {
var cal = $(e.target).parents('.drp-calendar');
if (cal.hasClass('left')) {
this.leftCalendar.month.subtract(1, 'month');
if (this.linkedCalendars)
this.rightCalendar.month.subtract(1, 'month');
} else {
this.rightCalendar.month.subtract(1, 'month');
}
this.updateCalendars();
},
clickNext: function(e) {
var cal = $(e.target).parents('.drp-calendar');
if (cal.hasClass('left')) {
this.leftCalendar.month.add(1, 'month');
} else {
this.rightCalendar.month.add(1, 'month');
if (this.linkedCalendars)
this.leftCalendar.month.add(1, 'month');
}
this.updateCalendars();
},
hoverDate: function(e) {
//ignore dates that can't be selected
if (!$(e.target).hasClass('available')) return;
var title = $(e.target).attr('data-title');
var row = title.substr(1, 1);
var col = title.substr(3, 1);
var cal = $(e.target).parents('.drp-calendar');
var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
//highlight the dates between the start date and the date being hovered as a potential end date
var leftCalendar = this.leftCalendar;
var rightCalendar = this.rightCalendar;
var startDate = this.startDate;
if (!this.endDate) {
this.container.find('.drp-calendar tbody td').each(function(index, el) {
//skip week numbers, only look at dates
if ($(el).hasClass('week')) return;
var title = $(el).attr('data-title');
var row = title.substr(1, 1);
var col = title.substr(3, 1);
var cal = $(el).parents('.drp-calendar');
var dt = cal.hasClass('left') ? leftCalendar.calendar[row][col] : rightCalendar.calendar[row][col];
if ((dt.isAfter(startDate) && dt.isBefore(date)) || dt.isSame(date, 'day')) {
$(el).addClass('in-range');
} else {
$(el).removeClass('in-range');
}
});
}
},
clickDate: function(e) {
if (!$(e.target).hasClass('available')) return;
var title = $(e.target).attr('data-title');
var row = title.substr(1, 1);
var col = title.substr(3, 1);
var cal = $(e.target).parents('.drp-calendar');
var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
//
// this function needs to do a few things:
// * alternate between selecting a start and end date for the range,
// * if the time picker is enabled, apply the hour/minute/second from the select boxes to the clicked date
// * if autoapply is enabled, and an end date was chosen, apply the selection
// * if single date picker mode, and time picker isn't enabled, apply the selection immediately
// * if one of the inputs above the calendars was focused, cancel that manual input
//
if (this.endDate || date.isBefore(this.startDate, 'day')) { //picking start
if (this.timePicker) {
var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
if (!this.timePicker24Hour) {
var ampm = this.container.find('.left .ampmselect').val();
if (ampm === 'PM' && hour < 12)
hour += 12;
if (ampm === 'AM' && hour === 12)
hour = 0;
}
var minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
var second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
date = date.clone().hour(hour).minute(minute).second(second);
}
this.endDate = null;
this.setStartDate(date.clone());
} else if (!this.endDate && date.isBefore(this.startDate)) {
//special case: clicking the same date for start/end,
//but the time of the end date is before the start date
this.setEndDate(this.startDate.clone());
} else { // picking end
if (this.timePicker) {
var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
if (!this.timePicker24Hour) {
var ampm = this.container.find('.right .ampmselect').val();
if (ampm === 'PM' && hour < 12)
hour += 12;
if (ampm === 'AM' && hour === 12)
hour = 0;
}
var minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
var second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
date = date.clone().hour(hour).minute(minute).second(second);
}
this.setEndDate(date.clone());
if (this.autoApply) {
this.calculateChosenLabel();
this.clickApply();
}
}
if (this.singleDatePicker) {
this.setEndDate(this.startDate);
if (!this.timePicker)
this.clickApply();
}
this.updateView();
//This is to cancel the blur event handler if the mouse was in one of the inputs
e.stopPropagation();
},
calculateChosenLabel: function () {
var customRange = true;
var i = 0;
for (var range in this.ranges) {
if (this.timePicker) {
var format = this.timePickerSeconds ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD HH:mm";
//ignore times when comparing dates if time picker seconds is not enabled
if (this.startDate.format(format) == this.ranges[range][0].format(format) && this.endDate.format(format) == this.ranges[range][1].format(format)) {
customRange = false;
this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
break;
}
} else {
//ignore times when comparing dates if time picker is not enabled
if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) {
customRange = false;
this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
break;
}
}
i++;
}
if (customRange) {
if (this.showCustomRangeLabel) {
this.chosenLabel = this.container.find('.ranges li:last').addClass('active').attr('data-range-key');
} else {
this.chosenLabel = null;
}
this.showCalendars();
}
},
clickApply: function(e) {
this.hide();
this.element.trigger('apply.daterangepicker', this);
},
clickCancel: function(e) {
this.startDate = this.oldStartDate;
this.endDate = this.oldEndDate;
this.hide();
this.element.trigger('cancel.daterangepicker', this);
},
monthOrYearChanged: function(e) {
var isLeft = $(e.target).closest('.drp-calendar').hasClass('left'),
leftOrRight = isLeft ? 'left' : 'right',
cal = this.container.find('.drp-calendar.'+leftOrRight);
// Month must be Number for new moment versions
var month = parseInt(cal.find('.monthselect').val(), 10);
var year = cal.find('.yearselect').val();
if (!isLeft) {
if (year < this.startDate.year() || (year == this.startDate.year() && month < this.startDate.month())) {
month = this.startDate.month();
year = this.startDate.year();
}
}
if (this.minDate) {
if (year < this.minDate.year() || (year == this.minDate.year() && month < this.minDate.month())) {
month = this.minDate.month();
year = this.minDate.year();
}
}
if (this.maxDate) {
if (year > this.maxDate.year() || (year == this.maxDate.year() && month > this.maxDate.month())) {
month = this.maxDate.month();
year = this.maxDate.year();
}
}
if (isLeft) {
this.leftCalendar.month.month(month).year(year);
if (this.linkedCalendars)
this.rightCalendar.month = this.leftCalendar.month.clone().add(1, 'month');
} else {
this.rightCalendar.month.month(month).year(year);
if (this.linkedCalendars)
this.leftCalendar.month = this.rightCalendar.month.clone().subtract(1, 'month');
}
this.updateCalendars();
},
timeChanged: function(e) {
var cal = $(e.target).closest('.drp-calendar'),
isLeft = cal.hasClass('left');
var hour = parseInt(cal.find('.hourselect').val(), 10);
var minute = parseInt(cal.find('.minuteselect').val(), 10);
var second = this.timePickerSeconds ? parseInt(cal.find('.secondselect').val(), 10) : 0;
if (!this.timePicker24Hour) {
var ampm = cal.find('.ampmselect').val();
if (ampm === 'PM' && hour < 12)
hour += 12;
if (ampm === 'AM' && hour === 12)
hour = 0;
}
if (isLeft) {
var start = this.startDate.clone();
start.hour(hour);
start.minute(minute);
start.second(second);
this.setStartDate(start);
if (this.singleDatePicker) {
this.endDate = this.startDate.clone();
} else if (this.endDate && this.endDate.format('YYYY-MM-DD') == start.format('YYYY-MM-DD') && this.endDate.isBefore(start)) {
this.setEndDate(start.clone());
}
} else if (this.endDate) {
var end = this.endDate.clone();
end.hour(hour);
end.minute(minute);
end.second(second);
this.setEndDate(end);
}
//update the calendars so all clickable dates reflect the new time component
this.updateCalendars();
//update the form inputs above the calendars with the new time
this.updateFormInputs();
//re-render the time pickers because changing one selection can affect what's enabled in another
this.renderTimePicker('left');
this.renderTimePicker('right');
},
elementChanged: function() {
if (!this.element.is('input')) return;
if (!this.element.val().length) return;
var dateString = this.element.val().split(this.locale.separator),
start = null,
end = null;
if (dateString.length === 2) {
start = moment(dateString[0], this.locale.format);
end = moment(dateString[1], this.locale.format);
}
if (this.singleDatePicker || start === null || end === null) {
start = moment(this.element.val(), this.locale.format);
end = start;
}
if (!start.isValid() || !end.isValid()) return;
this.setStartDate(start);
this.setEndDate(end);
this.updateView();
},
keydown: function(e) {
//hide on tab or enter
if ((e.keyCode === 9) || (e.keyCode === 13)) {
this.hide();
}
//hide on esc and prevent propagation
if (e.keyCode === 27) {
e.preventDefault();
e.stopPropagation();
this.hide();
}
},
updateElement: function() {
if (this.element.is('input') && this.autoUpdateInput) {
var newValue = this.startDate.format(this.locale.format);
if (!this.singleDatePicker) {
newValue += this.locale.separator + this.endDate.format(this.locale.format);
}
if (newValue !== this.element.val()) {
this.element.val(newValue).trigger('change');
}
}
},
remove: function() {
this.container.remove();
this.element.off('.daterangepicker');
this.element.removeData();
}
};
$.fn.daterangepicker = function(options, callback) {
var implementOptions = $.extend(true, {}, $.fn.daterangepicker.defaultOptions, options);
this.each(function() {
var el = $(this);
if (el.data('daterangepicker'))
el.data('daterangepicker').remove();
el.data('daterangepicker', new DateRangePicker(el, implementOptions, callback));
});
return this;
};
return DateRangePicker;
}));
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="UTF-8" />
<title>A date range picker for Bootstrap</title>
<!--<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" />-->
<link rel="stylesheet" type="text/css" media="all" href="daterangepicker.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js"></script>
<script type="text/javascript" src="daterangepicker.js"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body style="margin: 60px 0">
<div class="container">
<h1 style="margin: 0 0 20px 0">Configuration Builder</h1>
<div class="well configurator">
<form>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="parentEl">parentEl</label>
<input type="text" class="form-control" id="parentEl" value="" placeholder="body">
</div>
<div class="form-group">
<label for="startDate">startDate</label>
<input type="text" class="form-control" id="startDate" value="07/01/2015">
</div>
<div class="form-group">
<label for="endDate">endDate</label>
<input type="text" class="form-control" id="endDate" value="07/15/2015">
</div>
<div class="form-group">
<label for="minDate">minDate</label>
<input type="text" class="form-control" id="minDate" value="" placeholder="MM/DD/YYYY">
</div>
<div class="form-group">
<label for="maxDate">maxDate</label>
<input type="text" class="form-control" id="maxDate" value="" placeholder="MM/DD/YYYY">
</div>
</div>
<div class="col-md-4">
<div class="checkbox">
<label>
<input type="checkbox" id="autoApply"> autoApply
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="singleDatePicker"> singleDatePicker
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showDropdowns"> showDropdowns
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showWeekNumbers"> showWeekNumbers
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showISOWeekNumbers"> showISOWeekNumbers
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePicker" checked="checked"> timePicker
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePicker24Hour"> timePicker24Hour
</label>
</div>
<div class="form-group">
<label for="timePickerIncrement">timePickerIncrement (in minutes)</label>
<input type="text" class="form-control" id="timePickerIncrement" value="1">
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePickerSeconds"> timePickerSeconds
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="dateLimit"> dateLimit (with example date range span)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="ranges" checked="checked"> ranges (with example predefined ranges)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="locale"> locale (with example settings)
</label>
<label id="rtl-wrap">
<input type="checkbox" id="rtl"> RTL (right-to-left)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="alwaysShowCalendars"> alwaysShowCalendars
</label>
</div>
</div>
<div class="col-md-4">
<div class="checkbox">
<label>
<input type="checkbox" id="linkedCalendars" checked="checked"> linkedCalendars
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="autoUpdateInput" checked="checked"> autoUpdateInput
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showCustomRangeLabel" checked="checked"> showCustomRangeLabel
</label>
</div>
<div class="form-group">
<label for="opens">opens</label>
<select id="opens" class="form-control">
<option value="right" selected>right</option>
<option value="left">left</option>
<option value="center">center</option>
</select>
</div>
<div class="form-group">
<label for="drops">drops</label>
<select id="drops" class="form-control">
<option value="down" selected>down</option>
<option value="up">up</option>
</select>
</div>
<div class="form-group">
<label for="buttonClasses">buttonClasses</label>
<input type="text" class="form-control" id="buttonClasses" value="btn btn-sm">
</div>
<div class="form-group">
<label for="applyClass">applyClass</label>
<input type="text" class="form-control" id="applyClass" value="btn-success">
</div>
<div class="form-group">
<label for="cancelClass">cancelClass</label>
<input type="text" class="form-control" id="cancelClass" value="btn-default">
</div>
</div>
</div>
</form>
</div>
<div class="row">
<div class="col-md-4 col-md-offset-2 demo">
<h4>Your Date Range Picker</h4>
<center>
<input type="text" id="config-demo" class="form-control">
</center>
</div>
<div class="col-md-6">
<h4>Configuration</h4>
<div class="well">
<textarea id="config-text" style="height: 300px; width: 100%; padding: 10px"></textarea>
</div>
</div>
</div>
</div>
<style type="text/css">
.demo { position: relative; }
.demo i {
position: absolute; bottom: 10px; right: 24px; top: auto; cursor: pointer;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$('#config-text').keyup(function() {
eval($(this).val());
});
$('.configurator input, .configurator select').change(function() {
updateConfig();
});
$('.demo i').click(function() {
$(this).parent().find('input').click();
});
$('#startDate').daterangepicker({
singleDatePicker: true,
startDate: moment().subtract(6, 'days')
});
$('#endDate').daterangepicker({
singleDatePicker: true,
startDate: moment()
});
updateConfig();
function updateConfig() {
var options = {};
if ($('#singleDatePicker').is(':checked'))
options.singleDatePicker = true;
if ($('#showDropdowns').is(':checked'))
options.showDropdowns = true;
if ($('#showWeekNumbers').is(':checked'))
options.showWeekNumbers = true;
if ($('#showISOWeekNumbers').is(':checked'))
options.showISOWeekNumbers = true;
if ($('#timePicker').is(':checked'))
options.timePicker = true;
if ($('#timePicker24Hour').is(':checked'))
options.timePicker24Hour = true;
if ($('#timePickerIncrement').val().length && $('#timePickerIncrement').val() != 1)
options.timePickerIncrement = parseInt($('#timePickerIncrement').val(), 10);
if ($('#timePickerSeconds').is(':checked'))
options.timePickerSeconds = true;
if ($('#autoApply').is(':checked'))
options.autoApply = true;
if ($('#dateLimit').is(':checked'))
options.dateLimit = { days: 7 };
if ($('#ranges').is(':checked')) {
options.ranges = {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
};
}
if ($('#locale').is(':checked')) {
$('#rtl-wrap').show();
options.locale = {
direction: $('#rtl').is(':checked') ? 'rtl' : 'ltr',
format: 'MM/DD/YYYY HH:mm',
separator: ' - ',
applyLabel: 'Apply',
cancelLabel: 'Cancel',
fromLabel: 'From',
toLabel: 'To',
customRangeLabel: 'Custom',
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
firstDay: 1
};
} else {
$('#rtl-wrap').hide();
}
if (!$('#linkedCalendars').is(':checked'))
options.linkedCalendars = false;
if (!$('#autoUpdateInput').is(':checked'))
options.autoUpdateInput = false;
if (!$('#showCustomRangeLabel').is(':checked'))
options.showCustomRangeLabel = false;
if ($('#alwaysShowCalendars').is(':checked'))
options.alwaysShowCalendars = true;
if ($('#parentEl').val().length)
options.parentEl = $('#parentEl').val();
if ($('#startDate').val().length)
options.startDate = $('#startDate').val();
if ($('#endDate').val().length)
options.endDate = $('#endDate').val();
if ($('#minDate').val().length)
options.minDate = $('#minDate').val();
if ($('#maxDate').val().length)
options.maxDate = $('#maxDate').val();
if ($('#opens').val().length && $('#opens').val() != 'right')
options.opens = $('#opens').val();
if ($('#drops').val().length && $('#drops').val() != 'down')
options.drops = $('#drops').val();
if ($('#buttonClasses').val().length && $('#buttonClasses').val() != 'btn btn-sm')
options.buttonClasses = $('#buttonClasses').val();
if ($('#applyClass').val().length && $('#applyClass').val() != 'btn-success')
options.applyClass = $('#applyClass').val();
if ($('#cancelClass').val().length && $('#cancelClass').val() != 'btn-default')
options.cancelClass = $('#cancelClass').val();
$('#config-text').val("$('#demo').daterangepicker(" + JSON.stringify(options, null, ' ') + ", function(start, end, label) {\n console.log(\"New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')\");\n});");
$('#config-demo').daterangepicker(options, function(start, end, label) { console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')'); }).click();;
}
});
</script>
</body>
</html>
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="UTF-8" />
<title>A date range picker for Bootstrap</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="all" href="../../daterangepicker.css" />
<style type="text/css">
.demo { position: relative; }
.demo i {
position: absolute; bottom: 10px; right: 24px; top: auto; cursor: pointer;
}
</style>
</head>
<body style="margin: 60px 0">
<div class="container">
<h1 style="margin: 0 0 20px 0">Configuration Builder</h1>
<div class="well configurator">
<form>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="parentEl">parentEl</label>
<input type="text" class="form-control" id="parentEl" value="" placeholder="body">
</div>
<div class="form-group">
<label for="startDate">startDate</label>
<input type="text" class="form-control" id="startDate" value="07/01/2015">
</div>
<div class="form-group">
<label for="endDate">endDate</label>
<input type="text" class="form-control" id="endDate" value="07/15/2015">
</div>
<div class="form-group">
<label for="minDate">minDate</label>
<input type="text" class="form-control" id="minDate" value="" placeholder="MM/DD/YYYY">
</div>
<div class="form-group">
<label for="maxDate">maxDate</label>
<input type="text" class="form-control" id="maxDate" value="" placeholder="MM/DD/YYYY">
</div>
</div>
<div class="col-md-4">
<div class="checkbox">
<label>
<input type="checkbox" id="autoApply"> autoApply
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="singleDatePicker"> singleDatePicker
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showDropdowns"> showDropdowns
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showWeekNumbers"> showWeekNumbers
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showISOWeekNumbers"> showISOWeekNumbers
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePicker"> timePicker
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePicker24Hour"> timePicker24Hour
</label>
</div>
<div class="form-group">
<label for="timePickerIncrement">timePickerIncrement (in minutes)</label>
<input type="text" class="form-control" id="timePickerIncrement" value="1">
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePickerSeconds"> timePickerSeconds
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="dateLimit"> dateLimit (with example date range span)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="ranges"> ranges (with example predefined ranges)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="locale"> locale (with example settings)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="linkedCalendars" checked="checked"> linkedCalendars
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="autoUpdateInput" checked="checked"> autoUpdateInput
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="alwaysShowCalendars"> alwaysShowCalendars
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="opens">opens</label>
<select id="opens" class="form-control">
<option value="right" selected>right</option>
<option value="left">left</option>
<option value="center">center</option>
</select>
</div>
<div class="form-group">
<label for="drops">drops</label>
<select id="drops" class="form-control">
<option value="down" selected>down</option>
<option value="up">up</option>
</select>
</div>
<div class="form-group">
<label for="buttonClasses">buttonClasses</label>
<input type="text" class="form-control" id="buttonClasses" value="btn btn-sm">
</div>
<div class="form-group">
<label for="applyClass">applyClass</label>
<input type="text" class="form-control" id="applyClass" value="btn-success">
</div>
<div class="form-group">
<label for="cancelClass">cancelClass</label>
<input type="text" class="form-control" id="cancelClass" value="btn-default">
</div>
</div>
</div>
</form>
</div>
<div class="row">
<div class="col-md-4 col-md-offset-2 demo">
<h4>Your Date Range Picker</h4>
<input type="text" id="config-demo" class="form-control">
<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
</div>
<div class="col-md-6">
<h4>Configuration</h4>
<div class="well">
<textarea id="config-text" style="height: 300px; width: 100%; padding: 10px"></textarea>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="require.js" data-main="main.js"></script>
</body>
</html>
requirejs.config({
"paths": {
"jquery": "https://code.jquery.com/jquery-1.11.3.min",
"moment": "../../moment",
"daterangepicker": "../../daterangepicker"
}
});
requirejs(['jquery', 'moment', 'daterangepicker'] , function ($, moment) {
$(document).ready(function() {
$('#config-text').keyup(function() {
eval($(this).val());
});
$('.configurator input, .configurator select').change(function() {
updateConfig();
});
$('.demo i').click(function() {
$(this).parent().find('input').click();
});
$('#startDate').daterangepicker({
singleDatePicker: true,
startDate: moment().subtract(6, 'days')
});
$('#endDate').daterangepicker({
singleDatePicker: true,
startDate: moment()
});
updateConfig();
function updateConfig() {
var options = {};
if ($('#singleDatePicker').is(':checked'))
options.singleDatePicker = true;
if ($('#showDropdowns').is(':checked'))
options.showDropdowns = true;
if ($('#showWeekNumbers').is(':checked'))
options.showWeekNumbers = true;
if ($('#showISOWeekNumbers').is(':checked'))
options.showISOWeekNumbers = true;
if ($('#timePicker').is(':checked'))
options.timePicker = true;
if ($('#timePicker24Hour').is(':checked'))
options.timePicker24Hour = true;
if ($('#timePickerIncrement').val().length && $('#timePickerIncrement').val() != 1)
options.timePickerIncrement = parseInt($('#timePickerIncrement').val(), 10);
if ($('#timePickerSeconds').is(':checked'))
options.timePickerSeconds = true;
if ($('#autoApply').is(':checked'))
options.autoApply = true;
if ($('#dateLimit').is(':checked'))
options.dateLimit = { days: 7 };
if ($('#ranges').is(':checked')) {
options.ranges = {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
};
}
if ($('#locale').is(':checked')) {
options.locale = {
format: 'MM/DD/YYYY HH:mm',
separator: ' - ',
applyLabel: 'Apply',
cancelLabel: 'Cancel',
fromLabel: 'From',
toLabel: 'To',
customRangeLabel: 'Custom',
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
firstDay: 1
};
}
if (!$('#linkedCalendars').is(':checked'))
options.linkedCalendars = false;
if (!$('#autoUpdateInput').is(':checked'))
options.autoUpdateInput = false;
if ($('#alwaysShowCalendars').is(':checked'))
options.alwaysShowCalendars = true;
if ($('#parentEl').val().length)
options.parentEl = $('#parentEl').val();
if ($('#startDate').val().length)
options.startDate = $('#startDate').val();
if ($('#endDate').val().length)
options.endDate = $('#endDate').val();
if ($('#minDate').val().length)
options.minDate = $('#minDate').val();
if ($('#maxDate').val().length)
options.maxDate = $('#maxDate').val();
if ($('#opens').val().length && $('#opens').val() != 'right')
options.opens = $('#opens').val();
if ($('#drops').val().length && $('#drops').val() != 'down')
options.drops = $('#drops').val();
if ($('#buttonClasses').val().length && $('#buttonClasses').val() != 'btn btn-sm')
options.buttonClasses = $('#buttonClasses').val();
if ($('#applyClass').val().length && $('#applyClass').val() != 'btn-success')
options.applyClass = $('#applyClass').val();
if ($('#cancelClass').val().length && $('#cancelClass').val() != 'btn-default')
options.cancelClass = $('#cancelClass').val();
$('#config-text').val("$('#demo').daterangepicker(" + JSON.stringify(options, null, ' ') + ", function(start, end, label) {\n console.log(\"New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')\");\n});");
$('#config-demo').daterangepicker(options, function(start, end, label) { console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')'); });
}
});
});
/*
RequireJS 2.2.0 Copyright jQuery Foundation and other contributors.
Released under MIT license, http://github.com/requirejs/requirejs/LICENSE
*/
var requirejs,require,define;
(function(ga){function ka(b,c,d,g){return g||""}function K(b){return"[object Function]"===Q.call(b)}function L(b){return"[object Array]"===Q.call(b)}function y(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function X(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));--d);}}function x(b,c){return la.call(b,c)}function e(b,c){return x(b,c)&&b[c]}function D(b,c){for(var d in b)if(x(b,d)&&c(b[d],d))break}function Y(b,c,d,g){c&&D(c,function(c,e){if(d||!x(b,e))!g||"object"!==
typeof c||!c||L(c)||K(c)||c instanceof RegExp?b[e]=c:(b[e]||(b[e]={}),Y(b[e],c,d,g))});return b}function z(b,c){return function(){return c.apply(b,arguments)}}function ha(b){throw b;}function ia(b){if(!b)return b;var c=ga;y(b.split("."),function(b){c=c[b]});return c}function F(b,c,d,g){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=g;d&&(c.originalError=d);return c}function ma(b){function c(a,n,b){var h,k,f,c,d,l,g,r;n=n&&n.split("/");var q=p.map,m=q&&q["*"];
if(a){a=a.split("/");k=a.length-1;p.nodeIdCompat&&U.test(a[k])&&(a[k]=a[k].replace(U,""));"."===a[0].charAt(0)&&n&&(k=n.slice(0,n.length-1),a=k.concat(a));k=a;for(f=0;f<k.length;f++)c=k[f],"."===c?(k.splice(f,1),--f):".."===c&&0!==f&&(1!==f||".."!==k[2])&&".."!==k[f-1]&&0<f&&(k.splice(f-1,2),f-=2);a=a.join("/")}if(b&&q&&(n||m)){k=a.split("/");f=k.length;a:for(;0<f;--f){d=k.slice(0,f).join("/");if(n)for(c=n.length;0<c;--c)if(b=e(q,n.slice(0,c).join("/")))if(b=e(b,d)){h=b;l=f;break a}!g&&m&&e(m,d)&&
(g=e(m,d),r=f)}!h&&g&&(h=g,l=r);h&&(k.splice(0,l,h),a=k.join("/"))}return(h=e(p.pkgs,a))?h:a}function d(a){E&&y(document.getElementsByTagName("script"),function(n){if(n.getAttribute("data-requiremodule")===a&&n.getAttribute("data-requirecontext")===l.contextName)return n.parentNode.removeChild(n),!0})}function m(a){var n=e(p.paths,a);if(n&&L(n)&&1<n.length)return n.shift(),l.require.undef(a),l.makeRequire(null,{skipMap:!0})([a]),!0}function r(a){var n,b=a?a.indexOf("!"):-1;-1<b&&(n=a.substring(0,
b),a=a.substring(b+1,a.length));return[n,a]}function q(a,n,b,h){var k,f,d=null,g=n?n.name:null,p=a,q=!0,m="";a||(q=!1,a="_@r"+(Q+=1));a=r(a);d=a[0];a=a[1];d&&(d=c(d,g,h),f=e(v,d));a&&(d?m=f&&f.normalize?f.normalize(a,function(a){return c(a,g,h)}):-1===a.indexOf("!")?c(a,g,h):a:(m=c(a,g,h),a=r(m),d=a[0],m=a[1],b=!0,k=l.nameToUrl(m)));b=!d||f||b?"":"_unnormalized"+(T+=1);return{prefix:d,name:m,parentMap:n,unnormalized:!!b,url:k,originalName:p,isDefine:q,id:(d?d+"!"+m:m)+b}}function u(a){var b=a.id,
c=e(t,b);c||(c=t[b]=new l.Module(a));return c}function w(a,b,c){var h=a.id,k=e(t,h);if(!x(v,h)||k&&!k.defineEmitComplete)if(k=u(a),k.error&&"error"===b)c(k.error);else k.on(b,c);else"defined"===b&&c(v[h])}function A(a,b){var c=a.requireModules,h=!1;if(b)b(a);else if(y(c,function(b){if(b=e(t,b))b.error=a,b.events.error&&(h=!0,b.emit("error",a))}),!h)g.onError(a)}function B(){V.length&&(y(V,function(a){var b=a[0];"string"===typeof b&&(l.defQueueMap[b]=!0);G.push(a)}),V=[])}function C(a){delete t[a];
delete Z[a]}function J(a,b,c){var h=a.map.id;a.error?a.emit("error",a.error):(b[h]=!0,y(a.depMaps,function(h,f){var d=h.id,g=e(t,d);!g||a.depMatched[f]||c[d]||(e(b,d)?(a.defineDep(f,v[d]),a.check()):J(g,b,c))}),c[h]=!0)}function H(){var a,b,c=(a=1E3*p.waitSeconds)&&l.startTime+a<(new Date).getTime(),h=[],k=[],f=!1,g=!0;if(!aa){aa=!0;D(Z,function(a){var l=a.map,e=l.id;if(a.enabled&&(l.isDefine||k.push(a),!a.error))if(!a.inited&&c)m(e)?f=b=!0:(h.push(e),d(e));else if(!a.inited&&a.fetched&&l.isDefine&&
(f=!0,!l.prefix))return g=!1});if(c&&h.length)return a=F("timeout","Load timeout for modules: "+h,null,h),a.contextName=l.contextName,A(a);g&&y(k,function(a){J(a,{},{})});c&&!b||!f||!E&&!ja||ba||(ba=setTimeout(function(){ba=0;H()},50));aa=!1}}function I(a){x(v,a[0])||u(q(a[0],null,!0)).init(a[1],a[2])}function O(a){a=a.currentTarget||a.srcElement;var b=l.onScriptLoad;a.detachEvent&&!ca?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=l.onScriptError;a.detachEvent&&!ca||a.removeEventListener("error",
b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function P(){var a;for(B();G.length;){a=G.shift();if(null===a[0])return A(F("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));I(a)}l.defQueueMap={}}var aa,da,l,R,ba,p={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},t={},Z={},ea={},G=[],v={},W={},fa={},Q=1,T=1;R={require:function(a){return a.require?a.require:a.require=l.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?
v[a.map.id]=a.exports:a.exports=v[a.map.id]={}},module:function(a){return a.module?a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){return e(p.config,a.map.id)||{}},exports:a.exports||(a.exports={})}}};da=function(a){this.events=e(ea,a.id)||{};this.map=a;this.shim=e(p.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};da.prototype={init:function(a,b,c,h){h=h||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&
(c=z(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=c;this.inited=!0;this.ignore=h.ignore;h.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,--this.depCount,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;l.startTime=(new Date).getTime();var a=this.map;if(this.shim)l.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],z(this,function(){return a.prefix?this.callPlugin():
this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=this.map.url;W[a]||(W[a]=!0,l.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var h=this.exports,k=this.factory;if(!this.inited)x(l.defQueueMap,c)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(K(k)){if(this.events.error&&this.map.isDefine||g.onError!==
ha)try{h=l.execCb(c,k,b,h)}catch(d){a=d}else h=l.execCb(c,k,b,h);this.map.isDefine&&void 0===h&&((b=this.module)?h=b.exports:this.usingExports&&(h=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",A(this.error=a)}else h=k;this.exports=h;if(this.map.isDefine&&!this.ignore&&(v[c]=h,g.onResourceLoad)){var f=[];y(this.depMaps,function(a){f.push(a.normalizedMap||a)});g.onResourceLoad(l,this.map,f)}C(c);
this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var a=this.map,b=a.id,d=q(a.prefix);this.depMaps.push(d);w(d,"defined",z(this,function(h){var k,f,d=e(fa,this.map.id),M=this.map.name,r=this.map.parentMap?this.map.parentMap.name:null,m=l.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(h.normalize&&(M=h.normalize(M,function(a){return c(a,r,!0)})||
""),f=q(a.prefix+"!"+M,this.map.parentMap),w(f,"defined",z(this,function(a){this.map.normalizedMap=f;this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),h=e(t,f.id)){this.depMaps.push(f);if(this.events.error)h.on("error",z(this,function(a){this.emit("error",a)}));h.enable()}}else d?(this.map.url=l.nameToUrl(d),this.load()):(k=z(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),k.error=z(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];D(t,function(a){0===
a.map.id.indexOf(b+"_unnormalized")&&C(a.map.id)});A(a)}),k.fromText=z(this,function(h,c){var d=a.name,f=q(d),M=S;c&&(h=c);M&&(S=!1);u(f);x(p.config,b)&&(p.config[d]=p.config[b]);try{g.exec(h)}catch(e){return A(F("fromtexteval","fromText eval for "+b+" failed: "+e,e,[b]))}M&&(S=!0);this.depMaps.push(f);l.completeLoad(d);m([d],k)}),h.load(a.name,m,k,p))}));l.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){Z[this.map.id]=this;this.enabling=this.enabled=!0;y(this.depMaps,z(this,function(a,
b){var c,h;if("string"===typeof a){a=q(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=e(R,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;w(a,"defined",z(this,function(a){this.undefed||(this.defineDep(b,a),this.check())}));this.errback?w(a,"error",z(this,this.errback)):this.events.error&&w(a,"error",z(this,function(a){this.emit("error",a)}))}c=a.id;h=t[c];x(R,c)||!h||h.enabled||l.enable(a,this)}));D(this.pluginMaps,z(this,function(a){var b=e(t,a.id);
b&&!b.enabled&&l.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){y(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};l={config:p,contextName:b,registry:t,defined:v,urlFetched:W,defQueue:G,defQueueMap:{},Module:da,makeModuleMap:q,nextTick:g.nextTick,onError:A,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");if("string"===typeof a.urlArgs){var b=
a.urlArgs;a.urlArgs=function(a,c){return(-1===c.indexOf("?")?"?":"&")+b}}var c=p.shim,h={paths:!0,bundles:!0,config:!0,map:!0};D(a,function(a,b){h[b]?(p[b]||(p[b]={}),Y(p[b],a,!0,!0)):p[b]=a});a.bundles&&D(a.bundles,function(a,b){y(a,function(a){a!==b&&(fa[a]=b)})});a.shim&&(D(a.shim,function(a,b){L(a)&&(a={deps:a});!a.exports&&!a.init||a.exportsFn||(a.exportsFn=l.makeShimExports(a));c[b]=a}),p.shim=c);a.packages&&y(a.packages,function(a){var b;a="string"===typeof a?{name:a}:a;b=a.name;a.location&&
(p.paths[b]=a.location);p.pkgs[b]=a.name+"/"+(a.main||"main").replace(na,"").replace(U,"")});D(t,function(a,b){a.inited||a.map.unnormalized||(a.map=q(b,null,!0))});(a.deps||a.callback)&&l.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ga,arguments));return b||a.exports&&ia(a.exports)}},makeRequire:function(a,n){function m(c,d,f){var e,r;n.enableBuildCallback&&d&&K(d)&&(d.__requireJsBuild=!0);if("string"===typeof c){if(K(d))return A(F("requireargs",
"Invalid require call"),f);if(a&&x(R,c))return R[c](t[a.id]);if(g.get)return g.get(l,c,a,m);e=q(c,a,!1,!0);e=e.id;return x(v,e)?v[e]:A(F("notloaded",'Module name "'+e+'" has not been loaded yet for context: '+b+(a?"":". Use require([])")))}P();l.nextTick(function(){P();r=u(q(null,a));r.skipMap=n.skipMap;r.init(c,d,f,{enabled:!0});H()});return m}n=n||{};Y(m,{isBrowser:E,toUrl:function(b){var d,f=b.lastIndexOf("."),g=b.split("/")[0];-1!==f&&("."!==g&&".."!==g||1<f)&&(d=b.substring(f,b.length),b=b.substring(0,
f));return l.nameToUrl(c(b,a&&a.id,!0),d,!0)},defined:function(b){return x(v,q(b,a,!1,!0).id)},specified:function(b){b=q(b,a,!1,!0).id;return x(v,b)||x(t,b)}});a||(m.undef=function(b){B();var c=q(b,a,!0),f=e(t,b);f.undefed=!0;d(b);delete v[b];delete W[c.url];delete ea[b];X(G,function(a,c){a[0]===b&&G.splice(c,1)});delete l.defQueueMap[b];f&&(f.events.defined&&(ea[b]=f.events),C(b))});return m},enable:function(a){e(t,a.id)&&u(a).enable()},completeLoad:function(a){var b,c,d=e(p.shim,a)||{},g=d.exports;
for(B();G.length;){c=G.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===a&&(b=!0);I(c)}l.defQueueMap={};c=e(t,a);if(!b&&!x(v,a)&&c&&!c.inited)if(!p.enforceDefine||g&&ia(g))I([a,d.deps||[],d.exportsFn]);else return m(a)?void 0:A(F("nodefine","No define call for "+a,null,[a]));H()},nameToUrl:function(a,b,c){var d,k,f,m;(d=e(p.pkgs,a))&&(a=d);if(d=e(fa,a))return l.nameToUrl(d,b,c);if(g.jsExtRegExp.test(a))d=a+(b||"");else{d=p.paths;k=a.split("/");for(f=k.length;0<f;--f)if(m=k.slice(0,f).join("/"),
m=e(d,m)){L(m)&&(m=m[0]);k.splice(0,f,m);break}d=k.join("/");d+=b||(/^data\:|^blob\:|\?/.test(d)||c?"":".js");d=("/"===d.charAt(0)||d.match(/^[\w\+\.\-]+:/)?"":p.baseUrl)+d}return p.urlArgs&&!/^blob\:/.test(d)?d+p.urlArgs(a,d):d},load:function(a,b){g.load(l,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||oa.test((a.currentTarget||a.srcElement).readyState))N=null,a=O(a),l.completeLoad(a.id)},onScriptError:function(a){var b=O(a);if(!m(b.id)){var c=[];
D(t,function(a,d){0!==d.indexOf("_@r")&&y(a.depMaps,function(a){if(a.id===b.id)return c.push(d),!0})});return A(F("scripterror",'Script error for "'+b.id+(c.length?'", needed by: '+c.join(", "):'"'),a,[b.id]))}}};l.require=l.makeRequire();return l}function pa(){if(N&&"interactive"===N.readyState)return N;X(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b});return N}var g,B,C,H,O,I,N,P,u,T,qa=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ra=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
U=/\.js$/,na=/^\.\//;B=Object.prototype;var Q=B.toString,la=B.hasOwnProperty,E=!("undefined"===typeof window||"undefined"===typeof navigator||!window.document),ja=!E&&"undefined"!==typeof importScripts,oa=E&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,ca="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),J={},w={},V=[],S=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(K(requirejs))return;w=requirejs;requirejs=void 0}"undefined"===typeof require||
K(require)||(w=require,require=void 0);g=requirejs=function(b,c,d,m){var r,q="_";L(b)||"string"===typeof b||(r=b,L(c)?(b=c,c=d,d=m):b=[]);r&&r.context&&(q=r.context);(m=e(J,q))||(m=J[q]=g.s.newContext(q));r&&m.configure(r);return m.require(b,c,d)};g.config=function(b){return g(b)};g.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=g);g.version="2.2.0";g.jsExtRegExp=/^\/|:|\?|\.js$/;g.isBrowser=E;B=g.s={contexts:J,newContext:ma};g({});y(["toUrl",
"undef","defined","specified"],function(b){g[b]=function(){var c=J._;return c.require[b].apply(c,arguments)}});E&&(C=B.head=document.getElementsByTagName("head")[0],H=document.getElementsByTagName("base")[0])&&(C=B.head=H.parentNode);g.onError=ha;g.createNode=function(b,c,d){c=b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};g.load=function(b,c,d){var m=b&&b.config||
{},e;if(E){e=g.createNode(m,c,d);e.setAttribute("data-requirecontext",b.contextName);e.setAttribute("data-requiremodule",c);!e.attachEvent||e.attachEvent.toString&&0>e.attachEvent.toString().indexOf("[native code")||ca?(e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)):(S=!0,e.attachEvent("onreadystatechange",b.onScriptLoad));e.src=d;if(m.onNodeCreated)m.onNodeCreated(e,m,c,d);P=e;H?C.insertBefore(e,H):C.appendChild(e);P=null;return e}if(ja)try{setTimeout(function(){},
0),importScripts(d),b.completeLoad(c)}catch(q){b.onError(F("importscripts","importScripts failed for "+c+" at "+d,q,[c]))}};E&&!w.skipDataMain&&X(document.getElementsByTagName("script"),function(b){C||(C=b.parentNode);if(O=b.getAttribute("data-main"))return u=O,w.baseUrl||-1!==u.indexOf("!")||(I=u.split("/"),u=I.pop(),T=I.length?I.join("/")+"/":"./",w.baseUrl=T),u=u.replace(U,""),g.jsExtRegExp.test(u)&&(u=O),w.deps=w.deps?w.deps.concat(u):[u],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&
(d=c,c=b,b=null);L(c)||(d=c,c=null);!c&&K(d)&&(c=[],d.length&&(d.toString().replace(qa,ka).replace(ra,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));S&&(e=P||pa())&&(b||(b=e.getAttribute("data-requiremodule")),g=J[e.getAttribute("data-requirecontext")]);g?(g.defQueue.push([b,c,d]),g.defQueueMap[b]=!0):V.push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(w)}})(this);
# Browserify example
Two steps need to be done for this to work
In the project root
npm install
In this folder
../../node_modules/.bin/browserify main.js -o bundle.js
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="UTF-8" />
<title>A date range picker for Bootstrap</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="all" href="../../daterangepicker.css" />
<style type="text/css">
.demo { position: relative; }
.demo i {
position: absolute; bottom: 10px; right: 24px; top: auto; cursor: pointer;
}
</style>
</head>
<body style="margin: 60px 0">
<div class="container">
<h1 style="margin: 0 0 20px 0">Configuration Builder</h1>
<div class="well configurator">
<form>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="parentEl">parentEl</label>
<input type="text" class="form-control" id="parentEl" value="" placeholder="body">
</div>
<div class="form-group">
<label for="startDate">startDate</label>
<input type="text" class="form-control" id="startDate" value="07/01/2015">
</div>
<div class="form-group">
<label for="endDate">endDate</label>
<input type="text" class="form-control" id="endDate" value="07/15/2015">
</div>
<div class="form-group">
<label for="minDate">minDate</label>
<input type="text" class="form-control" id="minDate" value="" placeholder="MM/DD/YYYY">
</div>
<div class="form-group">
<label for="maxDate">maxDate</label>
<input type="text" class="form-control" id="maxDate" value="" placeholder="MM/DD/YYYY">
</div>
</div>
<div class="col-md-4">
<div class="checkbox">
<label>
<input type="checkbox" id="autoApply"> autoApply
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="singleDatePicker"> singleDatePicker
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showDropdowns"> showDropdowns
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showWeekNumbers"> showWeekNumbers
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showISOWeekNumbers"> showISOWeekNumbers
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePicker"> timePicker
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePicker24Hour"> timePicker24Hour
</label>
</div>
<div class="form-group">
<label for="timePickerIncrement">timePickerIncrement (in minutes)</label>
<input type="text" class="form-control" id="timePickerIncrement" value="1">
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePickerSeconds"> timePickerSeconds
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="dateLimit"> dateLimit (with example date range span)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="ranges"> ranges (with example predefined ranges)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="locale"> locale (with example settings)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="linkedCalendars" checked="checked"> linkedCalendars
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="autoUpdateInput" checked="checked"> autoUpdateInput
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="alwaysShowCalendars"> alwaysShowCalendars
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="opens">opens</label>
<select id="opens" class="form-control">
<option value="right" selected>right</option>
<option value="left">left</option>
<option value="center">center</option>
</select>
</div>
<div class="form-group">
<label for="drops">drops</label>
<select id="drops" class="form-control">
<option value="down" selected>down</option>
<option value="up">up</option>
</select>
</div>
<div class="form-group">
<label for="buttonClasses">buttonClasses</label>
<input type="text" class="form-control" id="buttonClasses" value="btn btn-sm">
</div>
<div class="form-group">
<label for="applyClass">applyClass</label>
<input type="text" class="form-control" id="applyClass" value="btn-success">
</div>
<div class="form-group">
<label for="cancelClass">cancelClass</label>
<input type="text" class="form-control" id="cancelClass" value="btn-default">
</div>
</div>
</div>
</form>
</div>
<div class="row">
<div class="col-md-4 col-md-offset-2 demo">
<h4>Your Date Range Picker</h4>
<input type="text" id="config-demo" class="form-control">
<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
</div>
<div class="col-md-6">
<h4>Configuration</h4>
<div class="well">
<textarea id="config-text" style="height: 300px; width: 100%; padding: 10px"></textarea>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="bundle.js"></script>
</body>
</html>
require('../../daterangepicker.js');
var $ = require('jquery'),
moment = require('moment');
$(document).ready(function() {
$('#config-text').keyup(function() {
eval($(this).val());
});
$('.configurator input, .configurator select').change(function() {
updateConfig();
});
$('.demo i').click(function() {
$(this).parent().find('input').click();
});
$('#startDate').daterangepicker({
singleDatePicker: true,
startDate: moment().subtract(6, 'days')
});
$('#endDate').daterangepicker({
singleDatePicker: true,
startDate: moment()
});
updateConfig();
function updateConfig() {
var options = {};
if ($('#singleDatePicker').is(':checked'))
options.singleDatePicker = true;
if ($('#showDropdowns').is(':checked'))
options.showDropdowns = true;
if ($('#showWeekNumbers').is(':checked'))
options.showWeekNumbers = true;
if ($('#showISOWeekNumbers').is(':checked'))
options.showISOWeekNumbers = true;
if ($('#timePicker').is(':checked'))
options.timePicker = true;
if ($('#timePicker24Hour').is(':checked'))
options.timePicker24Hour = true;
if ($('#timePickerIncrement').val().length && $('#timePickerIncrement').val() != 1)
options.timePickerIncrement = parseInt($('#timePickerIncrement').val(), 10);
if ($('#timePickerSeconds').is(':checked'))
options.timePickerSeconds = true;
if ($('#autoApply').is(':checked'))
options.autoApply = true;
if ($('#dateLimit').is(':checked'))
options.dateLimit = { days: 7 };
if ($('#ranges').is(':checked')) {
options.ranges = {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
};
}
if ($('#locale').is(':checked')) {
options.locale = {
format: 'MM/DD/YYYY HH:mm',
separator: ' - ',
applyLabel: 'Apply',
cancelLabel: 'Cancel',
fromLabel: 'From',
toLabel: 'To',
customRangeLabel: 'Custom',
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
firstDay: 1
};
}
if (!$('#linkedCalendars').is(':checked'))
options.linkedCalendars = false;
if (!$('#autoUpdateInput').is(':checked'))
options.autoUpdateInput = false;
if ($('#alwaysShowCalendars').is(':checked'))
options.alwaysShowCalendars = true;
if ($('#parentEl').val().length)
options.parentEl = $('#parentEl').val();
if ($('#startDate').val().length)
options.startDate = $('#startDate').val();
if ($('#endDate').val().length)
options.endDate = $('#endDate').val();
if ($('#minDate').val().length)
options.minDate = $('#minDate').val();
if ($('#maxDate').val().length)
options.maxDate = $('#maxDate').val();
if ($('#opens').val().length && $('#opens').val() != 'right')
options.opens = $('#opens').val();
if ($('#drops').val().length && $('#drops').val() != 'down')
options.drops = $('#drops').val();
if ($('#buttonClasses').val().length && $('#buttonClasses').val() != 'btn btn-sm')
options.buttonClasses = $('#buttonClasses').val();
if ($('#applyClass').val().length && $('#applyClass').val() != 'btn-success')
options.applyClass = $('#applyClass').val();
if ($('#cancelClass').val().length && $('#cancelClass').val() != 'btn-default')
options.cancelClass = $('#cancelClass').val();
$('#config-text').val("$('#demo').daterangepicker(" + JSON.stringify(options, null, ' ') + ", function(start, end, label) {\n console.log(\"New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')\");\n});");
$('#config-demo').daterangepicker(options, function(start, end, label) { console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')'); });
}
});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function d(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function h(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function y(e,t,n,s){return Ot(e,t,n,s,!0).utc()}function g(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function p(e){if(null==e._isValid){var t=g(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function v(e){var t=y(NaN);return null!=e?_(g(t),e):g(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var r=c.momentProperties=[];function w(e,t){var n,s,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=g(t)),l(t._locale)||(e._locale=t._locale),0<r.length)for(n=0;n<r.length;n++)l(i=t[s=r[n]])||(e[s]=i);return e}var t=!1;function M(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,c.updateOffset(this),t=!1)}function S(e){return e instanceof M||null!=e&&null!=e._isAMomentObject}function D(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function k(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=D(t)),n}function a(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&k(e[s])!==k(t[s]))&&a++;return a+r}function Y(e){!1===c.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return _(function(){if(null!=c.deprecationHandler&&c.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}Y(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,O={};function T(e,t){null!=c.deprecationHandler&&c.deprecationHandler(e,t),O[e]||(Y(t),O[e]=!0)}function x(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function b(e,t){var n,s=_({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},_(s[n],e[n]),_(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=_({},s[n]));return s}function P(e){null!=e&&this.set(e)}c.suppressDeprecationWarnings=!1,c.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};var W={};function H(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function R(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function C(e){var t,n,s={};for(n in e)m(e,n)&&(t=R(n))&&(s[t]=e[n]);return s}var F={};function L(e,t){F[e]=t}function U(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([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,G=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},E={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(E[e]=i),t&&(E[t[0]]=function(){return U(i.apply(this,arguments),t[1],t[2])}),n&&(E[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=j(t,e.localeData()),V[t]=V[t]||function(s){var e,i,t,r=s.match(N);for(e=0,i=r.length;e<i;e++)E[r[e]]?r[e]=E[r[e]]:r[e]=(t=r[e]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(e){var t,n="";for(t=0;t<i;t++)n+=x(r[t])?r[t].call(e,s):r[t];return n}}(t),V[t](e)):e.localeData().invalidDate()}function j(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(G.lastIndex=0;0<=n&&G.test(e);)e=e.replace(G,s),G.lastIndex=0,n-=1;return e}var Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,J=/[+-]?\d{6}/,B=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,te=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,ie=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oe={};function ue(e,n,s){oe[e]=x(n)?n:function(e,t){return e&&s?s:n}}function le(e,t){return m(oe,e)?oe[e](t._strict,t._locale):new RegExp(de(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function de(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var he={};function ce(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),d(n)&&(s=function(e,t){t[n]=k(e)}),t=0;t<e.length;t++)he[e[t]]=s}function fe(e,i){ce(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var me=0,_e=1,ye=2,ge=3,pe=4,ve=5,we=6,Me=7,Se=8;function De(e){return ke(e)?366:365}function ke(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),H("year","y"),L("year",1),ue("Y",se),ue("YY",B,z),ue("YYYY",ee,q),ue("YYYYY",te,J),ue("YYYYYY",te,J),ce(["YYYYY","YYYYYY"],me),ce("YYYY",function(e,t){t[me]=2===e.length?c.parseTwoDigitYear(e):k(e)}),ce("YY",function(e,t){t[me]=c.parseTwoDigitYear(e)}),ce("Y",function(e,t){t[me]=parseInt(e,10)}),c.parseTwoDigitYear=function(e){return k(e)+(68<k(e)?1900:2e3)};var Ye,Oe=Te("FullYear",!0);function Te(t,n){return function(e){return null!=e?(be(this,t,e),c.updateOffset(this,n),this):xe(this,t)}}function xe(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function be(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&ke(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Pe(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?ke(e)?29:28:31-s%7%2}Ye=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),H("month","M"),L("month",8),ue("M",B),ue("MM",B,z),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ce(["M","MM"],function(e,t){t[_e]=k(e)-1}),ce(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[_e]=i:g(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,He="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var Re="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Ce(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=k(t);else if(!d(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Fe(e){return null!=e?(Ce(this,e),c.updateOffset(this,!0),this):xe(this,"Month")}var Le=ae;var Ue=ae;function Ne(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=y([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=de(s[t]),i[t]=de(i[t]);for(t=0;t<24;t++)r[t]=de(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ge(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&0<=e&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function Ve(e,t,n){var s=7+t-n;return-((7+Ge(e,0,s).getUTCDay()-t)%7)+s-1}function Ee(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ve(e,s,i);return o<=0?a=De(r=e-1)+o:o>De(e)?(r=e+1,a=o-De(e)):(r=e,a=o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(De(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),H("week","w"),H("isoWeek","W"),L("week",5),L("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=k(e)});I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),H("day","d"),H("weekday","e"),H("isoWeekday","E"),L("day",11),L("weekday",11),L("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=k(e)});var je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var ze="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var $e=ae;var qe=ae;var Je=ae;function Be(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=de(o[t]),u[t]=de(u[t]),l[t]=de(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Qe(){return this.hours()%12||12}function Xe(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Ke(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Qe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Qe.apply(this)+U(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Qe.apply(this)+U(this.minutes(),2)+U(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+U(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+U(this.minutes(),2)+U(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),H("hour","h"),L("hour",13),ue("a",Ke),ue("A",Ke),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=k(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=k(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s,2)),t[ve]=k(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s,2)),t[ve]=k(e.substr(i))});var et,tt=Te("Hours",!0),nt={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{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"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d 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"},months:He,monthsShort:Re,week:{dow:0,doy:6},weekdays:je,weekdaysMin:ze,weekdaysShort:Ze,meridiemParse:/[ap]\.?m?\.?/i},st={},it={};function rt(e){return e?e.toLowerCase().replace("_","-"):e}function at(e){var t=null;if(!st[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=et._abbr,require("./locale/"+e),ot(t)}catch(e){}return st[e]}function ot(e,t){var n;return e&&((n=l(t)?lt(e):ut(e,t))?et=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),et._abbr}function ut(e,t){if(null!==t){var n,s=nt;if(t.abbr=e,null!=st[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=st[e]._config;else if(null!=t.parentLocale)if(null!=st[t.parentLocale])s=st[t.parentLocale]._config;else{if(null==(n=at(t.parentLocale)))return it[t.parentLocale]||(it[t.parentLocale]=[]),it[t.parentLocale].push({name:e,config:t}),null;s=n._config}return st[e]=new P(b(s,t)),it[e]&&it[e].forEach(function(e){ut(e.name,e.config)}),ot(e),st[e]}return delete st[e],null}function lt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return et;if(!o(e)){if(t=at(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=rt(e[r]).split("-")).length,n=(n=rt(e[r+1]))?n.split("-"):null;0<t;){if(s=at(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&a(i,n,!0)>=t-1)break;t--}r++}return et}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11<n[_e]?_e:n[ye]<1||n[ye]>Pe(n[me],n[_e])?ye:n[ge]<0||24<n[ge]||24===n[ge]&&(0!==n[pe]||0!==n[ve]||0!==n[we])?ge:n[pe]<0||59<n[pe]?pe:n[ve]<0||59<n[ve]?ve:n[we]<0||999<n[we]?we:-1,g(e)._overflowDayOfYear&&(t<me||ye<t)&&(t=ye),g(e)._overflowWeeks&&-1===t&&(t=Me),g(e)._overflowWeekday&&-1===t&&(t=Se),g(e).overflow=t),e}function ht(e,t,n){return null!=e?e:null!=t?t:n}function ct(e){var t,n,s,i,r,a=[];if(!e._d){var o,u;for(o=e,u=new Date(c.now()),s=o._useUTC?[u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()]:[u.getFullYear(),u.getMonth(),u.getDate()],e._w&&null==e._a[ye]&&null==e._a[_e]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ht(t.GG,e._a[me],Ie(Tt(),1,4).year),s=ht(t.W,1),((i=ht(t.E,1))<1||7<i)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ie(Tt(),r,a);n=ht(t.gg,e._a[me],l.year),s=ht(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r}s<1||s>Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ht(e._a[me],s[me]),(e._dayOfYear>De(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[pe]&&0===e._a[ve]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o=new Date(e,t,n,s,i,r,a);return e<100&&0<=e&&isFinite(o.getFullYear())&&o.setFullYear(e),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var ft=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,mt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/Z|[+-]\d\d(?::?\d\d)?/,yt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],gt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function vt(e){var t,n,s,i,r,a,o=e._i,u=ft.exec(o)||mt.exec(o);if(u){for(g(e).iso=!0,t=0,n=yt.length;t<n;t++)if(yt[t][1].exec(u[1])){i=yt[t][0],s=!1!==yt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[3])){r=(u[2]||" ")+gt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!_t.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),kt(e)}else e._isValid=!1}var wt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function Mt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),Re.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}var St={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Dt(e){var t,n,s,i=wt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim());if(i){var r=Mt(i[4],i[3],i[2],i[5],i[6],i[7]);if(t=i[1],n=r,s=e,t&&Ze.indexOf(t)!==new Date(n[0],n[1],n[2]).getDay()&&(g(s).weekdayMismatch=!0,!(s._isValid=!1)))return;e._a=r,e._tzm=function(e,t,n){if(e)return St[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(i[8],i[9],i[10]),e._d=Ge.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function kt(e){if(e._f!==c.ISO_8601)if(e._f!==c.RFC_2822){e._a=[],g(e).empty=!0;var t,n,s,i,r,a,o,u,l=""+e._i,d=l.length,h=0;for(s=j(e._f,e._locale).match(N)||[],t=0;t<s.length;t++)i=s[t],(n=(l.match(le(i,e))||[])[0])&&(0<(r=l.substr(0,l.indexOf(n))).length&&g(e).unusedInput.push(r),l=l.slice(l.indexOf(n)+n.length),h+=n.length),E[i]?(n?g(e).empty=!1:g(e).unusedTokens.push(i),a=i,u=e,null!=(o=n)&&m(he,a)&&he[a](o,u._a,u,a)):e._strict&&!n&&g(e).unusedTokens.push(i);g(e).charsLeftOver=d-h,0<l.length&&g(e).unusedInput.push(l),e._a[ge]<=12&&!0===g(e).bigHour&&0<e._a[ge]&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[ge]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[ge],e._meridiem),ct(e),dt(e)}else Dt(e);else vt(e)}function Yt(e){var t,n,s,i,r=e._i,a=e._f;return e._locale=e._locale||lt(e._l),null===r||void 0===a&&""===r?v({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),S(r)?new M(dt(r)):(h(r)?e._d=r:o(a)?function(e){var t,n,s,i,r;if(0===e._f.length)return g(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],kt(t),p(t)&&(r+=g(t).charsLeftOver,r+=10*g(t).unusedTokens.length,g(t).score=r,(null==s||r<s)&&(s=r,n=t));_(e,n||t)}(e):a?kt(e):l(n=(t=e)._i)?t._d=new Date(c.now()):h(n)?t._d=new Date(n.valueOf()):"string"==typeof n?(s=t,null===(i=pt.exec(s._i))?(vt(s),!1===s._isValid&&(delete s._isValid,Dt(s),!1===s._isValid&&(delete s._isValid,c.createFromInputFallback(s)))):s._d=new Date(+i[1])):o(n)?(t._a=f(n.slice(0),function(e){return parseInt(e,10)}),ct(t)):u(n)?function(e){if(!e._d){var t=C(e._i);e._a=f([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ct(e)}}(t):d(n)?t._d=new Date(n):c.createFromInputFallback(t),p(e)||(e._d=null),e))}function Ot(e,t,n,s,i){var r,a={};return!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new M(dt(Yt(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function Tt(e,t,n,s){return Ot(e,t,n,s,!1)}c.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),c.ISO_8601=function(){},c.RFC_2822=function(){};var xt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Tt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:v()}),bt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Tt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:v()});function Pt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return Tt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Wt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ht(e){var t=C(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,d=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===Ye.call(Wt,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Wt.length;++s)if(e[Wt[s]]){if(n)return!1;parseFloat(e[Wt[s]])!==k(e[Wt[s]])&&(n=!0)}return!0}(t),this._milliseconds=+d+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=lt(),this._bubble()}function Rt(e){return e instanceof Ht}function Ct(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){I(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+U(~~(e/60),2)+n+U(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ue("Z",re),ue("ZZ",re),ce(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Ut(re,e)});var Lt=/([\+\-]|\d\d)/gi;function Ut(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Lt)||["-",0,0],i=60*s[1]+k(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Nt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(S(e)||h(e)?e.valueOf():Tt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),c.updateOffset(n,!1),n):Tt(e).local()}function Gt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Vt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}c.updateOffset=function(){};var Et=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,It=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function At(e,t){var n,s,i,r=e,a=null;return Rt(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:d(e)?(r={},t?r[t]=e:r.milliseconds=e):(a=Et.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:k(a[ye])*n,h:k(a[ge])*n,m:k(a[pe])*n,s:k(a[ve])*n,ms:k(Ct(1e3*a[we]))*n}):(a=It.exec(e))?(n="-"===a[1]?-1:(a[1],1),r={y:jt(a[2],n),M:jt(a[3],n),w:jt(a[4],n),d:jt(a[5],n),h:jt(a[6],n),m:jt(a[7],n),s:jt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Nt(t,e),e.isBefore(t)?n=Zt(e,t):((n=Zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(Tt(r.from),Tt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ht(r),Rt(e)&&m(e,"_locale")&&(s._locale=e._locale),s}function jt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Zt(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function zt(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(T(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),$t(this,At(e="string"==typeof e?+e:e,t),s),this}}function $t(e,t,n,s){var i=t._milliseconds,r=Ct(t._days),a=Ct(t._months);e.isValid()&&(s=null==s||s,a&&Ce(e,xe(e,"Month")+a*n),r&&be(e,"Date",xe(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&c.updateOffset(e,r||a))}At.fn=Ht.prototype,At.invalid=function(){return At(NaN)};var qt=zt(1,"add"),Jt=zt(-1,"subtract");function Bt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function Qt(e){var t;return void 0===e?this._locale._abbr:(null!=(t=lt(e))&&(this._locale=t),this)}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Xt=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function Kt(){return this._locale}function en(e,t){I(0,[e,e.length],0,t)}function tn(e,t,n,s,i){var r;return null==e?Ie(this,s,i).year:((r=Ae(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ge(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),en("gggg","weekYear"),en("ggggg","weekYear"),en("GGGG","isoWeekYear"),en("GGGGG","isoWeekYear"),H("weekYear","gg"),H("isoWeekYear","GG"),L("weekYear",1),L("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",B,z),ue("gg",B,z),ue("GGGG",ee,q),ue("gggg",ee,q),ue("GGGGG",te,J),ue("ggggg",te,J),fe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=k(e)}),fe(["gg","GG"],function(e,t,n,s){t[s]=c.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),H("quarter","Q"),L("quarter",7),ue("Q",Z),ce("Q",function(e,t){t[_e]=3*(k(e)-1)}),I("D",["DD",2],"Do","date"),H("date","D"),L("date",9),ue("D",B),ue("DD",B,z),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ce(["D","DD"],ye),ce("Do",function(e,t){t[ye]=k(e.match(B)[0])});var nn=Te("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),H("dayOfYear","DDD"),L("dayOfYear",4),ue("DDD",K),ue("DDDD",$),ce(["DDD","DDDD"],function(e,t,n){n._dayOfYear=k(e)}),I("m",["mm",2],0,"minute"),H("minute","m"),L("minute",14),ue("m",B),ue("mm",B,z),ce(["m","mm"],pe);var sn=Te("Minutes",!1);I("s",["ss",2],0,"second"),H("second","s"),L("second",15),ue("s",B),ue("ss",B,z),ce(["s","ss"],ve);var rn,an=Te("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),H("millisecond","ms"),L("millisecond",16),ue("S",K,Z),ue("SS",K,z),ue("SSS",K,$),rn="SSSS";rn.length<=9;rn+="S")ue(rn,ne);function on(e,t){t[we]=k(1e3*("0."+e))}for(rn="S";rn.length<=9;rn+="S")ce(rn,on);var un=Te("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var ln=M.prototype;function dn(e){return e}ln.add=qt,ln.calendar=function(e,t){var n=e||Tt(),s=Nt(n,this).startOf("day"),i=c.calendarFormat(this,s)||"sameElse",r=t&&(x(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,Tt(n)))},ln.clone=function(){return new M(this)},ln.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Nt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=R(t)){case"year":r=Bt(this,s)/12;break;case"month":r=Bt(this,s);break;case"quarter":r=Bt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:D(r)},ln.endOf=function(e){return void 0===(e=R(e))||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))},ln.format=function(e){e||(e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},ln.from=function(e,t){return this.isValid()&&(S(e)&&e.isValid()||Tt(e).isValid())?At({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},ln.fromNow=function(e){return this.from(Tt(),e)},ln.to=function(e,t){return this.isValid()&&(S(e)&&e.isValid()||Tt(e).isValid())?At({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},ln.toNow=function(e){return this.to(Tt(),e)},ln.get=function(e){return x(this[e=R(e)])?this[e]():this},ln.invalidAt=function(){return g(this).overflow},ln.isAfter=function(e,t){var n=S(e)?e:Tt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=R(l(t)?"millisecond":t))?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},ln.isBefore=function(e,t){var n=S(e)?e:Tt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=R(l(t)?"millisecond":t))?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},ln.isBetween=function(e,t,n,s){return("("===(s=s||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===s[1]?this.isBefore(t,n):!this.isAfter(t,n))},ln.isSame=function(e,t){var n,s=S(e)?e:Tt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=R(t||"millisecond"))?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},ln.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},ln.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},ln.isValid=function(){return p(this)},ln.lang=Xt,ln.locale=Qt,ln.localeData=Kt,ln.max=bt,ln.min=xt,ln.parsingFlags=function(){return _({},g(this))},ln.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:F[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=C(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(x(this[e=R(e)]))return this[e](t);return this},ln.startOf=function(e){switch(e=R(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this},ln.subtract=Jt,ln.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},ln.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},ln.toDate=function(){return new Date(this.valueOf())},ln.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):x(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},ln.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},ln.toJSON=function(){return this.isValid()?this.toISOString():null},ln.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},ln.unix=function(){return Math.floor(this.valueOf()/1e3)},ln.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},ln.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},ln.year=Oe,ln.isLeapYear=function(){return ke(this.year())},ln.weekYear=function(e){return tn.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},ln.isoWeekYear=function(e){return tn.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},ln.quarter=ln.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},ln.month=Fe,ln.daysInMonth=function(){return Pe(this.year(),this.month())},ln.week=ln.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},ln.isoWeek=ln.isoWeeks=function(e){var t=Ie(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},ln.weeksInYear=function(){var e=this.localeData()._week;return Ae(this.year(),e.dow,e.doy)},ln.isoWeeksInYear=function(){return Ae(this.year(),1,4)},ln.date=nn,ln.day=ln.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},ln.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},ln.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=(n=e,s=this.localeData(),"string"==typeof n?s.weekdaysParse(n)%7||7:isNaN(n)?null:n);return this.day(this.day()%7?t:t-7)}return this.day()||7;var n,s},ln.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},ln.hour=ln.hours=tt,ln.minute=ln.minutes=sn,ln.second=ln.seconds=an,ln.millisecond=ln.milliseconds=un,ln.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=Ut(re,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Gt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?$t(this,At(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,c.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?i:Gt(this)},ln.utc=function(e){return this.utcOffset(0,e)},ln.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Gt(this),"m")),this},ln.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Ut(ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},ln.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Tt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},ln.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},ln.isLocal=function(){return!!this.isValid()&&!this._isUTC},ln.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},ln.isUtc=Vt,ln.isUTC=Vt,ln.zoneAbbr=function(){return this._isUTC?"UTC":""},ln.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},ln.dates=n("dates accessor is deprecated. Use date instead.",nn),ln.months=n("months accessor is deprecated. Use month instead",Fe),ln.years=n("years accessor is deprecated. Use year instead",Oe),ln.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),ln.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Yt(e))._a){var t=e._isUTC?y(e._a):Tt(e._a);this._isDSTShifted=this.isValid()&&0<a(e._a,t.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted});var hn=P.prototype;function cn(e,t,n,s){var i=lt(),r=y().set(s,t);return i[n](r,e)}function fn(e,t,n){if(d(e)&&(t=e,e=void 0),e=e||"",null!=t)return cn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=cn(e,s,n,"month");return i}function mn(e,t,n,s){"boolean"==typeof e?d(t)&&(n=t,t=void 0):(t=e,e=!1,d(n=t)&&(n=t,t=void 0)),t=t||"";var i,r=lt(),a=e?r._week.dow:0;if(null!=n)return cn(t,(n+a)%7,s,"day");var o=[];for(i=0;i<7;i++)o[i]=cn(t,(i+a)%7,s,"day");return o}hn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return x(s)?s.call(t,n):s},hn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},hn.invalidDate=function(){return this._invalidDate},hn.ordinal=function(e){return this._ordinal.replace("%d",e)},hn.preparse=dn,hn.postformat=dn,hn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return x(i)?i(e,t,n,s):i.replace(/%d/i,e)},hn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return x(n)?n(t):n.replace(/%s/i,t)},hn.set=function(e){var t,n;for(n in e)x(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},hn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},hn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},hn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=y([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=y([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},hn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=Ue),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},hn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Le),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},hn.week=function(e){return Ie(e,this._week.dow,this._week.doy).week},hn.firstDayOfYear=function(){return this._week.doy},hn.firstDayOfWeek=function(){return this._week.dow},hn.weekdays=function(e,t){return e?o(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]:o(this._weekdays)?this._weekdays:this._weekdays.standalone},hn.weekdaysMin=function(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin},hn.weekdaysShort=function(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort},hn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=y([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=y([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},hn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=$e),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},hn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=qe),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},hn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Je),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},hn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},hn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ot("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===k(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),c.lang=n("moment.lang is deprecated. Use moment.locale instead.",ot),c.langData=n("moment.langData is deprecated. Use moment.localeData instead.",lt);var _n=Math.abs;function yn(e,t,n,s){var i=At(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function gn(e){return e<0?Math.floor(e):Math.ceil(e)}function pn(e){return 4800*e/146097}function vn(e){return 146097*e/4800}function wn(e){return function(){return this.as(e)}}var Mn=wn("ms"),Sn=wn("s"),Dn=wn("m"),kn=wn("h"),Yn=wn("d"),On=wn("w"),Tn=wn("M"),xn=wn("y");function bn(e){return function(){return this.isValid()?this._data[e]:NaN}}var Pn=bn("milliseconds"),Wn=bn("seconds"),Hn=bn("minutes"),Rn=bn("hours"),Cn=bn("days"),Fn=bn("months"),Ln=bn("years");var Un=Math.round,Nn={ss:44,s:45,m:45,h:22,d:26,M:11};var Gn=Math.abs;function Vn(e){return(0<e)-(e<0)||+e}function En(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Gn(this._milliseconds)/1e3,s=Gn(this._days),i=Gn(this._months);t=D((e=D(n/60))/60),n%=60,e%=60;var r=D(i/12),a=i%=12,o=s,u=t,l=e,d=n?n.toFixed(3).replace(/\.?0+$/,""):"",h=this.asSeconds();if(!h)return"P0D";var c=h<0?"-":"",f=Vn(this._months)!==Vn(h)?"-":"",m=Vn(this._days)!==Vn(h)?"-":"",_=Vn(this._milliseconds)!==Vn(h)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||d?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(d?_+d+"S":"")}var In=Ht.prototype;return In.isValid=function(){return this._isValid},In.abs=function(){var e=this._data;return this._milliseconds=_n(this._milliseconds),this._days=_n(this._days),this._months=_n(this._months),e.milliseconds=_n(e.milliseconds),e.seconds=_n(e.seconds),e.minutes=_n(e.minutes),e.hours=_n(e.hours),e.months=_n(e.months),e.years=_n(e.years),this},In.add=function(e,t){return yn(this,e,t,1)},In.subtract=function(e,t){return yn(this,e,t,-1)},In.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=R(e))||"year"===e)return t=this._days+s/864e5,n=this._months+pn(t),"month"===e?n:n/12;switch(t=this._days+Math.round(vn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},In.asMilliseconds=Mn,In.asSeconds=Sn,In.asMinutes=Dn,In.asHours=kn,In.asDays=Yn,In.asWeeks=On,In.asMonths=Tn,In.asYears=xn,In.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*k(this._months/12):NaN},In._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*gn(vn(o)+a),o=a=0),u.milliseconds=r%1e3,e=D(r/1e3),u.seconds=e%60,t=D(e/60),u.minutes=t%60,n=D(t/60),u.hours=n%24,o+=i=D(pn(a+=D(n/24))),a-=gn(vn(i)),s=D(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},In.clone=function(){return At(this)},In.get=function(e){return e=R(e),this.isValid()?this[e+"s"]():NaN},In.milliseconds=Pn,In.seconds=Wn,In.minutes=Hn,In.hours=Rn,In.days=Cn,In.weeks=function(){return D(this.days()/7)},In.months=Fn,In.years=Ln,In.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t,n,s,i,r,a,o,u,l,d,h,c=this.localeData(),f=(n=!e,s=c,i=At(t=this).abs(),r=Un(i.as("s")),a=Un(i.as("m")),o=Un(i.as("h")),u=Un(i.as("d")),l=Un(i.as("M")),d=Un(i.as("y")),(h=r<=Nn.ss&&["s",r]||r<Nn.s&&["ss",r]||a<=1&&["m"]||a<Nn.m&&["mm",a]||o<=1&&["h"]||o<Nn.h&&["hh",o]||u<=1&&["d"]||u<Nn.d&&["dd",u]||l<=1&&["M"]||l<Nn.M&&["MM",l]||d<=1&&["y"]||["yy",d])[2]=n,h[3]=0<+t,h[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,h));return e&&(f=c.pastFuture(+this,f)),c.postformat(f)},In.toISOString=En,In.toString=En,In.toJSON=En,In.locale=Qt,In.localeData=Kt,In.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",En),In.lang=Xt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ce("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ce("x",function(e,t,n){n._d=new Date(k(e))}),c.version="2.22.1",e=Tt,c.fn=ln,c.min=function(){return Pt("isBefore",[].slice.call(arguments,0))},c.max=function(){return Pt("isAfter",[].slice.call(arguments,0))},c.now=function(){return Date.now?Date.now():+new Date},c.utc=y,c.unix=function(e){return Tt(1e3*e)},c.months=function(e,t){return fn(e,t,"months")},c.isDate=h,c.locale=ot,c.invalid=v,c.duration=At,c.isMoment=S,c.weekdays=function(e,t,n){return mn(e,t,n,"weekdays")},c.parseZone=function(){return Tt.apply(null,arguments).parseZone()},c.localeData=lt,c.isDuration=Rt,c.monthsShort=function(e,t){return fn(e,t,"monthsShort")},c.weekdaysMin=function(e,t,n){return mn(e,t,n,"weekdaysMin")},c.defineLocale=ut,c.updateLocale=function(e,t){if(null!=t){var n,s,i=nt;null!=(s=at(e))&&(i=s._config),(n=new P(t=b(i,t))).parentLocale=st[e],st[e]=n,ot(e)}else null!=st[e]&&(null!=st[e].parentLocale?st[e]=st[e].parentLocale:null!=st[e]&&delete st[e]);return st[e]},c.locales=function(){return s(st)},c.weekdaysShort=function(e,t,n){return mn(e,t,n,"weekdaysShort")},c.normalizeUnits=R,c.relativeTimeRounding=function(e){return void 0===e?Un:"function"==typeof e&&(Un=e,!0)},c.relativeTimeThreshold=function(e,t){return void 0!==Nn[e]&&(void 0===t?Nn[e]:(Nn[e]=t,"s"===e&&(Nn.ss=t-1),!0))},c.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},c.prototype=ln,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"YYYY-[W]WW",MONTH:"YYYY-MM"},c});
\ No newline at end of file
Package.describe({
name: 'dangrossman:bootstrap-daterangepicker',
version: '3.0.3',
summary: 'Date range picker component',
git: 'https://github.com/dangrossman/daterangepicker',
documentation: 'README.md'
});
Package.onUse(function(api) {
api.versionsFrom('METEOR@0.9.0.1');
api.use('momentjs:moment@2.22.1', ["client"]);
api.use('jquery@3.3.1', ["client"]);
api.addFiles('daterangepicker.js', ["client"]);
api.addFiles('daterangepicker.css', ["client"]);
});
{
"name": "daterangepicker",
"version": "3.0.3",
"description": "Date range picker component for Bootstrap",
"main": "daterangepicker.js",
"style": "daterangepicker.css",
"scripts": {
"scss": "node-sass daterangepicker.scss > daterangepicker.css",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/dangrossman/daterangepicker.git"
},
"author": {
"name": "Dan Grossman",
"email": "dan@dangrossman.info",
"url": "http://www.dangrossman.info"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/dangrossman/daterangepicker/issues"
},
"homepage": "https://github.com/dangrossman/daterangepicker",
"dependencies": {
"jquery": ">=1.10",
"moment": "^2.9.0"
},
"devDependencies": {
"node-sass": "^3.4.2"
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Date Range Picker &mdash; JavaScript Date &amp; Time Picker Library</title>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/0.2.1/trianglify.min.js"></script>
<script type="text/javascript" src="daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="daterangepicker.css" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
<script src="website.js"></script>
<link rel="stylesheet" type="text/css" href="website.css" />
<meta name="google-site-verification" content="1fP-Eo9i1ozV4MUlqZv2vsLv1r7tvYutUb6i38v0_vg" />
</head>
<body>
<nav class="navbar navbar-expand-sm navbar-dark bg-dark" style="padding: 0; justify-content: space-between">
<div class="container">
<ul class="navbar-nav">
<li class="nav-item" style="padding-left: 0"><a class="nav-link" href="/" style="color: #eeeeee"><i class="fa fa-calendar"></i>&nbsp; Date Range Picker</a></li>
</ul>
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="https://www.improvely.com" style="color: #33beff"><i class="fa fa-chart-bar"></i>&nbsp; Improvely</a></li>
<li class="nav-item"><a class="nav-link" href="https://www.w3counter.com" style="color: #ff9999"><i class="fa fa-chart-pie"></i>&nbsp; W3Counter</a></li>
<li class="nav-item"><a class="nav-link" href="https://www.websitegoodies.com" style="color: #f49a16"><i class="fa fa-wrench"></i>&nbsp; Website Goodies</a></li>
</ul>
</div>
</nav>
<div id="jumbo">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-12">
<h1 style="margin: 0 0 10px 0">Date Range Picker</h1>
<p style="font-size: 18px; margin-bottom: 0">
A JavaScript component for choosing date ranges,
dates and times.
</p>
</div>
<div class="col-md-6 col-sm-12" style="text-align: right; padding-right: 0">
<div style="margin-bottom: 10px; margin-right: 15px">
<a href="https://github.com/dangrossman/daterangepicker" class="btn btn-light"><i class="fab fa-github-alt"></i>&nbsp; View on GitHub</a>
&nbsp;
<a href="https://github.com/dangrossman/daterangepicker/archive/master.zip" class="btn btn-success"><i class="fas fa-download"></i>&nbsp; Download ZIP</a>
</div>
<div style="margin-right: 0px">
<iframe src="https://ghbtns.com/github-btn.html?user=dangrossman&repo=daterangepicker&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
<iframe src="https://ghbtns.com/github-btn.html?user=dangrossman&repo=daterangepicker&type=watch&count=true&size=large&v=2" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
<iframe src="https://ghbtns.com/github-btn.html?user=dangrossman&repo=daterangepicker&type=fork&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
</div>
</div>
</div>
</div>
</div>
<div class="container" style="padding: 0 30px" id="main">
<div class="row">
<div class="leftcol d-none d-lg-block d-xl-block">
<div id="menu" class="list-group" style="margin-bottom: 10px">
<a class="list-group-item" href="#usage">Getting Started</a>
<a class="list-group-item" href="#examples">Examples</a>
<a class="list-group-item" href="#options">Options, Methods &amp; Events</a>
<a class="list-group-item" href="#config">Configuration Generator</a>
<a class="list-group-item" href="#license">License &amp; Comments</a>
</div>
<div style="width: 300px; min-width: 300px">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- DRP Responsive -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-9095657276960731"
data-ad-slot="8963174596"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
<div class="rightcol">
<p>Originally created for reports at <a href="https://www.improvely.com">Improvely</a>, the Date Range Picker can be attached to any webpage element to pop up two calendars for selecting dates, times, or predefined ranges like "Last 30 Days".</p>
<a style="display: block; height: 300px; background: url('drp.png') top right no-repeat; background-size: cover; border: 1px solid #ccc; margin-bottom: 30px" href="https://awio.iljmp.com/5/drpdemo" title="Click for a Live Demo"></a>
<h1><a id="usage" href="#usage">Getting Started</a></h1>
<p>
To get started, include jQuery, Moment.js and Date Range Picker's files in your webpage:
</p>
<script src="https://gist.github.com/dangrossman/4879503153c6a7a0b3b6ebd64e0383b7.js"></script>
<p style="margin-bottom: 10px">
Then attach a date range picker to whatever you want to trigger it:
</p>
<div class="row">
<div class="col-8">
<label>Code:</label>
<script src="https://gist.github.com/dangrossman/f460cf1243d8ffb08c749730e89c2f3d.js"></script>
</div>
<div class="col-4">
<label>Produces:</label>
<input type="text" name="dates" class="form-control pull-right" />
<script>
$(function() {
$('input[name="dates"]').daterangepicker({ startDate: moment(), endDate: moment().add(2, 'day')});
})
</script>
</div>
</div>
<p>
You can customize Date Range Picker with options, and get notified when the user chooses new dates by providing a callback function.
</p>
<h1><a id="examples" href="#examples">Examples</a></h1>
<!-- Example 1 -->
<h2><a data-toggle="nothing" href="#example1">Simple Date Range Picker With a Callback</a></h2>
<div class="collapsable" id="example1">
<div class="row">
<div class="col-8">
<label>Code:</label>
<script src="https://gist.github.com/dangrossman/e118af4dbadc5177d7494dba9d3295d1.js"></script>
</div>
<div class="col-4">
<label>Produces:</label>
<input type="text" name="daterange" class="form-control" value="1/01/2018 - 01/15/2018" />
<script>
$(function() {
$('input[name="daterange"]').daterangepicker({
opens: 'left'
}, function(start, end, label) {
console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
});
});
</script>
</div>
</div>
</div>
<!-- Example 2 -->
<h2><a data-toggle="nothing" href="#example2">Date Range Picker With Times</a></h2>
<div class="collapsable" id="example2">
<div class="row">
<div class="col-8">
<label>Code:</label>
<script src="https://gist.github.com/dangrossman/14db17599e24652db7401ed2448eb91a.js"></script>
</div>
<div class="col-4">
<label>Produces:</label>
<input type="text" name="datetimes" class="form-control pull-right" />
<script>
$(function() {
$('input[name="datetimes"]').daterangepicker({
timePicker: true,
startDate: moment().startOf('hour'),
endDate: moment().startOf('hour').add(32, 'hour'),
locale: {
format: 'M/DD hh:mm A'
}
});
});
</script>
</div>
</div>
</div>
<!-- Example 3 -->
<h2><a data-toggle="nothing" href="#example3">Single Date Picker</a></h2>
<div class="collapsable" id="example3">
<div class="row">
<div class="col-8">
<label>Code:</label>
<script src="https://gist.github.com/dangrossman/98d8f1c304328c191b1ad33ac21354fd.js"></script>
</div>
<div class="col-4">
<label>Produces:</label>
<input type="text" name="birthday" class="form-control pull-right" value="10/24/1984" />
<script>
$(function() {
$('input[name="birthday"]').daterangepicker({
singleDatePicker: true,
showDropdowns: true,
minYear: 1901,
maxYear: parseInt(moment().format('YYYY'),10)
}, function(start, end, label) {
var years = moment().diff(start, 'years');
alert("You are " + years + " years old!");
});
});
</script>
</div>
</div>
</div>
<!-- Example 4 -->
<h2><a data-toggle="nothing" href="#example4">Predefined Date Ranges</a></h2>
<div class="collapsable" id="example4">
<div class="row">
<div class="col-8">
<label>Code:</label>
<script src="https://gist.github.com/dangrossman/8c6747b82572bc860364f17258004dbb.js"></script>
</div>
<div class="col-4">
<label>Produces:</label>
<div id="reportrange" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i>
</div>
<script type="text/javascript">
$(function() {
var start = moment().subtract(29, 'days');
var end = moment();
function cb(start, end) {
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
}, cb);
cb(start, end);
});
</script>
</div>
</div>
</div>
<!-- Example 5 -->
<h2><a data-toggle="nothing" href="#example5">Input Initially Empty</a></h2>
<div class="collapsable" id="example5">
<div class="row">
<div class="col-8">
<label>Code:</label>
<script src="https://gist.github.com/dangrossman/d50376f3467f69e7fb5570afd07dc921.js"></script>
</div>
<div class="col-4">
<label>Produces:</label>
<input type="text" name="datefilter" class="form-control pull-right" value="" />
<script type="text/javascript">
$(function() {
$('input[name="datefilter"]').daterangepicker({
autoUpdateInput: false,
locale: {
cancelLabel: 'Clear'
}
});
$('input[name="datefilter"]').on('apply.daterangepicker', function(ev, picker) {
$(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));
});
$('input[name="datefilter"]').on('cancel.daterangepicker', function(ev, picker) {
$(this).val('');
});
});
</script>
</div>
</div>
</div>
<h1 style="margin-top: 30px"><a id="options" href="#options">Options</a></h1>
<ul class="nobullets">
<li>
<code>startDate</code> (Date or string) The beginning date of the initially selected date range. If you provide a string, it must match the date format string set in your <code>locale</code> setting.
</li>
<li>
<code>endDate</code>: (Date or string) The end date of the initially selected date range.
</li>
<li>
<code>minDate</code>: (Date or string) The earliest date a user may select.
</li>
<li>
<code>maxDate</code>: (Date or string) The latest date a user may select.
</li>
<li>
<code>maxSpan</code>: (object) The maximum span between the selected start and end dates. Check off <code>maxSpan</code> in the configuration generator for an example of how to use this. You can provide any object the <code>moment</code> library would let you add to a date.
</li>
<li>
<code>showDropdowns</code>: (true/false) Show year and month select boxes above calendars to jump to a specific month and year.
</li>
<li>
<code>minYear</code>: (number) The minimum year shown in the dropdowns when <code>showDropdowns</code> is set to true.
</li>
<li>
<code>maxYear</code>: (number) The maximum year shown in the dropdowns when <code>showDropdowns</code> is set to true.
</li>
<li>
<code>showWeekNumbers</code>: (true/false) Show localized week numbers at the start of each week on the calendars.
</li>
<li>
<code>showISOWeekNumbers</code>: (true/false) Show ISO week numbers at the start of each week on the calendars.
</li>
<li>
<code>timePicker</code>: (true/false) Adds select boxes to choose times in addition to dates.
</li>
<li>
<code>timePickerIncrement</code>: (number) Increment of the minutes selection list for times (i.e. 30 to allow only selection of times ending in 0 or 30).
</li>
<li>
<code>timePicker24Hour</code>: (true/false) Use 24-hour instead of 12-hour times, removing the AM/PM selection.
</li>
<li>
<code>timePickerSeconds</code>: (true/false) Show seconds in the timePicker.
</li>
<li>
<code>ranges</code>: (object) Set predefined date ranges the user can select from. Each key is the label for the range, and its value an array with two dates representing the bounds of the range. Click <code>ranges</code> in the configuration generator for examples.
</li>
<li>
<code>showCustomRangeLabel</code>: (true/false) Displays "Custom Range" at
the end of the list of predefined ranges, when the <code>ranges</code> option is used.
This option will be highlighted whenever the current date range selection does not match one of the predefined ranges. Clicking it will display the calendars to select a new range.
</li>
<li>
<code>alwaysShowCalendars</code>: (true/false) Normally, if you use the <code>ranges</code> option to specify pre-defined date ranges, calendars for choosing a custom date range are not shown until the user clicks "Custom Range". When this option is set to true, the calendars for choosing a custom date range are always shown instead.
</li>
<li>
<code>opens</code>: ('left'/'right'/'center') Whether the picker appears aligned to the left, to the right, or centered under the HTML element it's attached to.
</li>
<li>
<code>drops</code>: ('down'/'up') Whether the picker appears below (default) or above the HTML element it's attached to.
</li>
<li>
<code>buttonClasses</code>: (string) CSS class names that will be added to both the apply and cancel buttons.
</li>
<li>
<code>applyButtonClasses</code>: (string) CSS class names that will be added only to the apply button.
</li>
<li>
<code>cancelButtonClasses</code>: (string) CSS class names that will be added only to the cancel button.
</li>
<li>
<code>locale</code>: (object) Allows you to provide localized strings for buttons and labels, customize the date format, and change the first day of week for the calendars.
Check off <code>locale</code> in the configuration generator to see how
to customize these options.
</li>
<li>
<code>singleDatePicker</code>: (true/false) Show only a single calendar to choose one date, instead of a range picker with two calendars. The start and end dates provided to your callback will be the same single date chosen.
</li>
<li>
<code>autoApply</code>: (true/false) Hide the apply and cancel buttons, and automatically apply a new date range as soon as two dates are clicked.
</li>
<li>
<code>linkedCalendars</code>: (true/false) When enabled, the two calendars displayed will always be for two sequential months (i.e. January and February), and both will be advanced when clicking the left or right arrows above the calendars. When disabled, the two calendars can be individually advanced and display any month/year.
</li>
<li>
<code>isInvalidDate</code>: (function) A function that is passed each date in the two
calendars before they are displayed, and may return true or false to indicate whether
that date should be available for selection or not.
</li>
<li>
<code>isCustomDate</code>: (function) A function that is passed each date in the two
calendars before they are displayed, and may return a string or array of CSS class names
to apply to that date's calendar cell.
</li>
<li>
<code>autoUpdateInput</code>: (true/false) Indicates whether the date range picker should
automatically update the value of the <code>&lt;input&gt;</code> element it's attached to at initialization and when the selected dates change.
</li>
<li>
<code>parentEl</code>: (string) jQuery selector of the parent element that the date range picker will be added to, if not provided this will be 'body'
</li>
</ul>
<h1 style="margin-top: 30px"><a id="methods" href="#methods">Methods</a></h1>
<p>
You can programmatically update the <code>startDate</code> and <code>endDate</code>
in the picker using the <code>setStartDate</code> and <code>setEndDate</code> methods.
You can access the Date Range Picker object and its functions and properties through
data properties of the element you attached it to.
</p>
<script src="https://gist.github.com/dangrossman/8ff9b1220c9b5682e8bd.js"></script>
<br/>
<ul class="nobullets">
<li>
<code>setStartDate(Date or string)</code>: Sets the date range picker's currently selected start date to the provided date
</li>
<li>
<code>setEndDate(Date or string)</code>: Sets the date range picker's currently selected end date to the provided date
</li>
</ul>
<p style="margin: 0"><b>Example usage:</b></p>
<script src="https://gist.github.com/dangrossman/e1a8effbaeacb50a1e31.js"></script>
<h1 style="margin-top: 30px"><a id="events" href="#events">Events</a></h1>
<p>
Several events are triggered on the element you attach the picker to, which you can listen for.
</p>
<ul class="nobullets">
<li>
<code>show.daterangepicker</code>: Triggered when the picker is shown
</li>
<li>
<code>hide.daterangepicker</code>: Triggered when the picker is hidden
</li>
<li>
<code>showCalendar.daterangepicker</code>: Triggered when the calendar(s) are shown
</li>
<li>
<code>hideCalendar.daterangepicker</code>: Triggered when the calendar(s) are hidden
</li>
<li>
<code>apply.daterangepicker</code>: Triggered when the apply button is clicked,
or when a predefined range is clicked
</li>
<li>
<code>cancel.daterangepicker</code>: Triggered when the cancel button is clicked
</li>
</ul>
<p>
Some applications need a "clear" instead of a "cancel" functionality, which can be achieved by changing the button label and watching for the cancel event:
</p>
<script src="https://gist.github.com/dangrossman/1bea78da703f2896564d.js"></script>
<br/>
<p>
While passing in a callback to the constructor is the easiest way to listen for changes in the selected date range, you can also do something every time the apply button is clicked even if the selection hasn't changed:
</p>
<script src="https://gist.github.com/dangrossman/0c6c911fea1459b5fd13.js"></script>
<h1 style="margin-top: 30px"><a id="config" href="#config">Configuration Generator</a></h1>
<div class="well configurator">
<form>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="parentEl">parentEl</label>
<input type="text" class="form-control" id="parentEl" value="" placeholder="body">
</div>
<div class="form-group">
<label for="startDate">startDate</label>
<input type="text" class="form-control" id="startDate" value="07/01/2017">
</div>
<div class="form-group">
<label for="endDate">endDate</label>
<input type="text" class="form-control" id="endDate" value="07/15/2017">
</div>
<div class="form-group">
<label for="minDate">minDate</label>
<input type="text" class="form-control" id="minDate" value="" placeholder="MM/DD/YYYY">
</div>
<div class="form-group">
<label for="maxDate">maxDate</label>
<input type="text" class="form-control" id="maxDate" value="" placeholder="MM/DD/YYYY">
</div>
<div class="form-group">
<label for="opens">opens</label>
<select id="opens" class="form-control">
<option value="right" selected>right</option>
<option value="left">left</option>
<option value="center">center</option>
</select>
</div>
<div class="form-group">
<label for="drops">drops</label>
<select id="drops" class="form-control">
<option value="down" selected>down</option>
<option value="up">up</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="checkbox">
<label>
<input type="checkbox" id="showDropdowns"> showDropdowns
</label>
</div>
<div class="form-group">
<label for="minYear">minYear</label>
<input type="text" class="form-control" id="minYear" value="">
</div>
<div class="form-group">
<label for="maxYear">maxYear</label>
<input type="text" class="form-control" id="maxYear" value="">
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showWeekNumbers"> showWeekNumbers
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showISOWeekNumbers"> showISOWeekNumbers
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="singleDatePicker"> singleDatePicker
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePicker"> timePicker
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePicker24Hour"> timePicker24Hour
</label>
</div>
<div class="form-group">
<label for="timePickerIncrement">timePickerIncrement (in minutes)</label>
<input type="text" class="form-control" id="timePickerIncrement" value="1">
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="timePickerSeconds"> timePickerSeconds
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="maxSpan"> maxSpan (example value)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="locale"> locale (example settings)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="autoApply"> autoApply
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="buttonClasses">buttonClasses</label>
<input type="text" class="form-control" id="buttonClasses" value="btn btn-sm">
</div>
<div class="form-group">
<label for="applyButtonClasses">applyButtonClasses</label>
<input type="text" class="form-control" id="applyButtonClasses" value="btn-primary">
</div>
<div class="form-group">
<label for="cancelButtonClasses">cancelButtonClasses</label>
<input type="text" class="form-control" id="cancelButtonClasses" value="btn-default">
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="ranges"> ranges (with example predefined ranges)
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="alwaysShowCalendars"> alwaysShowCalendars
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="showCustomRangeLabel" checked="checked"> showCustomRangeLabel
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="linkedCalendars" checked="checked"> linkedCalendars
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="autoUpdateInput" checked="checked"> autoUpdateInput
</label>
</div>
</div>
</div>
</form>
</div>
<div class="row">
<div class="col-4 demo">
<div style="position: relative">
<h2 style="margin-bottom: 15px">Your Date Range Picker</h2>
<input type="text" id="config-demo" class="form-control">
</div>
</div>
<div class="col-8">
<h2 style="margin-bottom: 15px">Your Configuration to Copy</h2>
<div class="well">
<textarea id="config-text" style="height: 300px; width: 100%; padding: 10px"></textarea>
</div>
</div>
</div>
<!-- License -->
<h1 style="margin-top: 30px"><a id="license" href="#license">License</a></h1>
<p>The MIT License (MIT)</p>
<p>Copyright (c) 2012-2018 <a href="http://www.dangrossman.info">Dan Grossman</a></p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</p>
<h1 style="margin-top: 30px"><a id="config" href="#comments">Comments</a></h1>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_url = 'http://www.dangrossman.info/2012/08/20/a-date-range-picker-for-twitter-bootstrap/';
var disqus_identifier = '1045 http://www.dangrossman.info/?p=1045';
var disqus_container_id = 'disqus_thread';
var disqus_shortname = 'dangrossman';
var disqus_title = "A Date Range Picker for Bootstrap";
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</div>
</div>
<!-- Begin W3Counter Tracking Code -->
<script type="text/javascript" src="https://www.w3counter.com/tracker.js?id=90840"></script>
<!-- End W3Counter Tracking Code -->
<script type="text/javascript">
var im_domain = 'awio';
var im_project_id = 48;
(function(e,t){window._improvely=[];var n=e.getElementsByTagName("script")[0];var r=e.createElement("script");r.type="text/javascript";r.src="https://"+im_domain+".iljmp.com/improvely.js";r.async=true;n.parentNode.insertBefore(r,n);if(typeof t.init=="undefined"){t.init=function(e,t){window._improvely.push(["init",e,t])};t.goal=function(e){window._improvely.push(["goal",e])};t.conversion=function(e){window._improvely.push(["conversion",e])};t.label=function(e){window._improvely.push(["label",e])}}window.improvely=t;t.init(im_domain,im_project_id)})(document,window.improvely||[])
</script>
<div id="footer">
Copyright &copy; 2012-2018 <a href="http://www.dangrossman.info/">Dan Grossman</a>.
</div>
</body>
</html>
body {
font-size: 15px;
line-height: 1.6em;
position: relative;
margin: 0;
}
.navbar .nav-item {
padding: 8px 0 8px 20px;
}
.navbar .nav-link {
font-weight: bold;
font-size: 14px;
padding: 0;
}
.navbar-expand-sm .navbar-nav .nav-link {
padding: 0;
}
.well {
background: #f5f5f5;
border-radius: 4px;
padding: 20px;
}
h1 {
font-size: 20px;
margin-bottom: 1em;
padding-bottom: 5px;
border-bottom: 1px dotted #08c;
}
h1:before {
content: '#';
color: #666;
position: relative;
padding-right: 5px;
}
h2 {
padding: 0;
margin: 20px 0 0 0;
font-size: 18px;
}
h2 a {
color: #444;
display: block;
background: #eee;
padding: 8px 12px;
margin-bottom: 0;
cursor: default;
text-decoration: none;
}
input.form-control {
font-size: 14px;
}
.collapsable {
border: 1px solid #eee;
padding: 12px;
display: block;
}
label {
font-size: 13px;
font-weight: bold;
}
.gist {
overflow: auto;
}
.gist .blob-wrapper.data {
max-height: 350px;
overflow: auto;
}
.list-group-item {
padding: 4px 0;
border: 0;
font-size: 16px;
}
.leftcol {
position: absolute;
top: 180px;
}
.rightcol {
max-width: 950px;
}
.container {
max-width: 1300px;
}
@media (min-width: 980px) {
.rightcol {
margin-left: 320px;
}
}
p, pre {
margin-bottom: 2em;
}
ul.nobullets {
margin: 0;
padding: 0;
list-style: none;
}
ul.nobullets li {
padding-bottom: 1em;
margin-bottom: 1em;
border-bottom: 1px dotted #ddd;
}
input[type="text"] {
padding: 6px;
width: 100%;
border-radius: 4px;
}
#footer {
background: #222;
margin-top: 80px;
padding: 10px;
color: #fff;
text-align: center;
}
#footer a:link, #footer a:visited {
color: #fff;
border-bottom: 1px dotted #fff;
}
#jumbo {
background: #c1deef;
color: #000;
padding: 20px 0;
margin-bottom: 20px;
}
#jumbo h1 {
font-size: 28px;
}
#jumbo .btn {
border-radius: 0;
font-size: 16px;
}
\ No newline at end of file
$(document).ready(function() {
$('#config-text').keyup(function() {
eval($(this).val());
});
$('.configurator input, .configurator select').change(function() {
updateConfig();
});
$('.demo i').click(function() {
$(this).parent().find('input').click();
});
$('#startDate').daterangepicker({
singleDatePicker: true,
startDate: moment().subtract(6, 'days')
});
$('#endDate').daterangepicker({
singleDatePicker: true,
startDate: moment()
});
//updateConfig();
function updateConfig() {
var options = {};
if ($('#singleDatePicker').is(':checked'))
options.singleDatePicker = true;
if ($('#showDropdowns').is(':checked'))
options.showDropdowns = true;
if ($('#minYear').val().length && $('#minYear').val() != 1)
options.minYear = parseInt($('#minYear').val(), 10);
if ($('#maxYear').val().length && $('#maxYear').val() != 1)
options.maxYear = parseInt($('#maxYear').val(), 10);
if ($('#showWeekNumbers').is(':checked'))
options.showWeekNumbers = true;
if ($('#showISOWeekNumbers').is(':checked'))
options.showISOWeekNumbers = true;
if ($('#timePicker').is(':checked'))
options.timePicker = true;
if ($('#timePicker24Hour').is(':checked'))
options.timePicker24Hour = true;
if ($('#timePickerIncrement').val().length && $('#timePickerIncrement').val() != 1)
options.timePickerIncrement = parseInt($('#timePickerIncrement').val(), 10);
if ($('#timePickerSeconds').is(':checked'))
options.timePickerSeconds = true;
if ($('#autoApply').is(':checked'))
options.autoApply = true;
if ($('#maxSpan').is(':checked'))
options.maxSpan = { days: 7 };
if ($('#ranges').is(':checked')) {
options.ranges = {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
};
}
if ($('#locale').is(':checked')) {
options.locale = {
format: 'MM/DD/YYYY',
separator: ' - ',
applyLabel: 'Apply',
cancelLabel: 'Cancel',
fromLabel: 'From',
toLabel: 'To',
customRangeLabel: 'Custom',
weekLabel: 'W',
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
firstDay: 1
};
}
if (!$('#linkedCalendars').is(':checked'))
options.linkedCalendars = false;
if (!$('#autoUpdateInput').is(':checked'))
options.autoUpdateInput = false;
if (!$('#showCustomRangeLabel').is(':checked'))
options.showCustomRangeLabel = false;
if ($('#alwaysShowCalendars').is(':checked'))
options.alwaysShowCalendars = true;
if ($('#parentEl').val().length)
options.parentEl = $('#parentEl').val();
if ($('#startDate').val().length)
options.startDate = $('#startDate').val();
if ($('#endDate').val().length)
options.endDate = $('#endDate').val();
if ($('#minDate').val().length)
options.minDate = $('#minDate').val();
if ($('#maxDate').val().length)
options.maxDate = $('#maxDate').val();
if ($('#opens').val().length && $('#opens').val() != 'right')
options.opens = $('#opens').val();
if ($('#drops').val().length && $('#drops').val() != 'down')
options.drops = $('#drops').val();
if ($('#buttonClasses').val().length && $('#buttonClasses').val() != 'btn btn-sm')
options.buttonClasses = $('#buttonClasses').val();
if ($('#applyButtonClasses').val().length && $('#applyButtonClasses').val() != 'btn-primary')
options.applyButtonClasses = $('#applyButtonClasses').val();
if ($('#cancelButtonClasses').val().length && $('#cancelButtonClasses').val() != 'btn-default')
options.cancelClass = $('#cancelButtonClasses').val();
$('#config-demo').daterangepicker(options, function(start, end, label) { console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')'); });
if (typeof options.ranges !== 'undefined') {
options.ranges = {};
}
var option_text = JSON.stringify(options, null, ' ');
var replacement = "ranges: {\n"
+ " 'Today': [moment(), moment()],\n"
+ " 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],\n"
+ " 'Last 7 Days': [moment().subtract(6, 'days'), moment()],\n"
+ " 'Last 30 Days': [moment().subtract(29, 'days'), moment()],\n"
+ " 'This Month': [moment().startOf('month'), moment().endOf('month')],\n"
+ " 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]\n"
+ " }";
option_text = option_text.replace(new RegExp('"ranges"\: \{\}', 'g'), replacement);
$('#config-text').val("$('#demo').daterangepicker(" + option_text + ", function(start, end, label) {\n console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');\n});");
}
$(window).scroll(function (event) {
var scroll = $(window).scrollTop();
if (scroll > 180) {
$('.leftcol').css('position', 'fixed');
$('.leftcol').css('top', '10px');
} else {
$('.leftcol').css('position', 'absolute');
$('.leftcol').css('top', '180px');
}
});
var bg = new Trianglify({
x_colors: ["#e1f3fd", "#eeeeee", "#407dbf"],
y_colors: 'match_x',
width: document.body.clientWidth,
height: 150,
stroke_width: 0,
cell_size: 20
});
$('#jumbo').css('background-image', 'url(' + bg.png() + ')');
});
<svg id="svg-filter">
<filter id="svg-blur">
<feGaussianBlur in="SourceGraphic" stdDeviation="4"></feGaussianBlur>
</filter>
</svg>
\ No newline at end of file
......@@ -287,7 +287,7 @@ a:hover {
}
.btn-slide {
color: #f2920a;
color: #c30800;
}
.btn-slide .text {
......
......@@ -657,23 +657,25 @@
.btn1-slide {
font-size: 13px;
font-weight: 600;
position: relative;
display: inline-block;
width: 170px;
height: 34px;
padding: 0 0 0 15px;
text-align: center;
text-transform: uppercase;
border: 1px solid #3c3c3c;
border: 1px solid #c30800;
border-radius: 50px;
background-color: #3c3c3c;
background-color: #fafafa;
color: #c30800;
}
.btn1-slide:hover {
color: #ffffff;
border: 1px solid #fafafa;
background-color: #c30800;
}
.btn1-slide .text {
font-style: inherit;
......@@ -1446,13 +1448,13 @@
}
.tours-layout:hover .image-wrapper .link {
-webkit-filter: blur(1px);
/* -webkit-filter: blur(1px);
-webkit-filter: url(../images/blur.svg#svg-blur);
-moz-filter: blur(1px);
-ms-filter: blur(1px);
filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius='1');
filter: blur(1px);
filter: url(../images/blur.svg#svg-blur);
filter: url(../images/blur.svg#svg-blur); */
}
.tours-layout:hover .image-wrapper .link img {
......
......@@ -1006,7 +1006,7 @@ body {
}
.formulaireDescktop {
width: 120%;
width: 150%;
margin-bottom: 0px !important;
display: inline-flex !important;
}
......@@ -1131,7 +1131,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
@media only screen and (min-device-width: 768px) {
.formulaireDescktop {
width: 120%;
width: 150%;
}
.marginInput {
......@@ -1431,7 +1431,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
.star-icon {
color: #f2920b !important;
font-size: 23px!important;
font-size: 22px!important;
}
......@@ -1577,7 +1577,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
background-size: cover;
/* background: linear-gradient( rgb(238, 238, 238), rgb(238, 238, 238)); */
height: 430px;
background-image: url(../images/background/trouvez_votre_vol.jpg);
background-image: url(../images/background/LP_Vol.jpg);
}
.checkout-banner{
......@@ -1607,7 +1607,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
background-size: cover;
/* background: linear-gradient( rgb(238, 238, 238), rgb(238, 238, 238)); */
height: 430px;
background-image: url(../images/background/images/vo-car-world.jpg);
background-image: url(../images/background/LP_Vo.jpg);
}
.vo-banner {
......@@ -1647,15 +1647,11 @@ div.input-daterange>div:nth-child(2)>div>ul {
background-size: cover;
/* background: linear-gradient( rgb(238, 238, 238), rgb(238, 238, 238)); */
height: 430px;
background-image: url(../images/background/trouvez_votre_hotel.jpg);
background-image: url(../images/background/LP_Hôtel.jpg);
}
.btn1-slide {
border: 1px solid #c30800 !important;
background-color: #c30800 !important;
}
.filter-btn {
margin-top: 5px
......@@ -1681,6 +1677,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
border-radius: 19px !important;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05) !important;
box-shadow: 0 1px 1px rgba(0, 0, 0, .05) !important;
min-height: 100px!important;
}
.AngularJS-smallsingle-flight-result {
......@@ -2311,25 +2308,39 @@ div.input-daterange>div:nth-child(2)>div>ul {
.card .image-wrapper .card-title .price {
position: absolute;
color: #c30800;
margin: 41px 0px 0px 0px;
/* margin: 41px 0px 0px 0px; */
font-size: 25px;
font-weight: 900;
text-shadow: 1px 1px 1px #ffffff;
transform: rotate(-44deg);
/* text-shadow: 1px 1px 1px #ffffff; */
/* transform: rotate(-44deg); */
z-index: 5;
min-width: 117px;
margin: 241px 0px 0px 210px;
}
.card .image-wrapper .card-title .price-from {
position: absolute;
color: #c30800;
margin: 51px 0px 0px 0px;
margin: 241px 0px 0px 175px;
font-size: 25px;
font-weight: 900;
text-shadow: 1px 1px 1px #ffffff;
transform: rotate(-44deg);
/* text-shadow: 1px 1px 1px #ffffff; */
/* transform: rotate(-44deg); */
z-index: 5;
min-width: 117px;
}
.card .image-wrapper .card-title .price-vo {
position: absolute;
color: #c30800;
/* margin: 41px 0px 0px 0px; */
font-size: 25px;
font-weight: 900;
/* text-shadow: 1px 1px 1px #ffffff; */
/* transform: rotate(-44deg); */
z-index: 5;
min-width: 117px;
margin: 280px 0px 0px 210px;
}
.card .image-wrapper .card-title .price-promo{
......@@ -2361,14 +2372,25 @@ div.input-daterange>div:nth-child(2)>div>ul {
left: 0;
}
.card .image-wrapper .card-title .card-starting-vo {
text-transform: uppercase;
color: #ffffff;
position: absolute;
margin: 281px 0px 0px 76px;
font-size: 12px;
font-weight: 900;
/* transform: rotate(-46deg); */
z-index: 5;
left: 0;
}
.card .image-wrapper .card-title .card-starting-from {
text-transform: uppercase;
color: #ffffff;
position: absolute;
margin: 48px 0px 0px -1px;
margin: 241px 0px 0px 76px;
font-size: 12px;
font-weight: 900;
transform: rotate(-46deg);
/* transform: rotate(-46deg); */
z-index: 5;
left: 0;
}
......@@ -2416,7 +2438,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
position: absolute;
z-index: 5;
right: 20px;
bottom: 20px;
bottom: 37px;
left: 20px;
display: inline-block;
color: #ffffff;
......@@ -2442,10 +2464,11 @@ div.input-daterange>div:nth-child(2)>div>ul {
.card .card-rating {
position: absolute;
margin: 28px 0px 0px 4px;
/* margin: 28px 0px 0px 4px; */
font-weight: 900;
transform: rotate(-46deg);
/* transform: rotate(-46deg); */
z-index: 5;
margin: 245px 0px 0px 93px;
}
......@@ -2478,7 +2501,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
font-size: 11px;
}
.card .card-ribbon {
.card .card-ribbon- {
width: 66%;
position: absolute;
......@@ -2492,7 +2515,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
}
.card .card-ribbon-from {
.card .card-ribbon--from- {
width: 71%;
position: absolute;
......@@ -2677,7 +2700,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
}
.navbar-nav {
margin-left: 11% !important;
margin-left: 8% !important;
margin-top: -1% !important;
}
......@@ -3049,8 +3072,17 @@ div.input-daterange>div:nth-child(2)>div>ul {
}
.card .image-wrapper .card-title .price {
margin: 242px 0px 0px 172px;
}
.card .image-wrapper .card-title .price-vo {
margin: 218px 0px 0px 143px;
}
.card .image-wrapper .card-title .card-starting-vo {
margin: 219px 0px 0px 56px;
}
}
......@@ -3181,10 +3213,17 @@ div.input-daterange>div:nth-child(2)>div>ul {
margin-top: 23px;
}
.card .card-ribbon {
.card .card-ribbon- {
width: 102%;
}
.card .image-wrapper .card-title .card-starting-vo {
margin: 160px 0px 0px 15px;
}
.card .image-wrapper .card-title .price-vo {
margin: 158px 0px 0px 91px;
}
}
......@@ -3533,6 +3572,16 @@ div.input-daterange>div:nth-child(2)>div>ul {
}
.card .image-wrapper .card-title .price {
margin: 186px 0px 0px 196px;
}
.card .card-rating {
margin: 191px 0px 0px 77px;
}
}
......@@ -3565,6 +3614,13 @@ div.input-daterange>div:nth-child(2)>div>ul {
display: none;
}
.card .card-rating {
margin: 138px 0px 0px 52px;
}
.card .image-wrapper .card-title .price {
margin: 134px 0px 0px 160px;
}
}
......@@ -3654,9 +3710,25 @@ div.input-daterange>div:nth-child(2)>div>ul {
}
.card .card-ribbon {
.card .card-ribbon- {
width: 67%;
}
.card .image-wrapper .card-title .price-vo {
margin: 212px 0px 0px 146px;
}
.card .image-wrapper .card-title .card-starting-vo {
margin: 212px 0px 0px 65px;
}
.card .image-wrapper .card-title .price-from {
margin: 241px 0px 0px 136px;
}
.card .image-wrapper .card-title .card-starting-from {
margin: 241px 0px 0px 46px;
}
}
......@@ -3833,18 +3905,17 @@ div.input-daterange>div:nth-child(2)>div>ul {
margin-top: -5px;
}
.card .card-ribbon {
.card .card-ribbon- {
width: 74%;
}
.card .card-ribbon-from {
.card .card-ribbon--from- {
width: 79%;
}
}
.bg-gray-transparent {
background-color: #5b57555c !important;
......@@ -3853,11 +3924,21 @@ div.input-daterange>div:nth-child(2)>div>ul {
.img-container {
background-color: #000000;
min-height: 600px;
}
.img-container-lodge {
background-color: #000000;
min-height: 514px!important;
}
.img-container img {
opacity: 0.7;
}
.img-container-lodge img {
opacity: 0.7;
}
.img-container-first {
background: linear-gradient(rgb(238, 238, 238), rgb(238, 238, 238));
......@@ -3930,10 +4011,7 @@ div.input-daterange>div:nth-child(2)>div>ul {
display: none;
}
.card .image-wrapper .card-title .price {
margin: 43px 0px 0px -9px;
}
.navbar-nav {
text-shadow: none;
......@@ -4055,6 +4133,27 @@ div.input-daterange>div:nth-child(2)>div>ul {
}
.result-btn-inv {
background-color: #c30800 !important;
border-color: #fafafa !important;
color: #fafafa !important;
width: 106px !important;
font-size: 14px;
font-weight: 700;
text-transform: none !important;
border: 1px solid #fafafa !important;
cursor: pointer;
}
.result-btn-inv:hover {
color: #c30800 !important;
background-color: #fafafa !important;
border-color: #c30800 !important;
}
.btn1-change-vol {
font-size: 13px;
font-weight: 500;
......@@ -4270,27 +4369,87 @@ footer.footer [ng-cloak] {
and (device-height : 812px)
and (-webkit-device-pixel-ratio : 3) {
.card .card-ribbon {
.card .card-ribbon- {
width: 70%;
}
.card .card-ribbon-from {
.card .card-ribbon--from- {
width: 73%;
}
.card .image-wrapper .card-title .price {
margin: 166px 0px 0px 172px;
}
.card .card-rating {
margin: 171px 0px 0px 76px;
}
.card .image-wrapper .card-title .card-starting-vo {
margin: 270px 0px 0px 84px;
}
.card .image-wrapper .card-title .price-vo {
margin: 268px 0px 0px 184px;
}
.card .image-wrapper .card-title .card-starting-from {
margin: 241px 0px 0px 46px;
}
.card .image-wrapper .card-title .price-from {
margin: 241px 0px 0px 166px;
}
}
/* iPhone 7/8 */
/* iPhone 6/7/8 */
@media only screen
and (device-width : 375px)
and (device-height : 667px)
and (-webkit-device-pixel-ratio : 2) {
.card .card-ribbon {
.card .card-ribbon- {
width: 72%;
}
.card .card-ribbon-from {
.card .card-ribbon--from- {
width: 73%;
}
.card .card-rating {
margin: 190px 0px 0px 87px;
}
.card .image-wrapper .card-title .price {
margin: 186px 0px 0px 193px;
}
.card .image-wrapper .card-title .price {
margin: 166px 0px 0px 175px;
}
.card .card-rating {
margin: 170px 0px 0px 77px;
}
.card .image-wrapper .card-title .price-vo {
margin: 264px 0px 0px 174px;
}
.card .image-wrapper .card-title .card-starting-vo {
margin: 264px 0px 0px 84px;
}
.card .image-wrapper .card-title .card-starting-from {
margin: 241px 0px 0px 62px;
}
.card .image-wrapper .card-title .price-from {
margin: 241px 0px 0px 176px;
}
}
......@@ -4299,23 +4458,65 @@ footer.footer [ng-cloak] {
and (device-width : 414px)
and (device-height : 736px)
and (-webkit-device-pixel-ratio : 3) {
.card .card-ribbon {
.card .card-ribbon- {
width: 63%;
}
.card .card-ribbon-from {
.card .card-ribbon--from- {
width: 66%;
}
}
/*
Only iPhone 4/4S (both: landscape and portrait) */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2/3)
.card .card-rating {
margin: 190px 0px 0px 93px;
}
.card .image-wrapper .card-title .price {
margin: 186px 0px 0px 185px;
}
.card .image-wrapper .card-title .card-starting-vo {
margin: 298px 0px 0px 84px;
}
.card .image-wrapper .card-title .price-vo {
margin: 298px 0px 0px 204px;
}
.card .image-wrapper .card-title .price-from {
margin: 241px 0px 0px 175px;
}
.card .image-wrapper .card-title .card-starting-from {
margin: 241px 0px 0px 76px;
}
}
/*Only iPhone 4/4S (both: landscape and portrait) */
@media only screen and (min-device-width: 320px) and
(max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2/3)
{
.card .card-ribbon-from {
.card .card-ribbon--from- {
width: 87%;
}
.card .image-wrapper .card-title .card-starting-vo {
margin: 219px 0px 0px 55px;
}
.card .image-wrapper .card-title .price-vo {
margin: 216px 0px 0px 138px;
}
.card .card-rating {
margin: 138px 0px 0px 46px;
}
.card .image-wrapper .card-title .price {
margin: 135px 0px 0px 137px;
}
}
......@@ -4333,4 +4534,63 @@ footer.footer [ng-cloak] {
.contact-box .label-login{
color: white;
}
.rooms-result{
border: 2px solid #eeeeee;
border-radius: 21px;
background: #eeeeee;
padding: 22px;
padding-bottom: 47px;
}
.change-search{
font-size: 13px;
width: 160px!important;
padding: 3px!important;
float: right;
}
/* galaxy s5*/
@media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) {
.card .image-wrapper .card-title .price {
margin: 156px 0px 0px 160px;
}
.card .card-rating {
margin: 162px 0px 0px 52px;
}
.card .image-wrapper .card-title .price-vo {
margin: 249px 0px 0px 155px;
}
.card .image-wrapper .card-title .card-starting-vo {
margin: 250px 0px 0px 65px;
}
.card .image-wrapper .card-title .price-from {
margin: 241px 0px 0px 159px;
}
.card .image-wrapper .card-title .card-starting-from {
margin: 241px 0px 0px 60px;
}
}
.card-agence{
border: 1px solid #eeeeee;
border-radius: 9px;
background: #eeeeee;
padding: 15px 15px 15px 15px;
margin-bottom: 15px;
}
.card-agence .agence{
border-radius: 9px;
margin-top: 21px;
margin-bottom: 15px;
}
\ No newline at end of file
......@@ -4,36 +4,45 @@
angular.module('tour-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('sightseeing-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('vo-sales', [
'ui.router',
'tours',
'ui.bootstrap',
'htmlToPdfSave',
'updateMeta'
'updateMeta',
'daterangepicker'
]);
angular.module('cruise-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('clubmed-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('omra-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('tours', [
'ui.bootstrap',
'daterangepicker'
]);
angular.module('tours', ['ui.bootstrap']);
// Source: src/html/scripts/tour-sales/controllers/search-form.js
angular.module('tours').controller('tours_SearchFormCtrl', [
'$scope',
......
......@@ -4,36 +4,45 @@
angular.module('tour-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('sightseeing-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('vo-sales', [
'ui.router',
'tours',
'ui.bootstrap',
'htmlToPdfSave',
'updateMeta'
'updateMeta',
'daterangepicker'
]);
angular.module('cruise-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('clubmed-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('omra-sales', [
'ui.router',
'tours',
'ui.bootstrap'
'ui.bootstrap',
'daterangepicker'
]);
angular.module('tours', [
'ui.bootstrap',
'daterangepicker'
]);
angular.module('tours', ['ui.bootstrap']);
// Source: src/html/scripts/tour-sales/states.js
angular.module('tours').config([
'$sceProvider',
......@@ -1416,6 +1425,60 @@
$scope.error = data;
}
}
// simple date picker
$scope.singleDatePicker = {
picker: null,
options: {
singleDatePicker: true,
pickerClasses: 'custom-display',
buttonClasses: 'btn',
applyButtonClasses: 'btn-primary',
cancelButtonClasses: 'btn-danger',
minDate: moment(),
locale: {
applyLabel: 'valider',
cancelLabel: 'annuler',
customRangeLabel: 'Custom range',
separator: ' - ',
format: 'DD/MM/YYYY',
weekLabel: 'S',
daysOfWeek: [
'Di',
'Lu',
'Ma',
'Me',
'Je',
'Ve',
'Sa'
],
monthNames: [
'Janvier',
'F\xe9vrier',
'Mars',
'Avril',
'Mai',
'Juin',
'Juillet',
'Ao\xfbt',
'Septembre',
'Octobre',
'Novembre',
'Decembre'
],
'firstDay': 1
},
eventHandlers: {
'apply.daterangepicker': function (event, picker) {
$scope.query.from = $scope.singleDatePicker.date;
}
}
}
};
if ($scope.query !== undefined && $stateParams.from) {
$scope.singleDatePicker.date = $stateParams.from;
} else {
$scope.singleDatePicker.date = moment();
}
}
]);
;
......
!function(){"use strict";angular.module("avi-contact",[]),angular.module("avi-card",[]),angular.module("avi-card").controller("CardCallFormCtrl",["$scope","$http","$log",function(a,b,c){function d(){a.options.agences=f.filter(function(b){return b.city==a.contact.agency.city.code})}function e(){b({method:"POST",url:"/card-requests",data:angular.extend(a.contact,{status:"opened",comment:"",_perms:{r:["*"],w:["*"],d:["g:admin"]}})}).success(function(b){a.state="success"}).error(function(){a.state="error"})}var f=[{email:"casa44far@atlasvoyages.com",name:"CASA 44",code:"CASA44",address:"44, avenue de l’Armée Royale, Centre Ville, CASABLANCA",city:"CASABLANCA"},{email:"casatwincenter@atlasvoyages.com",name:"CASA TWIN CENTER",code:"CASATWINCENTER",address:"191 bd Mohamed Zerktouni Twin Center n°157 porte Maârif. Maarif 20330 CASABLANCA",city:"CASABLANCA"},{email:"casatechnopark@atlasvoyages.com",name:"CASA Technopark",code:"CASATechnopark",address:"Technopark rez de chaussée, Room 167/168 Sidi maarouf, CASABLANCA",city:"CASABLANCA"},{email:"casaanfaplace@atlasvoyages.com",name:"Anfa Place",code:"AnfaPlace",address:"S3 Centre Commercial Anfa Place, Bd La Corniche. CASABLANCA",city:"CASABLANCA"},{email:"casa150far@atlasvoyages.com",name:"CASA 150",code:"CASA150",address:"150, avenue des FAR Centre Ville, CASABLANCA",city:"CASABLANCA"},{email:"rabatagdal@atlasvoyages.com",name:"RABAT AGDAL",code:"RABATAGDAL",address:"59, avenue Ibnou Sina Appt n°1 Agdal, Rabat",city:"RABAT"},{email:"rabathayryad@atlasvoyages.com",name:"RABAT RYAD",code:"RABATRYAD",address:"Mahaj ryad n°22 - Hay Riad Rabat",city:"RABAT"},{email:"rabatlabelgallery@atlasvoyages.com",name:"Label Gallery",code:"LabelGallery",address:"Galerie commerciale « Label Gallery », Souissi, Route des Zaers, 3,5 km, rez de chaussée, local n° 16 Rabat",city:"RABAT"},{email:"fescentre@atlasvoyages.com",name:"Fès center",code:"Fescenter",address:"15 rue Bouchaib Doukkali. Fès",city:"FES"},{email:"fesborj@atlasvoyages.com",name:"Borj Fès",code:"BorjFes",address:"Centre Commercial Borj Fès. Fès",city:"FES"},{email:"tangerville@atlasvoyages.com",name:"Tanger Ville",code:"TangerVille",address:"N° 6 rés Camilia, Rue ibn Taymiya. Tanger",city:"TANGER"},{email:"tangersoccoalto@atlasvoyages.com",name:"Socco Alto",code:"SoccoAlto",address:"Centre commercial « Socco Alto », sis au quartier Californie, angle Rues Boubana et Banafsaj, rez de chaussée bas, local n° R34 Tanger",city:"TANGER"},{email:"oujda@atlasvoyages.com",name:"Oujda",code:"Oujda",address:"21 Bis Rue Melillia - oujda",city:"OUJDA"},{email:"agadir@atlasvoyages.com",name:"Agadir",code:"Agadir",address:"Immeuble Sud Bahia Avenue Hassan II. Agadir",city:"AGADIR"},{email:"marrakech@atlasvoyages.com",name:"Marrakech",code:"Marrakech",address:"131, bd. Mohammed V 40000, Marrakech",city:"MARRAKECH"},{email:"meknes@atlasvoyages.com",name:"Meknès",code:"Meknes",address:"Rue Abou Ali Ben Rahal, Meknès",city:"MEKNES"},{email:"kenitra@atlasvoyages.com",name:"Kénitra",code:"Kenitra",address:"352, Bd Mohamed V – Résidence Palace - rez de chaussée",city:"KENITRA"}];angular.extend(a,{contact:{agency:{infos:{},city:{}}},state:"form",save:e,onCityChanged:d,options:{cities:[{code:"CASABLANCA",name:"CASABLANCA"},{code:"MARRAKECH",name:"MARRAKECH"},{code:"RABAT",name:"RABAT"},{code:"FES",name:"FÉS"},{code:"AGADIR",name:"AGADIR"},{code:"TANGER",name:"TANGER"},{code:"OUJDA",name:"OUJDA"},{code:"KENITRA",name:"KÉNITRA"},{code:"MEKNES",name:"MEKNÈS"}],agences:f}})}]),angular.module("avi-contact").controller("RequestCallFormCtrl",["$scope","$http","$log",function(a,b,c){function d(){c.debug("RequestCallFormCtrl: contact-requests onAdd"),b({method:"POST",url:"/contact-requests",data:angular.extend(a.contact,{status:"opened",_perms:{r:["*"],w:["*"],d:["g:admin"]}})}).success(function(b){a.state="success"}).error(function(){a.state="error"})}c.debug("RequestCallFormCtrl: init"),angular.extend(a,{contact:{agency:{infos:{},city:{}}},state:"form",save:d,options:{markets:["FRENCH","ENGLISH","DUTCH","OTHER"]}})}])}();
\ No newline at end of file
!function(){"use strict";angular.module("avi-contact",[]),angular.module("avi-card",[]),angular.module("avi-tombola",[]),angular.module("avi-card").controller("CardCallFormCtrl",["$scope","$http","$log",function(a,b,c){function d(){a.options.agences=f.filter(function(b){return b.city==a.contact.agency.city.code})}function e(){b({method:"POST",url:"/card-requests",data:angular.extend(a.contact,{status:"opened",comment:"",_perms:{r:["*"],w:["*"],d:["g:admin"]}})}).success(function(b){a.state="success"}).error(function(){a.state="error"})}var f=[{email:"casa44far@atlasvoyages.com",name:"CASA 44",code:"CASA44",address:"44, avenue de l’Armée Royale, Centre Ville, CASABLANCA",city:"CASABLANCA"},{email:"casatwincenter@atlasvoyages.com",name:"CASA TWIN CENTER",code:"CASATWINCENTER",address:"191 bd Mohamed Zerktouni Twin Center n°157 porte Maârif. Maarif 20330 CASABLANCA",city:"CASABLANCA"},{email:"casatechnopark@atlasvoyages.com",name:"CASA Technopark",code:"CASATechnopark",address:"Technopark rez de chaussée, Room 167/168 Sidi maarouf, CASABLANCA",city:"CASABLANCA"},{email:"casaanfaplace@atlasvoyages.com",name:"Anfa Place",code:"AnfaPlace",address:"S3 Centre Commercial Anfa Place, Bd La Corniche. CASABLANCA",city:"CASABLANCA"},{email:"casa150far@atlasvoyages.com",name:"CASA 150",code:"CASA150",address:"150, avenue des FAR Centre Ville, CASABLANCA",city:"CASABLANCA"},{email:"rabatagdal@atlasvoyages.com",name:"RABAT AGDAL",code:"RABATAGDAL",address:"59, avenue Ibnou Sina Appt n°1 Agdal, Rabat",city:"RABAT"},{email:"rabathayryad@atlasvoyages.com",name:"RABAT RYAD",code:"RABATRYAD",address:"Mahaj ryad n°22 - Hay Riad Rabat",city:"RABAT"},{email:"rabatlabelgallery@atlasvoyages.com",name:"Label Gallery",code:"LabelGallery",address:"Galerie commerciale « Label Gallery », Souissi, Route des Zaers, 3,5 km, rez de chaussée, local n° 16 Rabat",city:"RABAT"},{email:"fescentre@atlasvoyages.com",name:"Fès center",code:"Fescenter",address:"15 rue Bouchaib Doukkali. Fès",city:"FES"},{email:"fesborj@atlasvoyages.com",name:"Borj Fès",code:"BorjFes",address:"Centre Commercial Borj Fès. Fès",city:"FES"},{email:"tangerville@atlasvoyages.com",name:"Tanger Ville",code:"TangerVille",address:"N° 6 rés Camilia, Rue ibn Taymiya. Tanger",city:"TANGER"},{email:"tangersoccoalto@atlasvoyages.com",name:"Socco Alto",code:"SoccoAlto",address:"Centre commercial « Socco Alto », sis au quartier Californie, angle Rues Boubana et Banafsaj, rez de chaussée bas, local n° R34 Tanger",city:"TANGER"},{email:"oujda@atlasvoyages.com",name:"Oujda",code:"Oujda",address:"21 Bis Rue Melillia - oujda",city:"OUJDA"},{email:"agadir@atlasvoyages.com",name:"Agadir",code:"Agadir",address:"Immeuble Sud Bahia Avenue Hassan II. Agadir",city:"AGADIR"},{email:"marrakech@atlasvoyages.com",name:"Marrakech",code:"Marrakech",address:"131, bd. Mohammed V 40000, Marrakech",city:"MARRAKECH"},{email:"meknes@atlasvoyages.com",name:"Meknès",code:"Meknes",address:"Rue Abou Ali Ben Rahal, Meknès",city:"MEKNES"},{email:"kenitra@atlasvoyages.com",name:"Kénitra",code:"Kenitra",address:"352, Bd Mohamed V – Résidence Palace - rez de chaussée",city:"KENITRA"}];angular.extend(a,{contact:{agency:{infos:{},city:{}}},state:"form",save:e,onCityChanged:d,options:{cities:[{code:"CASABLANCA",name:"CASABLANCA"},{code:"MARRAKECH",name:"MARRAKECH"},{code:"RABAT",name:"RABAT"},{code:"FES",name:"FÉS"},{code:"AGADIR",name:"AGADIR"},{code:"TANGER",name:"TANGER"},{code:"OUJDA",name:"OUJDA"},{code:"KENITRA",name:"KÉNITRA"},{code:"MEKNES",name:"MEKNÈS"}],agences:f}})}]),angular.module("avi-contact").controller("RequestCallFormCtrl",["$scope","$http","$log",function(a,b,c){function d(){c.debug("RequestCallFormCtrl: contact-requests onAdd"),b({method:"POST",url:"/contact-requests",data:angular.extend(a.contact,{status:"opened",_perms:{r:["*"],w:["*"],d:["g:admin"]}})}).success(function(b){a.state="success"}).error(function(){a.state="error"})}c.debug("RequestCallFormCtrl: init"),angular.extend(a,{contact:{agency:{infos:{},city:{}}},state:"form",save:d,options:{markets:["FRENCH","ENGLISH","DUTCH","OTHER"]}})}]),angular.module("avi-tombola").controller("TombolaCallFormCtrl",["$scope","$http","$log",function(a,b,c){function d(){console.log(a.contact),b({method:"POST",url:"/tombola-requests",data:angular.extend(a.contact,{_perms:{r:["*"],w:["*"],d:["g:admin"]}})}).success(function(b){a.state="success"}).error(function(){a.state="error"})}angular.extend(a,{state:"form",save:d,options:{civilities:[{code:"M",name:"Monsieur"},{code:"Mme",name:"Madame"}]}})}])}();
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
(function () {
'use strict';
// Source: src/html/scripts/air-sales/air-form.js
angular.module("air", ["ui.bootstrap", "ui.select", "ui.bootstrap.datepicker"]);
// Source: src/html/scripts/air-sales/config/datepicker.js
angular
.module('air')
.config(function (datepickerConfig, datepickerPopupConfig) {
datepickerConfig.showWeeks = false;
datepickerConfig.dayFormat = 'd';
datepickerConfig.startingDay = 1;
datepickerConfig.minDate = new Date();
datepickerConfig.maxDate = moment().add(18, 'months').toDate();
datepickerConfig.maxMode = 'month';
datepickerPopupConfig.toggleWeeksText = null;
datepickerPopupConfig.showButtonBar = false;
});
// Source: src/html/scripts/air-sales/services/query-parser.js
angular
.module('air')
.factory('airQueryCodec',
/**
* @ngdoc service
* @name air.airQueryCodec
* @memberOf ftl.air
*
* @requires $rootScope
*
* @description
* convert air queries from/to stateParmas, and to api Query
*/
function($http, settings, $log) {
var knownFlags = [
'nonstop',
'direct',
// No advance purchase fares
'nap',
// No penalties fares
'npe',
// No restriction fares
'nr',
// Refundable fares
'rf',
'flexible'
];
var MOMENT_DATE_ISO = 'YYYY-MM-DD';
var ROUND_TRIP = 2;
var ONE_WAY = 1;
var MULTI_SEGMENTS = 3;
// regexFlight = /^[A-Z]{3},[A-Z]{3},\d{4}-\d{2}-\d{2}$/,
// this regex stinks
// regexTravellers = /^\d,\d?\d(,\d?\d){0,5}$/;
return {
ROUND_TRIP: ROUND_TRIP,
ONE_WAY: ONE_WAY,
MULTI_SEGMENTS: MULTI_SEGMENTS,
knownFlags: knownFlags,
newQuery: newQuery,
fromStateParams: function(encoded) {
//console.log('rrrr', encoded);
if (!encoded.flight) {
return null;
}
var iataCodes = {};
var decoded = newQuery();
//console.log('rrrr', decoded);
// segments
if (!angular.isArray(encoded.flight)) {
encoded.flight = [encoded.flight];
}
decoded.segments = encoded.flight.map(function(flight) {
// TO_DO validate regexFlight
var bits = flight.split(',');
if (!iataCodes[bits[0]]) {
iataCodes[bits[0]] = { code: bits[0], name: bits[0] };
}
if (!iataCodes[bits[1]]) {
iataCodes[bits[1]] = { code: bits[1], name: bits[0] };
}
return {
from: iataCodes[bits[0]],
to: iataCodes[bits[1]],
date: bits[2]
};
});
// linking tripType t segmentLength is a bad idea.
// ex: this bugs if its a departure open jaw.
decoded.tripType = Math.min(3, decoded.segments.length);
// thus...
if (decoded.tripType === 2 && decoded.segments[0].from !== decoded.segments[1].to) {
decoded.tripType = 3;
}
// travellers
encoded.travellers = encoded.travellers || '1';
var travellers = encoded.travellers.split(',');
decoded.adults = parseInt(travellers.shift(), 10) || 1;
console.log('travellers', travellers);
decoded.ages = travellers
.map(function(a) {
return {
v: parseInt(a, 10)
};
})
.filter(function(c) {
return c.v >= 0;
});
decoded.children = decoded.ages.length;
// flags
if (encoded.flags) {
encoded.flags
.split(',')
.filter(function(value) {
return knownFlags.indexOf(value) > -1;
})
.reduce(function(target, flag) {
target.flags[flag] = true;
return target;
}, decoded);
}
decoded.cabin = encoded.cabin || '-';
decoded.corpid = encoded.corpid;
// TODO allow multiple airlines
if (encoded.airlines) {
var pair = encoded.airlines.split('_');
decoded.preferredAirline = { code: pair[0], name: pair[1] };
}
return $http.get(settings.air.airportsResolve.replace(':codes', Object.keys(iataCodes).join(',')))
.then(function(res) {
angular.forEach(res.data, function(item) {
angular.extend(iataCodes[item.code], item);
});
$log.debug('decoded query', decoded);
return decoded;
}, function() {
// error just return without resolved names
return decoded;
});
},
toApi: function(query) {
var cabin = query.cabin || '-';
var out = '';
var carriers = query.preferredAirline ? query.preferredAirline.code : 'YY';
// ?itinerary=YY..CMNPAR20140619-&itinerary=YY..PARCMN20140628-&flags=direct,flexDates&travellers=2,1,4
// exclude VYTB
angular.forEach(query.segments, function(segment) {
out += '&itinerary=' + carriers + '..' + segment.from.code + segment.to.code + moment(segment.date).format('YYYYMMDD') + cabin;
});
// Convert travellers.
var travellers = query.ages.map(function(age) {
return age.v;
});
travellers.unshift(query.adults);
out += '&travellers=' + travellers.join(',');
var flags = Object.keys(query.flags)
.filter(function(flag) {
return query.flags[flag] && knownFlags.indexOf(flag) > -1;
}).join(',');
if (['M', 'C', 'F'].indexOf(query.cabin) > -1) {
out += '&cabin=' + query.cabin;
}
if (flags) {
out += '&flags=' + flags;
}
if (query.corpid) {
out += '&corpid=' + query.corpid;
}
return out;
},
toStateParams: function(decoded) {
var encoded = [];
console.log('aaaa', decoded);
//
// Segments
//
// make sure rountd trip data is set
if (decoded.tripType === ROUND_TRIP) {
decoded.segments[1].from = decoded.segments[0].to;
decoded.segments[1].to = decoded.segments[0].from;
// make sure other segments are cut;
decoded.segments.length = 2;
}
// make sure first flight
if (decoded.tripType === ONE_WAY) {
decoded.segments.length = 1;
}
// make sure we cuttof garbage.
// decoded.segments.length = Math.min(decoded.tripType, decoded.segments.length);
angular.forEach(decoded.segments, function(segment) {
encoded.push('flight=' +
segment.from.code + ',' +
segment.to.code + ',' +
moment(segment.date).format(MOMENT_DATE_ISO));
});
//
// Travellers
//
var travellers = (decoded.ages || []).map(function(a) {
return a.v;
});
// add adults in i=0
travellers.unshift(decoded.adults);
encoded.push('travellers=' + travellers.join(','));
//
// Cabin
//
if (decoded.cabin) {
encoded.push('&cabin=' + decoded.cabin);
}
if (decoded.preferredAirline) {
encoded.push('&airlines=' + decoded.preferredAirline.code + '_' + decoded.preferredAirline.name);
}
if (decoded.corpid) {
encoded.push('&corpid=' + decoded.corpid);
}
//
// Flags
//
// console.log('toStateParams flags',decoded.flags);
var flags = knownFlags.filter(function(flag) {
// console.log('toStateParams flag ',flag,decoded.flags[flag]);
// return true if query.flags[flag] === true
return decoded.flags[flag];
}).join(',');
if (flags) {
encoded.push('flags=' + flags);
}
$log.debug('toStateParams', decoded, encoded);
return encoded.join('&');
}
};
function newQuery() {
return {
tripType: ROUND_TRIP,
segments: [],
adults: 1,
children: 0,
ages: [],
cabin: '-',
corpid: '',
flags: knownFlags.reduce(function(reduced, value) {
reduced[value] = false;
return reduced;
}, {})
};
}
});
// Source: src/html/scripts/air-sales/controllers/search-form.js
angular
.module("air")
.controller("air_SearchFormCtrl", function (
$scope,
settings,
$window,
$http,
$log,
airQueryCodec,
$sce, $document
) {
$log.info("air_SearchFormCtrl:airQueryCodec", $scope.query);
var options = {
minDeparture: moment()
.startOf("day")
.toDate(),
maxDeparture: moment()
.add(1, "years")
.toDate(),
maxAdults: 9,
maxChildren: 9,
maxPax: 9,
adults: [1, 2, 3, 4, 5, 6, 7, 8, 9],
children: [0, 1, 2, 3, 4, 5, 7, 8, 9],
ages: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
tripTypes: [{
code: 1,
label: "Direct flight"
}, {
code: 2,
label: "Round trip"
}, {
"code": 3,
"label": "Multi-segments/open-jaw"
}]
};
/** new form with range date picker configuration */
$scope.date1 = "";
$scope.date2 = "";
$scope.roomDiv = false;
$scope.roomInput = "Adultes - Enfant ...";
function rangePickerChange() {
//console.log('-------- date simple format ------', $scope.date1);
var date2 = $scope.date1.split('--');
$scope.query.segments[0].date = convertDate(date2["0"]);
$scope.query.segments[1].date = convertDate(date2["1"]);
console.log(' in range picker fubnction ', $scope.query);
};
function simplePickerChange() {
//console.log('-------- date simple format ------', $scope.date2);
$scope.query.segments[0].date = convertDate($scope.date2);
console.log(' in range picker fubnction ', $scope.query);
};
function roomChange() {
var adulteCount = 0;
$scope.roomInput = "Adultes " + $scope.query.adults + " ,Enfant " + $scope.query.children;
$scope.roomDiv = $scope.roomDiv ? false : true;
//console.log("&&&&&&&&&&&&&&============================================ rooms", $scope.roomInput);
}
$document.bind('click', function (event) {
if (event.target.id !== "inputDivRooms" && event.target.className !== "guests__inputs divRooms ng-scope" && $scope.roomDiv === true && !event.target.classList.contains("divRoomsInputs") && !event.target.nextSibling.classList.contains("divRoomsInputs")) {
//console.log("&event ", event, event.target.id, event.target.className, $scope.roomDiv);
$scope.roomDiv = $scope.roomDiv ? false : true;
$scope.$apply();
}
});
function convertDate(date) {
var splitDate = date.split('/');
var convertedDate = new Date(splitDate[2], splitDate[1] - 1, splitDate[0]);
return convertedDate.toLocaleDateString("en-US");
}
/** end of --------new form with range date picker configuration */
//
// , {
// "code": 3,
// "label": "Multi-segments/open-jaw"
// }
var calendars = {};
var query;
//
if ($scope.query && !settings.air.standaloneSearchForm) {
query = angular.copy($scope.query);
console.log("------- query if existe with setting air -----", query);
}
// else if ($scope.query) {
// query = angular.copy($scope.query);
// console.log("------- query if existe only -----", query);
// }
else {
query = airQueryCodec.newQuery();
query.tripType = 0;
setSegmentCount(2);
console.log("------- query if not existe -----", query);
}
$scope.$watch("query.children", function (fresh, old) {
if (fresh !== old) {
while (query.ages.length < fresh) {
query.ages.push({});
}
while (query.ages.length > fresh) {
query.ages.pop();
}
}
});
if (!query.tripType) setSegmentCount(2);
angular.extend($scope, {
airports: [],
airlines: [],
query: query,
calendars: calendars,
setTripType: setSegmentCount,
addSegment: addSegment,
removeSegment: removeSegment,
toggleCalendar: toggleCalendar,
searchAirports: searchAirports,
searchAirlines: searchAirlines,
search: doSearch,
dateChanged: dateChanged,
maxSegments: 6,
options: options,
// HACK for ui-select wich renders html from different origin (cdnjs/apollo)
trustAsHtml: $sce.trustAsHtml,
simplePickerChange: simplePickerChange,
rangePickerChange: rangePickerChange,
roomChange: roomChange
});
/*
* @ngdoc method
* @name air_SearchFormCtrl#setSegmentCount
* @memberOf ftl.air
*
*
* @description
* updates segment array in query
*/
function setSegmentCount(tripType) {
var newCount = tripType;
if (newCount === query.tripType) return;
var segments = query.segments;
var previous,
i = 0;
// initial state
console.log("---- length setSegmentCount ----", query);
if (query.segments.length === 0) {
segments.push({
options: {
minDate: options.minDeparture,
minMonth: moment(options.minDeparture).startOf("month"),
initDate: "query.segments[0].options.minMonth"
}
});
}
i = segments.length;
while (segments.length < newCount) {
previous = query.segments[segments.length - 1];
segments.push({
from: previous.to,
options: {
minDate: previous.date ? previous.date : previous.minDate,
minMonth: previous.date ? moment(previous.date).startOf("month") : previous.minMonth,
initDate: "query.segments[" + i + "].options.minMonth"
}
});
i++;
}
if (newCount === 2) {
segments[1].from = segments[0].to;
segments[1].to = segments[0].from;
}
query.tripType = newCount;
}
function addSegment() {
var i = query.segments.length;
if (i >= 6) {
return;
}
var previous = query.segments[i - 1];
query.segments.push({
from: previous.to,
options: {
minDate: previous.date ? previous.date : previous.minDate,
minMonth: previous.date ? moment(previous.date).startOf("month") : previous.minMonth,
initDate: "query.segments[" + i + "].options.minMonth"
}
});
}
function removeSegment(segment) {
var index = query.segments.indexOf(segment);
if (index > -1) {
query.segments.splice(index, 1);
}
}
function searchAirports(val) {
$scope.airports = [];
if (val.length < 1) {
return [];
}
return $http
.get(settings.air.airportsSearch.replace(":term", val))
.then(function (res) {
$scope.airports = res.data || [];
return $scope.airports;
});
}
function searchAirlines(val) {
$scope.airlines = [];
if (val.length < 1) {
return [];
}
return $http
.get(settings.air.airlinesSearch.replace(":term", val))
.then(function (res) {
$scope.airlines = res.data || [];
return $scope.airlines;
});
}
function toggleCalendar($event, cal) {
var key = "cal" + cal;
var old = calendars[key];
for (var k in calendars) {
calendars[k] = false;
}
calendars[key] = !old;
}
function doSearch() {
// make sure last point === first
if (query.tripType === airQueryCodec.ROUND_TRIP) {
query.segments[1].from = query.segments[0].to;
query.segments[1].to = query.segments[0].from;
}
var qs = airQueryCodec.toStateParams(query);
if (settings.air && settings.air.standaloneSearchForm) {
$window.location.href = settings.air.salesApp + "?" + qs;
} else {
$window.location.href = settings.links.search + "?" + qs;
}
}
/**
* watching date changes to update next segment's min departure date
*/
function dateChanged(index) {
var segments = query.segments,
segment,
len = query.segments.length,
minDate,
initDate;
if (!segments[index]) return;
minDate = query.segments[index].date;
initDate = moment(minDate)
.startOf("month")
.toDate();
index++;
while (index < len) {
segment = segments[index];
segment.options = segments.options || {
initDate: "$parent.$parent.options.minMonth"
};
segment.options.minDate = minDate;
segment.options.minMonth = moment(minDate)
.startOf("month")
.toDate();
if (segment.date && moment(segment.date).isBefore(minDate)) {
segment.date = minDate;
}
index++;
}
//console.log('dateChanged', index);
}
});
}());
\ No newline at end of file
!function(){"use strict";angular.module("air",["ui.bootstrap","ui.select","ui.bootstrap.datepicker","daterangepicker"]),angular.module("air").config(["datepickerConfig","datepickerPopupConfig",function(a,b){a.showWeeks=!1,a.dayFormat="d",a.startingDay=1,a.minDate=new Date,a.maxDate=moment().add(18,"months").toDate(),a.maxMode="month",b.toggleWeeksText=null,b.showButtonBar=!1}]),angular.module("air").factory("airQueryCodec",["$http","settings","$log",function(a,b,c){function d(){return{tripType:f,segments:[],adults:1,children:0,ages:[],cabin:"-",corpid:"",flags:e.reduce(function(a,b){return a[b]=!1,a},{})}}var e=["nonstop","direct","nap","npe","nr","rf","flexible"],f=2,g=1;return{ROUND_TRIP:f,ONE_WAY:g,MULTI_SEGMENTS:3,knownFlags:e,newQuery:d,fromStateParams:function(f){if(!f.flight)return null;var g={},h=d();angular.isArray(f.flight)||(f.flight=[f.flight]),h.segments=f.flight.map(function(a){var b=a.split(",");return g[b[0]]||(g[b[0]]={code:b[0],name:b[0]}),g[b[1]]||(g[b[1]]={code:b[1],name:b[0]}),{from:g[b[0]],to:g[b[1]],date:b[2]}}),h.tripType=Math.min(3,h.segments.length),2===h.tripType&&h.segments[0].from!==h.segments[1].to&&(h.tripType=3),f.travellers=f.travellers||"1";var i=f.travellers.split(",");if(h.adults=parseInt(i.shift(),10)||1,console.log("travellers",i),h.ages=i.map(function(a){return{v:parseInt(a,10)}}).filter(function(a){return a.v>=0}),h.children=h.ages.length,f.flags&&f.flags.split(",").filter(function(a){return e.indexOf(a)>-1}).reduce(function(a,b){return a.flags[b]=!0,a},h),h.cabin=f.cabin||"-",h.corpid=f.corpid,f.airlines){var j=f.airlines.split("_");h.preferredAirline={code:j[0],name:j[1]}}return a.get(b.air.airportsResolve.replace(":codes",Object.keys(g).join(","))).then(function(a){return angular.forEach(a.data,function(a){angular.extend(g[a.code],a)}),c.debug("decoded query",h),h},function(){return h})},toApi:function(a){var b=a.cabin||"-",c="",d=a.preferredAirline?a.preferredAirline.code:"YY";angular.forEach(a.segments,function(a){c+="&itinerary="+d+".."+a.from.code+a.to.code+moment(a.date).format("YYYYMMDD")+b});var f=a.ages.map(function(a){return a.v});f.unshift(a.adults),c+="&travellers="+f.join(",");var g=Object.keys(a.flags).filter(function(b){return a.flags[b]&&e.indexOf(b)>-1}).join(",");return["M","C","F"].indexOf(a.cabin)>-1&&(c+="&cabin="+a.cabin),g&&(c+="&flags="+g),a.corpid&&(c+="&corpid="+a.corpid),c},toStateParams:function(a){var b=[];console.log("aaaa",a),a.tripType===f&&(a.segments[1].from=a.segments[0].to,a.segments[1].to=a.segments[0].from,a.segments.length=2),a.tripType===g&&(a.segments.length=1),angular.forEach(a.segments,function(a){b.push("flight="+a.from.code+","+a.to.code+","+moment(a.date).format("YYYY-MM-DD"))});var d=(a.ages||[]).map(function(a){return a.v});d.unshift(a.adults),b.push("travellers="+d.join(",")),a.cabin&&b.push("&cabin="+a.cabin),a.preferredAirline&&b.push("&airlines="+a.preferredAirline.code+"_"+a.preferredAirline.name),a.corpid&&b.push("&corpid="+a.corpid);var h=e.filter(function(b){return a.flags[b]}).join(",");return h&&b.push("flags="+h),c.debug("toStateParams",a,b),b.join("&")}}}]),angular.module("air").controller("air_SearchFormCtrl",["$scope","settings","$window","$http","$log","airQueryCodec","$sce","$document",function(a,b,c,d,e,f,g,h){function i(){a.roomInput="Adultes "+a.query.adults+" ,Enfant "+a.query.children,a.roomDiv=!a.roomDiv}function j(a){var b=a;if(b!==s.tripType){var c,d=s.segments,e=0;for(console.log("---- length setSegmentCount ----",s),0===s.segments.length&&d.push({options:{minDate:r.minDeparture,minMonth:moment(r.minDeparture).startOf("month"),initDate:"query.segments[0].options.minMonth"}}),e=d.length;d.length<b;)c=s.segments[d.length-1],d.push({from:c.to,options:{minDate:c.date?c.date:c.minDate,minMonth:c.date?moment(c.date).startOf("month"):c.minMonth,initDate:"query.segments["+e+"].options.minMonth"}}),e++;2===b&&(d[1].from=d[0].to,d[1].to=d[0].from),s.tripType=b}}function k(){var a=s.segments.length;if(!(a>=6)){var b=s.segments[a-1];s.segments.push({from:b.to,options:{minDate:b.date?b.date:b.minDate,minMonth:b.date?moment(b.date).startOf("month"):b.minMonth,initDate:"query.segments["+a+"].options.minMonth"}})}}function l(a){var b=s.segments.indexOf(a);b>-1&&s.segments.splice(b,1)}function m(c){return a.airports=[],c.length<1?[]:d.get(b.air.airportsSearch.replace(":term",c)).then(function(b){return a.airports=b.data||[],a.airports})}function n(c){return a.airlines=[],c.length<1?[]:d.get(b.air.airlinesSearch.replace(":term",c)).then(function(b){return a.airlines=b.data||[],a.airlines})}function o(a,b){var c="cal"+b,d=t[c];for(var e in t)t[e]=!1;t[c]=!d}function p(){s.tripType===f.ROUND_TRIP&&(s.segments[1].from=s.segments[0].to,s.segments[1].to=s.segments[0].from);var a=f.toStateParams(s);b.air&&b.air.standaloneSearchForm?c.location.href=b.air.salesApp+"?"+a:c.location.href=b.links.search+"?"+a}function q(a){var b,c,d=s.segments,e=s.segments.length;if(d[a])for(c=s.segments[a].date,moment(c).startOf("month").toDate(),a++;a<e;)b=d[a],b.options=d.options||{initDate:"$parent.$parent.options.minMonth"},b.options.minDate=c,b.options.minMonth=moment(c).startOf("month").toDate(),b.date&&moment(b.date).isBefore(c)&&(b.date=c),a++}e.info("air_SearchFormCtrl:airQueryCodec",a.query),a.rangeDatePicker={picker:null,options:{pickerClasses:"custom-display",buttonClasses:"btn",applyButtonClasses:"btn-primary",cancelButtonClasses:"btn-danger",minDate:moment(),locale:{applyLabel:"valider",cancelLabel:"annuler",customRangeLabel:"Custom range",separator:" - ",format:"DD/MM/YYYY",weekLabel:"S",daysOfWeek:["Di","Lu","Ma","Me","Je","Ve","Sa"],monthNames:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Decembre"],firstDay:1},eventHandlers:{"apply.daterangepicker":function(b,c){a.query.segments[0].date=a.rangeDatePicker.date.startDate,a.query.segments[1].date=a.rangeDatePicker.date.endDate}}}},void 0!==a.query&&2==a.query.tripType&&a.query.segments[0].date&&a.query.segments[1].date?a.rangeDatePicker.date={startDate:a.query.segments[0].date,endDate:a.query.segments[1].date}:a.rangeDatePicker.date={startDate:moment().subtract(1,"days"),endDate:moment()},a.singleDatePicker={picker:null,options:{singleDatePicker:!0,pickerClasses:"custom-display",buttonClasses:"btn",applyButtonClasses:"btn-primary",cancelButtonClasses:"btn-danger",minDate:moment(),locale:{applyLabel:"valider",cancelLabel:"annuler",customRangeLabel:"Custom range",separator:" - ",format:"DD/MM/YYYY",weekLabel:"S",daysOfWeek:["Di","Lu","Ma","Me","Je","Ve","Sa"],monthNames:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Decembre"],firstDay:1},eventHandlers:{"apply.daterangepicker":function(b,c){a.query.segments[0].date=a.singleDatePicker.date}}}},void 0!==a.query&&1==a.query.tripType&&a.query.segments[0].date?a.singleDatePicker.date=a.query.segments[0].date:a.singleDatePicker.date=moment();var r={minDeparture:moment().startOf("day").toDate(),maxDeparture:moment().add(1,"years").toDate(),maxAdults:9,maxChildren:9,maxPax:9,adults:[1,2,3,4,5,6,7,8,9],children:[0,1,2,3,4,5,7,8,9],ages:[0,1,2,3,4,5,6,7,8,9,10,11],tripTypes:[{code:1,label:"Direct flight"},{code:2,label:"Round trip"},{code:3,label:"Multi-segments/open-jaw"}]};a.roomDiv=!1,a.roomInput="Adultes - Enfant ...",h.bind("click",function(b){"inputDivRooms"===b.target.id||"guests__inputs divRooms ng-scope"===b.target.className||!0!==a.roomDiv||b.target.classList.contains("divRoomsInputs")||b.target.nextSibling.classList.contains("divRoomsInputs")||(a.roomDiv=!a.roomDiv,a.$apply())});var s,t={};a.query&&!b.air.standaloneSearchForm?(s=angular.copy(a.query),console.log("------- query if existe with setting air -----",s)):(s=f.newQuery(),s.tripType=0,j(2),console.log("------- query if not existe -----",s)),a.$watch("query.children",function(a,b){if(a!==b){for(;s.ages.length<a;)s.ages.push({});for(;s.ages.length>a;)s.ages.pop()}}),s.tripType||j(2),angular.extend(a,{airports:[],airlines:[],query:s,calendars:t,setTripType:j,addSegment:k,removeSegment:l,toggleCalendar:o,searchAirports:m,searchAirlines:n,search:p,dateChanged:q,maxSegments:6,options:r,trustAsHtml:g.trustAsHtml,roomChange:i})}])}();
\ No newline at end of file
!function(){"use strict";angular.module("lodge",["ui.bootstrap"]),angular.module("lodge").controller("lodge_SearchFormCtrl",["$scope","$http","$window","$location","$log","settings","lodgeQuery","$rootElement","$document",function(a,b,c,d,e,f,g,h,i){function j(){var b;a.date2&&(b=a.date2.split("--")),a.query&&(a.query.checkin=b[0],a.query.checkout=b[1])}function k(){var b;a.date1&&(b=a.date1.split("--")),a.query&&(a.query.checkin=m(b[0]),a.query.checkout=m(b[1]))}function l(b){var c=0;angular.forEach(a.query.rooms,function(a){c+=a.adults}),a.roomInput="chambres "+a.query.roomCount+" ,Adultes "+c+" ,Enfant "+a.query.childCount,a.roomDiv=!a.roomDiv}function m(a){var b=a.split("/");return new Date(b[2],b[1]-1,b[0]).toLocaleDateString("en-US")}function n(b,c){if(e.debug("roomCountUpdated",b,c),b!=c){for(var d=a.query.rooms;d.length<b;)d.push({adults:2,children:0,ages:[]});for(;d.length>b;)d.pop()}}function o(b){e.debug("childCountUpdated",b),console.log("---------","childCountUpdated",b,b.ages);var c=b.children,d=b.ages,f=d.length;for(a.query.childCount-=f;d.length<c;)d.push({});for(;d.length>c;)d.pop();a.query.childCount+=c}function p(a){return b.get(f.destinations.search.replace(":term",a)).then(function(a){return console.log(a),a.data})}function q(){var b=a.query;if(void 0!==b.destination){var e=g.toLocation(b);if(console.log("kdfjlkdjflkjdkfj",b,a),"search"===a.context){d.path("/recherche"+e.path);var h=d.search();h=angular.extend(h,e.search),d.search(e.search)}else{var i=[];angular.forEach(e.search,function(a,b){if("guests"==b)for(var c=0;c<e.search.guests.length;c++)i.push(b+"="+e.search.guests[c]);else i.push(b+"="+e.search[b])}),c.location.href=f.lodge.salesApp+"#!/recherche"+e.path+"?"+i.join("&")}}}function r(b,c){b.preventDefault(),b.stopPropagation(),a.toggleCalendars[c]=!a.toggleCalendars[c]}var s=moment().startOf("day"),t=angular.element(h.find("meta[name=description]")[0]);t.attr("content","hotel"),t.attr("charset","UTF-8");var u={adults:[1,2,3,4],children:[0,1,2,3,4],ages:[1,2,3,4,5,6,7,8,9,10,11],roomCount:[1,2,3,4,5,6],minCheckin:s.toDate(),maxCheckin:moment(s).add(12,"months").toDate(),checkin:{minDate:s.toDate(),minMonth:moment(s).startOf("month").toDate(),maxDate:moment(s).add(1,"years").toDate(),initDate:"options.checkin.minMonth"},checkout:{initDate:"options.checkout.minMonth"}};a.date1="",a.date2="",a.roomDiv=!1,a.roomInput="Chambre - Adultes ...",i.bind("click",function(b){"inputDivRooms"===b.target.id||"guests__inputs divRooms ng-scope"===b.target.className||!0!==a.roomDiv||b.target.classList.contains("divRoomsInputs")||b.target.nextSibling.classList.contains("divRoomsInputs")||(a.roomDiv=!a.roomDiv,a.$apply())}),u.checkout.minDate=moment(s).add(1,"days").toDate(),u.checkout.minMonth=moment(u.checkout.minDate).startOf("month").toDate(),u.checkout.initDate="options.checkout.minMonth",u.checkout.maxDate=moment(u.checkout.minDate).add(1,"years").toDate(),a.context,f.lodge.standaloneSearchForm&&(a.query={childCount:0,roomCount:1,rooms:[{adults:2,children:0,ages:[]}],rating:[]}),a.$watch("query.roomCount",n),angular.extend(a,{destinations:p,SimplePickerChange:k,roomChange:l,options:u,search:q,childCountUpdated:o,toggleCalendar:r,toggleCalendars:{},changesDateSearch:j}),e.debug("lodge_SearchFormCtrl: done")}]),angular.module("lodge").factory("lodgeQuery",["$q","$http","settings",function(a,b,c){function d(a){var b=a.split(","),c=parseInt(b.shift(),10),d=b.map(function(a){return{v:parseInt(a,10)}});return{adults:c,ages:d,children:d.length}}function e(e){angular.isArray(e.guests)||(e.guests=[e.guests]);for(var f,g=moment(e.from||"invalid","YYYY-MM-DD"),h=moment(e.to||"invalid","YYYY-MM-DD"),i=e.guests.slice(),j=e.country,k=e.destination,l={rooms:[],roomCount:0,childCount:0},m=a.defer();i[0];)f=d(i.shift()),l.rooms.push(f),l.childCount+=f.children;return l.roomCount=l.rooms.length,g.isValid()&&h.isValid()&&g.isBefore(h)?(l.checkin=g.toDate(),l.checkout=h.toDate()):(l.noDates=!0,l.checkin=moment().add(7,"days").toDate(),l.checkout=moment().add(8,"days").toDate()),e.propertyCode?(l.property=e.propertyCode,m.resolve(l),m.promise):(l.rating=[],e.rating&&(l.rating=e.rating.split("+")),e.hotelName&&(l.hotelName=e.hotelName),l.sort=e.sort||"recommended",l.order=e.order||"desc",isNaN(e.bmin)||(l.bmin=parseInt(e.bmin,10),l.bmax=l.bmin+1e3),j&&k?(console.log("ehehehehehehehehehehehe",c.destinations.index),b.get(c.destinations.index+"&code="+k).success(function(a){l.destination=a,m.resolve(l)}).error(function(a){m.reject(new Error("Unknown Destination"))})):m.resolve(l),m.promise)}function f(a){return a.v}function g(a,b){var c=a.rooms.reduce(function(a,b){var c=[b.adults].concat(b.ages.map(f));return a.push(c.join(",")),a},[]),d=moment(a.checkin).format("YYYY-MM-DD"),e=moment(a.checkout).format("YYYY-MM-DD"),g={search:{guests:c,from:d,to:e}};return b||void 0===a.destination||(g.path="/"+(a.destination.country.code?a.destination.country.code:a.destination.country)+"/"+a.destination.code),g}function h(a){var b={currency:"MAD",from:moment(a.checkin).format("YYYY-MM-DD"),to:moment(a.checkout).format("YYYY-MM-DD"),guests:a.rooms.map(function(a){return[a.adults].concat(a.ages.map(f)).join(",")})};if(a.property)return b.property=a.property,b;var c=a.destination.country.toLowerCase();return angular.extend(b,{skip:a.skip||0,limit:a.limit||25,country:c,locality:a.destination.code,order:a.order||"desc",sort:a.sort||"recommended"}),a.rating&&a.rating.length&&(b.rating=a.rating.join("+")),angular.forEach(["bmin","bmax","hotelName"],function(c){a[c]&&(b[c]=a[c])}),b}return{fromStateParam:e,toLocation:g,toApi:h}}])}();
\ No newline at end of file
!function(){"use strict";angular.module("lodge",["ui.bootstrap","daterangepicker"]),angular.module("lodge").controller("lodge_SearchFormCtrl",["$scope","$http","$window","$location","$log","settings","lodgeQuery","$rootElement","$document",function(a,b,c,d,e,f,g,h,i){function j(){var b;a.date2&&(b=a.date2.split("--")),a.query&&(a.query.checkin=b[0],a.query.checkout=b[1])}function k(){var b;a.date1&&(b=a.date1.split("--")),a.query&&(a.query.checkin=m(b[0]),a.query.checkout=m(b[1]))}function l(b){var c=0;angular.forEach(a.query.rooms,function(a){c+=a.adults}),a.roomInput="chambres "+a.query.roomCount+" ,Adultes "+c+" ,Enfant "+a.query.childCount,a.roomDiv=!a.roomDiv}function m(a){var b=a.split("/");return new Date(b[2],b[1]-1,b[0]).toLocaleDateString("en-US")}function n(b,c){if(b!=c){for(var d=a.query.rooms;d.length<b;)d.push({adults:2,children:0,ages:[]});for(;d.length>b;)d.pop()}}function o(b){e.debug("childCountUpdated",b);var c=b.children,d=b.ages,f=d.length;for(a.query.childCount-=f;d.length<c;)d.push({});for(;d.length>c;)d.pop();a.query.childCount+=c}function p(a){return b.get(f.destinations.search.replace(":term",a)).then(function(a){return a.data})}function q(){var b=a.query;if(void 0!==b.destination){var e=g.toLocation(b);if("search"===a.context){d.path("/recherche"+e.path);var h=d.search();h=angular.extend(h,e.search),d.search(e.search)}else{var i=[];angular.forEach(e.search,function(a,b){if("guests"==b)for(var c=0;c<e.search.guests.length;c++)i.push(b+"="+e.search.guests[c]);else i.push(b+"="+e.search[b])}),c.location.href=f.lodge.salesApp+"#!/recherche"+e.path+"?"+i.join("&")}}}function r(b,c){b.preventDefault(),b.stopPropagation(),a.toggleCalendars[c]=!a.toggleCalendars[c]}var s=moment().startOf("day"),t=angular.element(h.find("meta[name=description]")[0]);t.attr("content","hotel"),t.attr("charset","UTF-8");var u={adults:[1,2,3,4],children:[0,1,2,3,4],ages:[1,2,3,4,5,6,7,8,9,10,11],roomCount:[1,2,3,4,5,6],minCheckin:s.toDate(),maxCheckin:moment(s).add(12,"months").toDate(),checkin:{minDate:s.toDate(),minMonth:moment(s).startOf("month").toDate(),maxDate:moment(s).add(1,"years").toDate(),initDate:"options.checkin.minMonth"},checkout:{initDate:"options.checkout.minMonth"}};a.roomDiv=!1,a.roomInput="Chambre - Adultes ...",i.bind("click",function(b){"inputDivRooms"===b.target.id||"guests__inputs divRooms ng-scope"===b.target.className||!0!==a.roomDiv||b.target.classList.contains("divRoomsInputs")||b.target.nextSibling.classList.contains("divRoomsInputs")||(a.roomDiv=!a.roomDiv,a.$apply())}),u.checkout.minDate=moment(s).add(1,"days").toDate(),u.checkout.minMonth=moment(u.checkout.minDate).startOf("month").toDate(),u.checkout.initDate="options.checkout.minMonth",u.checkout.maxDate=moment(u.checkout.minDate).add(1,"years").toDate(),a.context,f.lodge.standaloneSearchForm&&(a.query={childCount:0,roomCount:1,rooms:[{adults:2,children:0,ages:[]}],rating:[]}),a.$watch("query.roomCount",n),angular.extend(a,{destinations:p,SimplePickerChange:k,roomChange:l,options:u,search:q,childCountUpdated:o,toggleCalendar:r,toggleCalendars:{},changesDateSearch:j}),a.rangeDatePickerLodge={date:{startDate:moment().subtract(1,"days"),endDate:moment()},picker:null,options:{pickerClasses:"custom-display",buttonClasses:"btn",applyButtonClasses:"btn-primary",cancelButtonClasses:"btn-danger",minDate:moment(),locale:{applyLabel:"valider",cancelLabel:"annuler",customRangeLabel:"Custom range",separator:" - ",format:"DD/MM/YYYY",weekLabel:"S",daysOfWeek:["Di","Lu","Ma","Me","Je","Ve","Sa"],monthNames:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Decembre"],firstDay:1},eventHandlers:{"apply.daterangepicker":function(b,c){a.query.checkin=a.rangeDatePickerLodge.date.startDate,a.query.checkout=a.rangeDatePickerLodge.date.endDate}}}}}]),angular.module("lodge").factory("lodgeQuery",["$q","$http","settings",function(a,b,c){function d(a){var b=a.split(","),c=parseInt(b.shift(),10),d=b.map(function(a){return{v:parseInt(a,10)}});return{adults:c,ages:d,children:d.length}}function e(e){angular.isArray(e.guests)||(e.guests=[e.guests]);for(var f,g=moment(e.from||"invalid","YYYY-MM-DD"),h=moment(e.to||"invalid","YYYY-MM-DD"),i=e.guests.slice(),j=e.country,k=e.destination,l={rooms:[],roomCount:0,childCount:0},m=a.defer();i[0];)f=d(i.shift()),l.rooms.push(f),l.childCount+=f.children;return l.roomCount=l.rooms.length,g.isValid()&&h.isValid()&&g.isBefore(h)?(l.checkin=g.toDate(),l.checkout=h.toDate()):(l.noDates=!0,l.checkin=moment().add(7,"days").toDate(),l.checkout=moment().add(8,"days").toDate()),e.propertyCode?(l.property=e.propertyCode,m.resolve(l),m.promise):(l.rating=[],e.rating&&(l.rating=e.rating.split("+")),e.hotelName&&(l.hotelName=e.hotelName),l.sort=e.sort||"recommended",l.order=e.order||"desc",isNaN(e.bmin)||(l.bmin=parseInt(e.bmin,10),l.bmax=l.bmin+1e3),j&&k?(console.log("ehehehehehehehehehehehe",c.destinations.index),b.get(c.destinations.index+"&code="+k).success(function(a){l.destination=a,m.resolve(l)}).error(function(a){m.reject(new Error("Unknown Destination"))})):m.resolve(l),m.promise)}function f(a){return a.v}function g(a,b){var c=a.rooms.reduce(function(a,b){var c=[b.adults].concat(b.ages.map(f));return a.push(c.join(",")),a},[]),d=moment(a.checkin).format("YYYY-MM-DD"),e=moment(a.checkout).format("YYYY-MM-DD"),g={search:{guests:c,from:d,to:e}};return b||void 0===a.destination||(g.path="/"+(a.destination.country.code?a.destination.country.code:a.destination.country)+"/"+a.destination.code),g}function h(a){var b={currency:"MAD",from:moment(a.checkin).format("YYYY-MM-DD"),to:moment(a.checkout).format("YYYY-MM-DD"),guests:a.rooms.map(function(a){return[a.adults].concat(a.ages.map(f)).join(",")})};if(a.property)return b.property=a.property,b;var c=a.destination.country.toLowerCase();return angular.extend(b,{skip:a.skip||0,limit:a.limit||25,country:c,locality:a.destination.code,order:a.order||"desc",sort:a.sort||"recommended"}),a.rating&&a.rating.length&&(b.rating=a.rating.join("+")),angular.forEach(["bmin","bmax","hotelName"],function(c){a[c]&&(b[c]=a[c])}),b}return{fromStateParam:e,toLocation:g,toApi:h}}])}();
\ No newline at end of file
!function(){"use strict";var a=window.location.href;a.indexOf("#")!==a.indexOf("#!")&&(window.location.href=a.replace("#","#!")),angular.module("lodge-sales",["angular-carousel","ui.router","lodge","ui.bootstrap","ngAnimate","angular-loading-bar","openlayers-directive","leaflet-directive","pascalprecht.translate"]),angular.module("lodge",["ui.router","ui.bootstrap.datepicker"]),angular.module("lodge-sales").run(["$rootScope","$injector","$log",function(a,b,c){var d;try{d=b.get("$analytics")}catch(a){return void c.warn("$analytics not available")}a.$on("lodgeSearchQuery",function(a,b){var c="/hotels/recherche/"+_.str.slugify(b.destination.country.name)+"/"+_.str.slugify(b.destination.name);d.pageTrack(c)}),a.$on("lodgePropertyView",function(a,b){var e="/hotels/"+_.str.slugify(b.address.country.code||"xx")+"/"+_.str.slugify(b.address.locality.name||"xx")+"/"+_.str.slugify(b.name);c.debug("$analytics.pageTrack",e),d.pageTrack(e)}),a.$on("lodgeBookCartSaved",function(a,b){console.log("lodgeBookCartSaved:event");var c="/checkout/",e=b.items[0]["@type"].toLowerCase();switch(e){case"air":c+="air";break;case"stayitem":c+="stay";break;case"omra":c+="omra";break;case"haj":c+="hajj";break;case"vo":c+="voyages-organisés";break;default:c+=e}d.pageTrack(c)})}]),angular.module("lodge").config(["datepickerConfig","datepickerPopupConfig",function(a,b){angular.extend(a,{showWeeks:!1,dayFormat:"d",startingDay:1,minDate:new Date,maxDate:moment().add(18,"months").toDate(),maxMode:"month"}),b.toggleWeeksText=null,b.showButtonBar=!1}]),angular.module("lodge-sales").config(["settings","$translateProvider",function(a,b){b.translations(a.i18n.lang,a.i18n.strings),b.preferredLanguage(a.i18n.lang)}]),angular.module("lodge-sales").config(["$sceProvider","$stateProvider","$urlRouterProvider","$httpProvider","$locationProvider",function(a,b,c,d,e){var f={blank:"/recherche",search:"/recherche/:country/:destination?from&to&guests&bmin&bmax&rating&hotelName&sort&order",view:"/:country/:location/:slug,:propertyCode?from&to&guests",params:{from:"du",to:"au",guests:"chambres",rating:"categorie",hotelName:"hotel",sort:"tri",order:"ordre"}};a.enabled(!1),e.hashPrefix("!"),b.state("blank",{url:f.blank,templateUrl:"hermes-lodge-search",controller:"lodge_SearchCtrl"}).state("search",{url:f.search,templateUrl:"hermes-lodge-search",controller:"lodge_SearchCtrl"}).state("view",{url:"/hotel/:propertyCode?from&to&rooms",templateUrl:"hermes-lodge-view",controller:"lodge_ViewCtrl",reloadOnSearch:!1}).state("viewSlug",{url:f.view,templateUrl:"hermes-lodge-view",controller:"lodge_ViewCtrl",reloadOnSearch:!1}),c.otherwise(f.blank),d.defaults.headers.common.Accept="application/json"}]),angular.module("lodge").controller("lodge_MapCtrl",["$scope","$log","$state","$stateParams","settings","$http","$location","$rootScope",function(a,b,c,d,e,f,g,h){function i(b,c){a.selectedHotel=c.model.hotel}var j=[];a.result.items.forEach(function(a){void 0!==a.coordinates&&j.push({lat:a.coordinates[0],lng:a.coordinates[1],compileMessage:!1,message:a.name,hotel:a})}),angular.extend(a,{center:{lat:j[0].lat,lng:j[0].lng,zoom:10},markers:j,selectedHotel:!1}),a.$on("leafletDirectiveMarker.click",i)}]),angular.module("lodge").controller("lodge_QuoteCtrl",["$scope","$log","$state","$stateParams","$location","$http","lodgeQuery","$window","settings","$timeout","$filter","$rootScope",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(b,c){if(b!=c){for(var d=a.propertyQuery.rooms;d.length<b;)d.push({adults:2,children:0,ages:[]});d.length=b}}function n(b){for(var c=b.children,d=b.ages;d.length<c;)d.push({}),a.propertyQuery.childCount++;for(;d.length>c;)d.pop(),a.propertyQuery.childCount--}function o(b,c){b.preventDefault(),b.stopPropagation();var d=a.toggleCalendars[c];a.toggleCalendars={},a.toggleCalendars[c]=!d}function p(){var b=a.propertyQuery,c=g.toLocation(b,!0),d=g.toApi(b,!0);e.search(c.search),a.status="loading",f.get(i.quotes.index,{params:d}).success(q).error(r)}function q(b){if(console.log("onQuotesLoaded.....................",b),b=JSOG.decode(b),0===b.quotes.length)return a.emit("lodgeRoomsUnavailable",a.propertyQuery),void(a.stay={});for(var c=b.quotes.reduce(s,[]),d=b.orderTemplate,e=d.trip.segments[0].rooms,f=e.length;f--;)d.items.unshift({type:"lodge",room:e[f],choices:t(e[f],c)});angular.extend(a,{stay:{checkin:d.trip.segments[0].checkin,checkout:d.trip.segments[0].checkout},cart:d,currentItem:d.items[0],status:"found"})}function r(){b.debug("onQuotesError",arguments),a.$emit("lodgeQuoteError",a.propertyQuery),a.status="error"}function s(a,b){for(var c,d=b.product.occupancy,e=b.product.roomType,f=b.product.board,g=a.length;g--&&!c;)a[g].occupancy===d&&(c=a[g]);void 0===c&&(c={occupancy:d,rooms:{}},a.push(c));var h=c.rooms[e.name];return h||(c.rooms[e.name]={room:e,boards:{}},h=c.rooms[e.name]),h.boards[f.code]||(h.boards[f.code]={board:f,quotes:[]}),h.boards[f.code].quotes.push(b),a}function t(a,b){for(var c,d=a.occupancy,e=b.length;e--&&!c;)if(b[e].occupancy===d)return b[e].rooms;return null}function u(b){var c=["type","room","choices"];angular.forEach(b,function(a,d){-1===c.indexOf(d)&&delete b[d]}),a.currentItem=b,a.readyToBook=!1}function v(b,c){angular.extend(b,c);var d=a.cart.items.filter(function(a){return"lodge"===a.type&&void 0===a.product});a.currentItem=d[0],a.readyToBook=0===d.length,l.okToBook=!0,w()}function w(){for(var b=a.cart.items,c=b.length,d=0;c--;)d+=100*b[c].totals.total;a.cart.totals.total=d/100}function x(){a.cart.trip.segments[0].property.name=d.slug,a.cart.trip.segments[0].property.address={country:d.country,location:d.location},a.cart.items.forEach(function(a){delete a.choices,a.room&&(a.travellers=a.room.guests)});var c=JSOG.encode(a.cart);c.items.forEach(function(a){delete a.room}),f.post("/carts",c).then(function(b){angular.isArray(b.data)&&(b.data=b.data[0]),h.location.href="/ngapps/checkout#/"+b.data._id,a.$emit("lodgeBookCartSaved",b.data)},function(){b.error("cart saving failed",arguments),a.status="error",a.error="Un problème est survenu lors du passage à la page paiement."})}b.debug("in_lodge_QuoteCtrl",l.property,d);var y=angular.extend({maxStay:30,minStay:1},i.options);l.okToBook=!1,y.minCheckin=moment().startOf("day").add(y.daysToMinCheckin||0).toDate(),y.maxCheckout=moment(y.minCheckin).add(y.monthsToMaxCheckout||10).toDate(),y.maxCheckin=moment(y.maxCheckout).subtract(y.minStay,"days"),d.from&&d.to?(a.status="loading",g.fromStateParam(d).then(function(c){b.debug("lodge_QuoteCtrl......",c),a.$emit("lodgePropertyQuery",c),a.propertyQuery=c;var d=g.toApi(c,!0);b.debug("lodge_QuoteCtrl",d),f.get(i.quotes.index,{params:d}).success(q).error(r)})):(a.status="blank",a.propertyQuery={property:d.propertyCode,childCount:0,roomCount:1,rooms:[{adults:2,children:0,ages:[]}]}),angular.extend(a,{options:y,getQuotes:p,promptForOffer:u,chooseOffer:v,toCheckout:x,childCountUpdated:n,toggleCalendar:o,toggleCalendars:{}}),a.$watch("propertyQuery.roomCount",m)}]),angular.module("lodge").controller("lodge_SearchFormCtrl",["$scope","$http","$window","$location","$log","settings","lodgeQuery","$rootElement","$document",function(a,b,c,d,e,f,g,h,i){function j(){var b;a.date2&&(b=a.date2.split("--")),a.query&&(a.query.checkin=b[0],a.query.checkout=b[1])}function k(){var b;a.date1&&(b=a.date1.split("--")),a.query&&(a.query.checkin=m(b[0]),a.query.checkout=m(b[1]))}function l(b){var c=0;angular.forEach(a.query.rooms,function(a){c+=a.adults}),a.roomInput="chambres "+a.query.roomCount+" ,Adultes "+c+" ,Enfant "+a.query.childCount,a.roomDiv=!a.roomDiv}function m(a){var b=a.split("/");return new Date(b[2],b[1]-1,b[0]).toLocaleDateString("en-US")}function n(b,c){if(e.debug("roomCountUpdated",b,c),b!=c){for(var d=a.query.rooms;d.length<b;)d.push({adults:2,children:0,ages:[]});for(;d.length>b;)d.pop()}}function o(b){e.debug("childCountUpdated",b),console.log("---------","childCountUpdated",b,b.ages);var c=b.children,d=b.ages,f=d.length;for(a.query.childCount-=f;d.length<c;)d.push({});for(;d.length>c;)d.pop();a.query.childCount+=c}function p(a){return b.get(f.destinations.search.replace(":term",a)).then(function(a){return console.log(a),a.data})}function q(){var b=a.query;if(void 0!==b.destination){var e=g.toLocation(b);if(console.log("kdfjlkdjflkjdkfj",b,a),"search"===a.context){d.path("/recherche"+e.path);var h=d.search();h=angular.extend(h,e.search),d.search(e.search)}else{var i=[];angular.forEach(e.search,function(a,b){if("guests"==b)for(var c=0;c<e.search.guests.length;c++)i.push(b+"="+e.search.guests[c]);else i.push(b+"="+e.search[b])}),c.location.href=f.lodge.salesApp+"#!/recherche"+e.path+"?"+i.join("&")}}}function r(b,c){b.preventDefault(),b.stopPropagation(),a.toggleCalendars[c]=!a.toggleCalendars[c]}var s=moment().startOf("day"),t=angular.element(h.find("meta[name=description]")[0]);t.attr("content","hotel"),t.attr("charset","UTF-8");var u={adults:[1,2,3,4],children:[0,1,2,3,4],ages:[1,2,3,4,5,6,7,8,9,10,11],roomCount:[1,2,3,4,5,6],minCheckin:s.toDate(),maxCheckin:moment(s).add(12,"months").toDate(),checkin:{minDate:s.toDate(),minMonth:moment(s).startOf("month").toDate(),maxDate:moment(s).add(1,"years").toDate(),initDate:"options.checkin.minMonth"},checkout:{initDate:"options.checkout.minMonth"}};a.date1="",a.date2="",a.roomDiv=!1,a.roomInput="Chambre - Adultes ...",i.bind("click",function(b){"inputDivRooms"===b.target.id||"guests__inputs divRooms ng-scope"===b.target.className||!0!==a.roomDiv||b.target.classList.contains("divRoomsInputs")||b.target.nextSibling.classList.contains("divRoomsInputs")||(a.roomDiv=!a.roomDiv,a.$apply())}),u.checkout.minDate=moment(s).add(1,"days").toDate(),u.checkout.minMonth=moment(u.checkout.minDate).startOf("month").toDate(),u.checkout.initDate="options.checkout.minMonth",u.checkout.maxDate=moment(u.checkout.minDate).add(1,"years").toDate(),a.context,f.lodge.standaloneSearchForm&&(a.query={childCount:0,roomCount:1,rooms:[{adults:2,children:0,ages:[]}],rating:[]}),a.$watch("query.roomCount",n),angular.extend(a,{destinations:p,SimplePickerChange:k,roomChange:l,options:u,search:q,childCountUpdated:o,toggleCalendar:r,toggleCalendars:{},changesDateSearch:j}),e.debug("lodge_SearchFormCtrl: done")}]),angular.module("lodge").controller("lodge_SearchCtrl",["$scope","$log","$state","$stateParams","$http","lodgeQuery","$window","$location","$timeout","settings","$translate","$rootElement",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(b){b.value=!b.value;var c=a.filters.categories,d=[];for(var e in c)"any"!==e&&!0===c[e].value&&d.push(e);0===d.length?h.search("rating",null):h.search("rating",d.join("+"))}function n(c){a.query=c,C=a.query,b.debug("query",C);for(var d in a.filters.categories)C.rating.indexOf(d)>-1&&(a.filters.categories[d].value=!0);C.bmin&&(a.filters.budget=C.bmin+500),a.$emit("lodgeSearchQuery",C),p()}function o(c){b.error(c),a.error=c}function p(){var b=a.query;console.log("settings.quotes.index:",j.quotes.index),b.limit=b.limit||E,a.status="searching",b.api||(b.api=f.toApi(b),b.sent=0),b.skip>0&&(b.api.skip=b.skip),e.get(j.quotes.index,{params:b.api}).success(q).error(s)}function q(b,c){var d=a.query;if(d.sent++,202===c)d.sent<40?D=i(p,1e3):r();else if(205===c)a.status="empty",delete d.sent,delete d.api;else if(200===c){var e=JSOG.decode(b),g=f.toLocation(d);angular.forEach(e.items,function(a){t(a,g)}),d.skip>0?Array.prototype.push.apply(a.result.items,e.items):a.result=e,a.hasMore=e.links&&void 0!==e.links.next,0===a.result.items.length?(a.status="empty",delete d.sent,delete d.api):a.status="found"}}function r(){b.error(new Error("search result timeout")),a.status="timeout",delete C.sent,delete C.api}function s(){b.error("Search Error",arguments),a.status="error"}function t(a,b){a.links=a.links||{},a.links.self="#!/"+_.str.slugify(a.address.country.name||a.address.country.code)+"/"+_.str.slugify(a.address.locality.name)+"/"+_.str.slugify(a.name)+","+a.code,a.sref=angular.extend({country:_.str.slugify(a.address.country.name||a.address.country.code),location:_.str.slugify(a.address.locality.name),slug:_.str.slugify(a.name),propertyCode:a.code},b.search)}function u(){if(!a.hasMore||["searching","empty"].indexOf(a.status)>-1)return!1;a.query.skip=a.result.items.length,a.query.limit=E,p()}function v(b){a.viewMode="map"===b?"map":"list"}function w(a){h.search("order",a.order||null),h.search("sort",a.code)}function x(a){var b=parseInt(a,10);if(angular.isNumber(b)){var c=Math.max(b-500,0);h.search("bmin",c),h.search("bmax",c+1e3)}}function y(a){a.length>1&&h.search("hotelName",a)}function z(){a.query.checkout=moment(a.query.checkin).add(a.query.nights,"days").format("YYYY-MM-DD")}function A(){a.query.nights=moment(a.query.checkout).diff(moment(a.query.checkin),"days")}b.info("lodge_SearchCtrl: init",d);var B=angular.element(l.find("meta[name=description]")[0]);B.attr("content","machin -----"),B.attr("charset","UTF-8");var C,D,E=30;a.countryCode=d.country;var F=[{code:"recommended",label:k.instant("recommended"),checked:!1},{code:"price",label:k.instant("sort-price-desc"),order:"desc",checked:!1},{code:"price",label:k.instant("sort-price-asc"),order:"asc",checked:!1},{code:"category",label:k.instant("sort-category-desc"),order:"desc",checked:!1},{code:"category",label:k.instant("sort-category-asc"),order:"asc",checked:!1}],G=[{code:"recommended",label:"Recommandé",checked:!1},{code:"price",label:"Prix décroissant",order:"desc",checked:!1},{code:"price",label:"Prix croissant",order:"asc",checked:!1},{code:"category",label:"Catégorie décroissante",order:"desc",checked:!1},{code:"category",label:"Catégorie croissante",order:"asc",checked:!1}],H={categories:{any:{label:k.instant("all"),value:!0},"1ST":{label:k.instant("1 star"),value:!1},"2ST":{label:k.instant("2 stars"),value:!1},"3ST":{label:k.instant("3 stars"),value:!1},"4ST":{label:k.instant("4 stars"),value:!1},"5ST":{label:k.instant("5 stars"),value:!1}}};if(angular.extend(a,{context:"search",loadMore:u,sortChange:w,budgetChange:x,hotelNameChange:y,categoriesChange:m,stateParams:d,nightsChanged:z,checkoutChanged:A,setViewMode:v,viewMode:"list"}),c.includes("search")?(f.fromStateParam(d).then(n,o),a.status="searching"):(a.status="blank",a.query={childCount:0,roomCount:1,rooms:[{adults:2,children:0,ages:[]}],nights:1,rating:[]}),d.sort||d.order){for(var I=0;I<F.length;I++)F[I].code===d.sort&&F[I].order===d.order&&(F[I].checked=!0,G[I].checked=!0);a.sorters=F,a.sortersfr=G}else a.sorters=F,a.sortersfr=G;if(d.rating){var J=d.rating.split("+");H.categories.any.value=!1;for(var K in H.categories)J.indexOf(K)>-1&&(H.categories[K].value=!0);a.filters=H}else a.filters=H;a.hasMore=!1}]),angular.module("lodge").controller("lodge_ViewCtrl",["$scope","$log","$state","$stateParams","settings","$sce","lodgeQuery","$http","$location","$anchorScroll","$rootScope","$timeout","$filter",function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(c){b.debug("lodge_ViewCtrl: onPropertyLoaded",c),c.rating.tripAdvisor&&(c.links=c.links||{},c.links.reviews=f.trustAsUrl(t.replace(":taId",c.rating.tripAdvisor.id))),c.description?(c.summary=c.description.content,c.description=c.area?c.area.content:void 0):c.area&&(c.summary=c.area.content),c.roomInfo&&(c.description?c.description=c.roomInfo.content:c.description+=c.roomInfo.content),c.photos.forEach(function(a,b){a.href=0==b?a.href.replace("320x180","1920x1000"):a.href.replace("320x180","1200x800")}),a.property=c,a.pdfImage="https:"+c.photos[0].href;var d=[{lat:c.coordinates[0],lon:c.coordinates[1],name:c.name}];angular.extend(a,{center:{lat:c.coordinates[0],lon:c.coordinates[1],zoom:16},markers:d}),document.title=k.title=c.name+" "+c.address.locality.name,a.$emit("lodgePropertyView",c)}function o(c,d){new Error("Could not load property description.").number=d,b.error("Could not load property description.",arguments),a.error="Erreur lors du chargement de l'hotel. Veuillez réessayer plus tard"}function p(a){i.hash(a),j()}function q(){console.log("generate program as pdf"),a.loadingProgram=!0,kendo.pdf.defineFont({"DejaVu Sans":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans.ttf","DejaVu Sans|Bold":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Bold.ttf","DejaVu Sans|Bold|Italic":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Oblique.ttf","DejaVu Sans|Italic":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Oblique.ttf"}),kendo.drawing.drawDOM("#program",{template:$("#page-template").html(),paperSize:"A4",margin:"1cm",scale:.5,forcePageBreak:".page-break",multiPage:!0}).then(function(b){console.log(" ending generating pdf"),u=b;var c=m("date")(new Date,"yyyy-MM-dd");kendo.drawing.pdf.saveAs(u,"détail "+a.property.name+"-"+c+".pdf"),a.loadingProgram=!1,a.$apply()})}function r(){q()}function s(){a.loadingTarif=!0;var b=m("date")(a.currentDate,"yyyy-MM-dd");kendo.pdf.defineFont({"DejaVu Sans":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans.ttf","DejaVu Sans|Bold":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Bold.ttf","DejaVu Sans|Bold|Italic":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Oblique.ttf","DejaVu Sans|Italic":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Oblique.ttf"}),console.log(" in generate tarifs as pdf"),l(function(){kendo.drawing.drawDOM("#tarifs",{paperSize:"A4",margin:"1cm",scale:.7}).then(function(c){kendo.drawing.pdf.saveAs(c,"devis "+a.property.name+"-"+b+".pdf"),a.loadingTarif=!1,a.$apply()})},10)}b.debug("lodge_ViewCtrl: init"),console.log("in lodge view controller");var t="//www.tripadvisor.com/WidgetEmbed-cdspropertydetail?locationId=:taId&partnerId=2329B67D74EA4BE5BBF080EB6AA6B31D&lang=fr_FR&display=true",u=null;h.get(e.properties.index+"/"+d.propertyCode).success(n).error(o),angular.extend(a,{scrollTo:p,context:"search",status:"searching",generatePDF:r,loadingProgram:!1,generatePdfTarifs:s,loadingTarif:!1}),a.currentDate=new Date}]),angular.module("lodge").controller("RoomsInputCtrl",["$scope","$attrs","$log",function(a,b,c){function d(b,c){return console.log(a.$parent.$eval(b)),angular.isDefined(b)?a.$parent.$eval(b):c}function e(){return{adults:2,children:[]}}for(var f={maxRooms:d(b.maxRooms,4),maxGuests:d(b.maxGuests,8),maxChildren:d(b.maxChildren,4),maxAdults:d(b.maxAdults,4),minAdults:d(b.minAdults,1),adultAge:d(b.adultAge,12)},g={roomCount:[],childAge:[],childCount:[],adultCount:[]},h=1;h<=f.maxRooms;)g.roomCount.push(h),h++;for(h=1;h<f.adultAge;)g.childAge.push(h),h++;for(h=f.minAdults;h<f.maxAdults;)g.adultCount.push(h),h++;for(h=0;h<=f.maxChildren;)g.childCount.push(h),h++;a.options=g,a.roomCountChange=function(b){for(;this.rooms.length<b;)this.rooms.push(e()),this.childCount.push(0);for(;this.rooms.length>b;){var c=this.rooms.pop();this.hasChildren-=c.children.length}a.change()},a.childCountChange=function(b,c){for(;b.children.length<c;)b.children.push({age:void 0}),a.hasChildren++;for(;b.children.length>c;)b.children.pop(),a.hasChildren--}}]).directive("roomsInput",["$parse","$log",function(a,b){return{restrict:"EA",replace:!0,template:'<div class="rooms-input" ng-class="{ in: isOpen(), fade: animation() }" style="max-width:300px"><select class="form-control" ng-options="count as (count + \' Chambre(s)\') for count in options.roomCount" ng-required ng-model="roomCount" ng-change="roomCountChange(roomCount)" ></select><table class="table table-condensed"><tr><th>Chambre</th><th>Adultes</th><th>Enfants</th><th ng-if="hasChildren > 0">Ages des enfants</th></tr><tr ng-repeat="room in rooms"><td>{{$index + 1}}</td><td><select class="form-control input-sm" ng-options="count for count in options.adultCount " ng-model="room.adults" style="margin-bottom: 0;display: inline;width: auto;"></select></td><td><select class="form-control input-sm" ng-options="count for count in options.childCount " ng-model="childCount[$index]" ng-change="childCountChange(room, childCount[$index])" style="margin-bottom: 0;display: inline;width: auto;"></select></td><td ng-if="hasChildren > 0"><select class="form-control input-sm" ng-repeat="child in room.children" ng-options="age as (age + \' an(s)\') for age in options.childAge" ng-model="child.age" ng-required style="margin-bottom: 0;display: inline;width: auto;"></select></td></tr></table></div>',scope:{roomCount:"&"},require:["roomsInput","^ngModel","?maxRooms"],controller:"RoomsInputCtrl",link:function(a,b,c,d){function e(){a.rooms=f.$modelValue,a.rooms=f.$modelValue,a.roomCount=a.rooms.length,a.childCount=[],a.hasChildren=0;for(var b=0;b<a.rooms.length;b++)a.childCount.push(a.rooms[b].children.length),a.hasChildren+=a.rooms[b].children.length}var f=(d[0],d[1]);a.change=function(){f.$setViewValue(a.rooms),f.$setValidity("rooms",!0)},f.$render=function(){e()},e()}}}]).directive("roomsInputPopup",["$compile","$parse","$document","$position","$filter",function(a,b,c,d,e){return{restrict:"EA",require:"^ngModel",link:function(f,g,h,i){function j(a){p?p(f,!!a):m.isOpen=!!a}function k(){m.position=n?d.offset(g):d.position(g),m.position.top=m.position.top+g.prop("offsetHeight")}var l,m=f.$new(),n=!0;h.$observe("roomsInputPopup",function(a){l=m.$watch("rooms",function(){i.$render()},!0)}),f.$on("$destroy",function(){x.remove(),l(),m.$destroy()});var o,p;h.isOpen&&(o=b(h.isOpen),p=o.assign,f.$watch(o,function(a){m.isOpen=!!a})),m.isOpen=!!o&&o(f);var q=function(a){m.isOpen&&a.target!==g[0]&&m.$apply(function(){j(!1)})},r=function(){m.$apply(function(){j(!0)})},s=angular.element("<div rooms-input-popup-wrap><div rooms-input></div></div>");s.attr({"ng-model":"rooms"});var t=angular.element(s.children()[0]),u={};h.roomsInputOptions&&(u=f.$eval(h.roomsInputOptions),t.attr(angular.extend({},u))),i.$render=function(){var a=i.$viewValue?e("humanizeRooming")(i.$modelValue):"";g.html(a+' | <span class="caret"></span>'),m.rooms=i.$modelValue};var v=!1,w=!1;m.$watch("isOpen",function(a){a?(k(),c.bind("click",q),w&&(g.unbind("focus",r),g.unbind("click",r)),g[0].focus(),v=!0):(v&&c.unbind("click",q),g.bind("focus",r),g.bind("click",r),w=!0),p&&p(f,a)});var x=a(s)(m);c.find("body").append(x)}}}]).directive("roomsInputPopupWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,template:"<ul class=\"dropdown-menu rooms-input-popup\" style=\"padding: 10px\" ng-style=\"{display: (isOpen && 'block') || 'none', top: position.top+'px', left: position.left+'px'}\"><li ng-transclude></li></ul>",link:function(a,b,c){b.bind("click",function(a){a.preventDefault(),a.stopPropagation()})}}}).filter("humanizeRooming",["$translate",function(a){return function(b){for(var c=0,d=0,e=b.length,f=b.length-1;f>=0;f-=1)c+=b[f].adults,d+=b[f].children.length;return d>0?a("r-rooms-a-adults-c-children",{r:e,a:c,c:d}):a("r-rooms-a-adults",{r:e,a:c})}}]),angular.module("ui.bootstrap.datepicker").controller("DatepickerController",["$scope","$attrs","$parse","$interpolate","$timeout","$log","dateFilter","datepickerConfig",function(a,b,c,d,e,f,g,h){var i=this,j={$setViewValue:angular.noop};this.modes=["day","month","year"],angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle","minMode","maxMode","showWeeks","startingDay","yearRange"],function(c,e){i[c]=angular.isDefined(b[c])?e<8?d(b[c])(a.$parent):a.$parent.$eval(b[c]):h[c]}),angular.forEach(["minDate","maxDate"],function(d){b[d]?a.$parent.$watch(c(b[d]),function(a){i[d]=a?new Date(a):null,i.refreshView()}):i[d]=h[d]?new Date(h[d]):null}),angular.isDefined(b.initDate)&&(console.log(b.initDate,c(b.initDate)),a.$parent.$watch(c("$parent.$parent."+b.initDate),function(a){console.log("initdare "+a),j.$modelValue||(i.activeDate=a?new Date(a):new Date,i.refreshView())})),a.datepickerMode=a.datepickerMode||h.datepickerMode,a.uniqueId="datepicker-"+a.$id+"-"+Math.floor(1e4*Math.random()),this.activeDate=angular.isDefined(b.initDate)?a.$parent.$eval(b.initDate):new Date,a.isActive=function(b){return 0===i.compare(b.date,i.activeDate)&&(a.activeDateId=b.uid,!0)},this.init=function(a){j=a,j.$render=function(){i.render()}},this.render=function(){if(j.$modelValue){var a=new Date(j.$modelValue),b=!isNaN(a);b?this.activeDate=a:f.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'),j.$setValidity("date",b)}this.refreshView()},this.refreshView=function(){if(this.element){this._refreshView();var a=j.$modelValue?new Date(j.$modelValue):null;j.$setValidity("date-disabled",!a||this.element&&!this.isDisabled(a))}},this.createDateObject=function(c,d){var e=j.$modelValue?new Date(j.$modelValue):null;return{date:c,label:g(c,d),selected:e&&0===this.compare(c,e),disabled:this.isDisabled(c),current:0===this.compare(c,new Date),classes:b.dateClasses&&a.dateClasses({date:c,mode:a.datepickerMode})||""}},this.isDisabled=function(c){return this.minDate&&this.compare(c,this.minDate)<0||this.maxDate&&this.compare(c,this.maxDate)>0||b.dateDisabled&&a.dateDisabled({date:c,mode:a.datepickerMode})},this.split=function(a,b){for(var c=[];a.length>0;)c.push(a.splice(0,b));return c},a.select=function(b){if(a.datepickerMode===i.minMode){var c=j.$modelValue?new Date(j.$modelValue):new Date(0,0,0,0,0,0,0);c.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),j.$setViewValue(c),j.$render()}else i.activeDate=b,a.datepickerMode=i.modes[i.modes.indexOf(a.datepickerMode)-1]},a.move=function(a){var b=i.activeDate.getFullYear()+a*(i.step.years||0),c=i.activeDate.getMonth()+a*(i.step.months||0);i.activeDate.setFullYear(b,c,1),i.refreshView()},a.toggleMode=function(b){b=b||1,a.datepickerMode===i.maxMode&&1===b||a.datepickerMode===i.minMode&&-1===b||(a.datepickerMode=i.modes[i.modes.indexOf(a.datepickerMode)+b])},a.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var k=function(){e(function(){i.element[0].focus()},0,!1)};a.$on("datepicker.focus",k),a.keydown=function(b){var c=a.keys[b.which];if(c&&!b.shiftKey&&!b.altKey)if(b.preventDefault(),b.stopPropagation(),"enter"===c||"space"===c){if(i.isDisabled(i.activeDate))return;a.select(i.activeDate),k()}else!b.ctrlKey||"up"!==c&&"down"!==c?(i.handleKeyDown(c,b),i.refreshView()):(a.toggleMode("up"===c?1:-1),k())}}]),angular.module("lodge").filter("lodgeRating",function(){var a={"1ST":"","2ST":"","3ST":"","4ST":"","5ST":"",RSD:"Résidence",riad:"Riad",NA:""},b={"1ST":":1EST:HS:H1_5:CAMP1:HSR1:APTH:1LL:AT1:1:","2ST":":2EST:HS2:H2S:HR2:2LL:HSR2:H2_5:APTH2:AT2:CAMP2:2:","3ST":":3EST:HS3:BB3:HR3:AT3:3LL:APTH3:H3S:H3_5:3:","4ST":":4EST:SUP:4LL:APTH4:H4_5:HS4:BB4:HR4:4LUX:HRS:4:","5ST":":5EST:BB5:HIST:APTH5:5LUX:HR5:H5_5:5LL:HS5:5:",RSD:":23:24:25:",riad:":16:",NA:":-1:161:26:"};return function(c){if(!c)return"";if(c.code)for(var d in b)if(b[d].indexOf(":"+c.code+":")>-1)return a[d];return c.name||c.code}}),angular.module("lodge").filter("money",["$filter",function(a){var b={MAD:"Dh",EUR:"€",USD:"$"};return function(c,d){var e=c.split(" ");return a("number")(e[0],0)+" "+b[e[1]]}}]),angular.module("lodge").filter("rooming",["$translate",function(a){function b(b,c,d){return 1===b?a.instant(c):a.instant(d,{n:b})}return function(c){if(!angular.isArray(c)||0===c.length)return"";var d=c.reduce(function(a,b){return a+b.adults},0),e=c.reduce(function(a,b){return a+b.ages.length},0),f={rooms:b(c.length,"one-room","n-room"),adults:b(d,"one-adult","n-adult"),children:b(e,"one-child","n-child")};return e>0?a.instant("rooms-adults-children",f):a.instant("rooms-adults",f)}}]).filter("money",function(){return function(a){return angular.isString(a)&&(a=a.split(" ")),a[0]=Math.round(parseFloat(a[0])),angular.isArray(a)?a[0]+" "+a[1]:a}}).filter("guests",function(){function a(a,b,c){return 1===a?b:c.replace(":count",a)}return function(b){for(var c=0,d=[],e=b.length;e--;)b[e].age?d.push(b[e].age):c++;var f="";if(f+=a(c,"un adulte",":count adultes"),d.length>0){var g=d.map(function(b){return a(b,"1 an",":count ans")});f+=", "+a(d.length,"un enfant",":count enfants"),f+=" ("+g.join(", ")+")"}return f}}),function(){var a,b;return a={},b=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},a.encode=function(a,c,d){var e,f,g,h;h=1,g={},f=function(a){return a.__jsogObjectId||(a.__jsogObjectId=""+h++),a.__jsogObjectId},e=function(a){var c,d;return d=function(a){var b,c,d,h;if(b=f(a),g[b])return g[b].__jsogUsed=!0,{"@ref":b};d=g[b]={"@id":b};for(c in a)h=a[c],"__jsogObjectId"!==c&&(d[c]=e(h));return d},c=function(a){var b;return function(){var c,d,f;for(f=[],c=0,d=a.length;c<d;c++)b=a[c],f.push(e(b));return f}()},null==a?a:b(a)?c(a):"object"==typeof a?d(a):a};var i=e(a);for(var j in g)g[j].__jsogUsed?delete g[j].__jsogUsed:delete g[j]["@id"];return i},a.decode=function(a){var c,d;return d={},(c=function(a){var e,f;return f=function(a){var b,e,f,g,h;if(f=a["@ref"],null!=f&&(f=f.toString()),null!=f)return d[f];g={},b=a["@id"],null!=b&&(b=b.toString()),b&&(d[b]=g);for(e in a)h=a[e],"@id"!==e&&(g[e]=c(h));return g},e=function(a){var b;return function(){var d,e,f;for(f=[],d=0,e=a.length;d<e;d++)b=a[d],f.push(c(b));return f}()},null==a?a:b(a)?e(a):"object"==typeof a?f(a):a})(a)},a.stringify=function(b){return JSON.stringify(a.encode(b))},a.parse=function(b){return a.decode(JSON.parse(b))},"undefined"!=typeof module&&null!==module&&module.exports&&(module.exports=a),"undefined"!=typeof window&&null!==window&&(window.JSOG=a),"function"==typeof define&&define.amd&&define("JSOG",[],function(){return a}),a}.call(this),angular.module("lodge").factory("lodgeQuery",["$q","$http","settings",function(a,b,c){function d(a){var b=a.split(","),c=parseInt(b.shift(),10),d=b.map(function(a){return{v:parseInt(a,10)}});return{adults:c,ages:d,children:d.length}}function e(e){angular.isArray(e.guests)||(e.guests=[e.guests]);for(var f,g=moment(e.from||"invalid","YYYY-MM-DD"),h=moment(e.to||"invalid","YYYY-MM-DD"),i=e.guests.slice(),j=e.country,k=e.destination,l={rooms:[],roomCount:0,childCount:0},m=a.defer();i[0];)f=d(i.shift()),l.rooms.push(f),l.childCount+=f.children;return l.roomCount=l.rooms.length,g.isValid()&&h.isValid()&&g.isBefore(h)?(l.checkin=g.toDate(),l.checkout=h.toDate()):(l.noDates=!0,l.checkin=moment().add(7,"days").toDate(),l.checkout=moment().add(8,"days").toDate()),e.propertyCode?(l.property=e.propertyCode,m.resolve(l),m.promise):(l.rating=[],e.rating&&(l.rating=e.rating.split("+")),e.hotelName&&(l.hotelName=e.hotelName),l.sort=e.sort||"recommended",l.order=e.order||"desc",isNaN(e.bmin)||(l.bmin=parseInt(e.bmin,10),l.bmax=l.bmin+1e3),j&&k?(console.log("ehehehehehehehehehehehe",c.destinations.index),b.get(c.destinations.index+"&code="+k).success(function(a){l.destination=a,m.resolve(l)}).error(function(a){m.reject(new Error("Unknown Destination"))})):m.resolve(l),m.promise)}function f(a){return a.v}function g(a,b){var c=a.rooms.reduce(function(a,b){var c=[b.adults].concat(b.ages.map(f));return a.push(c.join(",")),a},[]),d=moment(a.checkin).format("YYYY-MM-DD"),e=moment(a.checkout).format("YYYY-MM-DD"),g={search:{guests:c,from:d,to:e}};return b||void 0===a.destination||(g.path="/"+(a.destination.country.code?a.destination.country.code:a.destination.country)+"/"+a.destination.code),g}function h(a){var b={currency:"MAD",from:moment(a.checkin).format("YYYY-MM-DD"),to:moment(a.checkout).format("YYYY-MM-DD"),guests:a.rooms.map(function(a){return[a.adults].concat(a.ages.map(f)).join(",")})};if(a.property)return b.property=a.property,b;var c=a.destination.country.toLowerCase();return angular.extend(b,{skip:a.skip||0,limit:a.limit||25,country:c,locality:a.destination.code,order:a.order||"desc",sort:a.sort||"recommended"}),a.rating&&a.rating.length&&(b.rating=a.rating.join("+")),angular.forEach(["bmin","bmax","hotelName"],function(c){a[c]&&(b[c]=a[c])}),b}return{fromStateParam:e,toLocation:g,toApi:h}}])}();
\ No newline at end of file
!function(){"use strict";var a=window.location.href;a.indexOf("#")!==a.indexOf("#!")&&(window.location.href=a.replace("#","#!")),angular.module("lodge-sales",["angular-carousel","ui.router","lodge","ui.bootstrap","ngAnimate","angular-loading-bar","openlayers-directive","leaflet-directive","pascalprecht.translate","daterangepicker"]),angular.module("lodge",["ui.router","ui.bootstrap.datepicker","daterangepicker"]),angular.module("lodge-sales").run(["$rootScope","$injector","$log",function(a,b,c){var d;try{d=b.get("$analytics")}catch(a){return void c.warn("$analytics not available")}a.$on("lodgeSearchQuery",function(a,b){var c="/hotels/recherche/"+_.str.slugify(b.destination.country.name)+"/"+_.str.slugify(b.destination.name);d.pageTrack(c)}),a.$on("lodgePropertyView",function(a,b){var e="/hotels/"+_.str.slugify(b.address.country.code||"xx")+"/"+_.str.slugify(b.address.locality.name||"xx")+"/"+_.str.slugify(b.name);c.debug("$analytics.pageTrack",e),d.pageTrack(e)}),a.$on("lodgeBookCartSaved",function(a,b){console.log("lodgeBookCartSaved:event");var c="/checkout/",e=b.items[0]["@type"].toLowerCase();switch(e){case"air":c+="air";break;case"stayitem":c+="stay";break;case"omra":c+="omra";break;case"haj":c+="hajj";break;case"vo":c+="voyages-organisés";break;default:c+=e}d.pageTrack(c)})}]),angular.module("lodge").config(["datepickerConfig","datepickerPopupConfig",function(a,b){angular.extend(a,{showWeeks:!1,dayFormat:"d",startingDay:1,minDate:new Date,maxDate:moment().add(18,"months").toDate(),maxMode:"month"}),b.toggleWeeksText=null,b.showButtonBar=!1}]),angular.module("lodge-sales").config(["settings","$translateProvider",function(a,b){b.translations(a.i18n.lang,a.i18n.strings),b.preferredLanguage(a.i18n.lang)}]),angular.module("lodge-sales").config(["$sceProvider","$stateProvider","$urlRouterProvider","$httpProvider","$locationProvider",function(a,b,c,d,e){var f={blank:"/recherche",search:"/recherche/:country/:destination?from&to&guests&bmin&bmax&rating&hotelName&sort&order",view:"/:country/:location/:slug,:propertyCode?from&to&guests",params:{from:"du",to:"au",guests:"chambres",rating:"categorie",hotelName:"hotel",sort:"tri",order:"ordre"}};a.enabled(!1),e.hashPrefix("!"),b.state("blank",{url:f.blank,templateUrl:"hermes-lodge-search",controller:"lodge_SearchCtrl"}).state("search",{url:f.search,templateUrl:"hermes-lodge-search",controller:"lodge_SearchCtrl"}).state("view",{url:"/hotel/:propertyCode?from&to&rooms",templateUrl:"hermes-lodge-view",controller:"lodge_ViewCtrl",reloadOnSearch:!1}).state("viewSlug",{url:f.view,templateUrl:"hermes-lodge-view",controller:"lodge_ViewCtrl",reloadOnSearch:!1}),c.otherwise(f.blank),d.defaults.headers.common.Accept="application/json"}]),angular.module("lodge").controller("lodge_MapCtrl",["$scope","$log","$state","$stateParams","settings","$http","$location","$rootScope",function(a,b,c,d,e,f,g,h){function i(b,c){a.selectedHotel=c.model.hotel}var j=[];a.result.items.forEach(function(a){void 0!==a.coordinates&&j.push({lat:a.coordinates[0],lng:a.coordinates[1],compileMessage:!1,message:a.name,hotel:a})}),angular.extend(a,{center:{lat:j[0].lat,lng:j[0].lng,zoom:10},markers:j,selectedHotel:!1}),a.$on("leafletDirectiveMarker.click",i)}]),angular.module("lodge").controller("lodge_QuoteCtrl",["$scope","$log","$state","$stateParams","$location","$http","lodgeQuery","$window","settings","$timeout","$filter","$rootScope",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(b,c){if(b!=c){for(var d=a.propertyQuery.rooms;d.length<b;)d.push({adults:2,children:0,ages:[]});d.length=b}}function n(b){for(var c=b.children,d=b.ages;d.length<c;)d.push({}),a.propertyQuery.childCount++;for(;d.length>c;)d.pop(),a.propertyQuery.childCount--}function o(b,c){b.preventDefault(),b.stopPropagation();var d=a.toggleCalendars[c];a.toggleCalendars={},a.toggleCalendars[c]=!d}function p(){var b=a.propertyQuery,c=g.toLocation(b,!0),d=g.toApi(b,!0);e.search(c.search),a.status="loading",f.get(i.quotes.index,{params:d}).success(q).error(r)}function q(b){if(console.log("onQuotesLoaded.....................",b),b=JSOG.decode(b),0===b.quotes.length)return a.emit("lodgeRoomsUnavailable",a.propertyQuery),void(a.stay={});for(var c=b.quotes.reduce(s,[]),d=b.orderTemplate,e=d.trip.segments[0].rooms,f=e.length;f--;)d.items.unshift({type:"lodge",room:e[f],choices:t(e[f],c)});angular.extend(a,{stay:{checkin:d.trip.segments[0].checkin,checkout:d.trip.segments[0].checkout},cart:d,currentItem:d.items[0],status:"found"})}function r(){b.debug("onQuotesError",arguments),a.$emit("lodgeQuoteError",a.propertyQuery),a.status="error"}function s(a,b){for(var c,d=b.product.occupancy,e=b.product.roomType,f=b.product.board,g=a.length;g--&&!c;)a[g].occupancy===d&&(c=a[g]);void 0===c&&(c={occupancy:d,rooms:{}},a.push(c));var h=c.rooms[e.name];return h||(c.rooms[e.name]={room:e,boards:{}},h=c.rooms[e.name]),h.boards[f.code]||(h.boards[f.code]={board:f,quotes:[]}),h.boards[f.code].quotes.push(b),a}function t(a,b){for(var c,d=a.occupancy,e=b.length;e--&&!c;)if(b[e].occupancy===d)return b[e].rooms;return null}function u(b){var c=["type","room","choices"];angular.forEach(b,function(a,d){-1===c.indexOf(d)&&delete b[d]}),a.currentItem=b,a.readyToBook=!1}function v(b,c){angular.extend(b,c);var d=a.cart.items.filter(function(a){return"lodge"===a.type&&void 0===a.product});a.currentItem=d[0],a.readyToBook=0===d.length,l.okToBook=!0,w()}function w(){for(var b=a.cart.items,c=b.length,d=0;c--;)d+=100*b[c].totals.total;a.cart.totals.total=d/100}function x(){a.cart.trip.segments[0].property.name=d.slug,a.cart.trip.segments[0].property.address={country:d.country,location:d.location},a.cart.items.forEach(function(a){delete a.choices,a.room&&(a.travellers=a.room.guests)});var c=JSOG.encode(a.cart);c.items.forEach(function(a){delete a.room}),f.post("/carts",c).then(function(b){angular.isArray(b.data)&&(b.data=b.data[0]),h.location.href="/ngapps/checkout#/"+b.data._id,a.$emit("lodgeBookCartSaved",b.data)},function(){b.error("cart saving failed",arguments),a.status="error",a.error="Un problème est survenu lors du passage à la page paiement."})}b.debug("in_lodge_QuoteCtrl",l.property,d);var y=angular.extend({maxStay:30,minStay:1},i.options);l.okToBook=!1,y.minCheckin=moment().startOf("day").add(y.daysToMinCheckin||0).toDate(),y.maxCheckout=moment(y.minCheckin).add(y.monthsToMaxCheckout||10).toDate(),y.maxCheckin=moment(y.maxCheckout).subtract(y.minStay,"days"),d.from&&d.to?(a.status="loading",g.fromStateParam(d).then(function(c){b.debug("lodge_QuoteCtrl......",c),a.$emit("lodgePropertyQuery",c),a.propertyQuery=c;var d=g.toApi(c,!0);b.debug("lodge_QuoteCtrl",d),f.get(i.quotes.index,{params:d}).success(q).error(r)})):(a.status="blank",a.propertyQuery={property:d.propertyCode,childCount:0,roomCount:1,rooms:[{adults:2,children:0,ages:[]}]}),angular.extend(a,{options:y,getQuotes:p,promptForOffer:u,chooseOffer:v,toCheckout:x,childCountUpdated:n,toggleCalendar:o,toggleCalendars:{}}),a.$watch("propertyQuery.roomCount",m)}]),angular.module("lodge").controller("lodge_SearchFormCtrl",["$scope","$http","$window","$location","$log","settings","lodgeQuery","$rootElement","$document",function(a,b,c,d,e,f,g,h,i){function j(){var b;a.date2&&(b=a.date2.split("--")),a.query&&(a.query.checkin=b[0],a.query.checkout=b[1])}function k(){var b;a.date1&&(b=a.date1.split("--")),a.query&&(a.query.checkin=m(b[0]),a.query.checkout=m(b[1]))}function l(b){var c=0;angular.forEach(a.query.rooms,function(a){c+=a.adults}),a.roomInput="chambres "+a.query.roomCount+" ,Adultes "+c+" ,Enfant "+a.query.childCount,a.roomDiv=!a.roomDiv}function m(a){var b=a.split("/");return new Date(b[2],b[1]-1,b[0]).toLocaleDateString("en-US")}function n(b,c){if(b!=c){for(var d=a.query.rooms;d.length<b;)d.push({adults:2,children:0,ages:[]});for(;d.length>b;)d.pop()}}function o(b){e.debug("childCountUpdated",b);var c=b.children,d=b.ages,f=d.length;for(a.query.childCount-=f;d.length<c;)d.push({});for(;d.length>c;)d.pop();a.query.childCount+=c}function p(a){return b.get(f.destinations.search.replace(":term",a)).then(function(a){return a.data})}function q(){var b=a.query;if(void 0!==b.destination){var e=g.toLocation(b);if("search"===a.context){d.path("/recherche"+e.path);var h=d.search();h=angular.extend(h,e.search),d.search(e.search)}else{var i=[];angular.forEach(e.search,function(a,b){if("guests"==b)for(var c=0;c<e.search.guests.length;c++)i.push(b+"="+e.search.guests[c]);else i.push(b+"="+e.search[b])}),c.location.href=f.lodge.salesApp+"#!/recherche"+e.path+"?"+i.join("&")}}}function r(b,c){b.preventDefault(),b.stopPropagation(),a.toggleCalendars[c]=!a.toggleCalendars[c]}var s=moment().startOf("day"),t=angular.element(h.find("meta[name=description]")[0]);t.attr("content","hotel"),t.attr("charset","UTF-8");var u={adults:[1,2,3,4],children:[0,1,2,3,4],ages:[1,2,3,4,5,6,7,8,9,10,11],roomCount:[1,2,3,4,5,6],minCheckin:s.toDate(),maxCheckin:moment(s).add(12,"months").toDate(),checkin:{minDate:s.toDate(),minMonth:moment(s).startOf("month").toDate(),maxDate:moment(s).add(1,"years").toDate(),initDate:"options.checkin.minMonth"},checkout:{initDate:"options.checkout.minMonth"}};a.roomDiv=!1,a.roomInput="Chambre - Adultes ...",i.bind("click",function(b){"inputDivRooms"===b.target.id||"guests__inputs divRooms ng-scope"===b.target.className||!0!==a.roomDiv||b.target.classList.contains("divRoomsInputs")||b.target.nextSibling.classList.contains("divRoomsInputs")||(a.roomDiv=!a.roomDiv,a.$apply())}),u.checkout.minDate=moment(s).add(1,"days").toDate(),u.checkout.minMonth=moment(u.checkout.minDate).startOf("month").toDate(),u.checkout.initDate="options.checkout.minMonth",u.checkout.maxDate=moment(u.checkout.minDate).add(1,"years").toDate(),a.context,f.lodge.standaloneSearchForm&&(a.query={childCount:0,roomCount:1,rooms:[{adults:2,children:0,ages:[]}],rating:[]}),a.$watch("query.roomCount",n),angular.extend(a,{destinations:p,SimplePickerChange:k,roomChange:l,options:u,search:q,childCountUpdated:o,toggleCalendar:r,toggleCalendars:{},changesDateSearch:j}),a.rangeDatePickerLodge={date:{startDate:moment().subtract(1,"days"),endDate:moment()},picker:null,options:{pickerClasses:"custom-display",buttonClasses:"btn",applyButtonClasses:"btn-primary",cancelButtonClasses:"btn-danger",minDate:moment(),locale:{applyLabel:"valider",cancelLabel:"annuler",customRangeLabel:"Custom range",separator:" - ",format:"DD/MM/YYYY",weekLabel:"S",daysOfWeek:["Di","Lu","Ma","Me","Je","Ve","Sa"],monthNames:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Decembre"],firstDay:1},eventHandlers:{"apply.daterangepicker":function(b,c){a.query.checkin=a.rangeDatePickerLodge.date.startDate,a.query.checkout=a.rangeDatePickerLodge.date.endDate}}}}}]),angular.module("lodge").controller("lodge_SearchCtrl",["$scope","$log","$state","$stateParams","$http","lodgeQuery","$window","$location","$timeout","settings","$translate","$rootElement",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(b){b.value=!b.value;var c=a.filters.categories,d=[];for(var e in c)"any"!==e&&!0===c[e].value&&d.push(e);0===d.length?h.search("rating",null):h.search("rating",d.join("+"))}function n(b){a.query=b,C=a.query;for(var c in a.filters.categories)C.rating.indexOf(c)>-1&&(a.filters.categories[c].value=!0);C.bmin&&(a.filters.budget=C.bmin+500),a.$emit("lodgeSearchQuery",C),p()}function o(c){b.error(c),a.error=c}function p(){var b=a.query;b.limit=b.limit||E,a.status="searching",b.api||(b.api=f.toApi(b),b.sent=0),b.skip>0&&(b.api.skip=b.skip),e.get(j.quotes.index,{params:b.api}).success(q).error(s)}function q(b,c){var d=a.query;if(d.sent++,202===c)d.sent<40?D=i(p,1e3):r();else if(205===c)a.status="empty",delete d.sent,delete d.api;else if(200===c){var e=JSOG.decode(b),g=f.toLocation(d);angular.forEach(e.items,function(a){t(a,g)}),d.skip>0?Array.prototype.push.apply(a.result.items,e.items):a.result=e,a.hasMore=e.links&&void 0!==e.links.next,0===a.result.items.length?(a.status="empty",delete d.sent,delete d.api):a.status="found"}}function r(){b.error(new Error("search result timeout")),a.status="timeout",delete C.sent,delete C.api}function s(){b.error("Search Error",arguments),a.status="error"}function t(a,b){a.links=a.links||{},a.links.self="#!/"+_.str.slugify(a.address.country.name||a.address.country.code)+"/"+_.str.slugify(a.address.locality.name)+"/"+_.str.slugify(a.name)+","+a.code,a.sref=angular.extend({country:_.str.slugify(a.address.country.name||a.address.country.code),location:_.str.slugify(a.address.locality.name),slug:_.str.slugify(a.name),propertyCode:a.code},b.search)}function u(){if(!a.hasMore||["searching","empty"].indexOf(a.status)>-1)return!1;a.query.skip=a.result.items.length,a.query.limit=E,p()}function v(b){a.viewMode="map"===b?"map":"list"}function w(a){h.search("order",a.order||null),h.search("sort",a.code)}function x(a){var b=parseInt(a,10);if(angular.isNumber(b)){var c=Math.max(b-500,0);h.search("bmin",c),h.search("bmax",c+1e3)}}function y(a){a.length>1&&h.search("hotelName",a)}function z(){a.query.checkout=moment(a.query.checkin).add(a.query.nights,"days").format("YYYY-MM-DD")}function A(){a.query.nights=moment(a.query.checkout).diff(moment(a.query.checkin),"days")}var B=angular.element(l.find("meta[name=description]")[0]);B.attr("content","machin -----"),B.attr("charset","UTF-8");var C,D,E=30;a.countryCode=d.country;var F=[{code:"recommended",label:k.instant("recommended"),checked:!1},{code:"price",label:k.instant("sort-price-desc"),order:"desc",checked:!1},{code:"price",label:k.instant("sort-price-asc"),order:"asc",checked:!1},{code:"category",label:k.instant("sort-category-desc"),order:"desc",checked:!1},{code:"category",label:k.instant("sort-category-asc"),order:"asc",checked:!1}],G=[{code:"recommended",label:"Recommandé",checked:!1},{code:"price",label:"Prix décroissant",order:"desc",checked:!1},{code:"price",label:"Prix croissant",order:"asc",checked:!1},{code:"category",label:"Catégorie décroissante",order:"desc",checked:!1},{code:"category",label:"Catégorie croissante",order:"asc",checked:!1}],H={categories:{any:{label:k.instant("all"),value:!0},"1ST":{label:k.instant("1 star"),value:!1},"2ST":{label:k.instant("2 stars"),value:!1},"3ST":{label:k.instant("3 stars"),value:!1},"4ST":{label:k.instant("4 stars"),value:!1},"5ST":{label:k.instant("5 stars"),value:!1}}};if(angular.extend(a,{context:"search",loadMore:u,sortChange:w,budgetChange:x,hotelNameChange:y,categoriesChange:m,stateParams:d,nightsChanged:z,checkoutChanged:A,setViewMode:v,viewMode:"list"}),c.includes("search")?(f.fromStateParam(d).then(n,o),a.status="searching"):(a.status="blank",a.query={childCount:0,roomCount:1,rooms:[{adults:2,children:0,ages:[]}],nights:1,rating:[]}),d.sort||d.order){for(var I=0;I<F.length;I++)F[I].code===d.sort&&F[I].order===d.order&&(F[I].checked=!0,G[I].checked=!0);a.sorters=F,a.sortersfr=G}else a.sorters=F,a.sortersfr=G;if(d.rating){var J=d.rating.split("+");H.categories.any.value=!1;for(var K in H.categories)J.indexOf(K)>-1&&(H.categories[K].value=!0);a.filters=H}else a.filters=H;a.hasMore=!1,a.rangeDatePicker={picker:null,options:{pickerClasses:"custom-display",buttonClasses:"btn",applyButtonClasses:"btn-primary",cancelButtonClasses:"btn-danger",minDate:moment(),locale:{applyLabel:"valider",cancelLabel:"annuler",customRangeLabel:"Custom range",separator:" - ",format:"DD/MM/YYYY",weekLabel:"S",daysOfWeek:["Di","Lu","Ma","Me","Je","Ve","Sa"],monthNames:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Decembre"],firstDay:1},eventHandlers:{"apply.daterangepicker":function(b,c){a.query.checkin=a.rangeDatePicker.date.startDate,a.query.checkout=a.rangeDatePicker.date.endDate}}}},void 0!==d&&d.from&&d.to?a.rangeDatePicker.date={startDate:d.from,endDate:d.to}:a.rangeDatePicker.date={startDate:moment().subtract(1,"days"),endDate:moment()}}]),angular.module("lodge").controller("lodge_ViewCtrl",["$scope","$log","$state","$stateParams","settings","$sce","lodgeQuery","$http","$location","$anchorScroll","$rootScope","$timeout","$filter",function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(c){b.debug("lodge_ViewCtrl: onPropertyLoaded",c),c.rating.tripAdvisor&&(c.links=c.links||{},c.links.reviews=f.trustAsUrl(t.replace(":taId",c.rating.tripAdvisor.id))),c.description?(c.summary=c.description.content,c.description=c.area?c.area.content:void 0):c.area&&(c.summary=c.area.content),c.roomInfo&&(c.description?c.description=c.roomInfo.content:c.description+=c.roomInfo.content),c.photos.forEach(function(a,b){a.href=0==b?a.href.replace("320x180","1920x1000"):a.href.replace("320x180","1200x800")}),a.property=c,a.pdfImage="https:"+c.photos[0].href;var d=[{lat:c.coordinates[0],lon:c.coordinates[1],name:c.name}];angular.extend(a,{center:{lat:c.coordinates[0],lon:c.coordinates[1],zoom:16},markers:d}),document.title=k.title=c.name+" "+c.address.locality.name,a.$emit("lodgePropertyView",c)}function o(c,d){new Error("Could not load property description.").number=d,b.error("Could not load property description.",arguments),a.error="Erreur lors du chargement de l'hotel. Veuillez réessayer plus tard"}function p(a){i.hash(a),j()}function q(){console.log("generate program as pdf"),a.loadingProgram=!0,kendo.pdf.defineFont({"DejaVu Sans":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans.ttf","DejaVu Sans|Bold":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Bold.ttf","DejaVu Sans|Bold|Italic":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Oblique.ttf","DejaVu Sans|Italic":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Oblique.ttf"}),kendo.drawing.drawDOM("#program",{template:$("#page-template").html(),paperSize:"A4",margin:"1cm",scale:.5,forcePageBreak:".page-break",multiPage:!0}).then(function(b){console.log(" ending generating pdf"),u=b;var c=m("date")(new Date,"yyyy-MM-dd");kendo.drawing.pdf.saveAs(u,"détail "+a.property.name+"-"+c+".pdf"),a.loadingProgram=!1,a.$apply()})}function r(){q()}function s(){a.loadingTarif=!0;var b=m("date")(a.currentDate,"yyyy-MM-dd");kendo.pdf.defineFont({"DejaVu Sans":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans.ttf","DejaVu Sans|Bold":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Bold.ttf","DejaVu Sans|Bold|Italic":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Oblique.ttf","DejaVu Sans|Italic":"https://kendo.cdn.telerik.com/2016.1.112/styles/fonts/DejaVu/DejaVuSans-Oblique.ttf"}),console.log(" in generate tarifs as pdf"),l(function(){kendo.drawing.drawDOM("#tarifs",{paperSize:"A4",margin:"1cm",scale:.7}).then(function(c){kendo.drawing.pdf.saveAs(c,"devis "+a.property.name+"-"+b+".pdf"),a.loadingTarif=!1,a.$apply()})},10)}b.debug("lodge_ViewCtrl: init"),console.log("in lodge view controller");var t="//www.tripadvisor.com/WidgetEmbed-cdspropertydetail?locationId=:taId&partnerId=2329B67D74EA4BE5BBF080EB6AA6B31D&lang=fr_FR&display=true",u=null;h.get(e.properties.index+"/"+d.propertyCode).success(n).error(o),angular.extend(a,{scrollTo:p,context:"search",status:"searching",generatePDF:r,loadingProgram:!1,generatePdfTarifs:s,loadingTarif:!1}),a.currentDate=new Date}]),angular.module("lodge").controller("RoomsInputCtrl",["$scope","$attrs","$log",function(a,b,c){function d(b,c){return console.log(a.$parent.$eval(b)),angular.isDefined(b)?a.$parent.$eval(b):c}function e(){return{adults:2,children:[]}}for(var f={maxRooms:d(b.maxRooms,4),maxGuests:d(b.maxGuests,8),maxChildren:d(b.maxChildren,4),maxAdults:d(b.maxAdults,4),minAdults:d(b.minAdults,1),adultAge:d(b.adultAge,12)},g={roomCount:[],childAge:[],childCount:[],adultCount:[]},h=1;h<=f.maxRooms;)g.roomCount.push(h),h++;for(h=1;h<f.adultAge;)g.childAge.push(h),h++;for(h=f.minAdults;h<f.maxAdults;)g.adultCount.push(h),h++;for(h=0;h<=f.maxChildren;)g.childCount.push(h),h++;a.options=g,a.roomCountChange=function(b){for(;this.rooms.length<b;)this.rooms.push(e()),this.childCount.push(0);for(;this.rooms.length>b;){var c=this.rooms.pop();this.hasChildren-=c.children.length}a.change()},a.childCountChange=function(b,c){for(;b.children.length<c;)b.children.push({age:void 0}),a.hasChildren++;for(;b.children.length>c;)b.children.pop(),a.hasChildren--}}]).directive("roomsInput",["$parse","$log",function(a,b){return{restrict:"EA",replace:!0,template:'<div class="rooms-input" ng-class="{ in: isOpen(), fade: animation() }" style="max-width:300px"><select class="form-control" ng-options="count as (count + \' Chambre(s)\') for count in options.roomCount" ng-required ng-model="roomCount" ng-change="roomCountChange(roomCount)" ></select><table class="table table-condensed"><tr><th>Chambre</th><th>Adultes</th><th>Enfants</th><th ng-if="hasChildren > 0">Ages des enfants</th></tr><tr ng-repeat="room in rooms"><td>{{$index + 1}}</td><td><select class="form-control input-sm" ng-options="count for count in options.adultCount " ng-model="room.adults" style="margin-bottom: 0;display: inline;width: auto;"></select></td><td><select class="form-control input-sm" ng-options="count for count in options.childCount " ng-model="childCount[$index]" ng-change="childCountChange(room, childCount[$index])" style="margin-bottom: 0;display: inline;width: auto;"></select></td><td ng-if="hasChildren > 0"><select class="form-control input-sm" ng-repeat="child in room.children" ng-options="age as (age + \' an(s)\') for age in options.childAge" ng-model="child.age" ng-required style="margin-bottom: 0;display: inline;width: auto;"></select></td></tr></table></div>',scope:{roomCount:"&"},require:["roomsInput","^ngModel","?maxRooms"],controller:"RoomsInputCtrl",link:function(a,b,c,d){function e(){a.rooms=f.$modelValue,a.rooms=f.$modelValue,a.roomCount=a.rooms.length,a.childCount=[],a.hasChildren=0;for(var b=0;b<a.rooms.length;b++)a.childCount.push(a.rooms[b].children.length),a.hasChildren+=a.rooms[b].children.length}var f=(d[0],d[1]);a.change=function(){f.$setViewValue(a.rooms),f.$setValidity("rooms",!0)},f.$render=function(){e()},e()}}}]).directive("roomsInputPopup",["$compile","$parse","$document","$position","$filter",function(a,b,c,d,e){return{restrict:"EA",require:"^ngModel",link:function(f,g,h,i){function j(a){p?p(f,!!a):m.isOpen=!!a}function k(){m.position=n?d.offset(g):d.position(g),m.position.top=m.position.top+g.prop("offsetHeight")}var l,m=f.$new(),n=!0;h.$observe("roomsInputPopup",function(a){l=m.$watch("rooms",function(){i.$render()},!0)}),f.$on("$destroy",function(){x.remove(),l(),m.$destroy()});var o,p;h.isOpen&&(o=b(h.isOpen),p=o.assign,f.$watch(o,function(a){m.isOpen=!!a})),m.isOpen=!!o&&o(f);var q=function(a){m.isOpen&&a.target!==g[0]&&m.$apply(function(){j(!1)})},r=function(){m.$apply(function(){j(!0)})},s=angular.element("<div rooms-input-popup-wrap><div rooms-input></div></div>");s.attr({"ng-model":"rooms"});var t=angular.element(s.children()[0]),u={};h.roomsInputOptions&&(u=f.$eval(h.roomsInputOptions),t.attr(angular.extend({},u))),i.$render=function(){var a=i.$viewValue?e("humanizeRooming")(i.$modelValue):"";g.html(a+' | <span class="caret"></span>'),m.rooms=i.$modelValue};var v=!1,w=!1;m.$watch("isOpen",function(a){a?(k(),c.bind("click",q),w&&(g.unbind("focus",r),g.unbind("click",r)),g[0].focus(),v=!0):(v&&c.unbind("click",q),g.bind("focus",r),g.bind("click",r),w=!0),p&&p(f,a)});var x=a(s)(m);c.find("body").append(x)}}}]).directive("roomsInputPopupWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,template:"<ul class=\"dropdown-menu rooms-input-popup\" style=\"padding: 10px\" ng-style=\"{display: (isOpen && 'block') || 'none', top: position.top+'px', left: position.left+'px'}\"><li ng-transclude></li></ul>",link:function(a,b,c){b.bind("click",function(a){a.preventDefault(),a.stopPropagation()})}}}).filter("humanizeRooming",["$translate",function(a){return function(b){for(var c=0,d=0,e=b.length,f=b.length-1;f>=0;f-=1)c+=b[f].adults,d+=b[f].children.length;return d>0?a("r-rooms-a-adults-c-children",{r:e,a:c,c:d}):a("r-rooms-a-adults",{r:e,a:c})}}]),angular.module("ui.bootstrap.datepicker").controller("DatepickerController",["$scope","$attrs","$parse","$interpolate","$timeout","$log","dateFilter","datepickerConfig",function(a,b,c,d,e,f,g,h){var i=this,j={$setViewValue:angular.noop};this.modes=["day","month","year"],angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle","minMode","maxMode","showWeeks","startingDay","yearRange"],function(c,e){i[c]=angular.isDefined(b[c])?e<8?d(b[c])(a.$parent):a.$parent.$eval(b[c]):h[c]}),angular.forEach(["minDate","maxDate"],function(d){b[d]?a.$parent.$watch(c(b[d]),function(a){i[d]=a?new Date(a):null,i.refreshView()}):i[d]=h[d]?new Date(h[d]):null}),angular.isDefined(b.initDate)&&(console.log(b.initDate,c(b.initDate)),a.$parent.$watch(c("$parent.$parent."+b.initDate),function(a){console.log("initdare "+a),j.$modelValue||(i.activeDate=a?new Date(a):new Date,i.refreshView())})),a.datepickerMode=a.datepickerMode||h.datepickerMode,a.uniqueId="datepicker-"+a.$id+"-"+Math.floor(1e4*Math.random()),this.activeDate=angular.isDefined(b.initDate)?a.$parent.$eval(b.initDate):new Date,a.isActive=function(b){return 0===i.compare(b.date,i.activeDate)&&(a.activeDateId=b.uid,!0)},this.init=function(a){j=a,j.$render=function(){i.render()}},this.render=function(){if(j.$modelValue){var a=new Date(j.$modelValue),b=!isNaN(a);b?this.activeDate=a:f.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'),j.$setValidity("date",b)}this.refreshView()},this.refreshView=function(){if(this.element){this._refreshView();var a=j.$modelValue?new Date(j.$modelValue):null;j.$setValidity("date-disabled",!a||this.element&&!this.isDisabled(a))}},this.createDateObject=function(c,d){var e=j.$modelValue?new Date(j.$modelValue):null;return{date:c,label:g(c,d),selected:e&&0===this.compare(c,e),disabled:this.isDisabled(c),current:0===this.compare(c,new Date),classes:b.dateClasses&&a.dateClasses({date:c,mode:a.datepickerMode})||""}},this.isDisabled=function(c){return this.minDate&&this.compare(c,this.minDate)<0||this.maxDate&&this.compare(c,this.maxDate)>0||b.dateDisabled&&a.dateDisabled({date:c,mode:a.datepickerMode})},this.split=function(a,b){for(var c=[];a.length>0;)c.push(a.splice(0,b));return c},a.select=function(b){if(a.datepickerMode===i.minMode){var c=j.$modelValue?new Date(j.$modelValue):new Date(0,0,0,0,0,0,0);c.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),j.$setViewValue(c),j.$render()}else i.activeDate=b,a.datepickerMode=i.modes[i.modes.indexOf(a.datepickerMode)-1]},a.move=function(a){var b=i.activeDate.getFullYear()+a*(i.step.years||0),c=i.activeDate.getMonth()+a*(i.step.months||0);i.activeDate.setFullYear(b,c,1),i.refreshView()},a.toggleMode=function(b){b=b||1,a.datepickerMode===i.maxMode&&1===b||a.datepickerMode===i.minMode&&-1===b||(a.datepickerMode=i.modes[i.modes.indexOf(a.datepickerMode)+b])},a.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var k=function(){e(function(){i.element[0].focus()},0,!1)};a.$on("datepicker.focus",k),a.keydown=function(b){var c=a.keys[b.which];if(c&&!b.shiftKey&&!b.altKey)if(b.preventDefault(),b.stopPropagation(),"enter"===c||"space"===c){if(i.isDisabled(i.activeDate))return;a.select(i.activeDate),k()}else!b.ctrlKey||"up"!==c&&"down"!==c?(i.handleKeyDown(c,b),i.refreshView()):(a.toggleMode("up"===c?1:-1),k())}}]),angular.module("lodge").filter("lodgeRating",function(){var a={"1ST":"","2ST":"","3ST":"","4ST":"","5ST":"",RSD:"Résidence",riad:"Riad",NA:""},b={"1ST":":1EST:HS:H1_5:CAMP1:HSR1:APTH:1LL:AT1:1:","2ST":":2EST:HS2:H2S:HR2:2LL:HSR2:H2_5:APTH2:AT2:CAMP2:2:","3ST":":3EST:HS3:BB3:HR3:AT3:3LL:APTH3:H3S:H3_5:3:","4ST":":4EST:SUP:4LL:APTH4:H4_5:HS4:BB4:HR4:4LUX:HRS:4:","5ST":":5EST:BB5:HIST:APTH5:5LUX:HR5:H5_5:5LL:HS5:5:",RSD:":23:24:25:",riad:":16:",NA:":-1:161:26:"};return function(c){if(!c)return"";if(c.code)for(var d in b)if(b[d].indexOf(":"+c.code+":")>-1)return a[d];return c.name||c.code}}),angular.module("lodge").filter("money",["$filter",function(a){var b={MAD:"Dh",EUR:"€",USD:"$"};return function(c,d){var e=c.split(" ");return a("number")(e[0],0)+" "+b[e[1]]}}]),angular.module("lodge").filter("rooming",["$translate",function(a){function b(b,c,d){return 1===b?a.instant(c):a.instant(d,{n:b})}return function(c){if(!angular.isArray(c)||0===c.length)return"";var d=c.reduce(function(a,b){return a+b.adults},0),e=c.reduce(function(a,b){return a+b.ages.length},0),f={rooms:b(c.length,"one-room","n-room"),adults:b(d,"one-adult","n-adult"),children:b(e,"one-child","n-child")};return e>0?a.instant("rooms-adults-children",f):a.instant("rooms-adults",f)}}]).filter("money",function(){return function(a){return angular.isString(a)&&(a=a.split(" ")),a[0]=Math.round(parseFloat(a[0])),angular.isArray(a)?a[0]+" "+a[1]:a}}).filter("guests",function(){function a(a,b,c){return 1===a?b:c.replace(":count",a)}return function(b){for(var c=0,d=[],e=b.length;e--;)b[e].age?d.push(b[e].age):c++;var f="";if(f+=a(c,"un adulte",":count adultes"),d.length>0){var g=d.map(function(b){return a(b,"1 an",":count ans")});f+=", "+a(d.length,"un enfant",":count enfants"),f+=" ("+g.join(", ")+")"}return f}}),function(){var a,b;return a={},b=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},a.encode=function(a,c,d){var e,f,g,h;h=1,g={},f=function(a){return a.__jsogObjectId||(a.__jsogObjectId=""+h++),a.__jsogObjectId},e=function(a){var c,d;return d=function(a){var b,c,d,h;if(b=f(a),g[b])return g[b].__jsogUsed=!0,{"@ref":b};d=g[b]={"@id":b};for(c in a)h=a[c],"__jsogObjectId"!==c&&(d[c]=e(h));return d},c=function(a){var b;return function(){var c,d,f;for(f=[],c=0,d=a.length;c<d;c++)b=a[c],f.push(e(b));return f}()},null==a?a:b(a)?c(a):"object"==typeof a?d(a):a};var i=e(a);for(var j in g)g[j].__jsogUsed?delete g[j].__jsogUsed:delete g[j]["@id"];return i},a.decode=function(a){var c,d;return d={},(c=function(a){var e,f;return f=function(a){var b,e,f,g,h;if(f=a["@ref"],null!=f&&(f=f.toString()),null!=f)return d[f];g={},b=a["@id"],null!=b&&(b=b.toString()),b&&(d[b]=g);for(e in a)h=a[e],"@id"!==e&&(g[e]=c(h));return g},e=function(a){var b;return function(){var d,e,f;for(f=[],d=0,e=a.length;d<e;d++)b=a[d],f.push(c(b));return f}()},null==a?a:b(a)?e(a):"object"==typeof a?f(a):a})(a)},a.stringify=function(b){return JSON.stringify(a.encode(b))},a.parse=function(b){return a.decode(JSON.parse(b))},"undefined"!=typeof module&&null!==module&&module.exports&&(module.exports=a),"undefined"!=typeof window&&null!==window&&(window.JSOG=a),"function"==typeof define&&define.amd&&define("JSOG",[],function(){return a}),a}.call(this),angular.module("lodge").factory("lodgeQuery",["$q","$http","settings",function(a,b,c){function d(a){var b=a.split(","),c=parseInt(b.shift(),10),d=b.map(function(a){return{v:parseInt(a,10)}});return{adults:c,ages:d,children:d.length}}function e(e){angular.isArray(e.guests)||(e.guests=[e.guests]);for(var f,g=moment(e.from||"invalid","YYYY-MM-DD"),h=moment(e.to||"invalid","YYYY-MM-DD"),i=e.guests.slice(),j=e.country,k=e.destination,l={rooms:[],roomCount:0,childCount:0},m=a.defer();i[0];)f=d(i.shift()),l.rooms.push(f),l.childCount+=f.children;return l.roomCount=l.rooms.length,g.isValid()&&h.isValid()&&g.isBefore(h)?(l.checkin=g.toDate(),l.checkout=h.toDate()):(l.noDates=!0,l.checkin=moment().add(7,"days").toDate(),l.checkout=moment().add(8,"days").toDate()),e.propertyCode?(l.property=e.propertyCode,m.resolve(l),m.promise):(l.rating=[],e.rating&&(l.rating=e.rating.split("+")),e.hotelName&&(l.hotelName=e.hotelName),l.sort=e.sort||"recommended",l.order=e.order||"desc",isNaN(e.bmin)||(l.bmin=parseInt(e.bmin,10),l.bmax=l.bmin+1e3),j&&k?(console.log("ehehehehehehehehehehehe",c.destinations.index),b.get(c.destinations.index+"&code="+k).success(function(a){l.destination=a,m.resolve(l)}).error(function(a){
m.reject(new Error("Unknown Destination"))})):m.resolve(l),m.promise)}function f(a){return a.v}function g(a,b){var c=a.rooms.reduce(function(a,b){var c=[b.adults].concat(b.ages.map(f));return a.push(c.join(",")),a},[]),d=moment(a.checkin).format("YYYY-MM-DD"),e=moment(a.checkout).format("YYYY-MM-DD"),g={search:{guests:c,from:d,to:e}};return b||void 0===a.destination||(g.path="/"+(a.destination.country.code?a.destination.country.code:a.destination.country)+"/"+a.destination.code),g}function h(a){var b={currency:"MAD",from:moment(a.checkin).format("YYYY-MM-DD"),to:moment(a.checkout).format("YYYY-MM-DD"),guests:a.rooms.map(function(a){return[a.adults].concat(a.ages.map(f)).join(",")})};if(a.property)return b.property=a.property,b;var c=a.destination.country.toLowerCase();return angular.extend(b,{skip:a.skip||0,limit:a.limit||25,country:c,locality:a.destination.code,order:a.order||"desc",sort:a.sort||"recommended"}),a.rating&&a.rating.length&&(b.rating=a.rating.join("+")),angular.forEach(["bmin","bmax","hotelName"],function(c){a[c]&&(b[c]=a[c])}),b}return{fromStateParam:e,toLocation:g,toApi:h}}])}();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment