Rewrote frontend with AngularJS framework.
This commit is contained in:
parent
8807c6ae01
commit
1e44d67b3f
881
src/html/angular/angular-strap.js
vendored
Normal file
881
src/html/angular/angular-strap.js
vendored
Normal file
@ -0,0 +1,881 @@
|
||||
/**
|
||||
* AngularStrap - Twitter Bootstrap directives for AngularJS
|
||||
* @version v0.6.4 - 2013-02-03
|
||||
* @link http://mgcrea.github.com/angular-strap
|
||||
* @author Olivier Louvignes
|
||||
* @license MIT License, http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
|
||||
angular.module('$strap.config', []).value('$strap.config', {});
|
||||
angular.module('$strap.filters', ['$strap.config']);
|
||||
angular.module('$strap.directives', ['$strap.config']);
|
||||
angular.module('$strap', ['$strap.filters', '$strap.directives', '$strap.config']);
|
||||
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsAlert', ['$parse', '$timeout', '$compile', function($parse, $timeout, $compile) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function postLink(scope, element, attrs) {
|
||||
|
||||
scope.$watch(attrs.bsAlert, function(newValue, oldValue) {
|
||||
|
||||
if(typeof newValue === 'undefined') {
|
||||
if(typeof oldValue !== 'undefined') {
|
||||
element.remove();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Set alert content
|
||||
element.html((newValue.title ? '<strong>' + newValue.title + '</strong> ' : '') + newValue.content || '');
|
||||
|
||||
// Compile alert content
|
||||
$timeout(function(){
|
||||
$compile(element.contents())(scope);
|
||||
});
|
||||
|
||||
// Add proper class
|
||||
if(newValue.type || oldValue.type) {
|
||||
oldValue.type && element.removeClass('alert-' + oldValue.type);
|
||||
newValue.type && element.addClass('alert-' + newValue.type);
|
||||
}
|
||||
|
||||
// Setup close button
|
||||
if(newValue.close !== false) {
|
||||
element.prepend('<button type="button" class="close" data-dismiss="alert">×</button>');
|
||||
}
|
||||
|
||||
}, true);
|
||||
|
||||
// For basic alerts
|
||||
if(!attrs.bsAlert && attrs.close !== '0') {
|
||||
element.prepend('<button type="button" class="close" data-dismiss="alert">×</button>');
|
||||
}
|
||||
|
||||
element.addClass('alert').alert();
|
||||
|
||||
// element.on('close', function() {
|
||||
// });
|
||||
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsButton', ['$parse', '$timeout', function($parse, $timeout) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: '?ngModel',
|
||||
link: function postLink(scope, element, attrs, controller) {
|
||||
|
||||
// If we have a controller (i.e. ngModelController) then wire it up
|
||||
if(controller) {
|
||||
|
||||
// Set as single toggler if not part of a btn-group
|
||||
if(!element.parent('[data-toggle="buttons-checkbox"], [data-toggle="buttons-radio"]').length) {
|
||||
element.attr('data-toggle', 'button');
|
||||
}
|
||||
|
||||
// Handle start state
|
||||
var startValue = !!scope.$eval(attrs.ngModel);
|
||||
if(startValue) {
|
||||
element.addClass('active');
|
||||
}
|
||||
|
||||
// Watch model for changes
|
||||
scope.$watch(attrs.ngModel, function(newValue, oldValue) {
|
||||
var bNew = !!newValue, bOld = !!oldValue;
|
||||
if(bNew !== bOld) {
|
||||
$.fn.button.Constructor.prototype.toggle.call(button);
|
||||
// Handle $q promises
|
||||
} else if(bNew && !startValue) {
|
||||
element.addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Support buttons without .btn class
|
||||
if(!element.hasClass('btn')) {
|
||||
element.on('click.button.data-api', function (e) {
|
||||
element.button('toggle');
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize button
|
||||
element.button();
|
||||
|
||||
// Bootstrap override to handle toggling
|
||||
var button = element.data('button');
|
||||
button.toggle = function() {
|
||||
|
||||
if(!controller) {
|
||||
return $.fn.button.Constructor.prototype.toggle.call(this);
|
||||
}
|
||||
|
||||
var $parent = element.parent('[data-toggle="buttons-radio"]');
|
||||
|
||||
if($parent.length) {
|
||||
element.siblings('[ng-model]').each(function(k, v) {
|
||||
$parse($(v).attr('ng-model')).assign(scope, false);
|
||||
});
|
||||
scope.$digest();
|
||||
if(!controller.$modelValue) {
|
||||
controller.$setViewValue(!controller.$modelValue);
|
||||
scope.$digest();
|
||||
}
|
||||
} else {
|
||||
scope.$apply(function () {
|
||||
controller.$setViewValue(!controller.$modelValue);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/*Provide scope display functions
|
||||
scope._button = function(event) {
|
||||
element.button(event);
|
||||
};
|
||||
scope.loading = function() {
|
||||
element.tooltip('loading');
|
||||
};
|
||||
scope.reset = function() {
|
||||
element.tooltip('reset');
|
||||
};
|
||||
|
||||
if(attrs.loadingText) element.click(function () {
|
||||
//var btn = $(this)
|
||||
element.button('loading')
|
||||
setTimeout(function () {
|
||||
element.button('reset')
|
||||
}, 1000)
|
||||
});*/
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}])
|
||||
|
||||
.directive('bsButtonsCheckbox', ['$parse', function($parse) {
|
||||
'use strict';
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: '?ngModel',
|
||||
compile: function compile(tElement, tAttrs, transclude) {
|
||||
tElement.attr('data-toggle', 'buttons-checkbox').find('a, button').each(function(k, v) {
|
||||
$(v).attr('bs-button', '');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}])
|
||||
|
||||
.directive('bsButtonsRadio', ['$parse', function($parse) {
|
||||
'use strict';
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: '?ngModel',
|
||||
compile: function compile(tElement, tAttrs, transclude) {
|
||||
|
||||
tElement.attr('data-toggle', 'buttons-radio');
|
||||
|
||||
// Delegate to children ngModel
|
||||
if(!tAttrs.ngModel) {
|
||||
tElement.find('a, button').each(function(k, v) {
|
||||
$(v).attr('bs-button', '');
|
||||
});
|
||||
}
|
||||
|
||||
return function postLink(scope, iElement, iAttrs, controller) {
|
||||
|
||||
// If we have a controller (i.e. ngModelController) then wire it up
|
||||
if(controller) {
|
||||
|
||||
iElement
|
||||
.find('[value]').button()
|
||||
.filter('[value="' + scope.$eval(iAttrs.ngModel) + '"]')
|
||||
.addClass('active');
|
||||
|
||||
iElement.on('click.button.data-api', function (ev) {
|
||||
scope.$apply(function () {
|
||||
controller.$setViewValue($(ev.target).closest('button').attr('value'));
|
||||
});
|
||||
});
|
||||
|
||||
// Watch model for changes
|
||||
scope.$watch(iAttrs.ngModel, function(newValue, oldValue) {
|
||||
if(newValue !== oldValue) {
|
||||
var $btn = iElement.find('[value="' + scope.$eval(iAttrs.ngModel) + '"]');
|
||||
$.fn.button.Constructor.prototype.toggle.call($btn.data('button'));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsButtonSelect', ['$parse', '$timeout', function($parse, $timeout) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: '?ngModel',
|
||||
link: function postLink(scope, element, attr, ctrl) {
|
||||
|
||||
var getter = $parse(attr.bsButtonSelect),
|
||||
setter = getter.assign;
|
||||
|
||||
// Bind ngModelController
|
||||
if(ctrl) {
|
||||
element.text(scope.$eval(attr.ngModel));
|
||||
// Watch model for changes
|
||||
scope.$watch(attr.ngModel, function(newValue, oldValue) {
|
||||
element.text(newValue);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Click handling
|
||||
var values, value, index, newValue;
|
||||
element.on('click', function onClick() {
|
||||
values = getter(scope);
|
||||
value = ctrl ? scope.$eval(attr.ngModel) : element.text();
|
||||
index = values.indexOf(value);
|
||||
newValue = index > values.length - 2 ? values[0] : values[index + 1];
|
||||
|
||||
scope.$apply(function() {
|
||||
element.text(newValue);
|
||||
if(ctrl) {
|
||||
ctrl.$setViewValue(newValue);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
// https://github.com/eternicode/bootstrap-datepicker
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsDatepicker', ['$timeout', function($timeout) {
|
||||
'use strict';
|
||||
|
||||
var isTouch = 'ontouchstart' in window && !window.navigator.userAgent.match(/PhantomJS/i);
|
||||
|
||||
var DATE_REGEXP_MAP = {
|
||||
'/' : '[\\/]',
|
||||
'-' : '[-]',
|
||||
'.' : '[.]',
|
||||
'dd' : '(?:(?:[0-2]?[0-9]{1})|(?:[3][01]{1}))',
|
||||
'd' : '(?:(?:[0-2]?[0-9]{1})|(?:[3][01]{1}))',
|
||||
'mm' : '(?:[0]?[1-9]|[1][012])',
|
||||
'm' : '(?:[0]?[1-9]|[1][012])',
|
||||
'yyyy' : '(?:(?:[1]{1}[0-9]{1}[0-9]{1}[0-9]{1})|(?:[2]{1}[0-9]{3}))(?![[0-9]])',
|
||||
'yy' : '(?:(?:[0-9]{1}[0-9]{1}))(?![[0-9]])'
|
||||
};
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: '?ngModel',
|
||||
link: function postLink(scope, element, attrs, controller) {
|
||||
//console.log('postLink', this, arguments); window.element = element;
|
||||
|
||||
var regexpForDateFormat = function(dateFormat, options) {
|
||||
options || (options = {});
|
||||
var re = dateFormat, regexpMap = DATE_REGEXP_MAP;
|
||||
/*if(options.mask) {
|
||||
regexpMap['/'] = '';
|
||||
regexpMap['-'] = '';
|
||||
}*/
|
||||
angular.forEach(regexpMap, function(v, k) { re = re.split(k).join(v); });
|
||||
return new RegExp('^' + re + '$', ['i']);
|
||||
};
|
||||
|
||||
var dateFormatRegexp = isTouch ? 'yyyy/mm/dd' : regexpForDateFormat(attrs.dateFormat || 'mm/dd/yyyy'/*, {mask: !!attrs.uiMask}*/);
|
||||
|
||||
// Handle date validity according to dateFormat
|
||||
if(controller) {
|
||||
controller.$parsers.unshift(function(viewValue) {
|
||||
//console.warn('viewValue', viewValue, dateFormatRegexp, dateFormatRegexp.test(viewValue));
|
||||
if (!viewValue || dateFormatRegexp.test(viewValue)) {
|
||||
controller.$setValidity('date', true);
|
||||
return viewValue;
|
||||
} else {
|
||||
controller.$setValidity('date', false);
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Support add-on
|
||||
var component = element.next('[data-toggle="datepicker"]');
|
||||
if(component.length) {
|
||||
component.on('click', function() { isTouch ? element.trigger('focus') : element.datepicker('show'); });
|
||||
}
|
||||
|
||||
// Use native interface for touch devices
|
||||
if(isTouch && element.prop('type') === 'text') {
|
||||
|
||||
element.prop('type', 'date');
|
||||
element.on('change', function(ev) {
|
||||
scope.$apply(function () {
|
||||
controller.$setViewValue(element.val());
|
||||
});
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
// If we have a controller (i.e. ngModelController) then wire it up
|
||||
if(controller) {
|
||||
element.on('changeDate', function(ev) {
|
||||
scope.$apply(function () {
|
||||
controller.$setViewValue(element.val());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Popover GarbageCollection
|
||||
var $popover = element.closest('.popover');
|
||||
if($popover) {
|
||||
$popover.on('hide', function(e) {
|
||||
var datepicker = element.data('datepicker');
|
||||
if(datepicker) {
|
||||
datepicker.picker.remove();
|
||||
element.data('datepicker', null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Create datepicker
|
||||
element.attr('data-toggle', 'datepicker');
|
||||
element.datepicker({
|
||||
autoclose: true,
|
||||
language: attrs.language || 'en'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsDropdown', ['$parse', '$compile', function($parse, $compile) {
|
||||
'use strict';
|
||||
|
||||
var slice = Array.prototype.slice;
|
||||
|
||||
var template = '' +
|
||||
'<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">' +
|
||||
'<li ng-repeat="item in items" ng-class="{divider: !!item.divider, \'dropdown-submenu\': !!item.submenu && item.submenu.length}">' +
|
||||
'<a ng-hide="!!item.divider" tabindex="-1" ng-href="{{item.href}}" ng-click="{{item.click}}" target="{{item.target}}" ng-bind-html-unsafe="item.text"></a>' +
|
||||
'</li>' +
|
||||
'</ul>';
|
||||
|
||||
var linkSubmenu = function(items, parent, scope) {
|
||||
var subitems, submenu, subscope;
|
||||
for (var i = 0, l = items.length; i < l; i++) {
|
||||
if(subitems = items[i].submenu) {
|
||||
subscope = scope.$new();
|
||||
subscope.items = subitems;
|
||||
submenu = $compile(template)(subscope);
|
||||
submenu = submenu.appendTo(parent.children('li:nth-child(' + (i+1) + ')'));
|
||||
asyncLinkSubmenu(subitems, submenu, subscope);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var asyncLinkSubmenu = function() {
|
||||
var args = slice.call(arguments);
|
||||
setTimeout(function() {
|
||||
linkSubmenu.apply(null, args);
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
restrict: 'EA',
|
||||
scope: true,
|
||||
link: function postLink(scope, element, attr) {
|
||||
|
||||
var getter = $parse(attr.bsDropdown);
|
||||
|
||||
scope.items = getter(scope);
|
||||
var dropdown = $compile(template)(scope);
|
||||
asyncLinkSubmenu(scope.items, dropdown, scope);
|
||||
dropdown.insertAfter(element);
|
||||
|
||||
element
|
||||
.addClass('dropdown-toggle')
|
||||
.attr('data-toggle', "dropdown");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsModal', ['$parse', '$compile', '$http', '$timeout', '$q', '$templateCache', function($parse, $compile, $http, $timeout, $q, $templateCache) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: true,
|
||||
link: function postLink(scope, element, attr, ctrl) {
|
||||
|
||||
var getter = $parse(attr.bsModal),
|
||||
setter = getter.assign,
|
||||
value = getter(scope);
|
||||
|
||||
$q.when($templateCache.get(value) || $http.get(value, {cache: true})).then(function onSuccess(template) {
|
||||
|
||||
// Handle response from $http promise
|
||||
if(angular.isObject(template)) {
|
||||
template = template.data;
|
||||
}
|
||||
|
||||
// Build modal object
|
||||
var id = getter(scope).replace('.html', '').replace(/\//g, '-').replace(/\./g, '-') + '-' + scope.$id;
|
||||
var $modal = $('<div class="modal hide" tabindex="-1"></div>')
|
||||
.attr('id', id)
|
||||
.attr('data-backdrop', attr.backdrop || true)
|
||||
.attr('data-keyboard', attr.keyboard || true)
|
||||
.addClass(attr.modalClass ? 'fade ' + attr.modalClass : 'fade')
|
||||
.html(template);
|
||||
|
||||
$('body').append($modal);
|
||||
|
||||
// Configure element
|
||||
element.attr('href', '#' + id).attr('data-toggle', 'modal');
|
||||
|
||||
// Compile modal content
|
||||
$timeout(function(){
|
||||
$compile($modal)(scope);
|
||||
});
|
||||
|
||||
// Provide scope display functions
|
||||
scope._modal = function(name) {
|
||||
$modal.modal(name);
|
||||
};
|
||||
scope.hide = function() {
|
||||
$modal.modal('hide');
|
||||
};
|
||||
scope.show = function() {
|
||||
$modal.modal('show');
|
||||
};
|
||||
scope.dismiss = scope.hide;
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsNavbar', ['$location', function($location) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function postLink($scope, element, attrs, controller) {
|
||||
// Watch for the $location
|
||||
$scope.$watch(function() {
|
||||
return $location.path();
|
||||
}, function(newValue, oldValue) {
|
||||
|
||||
element.find('li[data-match-route]').each(function(k, li) {
|
||||
var $li = angular.element(li),
|
||||
pattern = $li.data('match-route'),
|
||||
regexp = new RegExp('^' + pattern + '$', ["i"]);
|
||||
|
||||
if(regexp.test(newValue)) {
|
||||
$li.addClass('active');
|
||||
} else {
|
||||
$li.removeClass('active');
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsPopover', ['$parse', '$compile', '$http', '$timeout', '$q', '$templateCache', function($parse, $compile, $http, $timeout, $q, $templateCache) {
|
||||
'use strict';
|
||||
|
||||
// Hide popovers when pressing esc
|
||||
$("body").on("keyup", function(ev) {
|
||||
if(ev.keyCode === 27) {
|
||||
$(".popover.in").each(function() {
|
||||
var $this = $(this);
|
||||
$this.popover('hide');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: true,
|
||||
link: function postLink(scope, element, attr, ctrl) {
|
||||
|
||||
var getter = $parse(attr.bsPopover),
|
||||
setter = getter.assign,
|
||||
value = getter(scope),
|
||||
options = {};
|
||||
|
||||
if(angular.isObject(value)) {
|
||||
options = value;
|
||||
}
|
||||
|
||||
$q.when(options.content || $templateCache.get(value) || $http.get(value, {cache: true})).then(function onSuccess(template) {
|
||||
|
||||
// Handle response from $http promise
|
||||
if(angular.isObject(template)) {
|
||||
template = template.data;
|
||||
}
|
||||
|
||||
// Handle data-unique attribute
|
||||
if(!!attr.unique) {
|
||||
element.on('show', function(ev) {
|
||||
// Hide any active popover except self
|
||||
$(".popover.in").each(function() {
|
||||
var $this = $(this),
|
||||
popover = $this.data('popover');
|
||||
if(popover && !popover.$element.is(element)) {
|
||||
$this.popover('hide');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Handle data-hide attribute (requires dot-notation model)
|
||||
if(!!attr.hide) {
|
||||
scope.$watch(attr.hide, function(newValue, oldValue) {
|
||||
if(!!newValue) {
|
||||
popover.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize popover
|
||||
element.popover(angular.extend({}, options, {
|
||||
content: function() {
|
||||
$timeout(function() { // use async $apply
|
||||
|
||||
var popover = element.data('popover'),
|
||||
$tip = popover.tip();
|
||||
|
||||
$compile($tip)(scope);
|
||||
|
||||
setTimeout(function() { // refresh position on nextTick
|
||||
popover.refresh();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return template;
|
||||
},
|
||||
html: true
|
||||
}));
|
||||
|
||||
// Bootstrap override to provide events, tip() reference, refreshable positions
|
||||
var popover = element.data('popover');
|
||||
popover.hasContent = function() {
|
||||
return this.getTitle() || template; // fix multiple $compile()
|
||||
};
|
||||
popover.refresh = function() {
|
||||
var $tip = this.tip(), inside, pos, actualWidth, actualHeight, placement, tp;
|
||||
|
||||
placement = typeof this.options.placement === 'function' ?
|
||||
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
||||
this.options.placement;
|
||||
|
||||
inside = /in/.test(placement);
|
||||
|
||||
pos = this.getPosition(inside);
|
||||
|
||||
actualWidth = $tip[0].offsetWidth;
|
||||
actualHeight = $tip[0].offsetHeight;
|
||||
|
||||
switch (inside ? placement.split(' ')[1] : placement) {
|
||||
case 'bottom':
|
||||
tp = {top: pos.top + pos.height + 10, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 'top':
|
||||
tp = {top: pos.top - actualHeight - 10, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 'left':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - 10};
|
||||
break;
|
||||
case 'right':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + 10};
|
||||
break;
|
||||
}
|
||||
|
||||
$tip.offset(tp);
|
||||
};
|
||||
popover.show = function() {
|
||||
var e = $.Event('show');
|
||||
this.$element.trigger(e);
|
||||
if (e.isDefaultPrevented()) {
|
||||
return;
|
||||
}
|
||||
var r = $.fn.popover.Constructor.prototype.show.apply(this, arguments);
|
||||
// Bind popover to the tip()
|
||||
this.$tip.data('popover', this);
|
||||
return r;
|
||||
};
|
||||
popover.hide = function() {
|
||||
var e = $.Event('hide');
|
||||
this.$element.trigger(e);
|
||||
if (e.isDefaultPrevented()) {
|
||||
return;
|
||||
}
|
||||
return $.fn.popover.Constructor.prototype.hide.apply(this, arguments);
|
||||
};
|
||||
|
||||
// Provide scope display functions
|
||||
scope._popover = function(name) {
|
||||
element.popover(name);
|
||||
};
|
||||
scope.hide = function() {
|
||||
element.popover('hide');
|
||||
};
|
||||
scope.show = function() {
|
||||
element.popover('show');
|
||||
};
|
||||
scope.dismiss = scope.hide;
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
|
||||
// https://github.com/jdewit/bootstrap-timepicker
|
||||
// https://github.com/kla/bootstrap-timepicker
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsTimepicker', ['$timeout', function($timeout) {
|
||||
'use strict';
|
||||
|
||||
var TIME_REGEXP = '((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: '?ngModel',
|
||||
link: function postLink(scope, element, attrs, controller) {
|
||||
|
||||
// If we have a controller (i.e. ngModelController) then wire it up
|
||||
if(controller) {
|
||||
element.on('change', function(ev) {
|
||||
scope.$apply(function () {
|
||||
controller.$setViewValue(element.val());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Handle input time validity
|
||||
var timeRegExp = new RegExp('^' + TIME_REGEXP + '$', ['i']);
|
||||
controller.$parsers.unshift(function(viewValue) {
|
||||
//console.warn('viewValue', viewValue, timeRegExp, timeRegExp.test(viewValue));
|
||||
if (!viewValue || timeRegExp.test(viewValue)) {
|
||||
controller.$setValidity('time', true);
|
||||
return viewValue;
|
||||
} else {
|
||||
controller.$setValidity('time', false);
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
|
||||
// Support add-on
|
||||
// var component = element.siblings('[data-toggle="timepicker"]');
|
||||
// if(component.length) {
|
||||
// component.on('click', function() {
|
||||
// var $widget = element.data('timepicker').$widget;
|
||||
// });
|
||||
// }
|
||||
|
||||
// Popover GarbageCollection
|
||||
var $popover = element.closest('.popover');
|
||||
if($popover) {
|
||||
$popover.on('hide', function(e) {
|
||||
var timepicker = element.data('timepicker');
|
||||
if(timepicker) {
|
||||
timepicker.$widget.remove();
|
||||
element.data('timepicker', null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Create datepicker
|
||||
element.attr('data-toggle', 'timepicker');
|
||||
//$timeout(function () {
|
||||
element.timepicker();
|
||||
//});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsTooltip', ['$parse', '$compile', function($parse, $compile) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: true,
|
||||
link: function postLink(scope, element, attrs, ctrl) {
|
||||
|
||||
if(!!attrs.unique) {
|
||||
element.on('show', function(ev) {
|
||||
// Hide any active popover except self
|
||||
$(".tooltip.in").each(function() {
|
||||
var $this = $(this),
|
||||
tooltip = $this.data('tooltip');
|
||||
if(tooltip && !tooltip.$element.is(element)) {
|
||||
$this.tooltip('hide');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize tooltip
|
||||
element.tooltip({
|
||||
title: scope.$eval(attrs.bsTooltip),
|
||||
html: true
|
||||
});
|
||||
|
||||
// Bootstrap override to provide events & tip() reference
|
||||
var tooltip = element.data('tooltip');
|
||||
tooltip.show = function() {
|
||||
var e = $.Event('show');
|
||||
this.$element.trigger(e);
|
||||
if (e.isDefaultPrevented()) {
|
||||
return;
|
||||
}
|
||||
var r = $.fn.tooltip.Constructor.prototype.show.apply(this, arguments);
|
||||
// Bind popover to the tip()
|
||||
this.tip().data('tooltip', this);
|
||||
return r;
|
||||
};
|
||||
tooltip.hide = function() {
|
||||
var e = $.Event('hide');
|
||||
this.$element.trigger(e);
|
||||
if (e.isDefaultPrevented()) {
|
||||
return;
|
||||
}
|
||||
return $.fn.tooltip.Constructor.prototype.hide.apply(this, arguments);
|
||||
};
|
||||
|
||||
//Provide scope display functions
|
||||
scope._tooltip = function(event) {
|
||||
element.tooltip(event);
|
||||
};
|
||||
scope.hide = function() {
|
||||
element.tooltip('hide');
|
||||
};
|
||||
scope.show = function() {
|
||||
element.tooltip('show');
|
||||
};
|
||||
scope.dismiss = scope.hide;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
angular.module('$strap.directives')
|
||||
|
||||
.directive('bsTypeahead', ['$parse', function($parse) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: '?ngModel',
|
||||
link: function postLink(scope, element, attrs, controller) {
|
||||
|
||||
var getter = $parse(attrs.bsTypeahead),
|
||||
setter = getter.assign,
|
||||
value = getter(scope);
|
||||
|
||||
// Watch bsTypeahead for changes
|
||||
scope.$watch(attrs.bsTypeahead, function(newValue, oldValue) {
|
||||
if(newValue !== oldValue) {
|
||||
value = newValue;
|
||||
}
|
||||
});
|
||||
|
||||
element.attr('data-provide', 'typeahead');
|
||||
element.typeahead({
|
||||
source: function(query) { return angular.isFunction(value) ? value.apply(null, arguments) : value; },
|
||||
minLength: attrs.minLength || 1,
|
||||
items: attrs.items,
|
||||
updater: function(value) {
|
||||
// If we have a controller (i.e. ngModelController) then wire it up
|
||||
if(controller) {
|
||||
scope.$apply(function () {
|
||||
controller.$setViewValue(value);
|
||||
});
|
||||
}
|
||||
return value;
|
||||
}
|
||||
});
|
||||
|
||||
// Bootstrap override
|
||||
var typeahead = element.data('typeahead');
|
||||
// Fixes #2043: allows minLength of zero to enable show all for typeahead
|
||||
typeahead.lookup = function (ev) {
|
||||
var items;
|
||||
this.query = this.$element.val() || '';
|
||||
if (this.query.length < this.options.minLength) {
|
||||
return this.shown ? this.hide() : this;
|
||||
}
|
||||
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source;
|
||||
return items ? this.process(items) : this;
|
||||
};
|
||||
|
||||
// Support 0-minLength
|
||||
if(attrs.minLength === "0") {
|
||||
setTimeout(function() { // Push to the event loop to make sure element.typeahead is defined (breaks tests otherwise)
|
||||
element.on('focus', function() {
|
||||
setTimeout(element.typeahead.bind(element, 'lookup'), 200);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}]);
|
8
src/html/angular/angular-strap.min.js
vendored
Normal file
8
src/html/angular/angular-strap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1318
src/html/angular/angular-ui-bootstrap.js
vendored
Normal file
1318
src/html/angular/angular-ui-bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14604
src/html/angular/angular.js
vendored
Normal file
14604
src/html/angular/angular.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
160
src/html/angular/angular.min.js
vendored
Normal file
160
src/html/angular/angular.min.js
vendored
Normal file
@ -0,0 +1,160 @@
|
||||
/*
|
||||
AngularJS v1.0.4
|
||||
(c) 2010-2012 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(T,Y,p){'use strict';function m(b,a,c){var d;if(b)if(L(b))for(d in b)d!="prototype"&&d!="length"&&d!="name"&&b.hasOwnProperty(d)&&a.call(c,b[d],d);else if(b.forEach&&b.forEach!==m)b.forEach(a,c);else if(M(b)&&va(b.length))for(d=0;d<b.length;d++)a.call(c,b[d],d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function mb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function fc(b,a,c){for(var d=mb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}
|
||||
function nb(b){return function(a,c){b(c,a)}}function wa(){for(var b=Z.length,a;b;){b--;a=Z[b].charCodeAt(0);if(a==57)return Z[b]="A",Z.join("");if(a==90)Z[b]="0";else return Z[b]=String.fromCharCode(a+1),Z.join("")}Z.unshift("0");return Z.join("")}function y(b){m(arguments,function(a){a!==b&&m(a,function(a,d){b[d]=a})});return b}function F(b){return parseInt(b,10)}function xa(b,a){return y(new (y(function(){},{prototype:b})),a)}function C(){}function ma(b){return b}function H(b){return function(){return b}}
|
||||
function t(b){return typeof b=="undefined"}function v(b){return typeof b!="undefined"}function M(b){return b!=null&&typeof b=="object"}function E(b){return typeof b=="string"}function va(b){return typeof b=="number"}function na(b){return Sa.apply(b)=="[object Date]"}function I(b){return Sa.apply(b)=="[object Array]"}function L(b){return typeof b=="function"}function oa(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function Q(b){return E(b)?b.replace(/^\s*/,"").replace(/\s*$/,""):b}function gc(b){return b&&
|
||||
(b.nodeName||b.bind&&b.find)}function Ta(b,a,c){var d=[];m(b,function(b,g,i){d.push(a.call(c,b,g,i))});return d}function ya(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0;c<b.length;c++)if(a===b[c])return c;return-1}function Ua(b,a){var c=ya(b,a);c>=0&&b.splice(c,1);return a}function U(b,a){if(oa(b)||b&&b.$evalAsync&&b.$watch)throw u("Can't copy Window or Scope");if(a){if(b===a)throw u("Can't copy equivalent objects or arrays");if(I(b)){for(;a.length;)a.pop();for(var c=0;c<b.length;c++)a.push(U(b[c]))}else for(c in m(a,
|
||||
function(b,c){delete a[c]}),b)a[c]=U(b[c])}else(a=b)&&(I(b)?a=U(b,[]):na(b)?a=new Date(b.getTime()):M(b)&&(a=U(b,{})));return a}function hc(b,a){var a=a||{},c;for(c in b)b.hasOwnProperty(c)&&c.substr(0,2)!=="$$"&&(a[c]=b[c]);return a}function ha(b,a){if(b===a)return!0;if(b===null||a===null)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&c=="object")if(I(b)){if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ha(b[d],a[d]))return!1;return!0}}else if(na(b))return na(a)&&b.getTime()==a.getTime();
|
||||
else{if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||oa(b)||oa(a))return!1;c={};for(d in b)if(!(d.charAt(0)==="$"||L(b[d]))){if(!ha(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c[d]&&d.charAt(0)!=="$"&&a[d]!==p&&!L(a[d]))return!1;return!0}return!1}function Va(b,a){var c=arguments.length>2?ia.call(arguments,2):[];return L(a)&&!(a instanceof RegExp)?c.length?function(){return arguments.length?a.apply(b,c.concat(ia.call(arguments,0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,
|
||||
arguments):a.call(b)}:a}function ic(b,a){var c=a;/^\$+/.test(b)?c=p:oa(a)?c="$WINDOW":a&&Y===a?c="$DOCUMENT":a&&a.$evalAsync&&a.$watch&&(c="$SCOPE");return c}function da(b,a){return JSON.stringify(b,ic,a?" ":null)}function ob(b){return E(b)?JSON.parse(b):b}function Wa(b){b&&b.length!==0?(b=D(""+b),b=!(b=="f"||b=="0"||b=="false"||b=="no"||b=="n"||b=="[]")):b=!1;return b}function pa(b){b=z(b).clone();try{b.html("")}catch(a){}return z("<div>").append(b).html().match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,
|
||||
function(a,b){return"<"+D(b)})}function Xa(b){var a={},c,d;m((b||"").split("&"),function(b){b&&(c=b.split("="),d=decodeURIComponent(c[0]),a[d]=v(c[1])?decodeURIComponent(c[1]):!0)});return a}function pb(b){var a=[];m(b,function(b,d){a.push(Ya(d,!0)+(b===!0?"":"="+Ya(b,!0)))});return a.length?a.join("&"):""}function Za(b){return Ya(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Ya(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,
|
||||
"$").replace(/%2C/gi,",").replace(a?null:/%20/g,"+")}function jc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,i=["ng:app","ng-app","x-ng-app","data-ng-app"],f=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;m(i,function(a){i[a]=!0;c(Y.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(m(b.querySelectorAll("."+a),c),m(b.querySelectorAll("."+a+"\\:"),c),m(b.querySelectorAll("["+a+"]"),c))});m(d,function(a){if(!e){var b=f.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):m(a.attributes,
|
||||
function(b){if(!e&&i[b.name])e=a,g=b.value})}});e&&a(e,g?[g]:[])}function qb(b,a){b=z(b);a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");var c=rb(a);c.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,i){a.$apply(function(){b.data("$injector",i);c(b)(a)})}]);return c}function $a(b,a){a=a||"_";return b.replace(kc,function(b,d){return(d?a:"")+b.toLowerCase()})}function ab(b,a,c){if(!b)throw new u("Argument '"+(a||"?")+"' is "+(c||"required"));
|
||||
return b}function qa(b,a,c){c&&I(b)&&(b=b[b.length-1]);ab(L(b),a,"not a function, got "+(b&&typeof b=="object"?b.constructor.name||"Object":typeof b));return b}function lc(b){function a(a,b,e){return a[b]||(a[b]=e())}return a(a(b,"angular",Object),"module",function(){var b={};return function(d,e,g){e&&b.hasOwnProperty(d)&&(b[d]=null);return a(b,d,function(){function a(c,d,e){return function(){b[e||"push"]([c,d,arguments]);return k}}if(!e)throw u("No module: "+d);var b=[],c=[],j=a("$injector","invoke"),
|
||||
k={_invokeQueue:b,_runBlocks:c,requires:e,name:d,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:j,run:function(a){c.push(a);return this}};g&&j(g);return k})}})}function sb(b){return b.replace(mc,function(a,b,d,e){return e?d.toUpperCase():d}).replace(nc,
|
||||
"Moz$1")}function bb(b,a){function c(){var e;for(var b=[this],c=a,i,f,h,j,k,l;b.length;){i=b.shift();f=0;for(h=i.length;f<h;f++){j=z(i[f]);c?j.triggerHandler("$destroy"):c=!c;k=0;for(e=(l=j.children()).length,j=e;k<j;k++)b.push(ja(l[k]))}}return d.apply(this,arguments)}var d=ja.fn[b],d=d.$original||d;c.$original=d;ja.fn[b]=c}function O(b){if(b instanceof O)return b;if(!(this instanceof O)){if(E(b)&&b.charAt(0)!="<")throw u("selectors not implemented");return new O(b)}if(E(b)){var a=Y.createElement("div");
|
||||
a.innerHTML="<div> </div>"+b;a.removeChild(a.firstChild);cb(this,a.childNodes);this.remove()}else cb(this,b)}function db(b){return b.cloneNode(!0)}function ra(b){tb(b);for(var a=0,b=b.childNodes||[];a<b.length;a++)ra(b[a])}function ub(b,a,c){var d=$(b,"events");$(b,"handle")&&(t(a)?m(d,function(a,c){eb(b,c,a);delete d[c]}):t(c)?(eb(b,a,d[a]),delete d[a]):Ua(d[a],c))}function tb(b){var a=b[za],c=Aa[a];c&&(c.handle&&(c.events.$destroy&&c.handle({},"$destroy"),ub(b)),delete Aa[a],b[za]=p)}function $(b,
|
||||
a,c){var d=b[za],d=Aa[d||-1];if(v(c))d||(b[za]=d=++oc,d=Aa[d]={}),d[a]=c;else return d&&d[a]}function vb(b,a,c){var d=$(b,"data"),e=v(c),g=!e&&v(a),i=g&&!M(a);!d&&!i&&$(b,"data",d={});if(e)d[a]=c;else if(g)if(i)return d&&d[a];else y(d,a);else return d}function Ba(b,a){return(" "+b.className+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" ")>-1}function wb(b,a){a&&m(a.split(" "),function(a){b.className=Q((" "+b.className+" ").replace(/[\n\t]/g," ").replace(" "+Q(a)+" "," "))})}function xb(b,a){a&&m(a.split(" "),
|
||||
function(a){if(!Ba(b,a))b.className=Q(b.className+" "+Q(a))})}function cb(b,a){if(a)for(var a=!a.nodeName&&v(a.length)&&!oa(a)?a:[a],c=0;c<a.length;c++)b.push(a[c])}function yb(b,a){return Ca(b,"$"+(a||"ngController")+"Controller")}function Ca(b,a,c){b=z(b);for(b[0].nodeType==9&&(b=b.find("html"));b.length;){if(c=b.data(a))return c;b=b.parent()}}function zb(b,a){var c=Da[a.toLowerCase()];return c&&Ab[b.nodeName]&&c}function pc(b,a){var c=function(c,e){if(!c.preventDefault)c.preventDefault=function(){c.returnValue=
|
||||
!1};if(!c.stopPropagation)c.stopPropagation=function(){c.cancelBubble=!0};if(!c.target)c.target=c.srcElement||Y;if(t(c.defaultPrevented)){var g=c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented};m(a[e||c.type],function(a){a.call(b,c)});aa<=8?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};
|
||||
c.elem=b;return c}function ga(b){var a=typeof b,c;if(a=="object"&&b!==null)if(typeof(c=b.$$hashKey)=="function")c=b.$$hashKey();else{if(c===p)c=b.$$hashKey=wa()}else c=b;return a+":"+c}function Ea(b){m(b,this.put,this)}function fb(){}function Bb(b){var a,c;if(typeof b=="function"){if(!(a=b.$inject))a=[],c=b.toString().replace(qc,""),c=c.match(rc),m(c[1].split(sc),function(b){b.replace(tc,function(b,c,d){a.push(d)})}),b.$inject=a}else I(b)?(c=b.length-1,qa(b[c],"fn"),a=b.slice(0,c)):qa(b,"fn",!0);
|
||||
return a}function rb(b){function a(a){return function(b,c){if(M(b))m(b,nb(a));else return a(b,c)}}function c(a,b){if(L(b)||I(b))b=l.instantiate(b);if(!b.$get)throw u("Provider "+a+" must define $get factory method.");return k[a+f]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[];m(a,function(a){if(!j.get(a))if(j.put(a,!0),E(a)){var c=sa(a);b=b.concat(e(c.requires)).concat(c._runBlocks);try{for(var d=c._invokeQueue,c=0,f=d.length;c<f;c++){var h=d[c],g=h[0]=="$injector"?l:l.get(h[0]);g[h[1]].apply(g,
|
||||
h[2])}}catch(n){throw n.message&&(n.message+=" from "+a),n;}}else if(L(a))try{b.push(l.invoke(a))}catch(i){throw i.message&&(i.message+=" from "+a),i;}else if(I(a))try{b.push(l.invoke(a))}catch(k){throw k.message&&(k.message+=" from "+String(a[a.length-1])),k;}else qa(a,"module")});return b}function g(a,b){function c(d){if(typeof d!=="string")throw u("Service name expected");if(a.hasOwnProperty(d)){if(a[d]===i)throw u("Circular dependency: "+h.join(" <- "));return a[d]}else try{return h.unshift(d),
|
||||
a[d]=i,a[d]=b(d)}finally{h.shift()}}function d(a,b,e){var f=[],h=Bb(a),j,g,n;g=0;for(j=h.length;g<j;g++)n=h[g],f.push(e&&e.hasOwnProperty(n)?e[n]:c(n));a.$inject||(a=a[j]);switch(b?-1:f.length){case 0:return a();case 1:return a(f[0]);case 2:return a(f[0],f[1]);case 3:return a(f[0],f[1],f[2]);case 4:return a(f[0],f[1],f[2],f[3]);case 5:return a(f[0],f[1],f[2],f[3],f[4]);case 6:return a(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6]);case 8:return a(f[0],f[1],f[2],
|
||||
f[3],f[4],f[5],f[6],f[7]);case 9:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8]);case 10:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9]);default:return a.apply(b,f)}}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=(I(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return M(e)?e:c},get:c,annotate:Bb}}var i={},f="Provider",h=[],j=new Ea,k={$provide:{provider:a(c),factory:a(d),service:a(function(a,b){return d(a,["$injector",function(a){return a.instantiate(b)}])}),
|
||||
value:a(function(a,b){return d(a,H(b))}),constant:a(function(a,b){k[a]=b;o[a]=b}),decorator:function(a,b){var c=l.get(a+f),d=c.$get;c.$get=function(){var a=r.invoke(d,c);return r.invoke(b,null,{$delegate:a})}}}},l=g(k,function(){throw u("Unknown provider: "+h.join(" <- "));}),o={},r=o.$injector=g(o,function(a){a=l.get(a+f);return r.invoke(a.$get,a)});m(e(b),function(a){r.invoke(a||C)});return r}function uc(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",
|
||||
function(a,c,d){function e(a){var b=null;m(a,function(a){!b&&D(a.nodeName)==="a"&&(b=a)});return b}function g(){var b=c.hash(),d;b?(d=i.getElementById(b))?d.scrollIntoView():(d=e(i.getElementsByName(b)))?d.scrollIntoView():b==="top"&&a.scrollTo(0,0):a.scrollTo(0,0)}var i=a.document;b&&d.$watch(function(){return c.hash()},function(){d.$evalAsync(g)});return g}]}function vc(b,a,c,d){function e(a){try{a.apply(null,ia.call(arguments,1))}finally{if(n--,n===0)for(;w.length;)try{w.pop()()}catch(b){c.error(b)}}}
|
||||
function g(a,b){(function ea(){m(q,function(a){a()});x=b(ea,a)})()}function i(){X!=f.url()&&(X=f.url(),m(s,function(a){a(f.url())}))}var f=this,h=a[0],j=b.location,k=b.history,l=b.setTimeout,o=b.clearTimeout,r={};f.isMock=!1;var n=0,w=[];f.$$completeOutstandingRequest=e;f.$$incOutstandingRequestCount=function(){n++};f.notifyWhenNoOutstandingRequests=function(a){m(q,function(a){a()});n===0?a():w.push(a)};var q=[],x;f.addPollFn=function(a){t(x)&&g(100,l);q.push(a);return a};var X=j.href,A=a.find("base");
|
||||
f.url=function(a,b){if(a){if(X!=a)return X=a,d.history?b?k.replaceState(null,"",a):(k.pushState(null,"",a),A.attr("href",A.attr("href"))):b?j.replace(a):j.href=a,f}else return j.href.replace(/%27/g,"'")};var s=[],J=!1;f.onUrlChange=function(a){J||(d.history&&z(b).bind("popstate",i),d.hashchange?z(b).bind("hashchange",i):f.addPollFn(i),J=!0);s.push(a);return a};f.baseHref=function(){var a=A.attr("href");return a?a.replace(/^https?\:\/\/[^\/]*/,""):a};var ba={},P="",K=f.baseHref();f.cookies=function(a,
|
||||
b){var d,e,f,j;if(a)if(b===p)h.cookie=escape(a)+"=;path="+K+";expires=Thu, 01 Jan 1970 00:00:00 GMT";else{if(E(b))d=(h.cookie=escape(a)+"="+escape(b)+";path="+K).length+1,d>4096&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!")}else{if(h.cookie!==P){P=h.cookie;d=P.split("; ");ba={};for(f=0;f<d.length;f++)e=d[f],j=e.indexOf("="),j>0&&(ba[unescape(e.substring(0,j))]=unescape(e.substring(j+1)))}return ba}};f.defer=function(a,b){var c;n++;c=l(function(){delete r[c];
|
||||
e(a)},b||0);r[c]=!0;return c};f.defer.cancel=function(a){return r[a]?(delete r[a],o(a),e(C),!0):!1}}function wc(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new vc(b,d,a,c)}]}function xc(){this.$get=function(){function b(b,d){function e(a){if(a!=l){if(o){if(o==a)o=a.n}else o=a;g(a.n,a.p);g(a,l);l=a;l.n=null}}function g(a,b){if(a!=b){if(a)a.p=b;if(b)b.n=a}}if(b in a)throw u("cacheId "+b+" taken");var i=0,f=y({},d,{id:b}),h={},j=d&&d.capacity||Number.MAX_VALUE,k={},
|
||||
l=null,o=null;return a[b]={put:function(a,b){var c=k[a]||(k[a]={key:a});e(c);t(b)||(a in h||i++,h[a]=b,i>j&&this.remove(o.key))},get:function(a){var b=k[a];if(b)return e(b),h[a]},remove:function(a){var b=k[a];if(b){if(b==l)l=b.p;if(b==o)o=b.n;g(b.n,b.p);delete k[a];delete h[a];i--}},removeAll:function(){h={};i=0;k={};l=o=null},destroy:function(){k=f=h=null;delete a[b]},info:function(){return y({},f,{size:i})}}}var a={};b.info=function(){var b={};m(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};
|
||||
return b}}function yc(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function Cb(b){var a={},c="Directive",d=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,e=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,g="Template must have exactly one root element. was: ";this.directive=function f(d,e){E(d)?(ab(e,"directive"),a.hasOwnProperty(d)||(a[d]=[],b.factory(d+c,["$injector","$exceptionHandler",function(b,c){var e=[];m(a[d],function(a){try{var f=b.invoke(a);if(L(f))f={compile:H(f)};else if(!f.compile&&f.link)f.compile=
|
||||
H(f.link);f.priority=f.priority||0;f.name=f.name||d;f.require=f.require||f.controller&&f.name;f.restrict=f.restrict||"A";e.push(f)}catch(j){c(j)}});return e}])),a[d].push(e)):m(d,nb(f));return this};this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope",function(b,h,j,k,l,o,r,n){function w(a,b,c){a instanceof z||(a=z(a));m(a,function(b,c){b.nodeType==3&&b.nodeValue.match(/\S+/)&&(a[c]=z(b).wrap("<span></span>").parent()[0])});var d=x(a,
|
||||
b,a,c);return function(b,c){ab(b,"scope");var e=c?ta.clone.call(a):a;e.data("$scope",b);q(e,"ng-scope");c&&c(e,b);d&&d(b,e,e);return e}}function q(a,b){try{a.addClass(b)}catch(c){}}function x(a,b,c,d){function e(a,c,d,j){var g,h,k,n,o,l,r,q=[];o=0;for(l=c.length;o<l;o++)q.push(c[o]);r=o=0;for(l=f.length;o<l;r++)h=q[r],c=f[o++],g=f[o++],c?(c.scope?(k=a.$new(M(c.scope)),z(h).data("$scope",k)):k=a,(n=c.transclude)||!j&&b?c(g,k,h,d,function(b){return function(c){var d=a.$new();return b(d,c).bind("$destroy",
|
||||
Va(d,d.$destroy))}}(n||b)):c(g,k,h,p,j)):g&&g(a,h.childNodes,p,j)}for(var f=[],j,g,h,k=0;k<a.length;k++)g=new ea,j=X(a[k],[],g,d),g=(j=j.length?A(j,a[k],g,b,c):null)&&j.terminal||!a[k].childNodes.length?null:x(a[k].childNodes,j?j.transclude:b),f.push(j),f.push(g),h=h||j||g;return h?e:null}function X(a,b,c,f){var j=c.$attr,g;switch(a.nodeType){case 1:s(b,fa(Db(a).toLowerCase()),"E",f);var h,k,n;g=a.attributes;for(var o=0,l=g&&g.length;o<l;o++)if(h=g[o],h.specified)k=h.name,n=fa(k.toLowerCase()),j[n]=
|
||||
k,c[n]=h=Q(aa&&k=="href"?decodeURIComponent(a.getAttribute(k,2)):h.value),zb(a,n)&&(c[n]=!0),V(a,b,h,n),s(b,n,"A",f);a=a.className;if(E(a)&&a!=="")for(;g=e.exec(a);)n=fa(g[2]),s(b,n,"C",f)&&(c[n]=Q(g[3])),a=a.substr(g.index+g[0].length);break;case 3:G(b,a.nodeValue);break;case 8:try{if(g=d.exec(a.nodeValue))n=fa(g[1]),s(b,n,"M",f)&&(c[n]=Q(g[2]))}catch(r){}}b.sort(P);return b}function A(a,b,c,d,e){function f(a,b){if(a)a.require=B.require,l.push(a);if(b)b.require=B.require,ca.push(b)}function h(a,
|
||||
b){var c,d="data",e=!1;if(E(a)){for(;(c=a.charAt(0))=="^"||c=="?";)a=a.substr(1),c=="^"&&(d="inheritedData"),e=e||c=="?";c=b[d]("$"+a+"Controller");if(!c&&!e)throw u("No controller: "+a);}else I(a)&&(c=[],m(a,function(a){c.push(h(a,b))}));return c}function k(a,d,e,f,g){var n,q,w,J,Ga;n=b===e?c:hc(c,new ea(z(e),c.$attr));q=n.$$element;if(A){var x=/^\s*([@=&])\s*(\w*)\s*$/,s=d.$parent||d;m(A.scope,function(a,b){var c=a.match(x)||[],e=c[2]||b,f,g,j;switch(c[1]){case "@":n.$observe(e,function(a){d[b]=
|
||||
a});n.$$observers[e].$$scope=s;break;case "=":g=o(n[e]);j=g.assign||function(){f=d[b]=g(s);throw u(Eb+n[e]+" (directive: "+A.name+")");};f=d[b]=g(s);d.$watch(function(){var a=g(s);a!==d[b]&&(a!==f?f=d[b]=a:j(s,a=f=d[b]));return a});break;case "&":g=o(n[e]);d[b]=function(a){return g(s,a)};break;default:throw u("Invalid isolate scope definition for directive "+A.name+": "+a);}})}t&&m(t,function(a){var b={$scope:d,$element:q,$attrs:n,$transclude:g};Ga=a.controller;Ga=="@"&&(Ga=n[a.name]);q.data("$"+
|
||||
a.name+"Controller",r(Ga,b))});f=0;for(w=l.length;f<w;f++)try{J=l[f],J(d,q,n,J.require&&h(J.require,q))}catch(X){j(X,pa(q))}a&&a(d,e.childNodes,p,g);f=0;for(w=ca.length;f<w;f++)try{J=ca[f],J(d,q,n,J.require&&h(J.require,q))}catch(Ha){j(Ha,pa(q))}}for(var n=-Number.MAX_VALUE,l=[],ca=[],x=null,A=null,P=null,s=c.$$element=z(b),B,G,V,C,v=d,t,y,W,D=0,F=a.length;D<F;D++){B=a[D];V=p;if(n>B.priority)break;if(W=B.scope)K("isolated scope",A,B,s),M(W)&&(q(s,"ng-isolate-scope"),A=B),q(s,"ng-scope"),x=x||B;G=
|
||||
B.name;if(W=B.controller)t=t||{},K("'"+G+"' controller",t[G],B,s),t[G]=B;if(W=B.transclude)K("transclusion",C,B,s),C=B,n=B.priority,W=="element"?(V=z(b),s=c.$$element=z(Y.createComment(" "+G+": "+c[G]+" ")),b=s[0],Fa(e,z(V[0]),b),v=w(V,d,n)):(V=z(db(b)).contents(),s.html(""),v=w(V,d));if(W=B.template)if(K("template",P,B,s),P=B,W=Ha(W),B.replace){V=z("<div>"+Q(W)+"</div>").contents();b=V[0];if(V.length!=1||b.nodeType!==1)throw new u(g+W);Fa(e,s,b);G={$attr:{}};a=a.concat(X(b,a.splice(D+1,a.length-
|
||||
(D+1)),G));J(c,G);F=a.length}else s.html(W);if(B.templateUrl)K("template",P,B,s),P=B,k=ba(a.splice(D,a.length-D),k,s,c,e,B.replace,v),F=a.length;else if(B.compile)try{y=B.compile(s,c,v),L(y)?f(null,y):y&&f(y.pre,y.post)}catch(H){j(H,pa(s))}if(B.terminal)k.terminal=!0,n=Math.max(n,B.priority)}k.scope=x&&x.scope;k.transclude=C&&v;return k}function s(d,e,g,h){var k=!1;if(a.hasOwnProperty(e))for(var n,e=b.get(e+c),o=0,l=e.length;o<l;o++)try{if(n=e[o],(h===p||h>n.priority)&&n.restrict.indexOf(g)!=-1)d.push(n),
|
||||
k=!0}catch(r){j(r)}return k}function J(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;m(a,function(d,e){e.charAt(0)!="$"&&(b[e]&&(d+=(e==="style"?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});m(b,function(b,f){f=="class"?(q(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):f=="style"?e.attr("style",e.attr("style")+";"+b):f.charAt(0)!="$"&&!a.hasOwnProperty(f)&&(a[f]=b,d[f]=c[f])})}function ba(a,b,c,d,e,f,j){var h=[],n,o,r=c[0],q=a.shift(),w=y({},q,{controller:null,templateUrl:null,transclude:null,scope:null});
|
||||
c.html("");k.get(q.templateUrl,{cache:l}).success(function(k){var l,q,k=Ha(k);if(f){q=z("<div>"+Q(k)+"</div>").contents();l=q[0];if(q.length!=1||l.nodeType!==1)throw new u(g+k);k={$attr:{}};Fa(e,c,l);X(l,a,k);J(d,k)}else l=r,c.html(k);a.unshift(w);n=A(a,c,d,j);for(o=x(c.contents(),j);h.length;){var ca=h.pop(),k=h.pop();q=h.pop();var s=h.pop(),m=l;q!==r&&(m=db(l),Fa(k,z(q),m));n(function(){b(o,s,m,e,ca)},s,m,e,ca)}h=null}).error(function(a,b,c,d){throw u("Failed to load template: "+d.url);});return function(a,
|
||||
c,d,e,f){h?(h.push(c),h.push(d),h.push(e),h.push(f)):n(function(){b(o,c,d,e,f)},c,d,e,f)}}function P(a,b){return b.priority-a.priority}function K(a,b,c,d){if(b)throw u("Multiple directives ["+b.name+", "+c.name+"] asking for "+a+" on: "+pa(d));}function G(a,b){var c=h(b,!0);c&&a.push({priority:0,compile:H(function(a,b){var d=b.parent(),e=d.data("$binding")||[];e.push(c);q(d.data("$binding",e),"ng-binding");a.$watch(c,function(a){b[0].nodeValue=a})})})}function V(a,b,c,d){var e=h(c,!0);e&&b.push({priority:100,
|
||||
compile:H(function(a,b,c){b=c.$$observers||(c.$$observers={});d==="class"&&(e=h(c[d],!0));c[d]=p;(b[d]||(b[d]=[])).$$inter=!0;(c.$$observers&&c.$$observers[d].$$scope||a).$watch(e,function(a){c.$set(d,a)})})})}function Fa(a,b,c){var d=b[0],e=d.parentNode,f,g;if(a){f=0;for(g=a.length;f<g;f++)if(a[f]==d){a[f]=c;break}}e&&e.replaceChild(c,d);c[z.expando]=d[z.expando];b[0]=c}var ea=function(a,b){this.$$element=a;this.$attr=b||{}};ea.prototype={$normalize:fa,$set:function(a,b,c,d){var e=zb(this.$$element[0],
|
||||
a),f=this.$$observers;e&&(this.$$element.prop(a,b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=$a(a,"-"));c!==!1&&(b===null||b===p?this.$$element.removeAttr(d):this.$$element.attr(d,b));f&&m(f[a],function(a){try{a(b)}catch(c){j(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);n.$evalAsync(function(){e.$$inter||b(c[a])});return b}};var C=h.startSymbol(),ca=h.endSymbol(),Ha=C=="{{"||ca=="}}"?ma:function(a){return a.replace(/\{\{/g,
|
||||
C).replace(/}}/g,ca)};return w}]}function fa(b){return sb(b.replace(zc,""))}function Ac(){var b={};this.register=function(a,c){M(a)?y(b,a):b[a]=c};this.$get=["$injector","$window",function(a,c){return function(d,e){if(E(d)){var g=d,d=b.hasOwnProperty(g)?b[g]:gb(e.$scope,g,!0)||gb(c,g,!0);qa(d,g,!0)}return a.instantiate(d,e)}}]}function Bc(){this.$get=["$window",function(b){return z(b.document)}]}function Cc(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b,arguments)}}]}function Dc(){var b=
|
||||
"{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):b};this.endSymbol=function(b){return b?(a=b,this):a};this.$get=["$parse",function(c){function d(d,f){for(var h,j,k=0,l=[],o=d.length,r=!1,n=[];k<o;)(h=d.indexOf(b,k))!=-1&&(j=d.indexOf(a,h+e))!=-1?(k!=h&&l.push(d.substring(k,h)),l.push(k=c(r=d.substring(h+e,j))),k.exp=r,k=j+g,r=!0):(k!=o&&l.push(d.substring(k)),k=o);if(!(o=l.length))l.push(""),o=1;if(!f||r)return n.length=o,k=function(a){for(var b=0,c=o,d;b<c;b++){if(typeof(d=l[b])=="function")d=
|
||||
d(a),d==null||d==p?d="":typeof d!="string"&&(d=da(d));n[b]=d}return n.join("")},k.exp=d,k.parts=l,k}var e=b.length,g=a.length;d.startSymbol=function(){return b};d.endSymbol=function(){return a};return d}]}function Fb(b){for(var b=b.split("/"),a=b.length;a--;)b[a]=Za(b[a]);return b.join("/")}function ua(b,a){var c=Gb.exec(b),c={protocol:c[1],host:c[3],port:F(c[5])||Hb[c[1]]||null,path:c[6]||"/",search:c[8],hash:c[10]};if(a)a.$$protocol=c.protocol,a.$$host=c.host,a.$$port=c.port;return c}function ka(b,
|
||||
a,c){return b+"://"+a+(c==Hb[b]?"":":"+c)}function Ec(b,a,c){var d=ua(b);return decodeURIComponent(d.path)!=a||t(d.hash)||d.hash.indexOf(c)!==0?b:ka(d.protocol,d.host,d.port)+a.substr(0,a.lastIndexOf("/"))+d.hash.substr(c.length)}function Fc(b,a,c){var d=ua(b);if(decodeURIComponent(d.path)==a)return b;else{var e=d.search&&"?"+d.search||"",g=d.hash&&"#"+d.hash||"",i=a.substr(0,a.lastIndexOf("/")),f=d.path.substr(i.length);if(d.path.indexOf(i)!==0)throw u('Invalid url "'+b+'", missing path prefix "'+
|
||||
i+'" !');return ka(d.protocol,d.host,d.port)+a+"#"+c+f+e+g}}function hb(b,a,c){a=a||"";this.$$parse=function(b){var c=ua(b,this);if(c.path.indexOf(a)!==0)throw u('Invalid url "'+b+'", missing path prefix "'+a+'" !');this.$$path=decodeURIComponent(c.path.substr(a.length));this.$$search=Xa(c.search);this.$$hash=c.hash&&decodeURIComponent(c.hash)||"";this.$$compose()};this.$$compose=function(){var b=pb(this.$$search),c=this.$$hash?"#"+Za(this.$$hash):"";this.$$url=Fb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=
|
||||
ka(this.$$protocol,this.$$host,this.$$port)+a+this.$$url};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Ia(b,a,c){var d;this.$$parse=function(b){var c=ua(b,this);if(c.hash&&c.hash.indexOf(a)!==0)throw u('Invalid url "'+b+'", missing hash prefix "'+a+'" !');d=c.path+(c.search?"?"+c.search:"");c=Gc.exec((c.hash||"").substr(a.length));this.$$path=c[1]?(c[1].charAt(0)=="/"?"":"/")+decodeURIComponent(c[1]):"";this.$$search=Xa(c[3]);this.$$hash=c[5]&&decodeURIComponent(c[5])||
|
||||
"";this.$$compose()};this.$$compose=function(){var b=pb(this.$$search),c=this.$$hash?"#"+Za(this.$$hash):"";this.$$url=Fb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=ka(this.$$protocol,this.$$host,this.$$port)+d+(this.$$url?"#"+a+this.$$url:"")};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Ib(b,a,c,d){Ia.apply(this,arguments);this.$$rewriteAppUrl=function(b){if(b.indexOf(c)==0)return c+d+"#"+a+b.substr(c.length)}}function Ja(b){return function(){return this[b]}}
|
||||
function Jb(b,a){return function(c){if(t(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Hc(){var b="",a=!1;this.hashPrefix=function(a){return v(a)?(b=a,this):b};this.html5Mode=function(b){return v(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function i(a){c.$broadcast("$locationChangeSuccess",f.absUrl(),a)}var f,h,j,k=d.url(),l=ua(k);a?(h=d.baseHref()||"/",j=h.substr(0,h.lastIndexOf("/")),l=ka(l.protocol,l.host,l.port)+j+"/",
|
||||
f=e.history?new hb(Ec(k,h,b),j,l):new Ib(Fc(k,h,b),b,l,h.substr(j.length+1))):(l=ka(l.protocol,l.host,l.port)+(l.path||"")+(l.search?"?"+l.search:"")+"#"+b+"/",f=new Ia(k,b,l));g.bind("click",function(a){if(!a.ctrlKey&&!(a.metaKey||a.which==2)){for(var b=z(a.target);D(b[0].nodeName)!=="a";)if(b[0]===g[0]||!(b=b.parent())[0])return;var d=b.prop("href"),e=f.$$rewriteAppUrl(d);d&&!b.attr("target")&&e&&(f.$$parse(e),c.$apply(),a.preventDefault(),T.angular["ff-684208-preventDefault"]=!0)}});f.absUrl()!=
|
||||
k&&d.url(f.absUrl(),!0);d.onUrlChange(function(a){f.absUrl()!=a&&(c.$evalAsync(function(){var b=f.absUrl();f.$$parse(a);i(b)}),c.$$phase||c.$digest())});var o=0;c.$watch(function(){var a=d.url(),b=f.$$replace;if(!o||a!=f.absUrl())o++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return o});return f}]}function Ic(){this.$get=["$window",function(b){function a(a){a instanceof u&&(a.stack?a=a.message&&
|
||||
a.stack.indexOf(a.message)===-1?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function c(c){var e=b.console||{},g=e[c]||e.log||C;return g.apply?function(){var b=[];m(arguments,function(c){b.push(a(c))});return g.apply(e,b)}:function(a,b){g(a,b)}}return{log:c("log"),warn:c("warn"),info:c("info"),error:c("error")}}]}function Jc(b,a){function c(a){return a.indexOf(q)!=-1}function d(){return n+1<b.length?b.charAt(n+1):!1}function e(a){return"0"<=
|
||||
a&&a<="9"}function g(a){return a==" "||a=="\r"||a=="\t"||a=="\n"||a=="\u000b"||a=="\u00a0"}function i(a){return"a"<=a&&a<="z"||"A"<=a&&a<="Z"||"_"==a||a=="$"}function f(a){return a=="-"||a=="+"||e(a)}function h(a,c,d){d=d||n;throw u("Lexer Error: "+a+" at column"+(v(c)?"s "+c+"-"+n+" ["+b.substring(c,d)+"]":" "+d)+" in expression ["+b+"].");}function j(){for(var a="",c=n;n<b.length;){var j=D(b.charAt(n));if(j=="."||e(j))a+=j;else{var g=d();if(j=="e"&&f(g))a+=j;else if(f(j)&&g&&e(g)&&a.charAt(a.length-
|
||||
1)=="e")a+=j;else if(f(j)&&(!g||!e(g))&&a.charAt(a.length-1)=="e")h("Invalid exponent");else break}n++}a*=1;o.push({index:c,text:a,json:!0,fn:function(){return a}})}function k(){for(var c="",d=n,f,j,h;n<b.length;){var k=b.charAt(n);if(k=="."||i(k)||e(k))k=="."&&(f=n),c+=k;else break;n++}if(f)for(j=n;j<b.length;){k=b.charAt(j);if(k=="("){h=c.substr(f-d+1);c=c.substr(0,f-d);n=j;break}if(g(k))j++;else break}d={index:d,text:c};if(Ka.hasOwnProperty(c))d.fn=d.json=Ka[c];else{var l=Kb(c,a);d.fn=y(function(a,
|
||||
b){return l(a,b)},{assign:function(a,b){return Lb(a,c,b)}})}o.push(d);h&&(o.push({index:f,text:".",json:!1}),o.push({index:f+1,text:h,json:!1}))}function l(a){var c=n;n++;for(var d="",e=a,f=!1;n<b.length;){var j=b.charAt(n);e+=j;if(f)j=="u"?(j=b.substring(n+1,n+5),j.match(/[\da-f]{4}/i)||h("Invalid unicode escape [\\u"+j+"]"),n+=4,d+=String.fromCharCode(parseInt(j,16))):(f=Kc[j],d+=f?f:j),f=!1;else if(j=="\\")f=!0;else if(j==a){n++;o.push({index:c,text:e,string:d,json:!0,fn:function(){return d}});
|
||||
return}else d+=j;n++}h("Unterminated quote",c)}for(var o=[],r,n=0,w=[],q,x=":";n<b.length;){q=b.charAt(n);if(c("\"'"))l(q);else if(e(q)||c(".")&&e(d()))j();else if(i(q)){if(k(),"{,".indexOf(x)!=-1&&w[0]=="{"&&(r=o[o.length-1]))r.json=r.text.indexOf(".")==-1}else if(c("(){}[].,;:"))o.push({index:n,text:q,json:":[,".indexOf(x)!=-1&&c("{[")||c("}]:,")}),c("{[")&&w.unshift(q),c("}]")&&w.shift(),n++;else if(g(q)){n++;continue}else{var m=q+d(),A=Ka[q],s=Ka[m];s?(o.push({index:n,text:m,fn:s}),n+=2):A?(o.push({index:n,
|
||||
text:q,fn:A,json:"[,:".indexOf(x)!=-1&&c("+-")}),n+=1):h("Unexpected next character ",n,n+1)}x=q}return o}function Lc(b,a,c,d){function e(a,c){throw u("Syntax Error: Token '"+c.text+"' "+a+" at column "+(c.index+1)+" of the expression ["+b+"] starting at ["+b.substring(c.index)+"].");}function g(){if(K.length===0)throw u("Unexpected end of expression: "+b);return K[0]}function i(a,b,c,d){if(K.length>0){var e=K[0],f=e.text;if(f==a||f==b||f==c||f==d||!a&&!b&&!c&&!d)return e}return!1}function f(b,c,
|
||||
d,f){return(b=i(b,c,d,f))?(a&&!b.json&&e("is not valid json",b),K.shift(),b):!1}function h(a){f(a)||e("is unexpected, expecting ["+a+"]",i())}function j(a,b){return function(c,d){return a(c,d,b)}}function k(a,b,c){return function(d,e){return b(d,e,a,c)}}function l(){for(var a=[];;)if(K.length>0&&!i("}",")",";","]")&&a.push(v()),!f(";"))return a.length==1?a[0]:function(b,c){for(var d,e=0;e<a.length;e++){var f=a[e];f&&(d=f(b,c))}return d}}function o(){for(var a=f(),b=c(a.text),d=[];;)if(a=f(":"))d.push(G());
|
||||
else{var e=function(a,c,e){for(var e=[e],f=0;f<d.length;f++)e.push(d[f](a,c));return b.apply(a,e)};return function(){return e}}}function r(){for(var a=n(),b;;)if(b=f("||"))a=k(a,b.fn,n());else return a}function n(){var a=w(),b;if(b=f("&&"))a=k(a,b.fn,n());return a}function w(){var a=q(),b;if(b=f("==","!="))a=k(a,b.fn,w());return a}function q(){var a;a=x();for(var b;b=f("+","-");)a=k(a,b.fn,x());if(b=f("<",">","<=",">="))a=k(a,b.fn,q());return a}function x(){for(var a=m(),b;b=f("*","/","%");)a=k(a,
|
||||
b.fn,m());return a}function m(){var a;return f("+")?A():(a=f("-"))?k(ba,a.fn,m()):(a=f("!"))?j(a.fn,m()):A()}function A(){var a;if(f("("))a=v(),h(")");else if(f("["))a=s();else if(f("{"))a=J();else{var b=f();(a=b.fn)||e("not a primary expression",b)}for(var c;b=f("(","[",".");)b.text==="("?(a=z(a,c),c=null):b.text==="["?(c=a,a=ea(a)):b.text==="."?(c=a,a=t(a)):e("IMPOSSIBLE");return a}function s(){var a=[];if(g().text!="]"){do a.push(G());while(f(","))}h("]");return function(b,c){for(var d=[],e=0;e<
|
||||
a.length;e++)d.push(a[e](b,c));return d}}function J(){var a=[];if(g().text!="}"){do{var b=f(),b=b.string||b.text;h(":");var c=G();a.push({key:b,value:c})}while(f(","))}h("}");return function(b,c){for(var d={},e=0;e<a.length;e++){var f=a[e],j=f.value(b,c);d[f.key]=j}return d}}var ba=H(0),P,K=Jc(b,d),G=function(){var a=r(),c,d;return(d=f("="))?(a.assign||e("implies assignment but ["+b.substring(0,d.index)+"] can not be assigned to",d),c=r(),function(b,d){return a.assign(b,c(b,d),d)}):a},z=function(a,
|
||||
b){var c=[];if(g().text!=")"){do c.push(G());while(f(","))}h(")");return function(d,e){for(var f=[],j=b?b(d,e):d,h=0;h<c.length;h++)f.push(c[h](d,e));h=a(d,e)||C;return h.apply?h.apply(j,f):h(f[0],f[1],f[2],f[3],f[4])}},t=function(a){var b=f().text,c=Kb(b,d);return y(function(b,d){return c(a(b,d),d)},{assign:function(c,d,e){return Lb(a(c,e),b,d)}})},ea=function(a){var b=G();h("]");return y(function(c,d){var e=a(c,d),f=b(c,d),j;if(!e)return p;if((e=e[f])&&e.then){j=e;if(!("$$v"in e))j.$$v=p,j.then(function(a){j.$$v=
|
||||
a});e=e.$$v}return e},{assign:function(c,d,e){return a(c,e)[b(c,e)]=d}})},v=function(){for(var a=G(),b;;)if(b=f("|"))a=k(a,b.fn,o());else return a};a?(G=r,z=t=ea=v=function(){e("is not valid json",{text:b,index:0})},P=A()):P=l();K.length!==0&&e("is an unexpected token",K[0]);return P}function Lb(b,a,c){for(var a=a.split("."),d=0;a.length>1;d++){var e=a.shift(),g=b[e];g||(g={},b[e]=g);b=g}return b[a.shift()]=c}function gb(b,a,c){if(!a)return b;for(var a=a.split("."),d,e=b,g=a.length,i=0;i<g;i++)d=
|
||||
a[i],b&&(b=(e=b)[d]);return!c&&L(b)?Va(e,b):b}function Mb(b,a,c,d,e){return function(g,i){var f=i&&i.hasOwnProperty(b)?i:g,h;if(f===null||f===p)return f;if((f=f[b])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!a||f===null||f===p)return f;if((f=f[a])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!c||f===null||f===p)return f;if((f=f[c])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!d||f===null||f===p)return f;
|
||||
if((f=f[d])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!e||f===null||f===p)return f;if((f=f[e])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}return f}}function Kb(b,a){if(ib.hasOwnProperty(b))return ib[b];var c=b.split("."),d=c.length,e;if(a)e=d<6?Mb(c[0],c[1],c[2],c[3],c[4]):function(a,b){var e=0,j;do j=Mb(c[e++],c[e++],c[e++],c[e++],c[e++])(a,b),b=p,a=j;while(e<d);return j};else{var g="var l, fn, p;\n";m(c,function(a,b){g+="if(s === null || s === undefined) return s;\nl=s;\ns="+
|
||||
(b?"s":'((k&&k.hasOwnProperty("'+a+'"))?k:s)')+'["'+a+'"];\nif (s && s.then) {\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n'});g+="return s;";e=Function("s","k",g);e.toString=function(){return g}}return ib[b]=e}function Mc(){var b={};this.$get=["$filter","$sniffer",function(a,c){return function(d){switch(typeof d){case "string":return b.hasOwnProperty(d)?b[d]:b[d]=Lc(d,!1,a,c.csp);case "function":return d;default:return C}}}]}function Nc(){this.$get=
|
||||
["$rootScope","$exceptionHandler",function(b,a){return Oc(function(a){b.$evalAsync(a)},a)}]}function Oc(b,a){function c(a){return a}function d(a){return i(a)}var e=function(){var f=[],h,j;return j={resolve:function(a){if(f){var c=f;f=p;h=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],h.then(a[0],a[1])})}},reject:function(a){j.resolve(i(a))},promise:{then:function(b,j){var g=e(),i=function(d){try{g.resolve((b||c)(d))}catch(e){a(e),g.reject(e)}},n=function(b){try{g.resolve((j||
|
||||
d)(b))}catch(c){a(c),g.reject(c)}};f?f.push([i,n]):h.then(i,n);return g.promise}}}},g=function(a){return a&&a.then?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},i=function(a){return{then:function(c,j){var g=e();b(function(){g.resolve((j||d)(a))});return g.promise}}};return{defer:e,reject:i,when:function(f,h,j){var k=e(),l,o=function(b){try{return(h||c)(b)}catch(d){return a(d),i(d)}},r=function(b){try{return(j||d)(b)}catch(c){return a(c),i(c)}};b(function(){g(f).then(function(a){l||
|
||||
(l=!0,k.resolve(g(a).then(o,r)))},function(a){l||(l=!0,k.resolve(r(a)))})});return k.promise},all:function(a){var b=e(),c=a.length,d=[];c?m(a,function(a,e){g(a).then(function(a){e in d||(d[e]=a,--c||b.resolve(d))},function(a){e in d||b.reject(a)})}):b.resolve(d);return b.promise}}}function Pc(){var b={};this.when=function(a,c){b[a]=y({reloadOnSearch:!0},c);if(a){var d=a[a.length-1]=="/"?a.substr(0,a.length-1):a+"/";b[d]={redirectTo:a}}return this};this.otherwise=function(a){this.when(null,a);return this};
|
||||
this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache",function(a,c,d,e,g,i,f){function h(a,b){for(var b="^"+b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"$",c="",d=[],e={},f=/:(\w+)/g,j,g=0;(j=f.exec(b))!==null;)c+=b.slice(g,j.index),c+="([^\\/]*)",d.push(j[1]),g=f.lastIndex;c+=b.substr(g);var h=a.match(RegExp(c));h&&m(d,function(a,b){e[a]=h[b+1]});return h?e:null}function j(){var b=k(),j=r.current;if(b&&j&&b.$route===j.$route&&ha(b.pathParams,j.pathParams)&&!b.reloadOnSearch&&
|
||||
!o)j.params=b.params,U(j.params,d),a.$broadcast("$routeUpdate",j);else if(b||j)o=!1,a.$broadcast("$routeChangeStart",b,j),(r.current=b)&&b.redirectTo&&(E(b.redirectTo)?c.path(l(b.redirectTo,b.params)).search(b.params).replace():c.url(b.redirectTo(b.pathParams,c.path(),c.search())).replace()),e.when(b).then(function(){if(b){var a=[],c=[],d;m(b.resolve||{},function(b,d){a.push(d);c.push(E(b)?g.get(b):g.invoke(b))});if(!v(d=b.template))if(v(d=b.templateUrl))d=i.get(d,{cache:f}).then(function(a){return a.data});
|
||||
v(d)&&(a.push("$template"),c.push(d));return e.all(c).then(function(b){var c={};m(b,function(b,d){c[a[d]]=b});return c})}}).then(function(c){if(b==r.current){if(b)b.locals=c,U(b.params,d);a.$broadcast("$routeChangeSuccess",b,j)}},function(c){b==r.current&&a.$broadcast("$routeChangeError",b,j,c)})}function k(){var a,d;m(b,function(b,e){if(!d&&(a=h(c.path(),e)))d=xa(b,{params:y({},c.search(),a),pathParams:a}),d.$route=b});return d||b[null]&&xa(b[null],{params:{},pathParams:{}})}function l(a,b){var c=
|
||||
[];m((a||"").split(":"),function(a,d){if(d==0)c.push(a);else{var e=a.match(/(\w+)(.*)/),f=e[1];c.push(b[f]);c.push(e[2]||"");delete b[f]}});return c.join("")}var o=!1,r={routes:b,reload:function(){o=!0;a.$evalAsync(j)}};a.$on("$locationChangeSuccess",j);return r}]}function Qc(){this.$get=H({})}function Rc(){var b=10;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse",function(a,c,d){function e(){this.$id=wa();this.$$phase=this.$parent=this.$$watchers=
|
||||
this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$destroyed=!1;this.$$asyncQueue=[];this.$$listeners={}}function g(a){if(h.$$phase)throw u(h.$$phase+" already in progress");h.$$phase=a}function i(a,b){var c=d(a);qa(c,b);return c}function f(){}e.prototype={$new:function(a){if(L(a))throw u("API-CHANGE: Use $controller to instantiate controllers.");a?(a=new e,a.$root=this.$root):(a=function(){},a.prototype=this,a=new a,a.$id=wa());a["this"]=
|
||||
a;a.$$listeners={};a.$parent=this;a.$$asyncQueue=[];a.$$watchers=a.$$nextSibling=a.$$childHead=a.$$childTail=null;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,c){var d=i(a,"watch"),e=this.$$watchers,g={fn:b,last:f,get:d,exp:a,eq:!!c};if(!L(b)){var h=i(b||C,"listener");g.fn=function(a,b,c){h(c)}}if(!e)e=this.$$watchers=[];e.unshift(g);return function(){Ua(e,g)}},$digest:function(){var a,
|
||||
d,e,i,r,n,m,q=b,x,p=[],A,s;g("$digest");do{m=!1;x=this;do{for(r=x.$$asyncQueue;r.length;)try{x.$eval(r.shift())}catch(J){c(J)}if(i=x.$$watchers)for(n=i.length;n--;)try{if(a=i[n],(d=a.get(x))!==(e=a.last)&&!(a.eq?ha(d,e):typeof d=="number"&&typeof e=="number"&&isNaN(d)&&isNaN(e)))m=!0,a.last=a.eq?U(d):d,a.fn(d,e===f?d:e,x),q<5&&(A=4-q,p[A]||(p[A]=[]),s=L(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,s+="; newVal: "+da(d)+"; oldVal: "+da(e),p[A].push(s))}catch(ba){c(ba)}if(!(i=x.$$childHead||x!==
|
||||
this&&x.$$nextSibling))for(;x!==this&&!(i=x.$$nextSibling);)x=x.$parent}while(x=i);if(m&&!q--)throw h.$$phase=null,u(b+" $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: "+da(p));}while(m||r.length);h.$$phase=null},$destroy:function(){if(!(h==this||this.$$destroyed)){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;if(a.$$childHead==this)a.$$childHead=this.$$nextSibling;if(a.$$childTail==this)a.$$childTail=this.$$prevSibling;if(this.$$prevSibling)this.$$prevSibling.$$nextSibling=
|
||||
this.$$nextSibling;if(this.$$nextSibling)this.$$nextSibling.$$prevSibling=this.$$prevSibling;this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null}},$eval:function(a,b){return d(a)(this,b)},$evalAsync:function(a){this.$$asyncQueue.push(a)},$apply:function(a){try{return g("$apply"),this.$eval(a)}catch(b){c(b)}finally{h.$$phase=null;try{h.$digest()}catch(d){throw c(d),d;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);return function(){c[ya(c,
|
||||
b)]=null}},$emit:function(a,b){var d=[],e,f=this,g=!1,h={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},i=[h].concat(ia.call(arguments,1)),m,p;do{e=f.$$listeners[a]||d;h.currentScope=f;m=0;for(p=e.length;m<p;m++)if(e[m])try{if(e[m].apply(null,i),g)return h}catch(A){c(A)}else e.splice(m,1),m--,p--;f=f.$parent}while(f);return h},$broadcast:function(a,b){var d=this,e=this,f={name:a,targetScope:this,preventDefault:function(){f.defaultPrevented=
|
||||
!0},defaultPrevented:!1},g=[f].concat(ia.call(arguments,1)),h,i;do{d=e;f.currentScope=d;e=d.$$listeners[a]||[];h=0;for(i=e.length;h<i;h++)if(e[h])try{e[h].apply(null,g)}catch(m){c(m)}else e.splice(h,1),h--,i--;if(!(e=d.$$childHead||d!==this&&d.$$nextSibling))for(;d!==this&&!(e=d.$$nextSibling);)d=d.$parent}while(d=e);return f}};var h=new e;return h}]}function Sc(){this.$get=["$window",function(b){var a={},c=F((/android (\d+)/.exec(D(b.navigator.userAgent))||[])[1]);return{history:!(!b.history||!b.history.pushState||
|
||||
c<4),hashchange:"onhashchange"in b&&(!b.document.documentMode||b.document.documentMode>7),hasEvent:function(c){if(c=="input"&&aa==9)return!1;if(t(a[c])){var e=b.document.createElement("div");a[c]="on"+c in e}return a[c]},csp:!1}}]}function Tc(){this.$get=H(T)}function Nb(b){var a={},c,d,e;if(!b)return a;m(b.split("\n"),function(b){e=b.indexOf(":");c=D(Q(b.substr(0,e)));d=Q(b.substr(e+1));c&&(a[c]?a[c]+=", "+d:a[c]=d)});return a}function Ob(b){var a=M(b)?b:p;return function(c){a||(a=Nb(b));return c?
|
||||
a[D(c)]||null:a}}function Pb(b,a,c){if(L(c))return c(b,a);m(c,function(c){b=c(b,a)});return b}function Uc(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d=this.defaults={transformResponse:[function(d){E(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=ob(d,!0)));return d}],transformRequest:[function(a){return M(a)&&Sa.apply(a)!=="[object File]"?da(a):a}],headers:{common:{Accept:"application/json, text/plain, */*","X-Requested-With":"XMLHttpRequest"},post:{"Content-Type":"application/json;charset=utf-8"},
|
||||
put:{"Content-Type":"application/json;charset=utf-8"}}},e=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,h,j,k){function l(a){function c(a){var b=y({},a,{data:Pb(a.data,a.headers,f)});return 200<=a.status&&a.status<300?b:j.reject(b)}a.method=la(a.method);var e=a.transformRequest||d.transformRequest,f=a.transformResponse||d.transformResponse,h=d.headers,h=y({"X-XSRF-TOKEN":b.cookies()["XSRF-TOKEN"]},h.common,h[D(a.method)],
|
||||
a.headers),e=Pb(a.data,Ob(h),e),g;t(a.data)&&delete h["Content-Type"];g=o(a,e,h);g=g.then(c,c);m(w,function(a){g=a(g)});g.success=function(b){g.then(function(c){b(c.data,c.status,c.headers,a)});return g};g.error=function(b){g.then(null,function(c){b(c.data,c.status,c.headers,a)});return g};return g}function o(b,c,d){function e(a,b,c){m&&(200<=a&&a<300?m.put(w,[a,b,Nb(c)]):m.remove(w));f(b,a,c);h.$apply()}function f(a,c,d){c=Math.max(c,0);(200<=c&&c<300?k.resolve:k.reject)({data:a,status:c,headers:Ob(d),
|
||||
config:b})}function i(){var a=ya(l.pendingRequests,b);a!==-1&&l.pendingRequests.splice(a,1)}var k=j.defer(),o=k.promise,m,p,w=r(b.url,b.params);l.pendingRequests.push(b);o.then(i,i);b.cache&&b.method=="GET"&&(m=M(b.cache)?b.cache:n);if(m)if(p=m.get(w))if(p.then)return p.then(i,i),p;else I(p)?f(p[1],p[0],U(p[2])):f(p,200,{});else m.put(w,o);p||a(b.method,w,c,e,d,b.timeout,b.withCredentials);return o}function r(a,b){if(!b)return a;var c=[];fc(b,function(a,b){a==null||a==p||(M(a)&&(a=da(a)),c.push(encodeURIComponent(b)+
|
||||
"="+encodeURIComponent(a)))});return a+(a.indexOf("?")==-1?"?":"&")+c.join("&")}var n=c("$http"),w=[];m(e,function(a){w.push(E(a)?k.get(a):k.invoke(a))});l.pendingRequests=[];(function(a){m(arguments,function(a){l[a]=function(b,c){return l(y(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){m(arguments,function(a){l[a]=function(b,c,d){return l(y(d||{},{method:a,url:b,data:c}))}})})("post","put");l.defaults=d;return l}]}function Vc(){this.$get=["$browser","$window","$document",
|
||||
function(b,a,c){return Wc(b,Xc,b.defer,a.angular.callbacks,c[0],a.location.protocol.replace(":",""))}]}function Wc(b,a,c,d,e,g){function i(a,b){var c=e.createElement("script"),d=function(){e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;aa?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:c.onload=c.onerror=d;e.body.appendChild(c)}return function(e,h,j,k,l,o,r){function n(a,c,d,e){c=(h.match(Gb)||["",g])[1]=="file"?d?200:404:c;a(c==1223?204:c,d,e);b.$$completeOutstandingRequest(C)}
|
||||
b.$$incOutstandingRequestCount();h=h||b.url();if(D(e)=="jsonp"){var p="_"+(d.counter++).toString(36);d[p]=function(a){d[p].data=a};i(h.replace("JSON_CALLBACK","angular.callbacks."+p),function(){d[p].data?n(k,200,d[p].data):n(k,-2);delete d[p]})}else{var q=new a;q.open(e,h,!0);m(l,function(a,b){a&&q.setRequestHeader(b,a)});var x;q.onreadystatechange=function(){q.readyState==4&&n(k,x||q.status,q.responseText,q.getAllResponseHeaders())};if(r)q.withCredentials=!0;q.send(j||"");o>0&&c(function(){x=-1;
|
||||
q.abort()},o)}}}function Yc(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),SHORTMONTH:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
|
||||
DAY:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),SHORTDAY:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return b===1?"one":"other"}}}}function Zc(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(b,a,c,d){function e(e,f,h){var j=c.defer(),
|
||||
k=j.promise,l=v(h)&&!h,f=a.defer(function(){try{j.resolve(e())}catch(a){j.reject(a),d(a)}l||b.$apply()},f),h=function(){delete g[k.$$timeoutId]};k.$$timeoutId=f;g[f]=j;k.then(h,h);return k}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),a.defer.cancel(b.$$timeoutId)):!1};return e}]}function Qb(b){function a(a,e){return b.factory(a+c,e)}var c="Filter";this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+c)}}];a("currency",
|
||||
Rb);a("date",Sb);a("filter",$c);a("json",ad);a("limitTo",bd);a("lowercase",cd);a("number",Tb);a("orderBy",Ub);a("uppercase",dd)}function $c(){return function(b,a){if(!(b instanceof Array))return b;var c=[];c.check=function(a){for(var b=0;b<c.length;b++)if(!c[b](a))return!1;return!0};var d=function(a,b){if(b.charAt(0)==="!")return!d(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return(""+a).toLowerCase().indexOf(b)>-1;case "object":for(var c in a)if(c.charAt(0)!=="$"&&
|
||||
d(a[c],b))return!0;return!1;case "array":for(c=0;c<a.length;c++)if(d(a[c],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a={$:a};case "object":for(var e in a)e=="$"?function(){var b=(""+a[e]).toLowerCase();b&&c.push(function(a){return d(a,b)})}():function(){var b=e,f=(""+a[e]).toLowerCase();f&&c.push(function(a){return d(gb(a,b),f)})}();break;case "function":c.push(a);break;default:return b}for(var g=[],i=0;i<b.length;i++){var f=b[i];c.check(f)&&
|
||||
g.push(f)}return g}}function Rb(b){var a=b.NUMBER_FORMATS;return function(b,d){if(t(d))d=a.CURRENCY_SYM;return Vb(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Tb(b){var a=b.NUMBER_FORMATS;return function(b,d){return Vb(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Vb(b,a,c,d,e){if(isNaN(b)||!isFinite(b))return"";var g=b<0,b=Math.abs(b),i=b+"",f="",h=[],j=!1;if(i.indexOf("e")!==-1){var k=i.match(/([\d\.]+)e(-?)(\d+)/);k&&k[2]=="-"&&k[3]>e+1?i="0":(f=i,j=!0)}if(!j){i=
|
||||
(i.split(Wb)[1]||"").length;t(e)&&(e=Math.min(Math.max(a.minFrac,i),a.maxFrac));var i=Math.pow(10,e),b=Math.round(b*i)/i,b=(""+b).split(Wb),i=b[0],b=b[1]||"",j=0,k=a.lgSize,l=a.gSize;if(i.length>=k+l)for(var j=i.length-k,o=0;o<j;o++)(j-o)%l===0&&o!==0&&(f+=c),f+=i.charAt(o);for(o=j;o<i.length;o++)(i.length-o)%k===0&&o!==0&&(f+=c),f+=i.charAt(o);for(;b.length<e;)b+="0";e&&(f+=d+b.substr(0,e))}h.push(g?a.negPre:a.posPre);h.push(f);h.push(g?a.negSuf:a.posSuf);return h.join("")}function jb(b,a,c){var d=
|
||||
"";b<0&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function N(b,a,c,d){return function(e){e=e["get"+b]();if(c>0||e>-c)e+=c;e===0&&c==-12&&(e=12);return jb(e,a,d)}}function La(b,a){return function(c,d){var e=c["get"+b](),g=la(a?"SHORT"+b:b);return d[g][e]}}function Sb(b){function a(a){var b;if(b=a.match(c)){var a=new Date(0),g=0,i=0;b[9]&&(g=F(b[9]+b[10]),i=F(b[9]+b[11]));a.setUTCFullYear(F(b[1]),F(b[2])-1,F(b[3]));a.setUTCHours(F(b[4]||0)-g,F(b[5]||0)-i,F(b[6]||
|
||||
0),F(b[7]||0))}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e){var g="",i=[],f,h,e=e||"mediumDate",e=b.DATETIME_FORMATS[e]||e;E(c)&&(c=ed.test(c)?F(c):a(c));va(c)&&(c=new Date(c));if(!na(c))return c;for(;e;)(h=fd.exec(e))?(i=i.concat(ia.call(h,1)),e=i.pop()):(i.push(e),e=null);m(i,function(a){f=gd[a];g+=f?f(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function ad(){return function(b){return da(b,
|
||||
!0)}}function bd(){return function(b,a){if(!(b instanceof Array))return b;var a=F(a),c=[],d,e;if(!b||!(b instanceof Array))return c;a>b.length?a=b.length:a<-b.length&&(a=-b.length);a>0?(d=0,e=a):(d=b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function Ub(b){return function(a,c,d){function e(a,b){return Wa(b)?function(b,c){return a(c,b)}:a}if(!(a instanceof Array))return a;if(!c)return a;for(var c=I(c)?c:[c],c=Ta(c,function(a){var c=!1,d=a||ma;if(E(a)){if(a.charAt(0)=="+"||a.charAt(0)==
|
||||
"-")c=a.charAt(0)=="-",a=a.substring(1);d=b(a)}return e(function(a,b){var c;c=d(a);var e=d(b),f=typeof c,g=typeof e;f==g?(f=="string"&&(c=c.toLowerCase()),f=="string"&&(e=e.toLowerCase()),c=c===e?0:c<e?-1:1):c=f<g?-1:1;return c},c)}),g=[],i=0;i<a.length;i++)g.push(a[i]);return g.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=c[d](a,b);if(e!==0)return e}return 0},d))}}function R(b){L(b)&&(b={link:b});b.restrict=b.restrict||"AC";return H(b)}function Xb(b,a){function c(a,c){c=c?"-"+$a(c,"-"):
|
||||
"";b.removeClass((a?Ma:Na)+c).addClass((a?Na:Ma)+c)}var d=this,e=b.parent().controller("form")||Oa,g=0,i=d.$error={};d.$name=a.name;d.$dirty=!1;d.$pristine=!0;d.$valid=!0;d.$invalid=!1;e.$addControl(d);b.addClass(Pa);c(!0);d.$addControl=function(a){a.$name&&!d.hasOwnProperty(a.$name)&&(d[a.$name]=a)};d.$removeControl=function(a){a.$name&&d[a.$name]===a&&delete d[a.$name];m(i,function(b,c){d.$setValidity(c,!0,a)})};d.$setValidity=function(a,b,j){var k=i[a];if(b){if(k&&(Ua(k,j),!k.length)){g--;if(!g)c(b),
|
||||
d.$valid=!0,d.$invalid=!1;i[a]=!1;c(!0,a);e.$setValidity(a,!0,d)}}else{g||c(b);if(k){if(ya(k,j)!=-1)return}else i[a]=k=[],g++,c(!1,a),e.$setValidity(a,!1,d);k.push(j);d.$valid=!1;d.$invalid=!0}};d.$setDirty=function(){b.removeClass(Pa).addClass(Yb);d.$dirty=!0;d.$pristine=!1;e.$setDirty()}}function S(b){return t(b)||b===""||b===null||b!==b}function Qa(b,a,c,d,e,g){var i=function(){var c=Q(a.val());d.$viewValue!==c&&b.$apply(function(){d.$setViewValue(c)})};if(e.hasEvent("input"))a.bind("input",i);
|
||||
else{var f;a.bind("keydown",function(a){a=a.keyCode;a===91||15<a&&a<19||37<=a&&a<=40||f||(f=g.defer(function(){i();f=null}))});a.bind("change",i)}d.$render=function(){a.val(S(d.$viewValue)?"":d.$viewValue)};var h=c.ngPattern,j=function(a,b){return S(b)||a.test(b)?(d.$setValidity("pattern",!0),b):(d.$setValidity("pattern",!1),p)};h&&(h.match(/^\/(.*)\/$/)?(h=RegExp(h.substr(1,h.length-2)),e=function(a){return j(h,a)}):e=function(a){var c=b.$eval(h);if(!c||!c.test)throw new u("Expected "+h+" to be a RegExp but was "+
|
||||
c);return j(c,a)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var k=F(c.ngMinlength),e=function(a){return!S(a)&&a.length<k?(d.$setValidity("minlength",!1),p):(d.$setValidity("minlength",!0),a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var l=F(c.ngMaxlength),c=function(a){return!S(a)&&a.length>l?(d.$setValidity("maxlength",!1),p):(d.$setValidity("maxlength",!0),a)};d.$parsers.push(c);d.$formatters.push(c)}}function kb(b,a){b="ngClass"+b;return R(function(c,d,e){function g(b,
|
||||
d){if(a===!0||c.$index%2===a)d&&b!==d&&i(d),f(b)}function i(a){M(a)&&!I(a)&&(a=Ta(a,function(a,b){if(a)return b}));d.removeClass(I(a)?a.join(" "):a)}function f(a){M(a)&&!I(a)&&(a=Ta(a,function(a,b){if(a)return b}));a&&d.addClass(I(a)?a.join(" "):a)}c.$watch(e[b],g,!0);e.$observe("class",function(){var a=c.$eval(e[b]);g(a,a)});b!=="ngClass"&&c.$watch("$index",function(d,g){var k=d%2;k!==g%2&&(k==a?f(c.$eval(e[b])):i(c.$eval(e[b])))})})}var D=function(b){return E(b)?b.toLowerCase():b},la=function(b){return E(b)?
|
||||
b.toUpperCase():b},u=T.Error,aa=F((/msie (\d+)/.exec(D(navigator.userAgent))||[])[1]),z,ja,ia=[].slice,Ra=[].push,Sa=Object.prototype.toString,Zb=T.angular||(T.angular={}),sa,Db,Z=["0","0","0"];C.$inject=[];ma.$inject=[];Db=aa<9?function(b){b=b.nodeName?b:b[0];return b.scopeName&&b.scopeName!="HTML"?la(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var kc=/[A-Z]/g,hd={full:"1.0.4",major:1,minor:0,dot:4,codeName:"bewildering-hair"},Aa=O.cache={},za=
|
||||
O.expando="ng-"+(new Date).getTime(),oc=1,$b=T.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},eb=T.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)},mc=/([\:\-\_]+(.))/g,nc=/^moz([A-Z])/,ta=O.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;this.bind("DOMContentLoaded",a);O(T).bind("load",a)},toString:function(){var b=[];m(this,function(a){b.push(""+a)});
|
||||
return"["+b.join(", ")+"]"},eq:function(b){return b>=0?z(this[b]):z(this[this.length+b])},length:0,push:Ra,sort:[].sort,splice:[].splice},Da={};m("multiple,selected,checked,disabled,readOnly,required".split(","),function(b){Da[D(b)]=b});var Ab={};m("input,select,option,textarea,button,form".split(","),function(b){Ab[la(b)]=!0});m({data:vb,inheritedData:Ca,scope:function(b){return Ca(b,"$scope")},controller:yb,injector:function(b){return Ca(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},
|
||||
hasClass:Ba,css:function(b,a,c){a=sb(a);if(v(c))b.style[a]=c;else{var d;aa<=8&&(d=b.currentStyle&&b.currentStyle[a],d===""&&(d="auto"));d=d||b.style[a];aa<=8&&(d=d===""?p:d);return d}},attr:function(b,a,c){var d=D(a);if(Da[d])if(v(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||C).specified?d:p;else if(v(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),b===null?p:b},prop:function(b,a,c){if(v(c))b[a]=c;else return b[a]},
|
||||
text:y(aa<9?function(b,a){if(b.nodeType==1){if(t(a))return b.innerText;b.innerText=a}else{if(t(a))return b.nodeValue;b.nodeValue=a}}:function(b,a){if(t(a))return b.textContent;b.textContent=a},{$dv:""}),val:function(b,a){if(t(a))return b.value;b.value=a},html:function(b,a){if(t(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)ra(d[c]);b.innerHTML=a}},function(b,a){O.prototype[a]=function(a,d){var e,g;if((b.length==2&&b!==Ba&&b!==yb?a:d)===p)if(M(a)){for(e=0;e<this.length;e++)if(b===
|
||||
vb)b(this[e],a);else for(g in a)b(this[e],g,a[g]);return this}else{if(this.length)return b(this[0],a,d)}else{for(e=0;e<this.length;e++)b(this[e],a,d);return this}return b.$dv}});m({removeData:tb,dealoc:ra,bind:function a(c,d,e){var g=$(c,"events"),i=$(c,"handle");g||$(c,"events",g={});i||$(c,"handle",i=pc(c,g));m(d.split(" "),function(d){var h=g[d];if(!h){if(d=="mouseenter"||d=="mouseleave"){var j=0;g.mouseenter=[];g.mouseleave=[];a(c,"mouseover",function(a){j++;j==1&&i(a,"mouseenter")});a(c,"mouseout",
|
||||
function(a){j--;j==0&&i(a,"mouseleave")})}else $b(c,d,i),g[d]=[];h=g[d]}h.push(e)})},unbind:ub,replaceWith:function(a,c){var d,e=a.parentNode;ra(a);m(new O(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];m(a.childNodes,function(a){a.nodeType===1&&c.push(a)});return c},contents:function(a){return a.childNodes||[]},append:function(a,c){m(new O(c),function(c){a.nodeType===1&&a.appendChild(c)})},prepend:function(a,c){if(a.nodeType===1){var d=a.firstChild;
|
||||
m(new O(c),function(c){d?a.insertBefore(c,d):(a.appendChild(c),d=c)})}},wrap:function(a,c){var c=z(c)[0],d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){ra(a);var c=a.parentNode;c&&c.removeChild(a)},after:function(a,c){var d=a,e=a.parentNode;m(new O(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:xb,removeClass:wb,toggleClass:function(a,c,d){t(d)&&(d=!Ba(a,c));(d?xb:wb)(a,c)},parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},next:function(a){if(a.nextElementSibling)return a.nextElementSibling;
|
||||
for(a=a.nextSibling;a!=null&&a.nodeType!==1;)a=a.nextSibling;return a},find:function(a,c){return a.getElementsByTagName(c)},clone:db,triggerHandler:function(a,c){var d=($(a,"events")||{})[c];m(d,function(c){c.call(a,null)})}},function(a,c){O.prototype[c]=function(c,e){for(var g,i=0;i<this.length;i++)g==p?(g=a(this[i],c,e),g!==p&&(g=z(g))):cb(g,a(this[i],c,e));return g==p?this:g}});Ea.prototype={put:function(a,c){this[ga(a)]=c},get:function(a){return this[ga(a)]},remove:function(a){var c=this[a=ga(a)];
|
||||
delete this[a];return c}};fb.prototype={push:function(a,c){var d=this[a=ga(a)];d?d.push(c):this[a]=[c]},shift:function(a){var c=this[a=ga(a)];if(c)return c.length==1?(delete this[a],c[0]):c.shift()},peek:function(a){if(a=this[ga(a)])return a[0]}};var rc=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,sc=/,/,tc=/^\s*(_?)(\S+?)\1\s*$/,qc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Eb="Non-assignable model expression: ";Cb.$inject=["$provide"];var zc=/^(x[\:\-_]|data[\:\-_])/i,Gb=/^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
|
||||
ac=/^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,Gc=ac,Hb={http:80,https:443,ftp:21};hb.prototype={$$replace:!1,absUrl:Ja("$$absUrl"),url:function(a,c){if(t(a))return this.$$url;var d=ac.exec(a);d[1]&&this.path(decodeURIComponent(d[1]));if(d[2]||d[1])this.search(d[3]||"");this.hash(d[5]||"",c);return this},protocol:Ja("$$protocol"),host:Ja("$$host"),port:Ja("$$port"),path:Jb("$$path",function(a){return a.charAt(0)=="/"?a:"/"+a}),search:function(a,c){if(t(a))return this.$$search;v(c)?c===null?delete this.$$search[a]:
|
||||
this.$$search[a]=c:this.$$search=E(a)?Xa(a):a;this.$$compose();return this},hash:Jb("$$hash",ma),replace:function(){this.$$replace=!0;return this}};Ia.prototype=xa(hb.prototype);Ib.prototype=xa(Ia.prototype);var Ka={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:C,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return v(d)?v(e)?d+e:d:v(e)?e:p},"-":function(a,c,d,e){d=d(a,c);e=e(a,c);return(v(d)?d:0)-(v(e)?e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},
|
||||
"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^e(a,c)},"=":C,"==":function(a,c,d,e){return d(a,c)==e(a,c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},">":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},
|
||||
"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},Kc={n:"\n",f:"\u000c",r:"\r",t:"\t",v:"\u000b","'":"'",'"':'"'},ib={},Xc=T.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw new u("This browser does not support XMLHttpRequest.");};Qb.$inject=["$provide"];Rb.$inject=
|
||||
["$locale"];Tb.$inject=["$locale"];var Wb=".",gd={yyyy:N("FullYear",4),yy:N("FullYear",2,0,!0),y:N("FullYear",1),MMMM:La("Month"),MMM:La("Month",!0),MM:N("Month",2,1),M:N("Month",1,1),dd:N("Date",2),d:N("Date",1),HH:N("Hours",2),H:N("Hours",1),hh:N("Hours",2,-12),h:N("Hours",1,-12),mm:N("Minutes",2),m:N("Minutes",1),ss:N("Seconds",2),s:N("Seconds",1),EEEE:La("Day"),EEE:La("Day",!0),a:function(a,c){return a.getHours()<12?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=a.getTimezoneOffset();return jb(a/60,2)+
|
||||
jb(Math.abs(a%60),2)}},fd=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,ed=/^\d+$/;Sb.$inject=["$locale"];var cd=H(D),dd=H(la);Ub.$inject=["$parse"];var id=H({restrict:"E",compile:function(a,c){c.href||c.$set("href","");return function(a,c){c.bind("click",function(a){c.attr("href")||a.preventDefault()})}}}),lb={};m(Da,function(a,c){var d=fa("ng-"+c);lb[d]=function(){return{priority:100,compile:function(){return function(a,g,i){a.$watch(i[d],function(a){i.$set(c,!!a)})}}}}});
|
||||
m(["src","href"],function(a){var c=fa("ng-"+a);lb[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){c&&(g.$set(a,c),aa&&e.prop(a,c))})}}}});var Oa={$addControl:C,$removeControl:C,$setValidity:C,$setDirty:C};Xb.$inject=["$element","$attrs","$scope"];var Ra=function(a){return["$timeout",function(c){var d={name:"form",restrict:"E",controller:Xb,compile:function(){return{pre:function(a,d,i,f){if(!i.action){var h=function(a){a.preventDefault?a.preventDefault():a.returnValue=
|
||||
!1};$b(d[0],"submit",h);d.bind("$destroy",function(){c(function(){eb(d[0],"submit",h)},0,!1)})}var j=d.parent().controller("form"),k=i.name||i.ngForm;k&&(a[k]=f);j&&d.bind("$destroy",function(){j.$removeControl(f);k&&(a[k]=p);y(f,Oa)})}}}};return a?y(U(d),{restrict:"EAC"}):d}]},jd=Ra(),kd=Ra(!0),ld=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,md=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/,nd=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,bc={text:Qa,number:function(a,
|
||||
c,d,e,g,i){Qa(a,c,d,e,g,i);e.$parsers.push(function(a){var c=S(a);return c||nd.test(a)?(e.$setValidity("number",!0),a===""?null:c?a:parseFloat(a)):(e.$setValidity("number",!1),p)});e.$formatters.push(function(a){return S(a)?"":""+a});if(d.min){var f=parseFloat(d.min),a=function(a){return!S(a)&&a<f?(e.$setValidity("min",!1),p):(e.$setValidity("min",!0),a)};e.$parsers.push(a);e.$formatters.push(a)}if(d.max){var h=parseFloat(d.max),d=function(a){return!S(a)&&a>h?(e.$setValidity("max",!1),p):(e.$setValidity("max",
|
||||
!0),a)};e.$parsers.push(d);e.$formatters.push(d)}e.$formatters.push(function(a){return S(a)||va(a)?(e.$setValidity("number",!0),a):(e.$setValidity("number",!1),p)})},url:function(a,c,d,e,g,i){Qa(a,c,d,e,g,i);a=function(a){return S(a)||ld.test(a)?(e.$setValidity("url",!0),a):(e.$setValidity("url",!1),p)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,g,i){Qa(a,c,d,e,g,i);a=function(a){return S(a)||md.test(a)?(e.$setValidity("email",!0),a):(e.$setValidity("email",!1),p)};e.$formatters.push(a);
|
||||
e.$parsers.push(a)},radio:function(a,c,d,e){t(d.name)&&c.attr("name",wa());c.bind("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var g=d.ngTrueValue,i=d.ngFalseValue;E(g)||(g=!0);E(i)||(i=!1);c.bind("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$formatters.push(function(a){return a===
|
||||
g});e.$parsers.push(function(a){return a?g:i})},hidden:C,button:C,submit:C,reset:C},cc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",link:function(d,e,g,i){i&&(bc[D(g.type)]||bc.text)(d,e,g,i,c,a)}}}],Na="ng-valid",Ma="ng-invalid",Pa="ng-pristine",Yb="ng-dirty",od=["$scope","$exceptionHandler","$attrs","$element","$parse",function(a,c,d,e,g){function i(a,c){c=c?"-"+$a(c,"-"):"";e.removeClass((a?Ma:Na)+c).addClass((a?Na:Ma)+c)}this.$modelValue=this.$viewValue=Number.NaN;
|
||||
this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var f=g(d.ngModel),h=f.assign;if(!h)throw u(Eb+d.ngModel+" ("+pa(e)+")");this.$render=C;var j=e.inheritedData("$formController")||Oa,k=0,l=this.$error={};e.addClass(Pa);i(!0);this.$setValidity=function(a,c){if(l[a]!==!c){if(c){if(l[a]&&k--,!k)i(!0),this.$valid=!0,this.$invalid=!1}else i(!1),this.$invalid=!0,this.$valid=!1,k++;l[a]=!c;i(c,a);j.$setValidity(a,
|
||||
c,this)}};this.$setViewValue=function(d){this.$viewValue=d;if(this.$pristine)this.$dirty=!0,this.$pristine=!1,e.removeClass(Pa).addClass(Yb),j.$setDirty();m(this.$parsers,function(a){d=a(d)});if(this.$modelValue!==d)this.$modelValue=d,h(a,d),m(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}})};var o=this;a.$watch(function(){var c=f(a);if(o.$modelValue!==c){var d=o.$formatters,e=d.length;for(o.$modelValue=c;e--;)c=d[e](c);if(o.$viewValue!==c)o.$viewValue=c,o.$render()}})}],pd=function(){return{require:["ngModel",
|
||||
"^?form"],controller:od,link:function(a,c,d,e){var g=e[0],i=e[1]||Oa;i.$addControl(g);c.bind("$destroy",function(){i.$removeControl(g)})}}},qd=H({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),dc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var g=function(a){if(d.required&&(S(a)||a===!1))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);
|
||||
d.$observe("required",function(){g(e.$viewValue)})}}}},rd=function(){return{require:"ngModel",link:function(a,c,d,e){var g=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){var c=[];a&&m(a.split(g),function(a){a&&c.push(Q(a))});return c});e.$formatters.push(function(a){return I(a)?a.join(", "):p})}}},sd=/^(true|false|\d+)$/,td=function(){return{priority:100,compile:function(a,c){return sd.test(c.ngValue)?function(a,c,g){g.$set("value",a.$eval(g.ngValue))}:function(a,
|
||||
c,g){a.$watch(g.ngValue,function(a){g.$set("value",a,!1)})}}}},ud=R(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==p?"":a)})}),vd=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],wd=[function(){return function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBindHtmlUnsafe);a.$watch(d.ngBindHtmlUnsafe,
|
||||
function(a){c.html(a||"")})}}],xd=kb("",!0),yd=kb("Odd",0),zd=kb("Even",1),Ad=R({compile:function(a,c){c.$set("ngCloak",p);a.removeClass("ng-cloak")}}),Bd=[function(){return{scope:!0,controller:"@"}}],Cd=["$sniffer",function(a){return{priority:1E3,compile:function(){a.csp=!0}}}],ec={};m("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave".split(" "),function(a){var c=fa("ng-"+a);ec[c]=["$parse",function(d){return function(e,g,i){var f=d(i[c]);g.bind(D(a),function(a){e.$apply(function(){f(e,
|
||||
{$event:a})})})}}]});var Dd=R(function(a,c,d){c.bind("submit",function(){a.$apply(d.ngSubmit)})}),Ed=["$http","$templateCache","$anchorScroll","$compile",function(a,c,d,e){return{restrict:"ECA",terminal:!0,compile:function(g,i){var f=i.ngInclude||i.src,h=i.onload||"",j=i.autoscroll;return function(g,i){var o=0,m,n=function(){m&&(m.$destroy(),m=null);i.html("")};g.$watch(f,function(f){var q=++o;f?a.get(f,{cache:c}).success(function(a){q===o&&(m&&m.$destroy(),m=g.$new(),i.html(a),e(i.contents())(m),
|
||||
v(j)&&(!j||g.$eval(j))&&d(),m.$emit("$includeContentLoaded"),g.$eval(h))}).error(function(){q===o&&n()}):n()})}}}}],Fd=R({compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),Gd=R({terminal:!0,priority:1E3}),Hd=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,i){var f=i.count,h=g.attr(i.$attr.when),j=i.offset||0,k=e.$eval(h),l={},o=c.startSymbol(),r=c.endSymbol();m(k,function(a,e){l[e]=c(a.replace(d,o+f+"-"+j+r))});e.$watch(function(){var c=
|
||||
parseFloat(e.$eval(f));return isNaN(c)?"":(k[c]||(c=a.pluralCat(c-j)),l[c](e,g,!0))},function(a){g.text(a)})}}}],Id=R({transclude:"element",priority:1E3,terminal:!0,compile:function(a,c,d){return function(a,c,i){var f=i.ngRepeat,i=f.match(/^\s*(.+)\s+in\s+(.*)\s*$/),h,j,k;if(!i)throw u("Expected ngRepeat in form of '_item_ in _collection_' but got '"+f+"'.");f=i[1];h=i[2];i=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!i)throw u("'item' in 'item in collection' should be identifier or (key, value) but got '"+
|
||||
f+"'.");j=i[3]||i[1];k=i[2];var l=new fb;a.$watch(function(a){var e,f,i=a.$eval(h),m=c,p=new fb,z,A,s,v,t,u;if(I(i))t=i||[];else{t=[];for(s in i)i.hasOwnProperty(s)&&s.charAt(0)!="$"&&t.push(s);t.sort()}z=t.length;e=0;for(f=t.length;e<f;e++){s=i===t?e:t[e];v=i[s];if(u=l.shift(v)){A=u.scope;p.push(v,u);if(e!==u.index)u.index=e,m.after(u.element);m=u.element}else A=a.$new();A[j]=v;k&&(A[k]=s);A.$index=e;A.$first=e===0;A.$last=e===z-1;A.$middle=!(A.$first||A.$last);u||d(A,function(a){m.after(a);u={scope:A,
|
||||
element:m=a,index:e};p.push(v,u)})}for(s in l)if(l.hasOwnProperty(s))for(t=l[s];t.length;)v=t.pop(),v.element.remove(),v.scope.$destroy();l=p})}}}),Jd=R(function(a,c,d){a.$watch(d.ngShow,function(a){c.css("display",Wa(a)?"":"none")})}),Kd=R(function(a,c,d){a.$watch(d.ngHide,function(a){c.css("display",Wa(a)?"none":"")})}),Ld=R(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&m(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Md=H({restrict:"EA",require:"ngSwitch",controller:function(){this.cases=
|
||||
{}},link:function(a,c,d,e){var g,i,f;a.$watch(d.ngSwitch||d.on,function(h){i&&(f.$destroy(),i.remove(),i=f=null);if(g=e.cases["!"+h]||e.cases["?"])a.$eval(d.change),f=a.$new(),g(f,function(a){i=a;c.append(a)})})}}),Nd=R({transclude:"element",priority:500,require:"^ngSwitch",compile:function(a,c,d){return function(a,g,i,f){f.cases["!"+c.ngSwitchWhen]=d}}}),Od=R({transclude:"element",priority:500,require:"^ngSwitch",compile:function(a,c,d){return function(a,c,i,f){f.cases["?"]=d}}}),Pd=R({controller:["$transclude",
|
||||
"$element",function(a,c){a(function(a){c.append(a)})}]}),Qd=["$http","$templateCache","$route","$anchorScroll","$compile","$controller",function(a,c,d,e,g,i){return{restrict:"ECA",terminal:!0,link:function(a,c,j){function k(){var j=d.current&&d.current.locals,k=j&&j.$template;if(k){c.html(k);l&&(l.$destroy(),l=null);var k=g(c.contents()),m=d.current;l=m.scope=a.$new();if(m.controller)j.$scope=l,j=i(m.controller,j),c.contents().data("$ngControllerController",j);k(l);l.$emit("$viewContentLoaded");l.$eval(o);
|
||||
e()}else c.html(""),l&&(l.$destroy(),l=null)}var l,o=j.onload||"";a.$on("$routeChangeSuccess",k);k()}}}],Rd=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){d.type=="text/ng-template"&&a.put(d.id,c[0].text)}}}],Sd=H({terminal:!0}),Td=["$compile","$parse",function(a,c){var d=/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,e={$setViewValue:C};return{restrict:"E",
|
||||
require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var h=this,j={},k=e,l;h.databound=d.ngModel;h.init=function(a,c,d){k=a;l=d};h.addOption=function(c){j[c]=!0;k.$viewValue==c&&(a.val(c),l.parent()&&l.remove())};h.removeOption=function(a){this.hasOption(a)&&(delete j[a],k.$viewValue==a&&this.renderUnknownOption(a))};h.renderUnknownOption=function(c){c="? "+ga(c)+" ?";l.val(c);a.prepend(l);a.val(c);l.prop("selected",!0)};h.hasOption=function(a){return j.hasOwnProperty(a)};
|
||||
c.$on("$destroy",function(){h.renderUnknownOption=C})}],link:function(e,i,f,h){function j(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(s.parent()&&s.remove(),c.val(a),a===""&&x.prop("selected",!0)):t(a)&&x?c.val(""):e.renderUnknownOption(a)};c.bind("change",function(){a.$apply(function(){s.parent()&&s.remove();d.$setViewValue(c.val())})})}function k(a,c,d){var e;d.$render=function(){var a=new Ea(d.$viewValue);m(c.find("option"),function(c){c.selected=v(a.get(c.value))})};a.$watch(function(){ha(e,
|
||||
d.$viewValue)||(e=U(d.$viewValue),d.$render())});c.bind("change",function(){a.$apply(function(){var a=[];m(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function l(e,f,g){function h(){var a={"":[]},c=[""],d,i,t,v,u;t=g.$modelValue;v=r(e)||[];var x=l?mb(v):v,z,w,y;w={};u=!1;var B,D;if(n)u=new Ea(t);else if(t===null||q)a[""].push({selected:t===null,id:"",label:""}),u=!0;for(y=0;z=x.length,y<z;y++){w[k]=v[l?w[l]=x[y]:y];d=m(e,w)||"";if(!(i=a[d]))i=a[d]=[],c.push(d);
|
||||
n?d=u.remove(o(e,w))!=p:(d=t===o(e,w),u=u||d);B=j(e,w);B=B===p?"":B;i.push({id:l?x[y]:y,label:B,selected:d})}!n&&!u&&a[""].unshift({id:"?",label:"",selected:!0});w=0;for(x=c.length;w<x;w++){d=c[w];i=a[d];if(s.length<=w)t={element:A.clone().attr("label",d),label:i.label},v=[t],s.push(v),f.append(t.element);else if(v=s[w],t=v[0],t.label!=d)t.element.attr("label",t.label=d);B=null;y=0;for(z=i.length;y<z;y++)if(d=i[y],u=v[y+1]){B=u.element;if(u.label!==d.label)B.text(u.label=d.label);if(u.id!==d.id)B.val(u.id=
|
||||
d.id);if(u.element.selected!==d.selected)B.prop("selected",u.selected=d.selected)}else d.id===""&&q?D=q:(D=C.clone()).val(d.id).attr("selected",d.selected).text(d.label),v.push({element:D,label:d.label,id:d.id,selected:d.selected}),B?B.after(D):t.element.append(D),B=D;for(y++;v.length>y;)v.pop().element.remove()}for(;s.length>w;)s.pop()[0].element.remove()}var i;if(!(i=w.match(d)))throw u("Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+w+"'.");
|
||||
var j=c(i[2]||i[1]),k=i[4]||i[6],l=i[5],m=c(i[3]||""),o=c(i[2]?i[1]:k),r=c(i[7]),s=[[{element:f,label:""}]];q&&(a(q)(e),q.removeClass("ng-scope"),q.remove());f.html("");f.bind("change",function(){e.$apply(function(){var a,c=r(e)||[],d={},h,i,j,m,q,t;if(n){i=[];m=0;for(t=s.length;m<t;m++){a=s[m];j=1;for(q=a.length;j<q;j++)if((h=a[j].element)[0].selected)h=h.val(),l&&(d[l]=h),d[k]=c[h],i.push(o(e,d))}}else h=f.val(),h=="?"?i=p:h==""?i=null:(d[k]=c[h],l&&(d[l]=h),i=o(e,d));g.$setViewValue(i)})});g.$render=
|
||||
h;e.$watch(h)}if(h[1]){for(var o=h[0],r=h[1],n=f.multiple,w=f.ngOptions,q=!1,x,C=z(Y.createElement("option")),A=z(Y.createElement("optgroup")),s=C.clone(),h=0,y=i.children(),D=y.length;h<D;h++)if(y[h].value==""){x=q=y.eq(h);break}o.init(r,q,s);if(n&&(f.required||f.ngRequired)){var E=function(a){r.$setValidity("required",!f.required||a&&a.length);return a};r.$parsers.push(E);r.$formatters.unshift(E);f.$observe("required",function(){E(r.$viewValue)})}w?l(e,i,r):n?k(e,i,r):j(e,i,r,o)}}}}],Ud=["$interpolate",
|
||||
function(a){var c={addOption:C,removeOption:C};return{restrict:"E",priority:100,compile:function(d,e){if(t(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e){var j=d.parent(),k=j.data("$selectController")||j.parent().data("$selectController");k&&k.databound?d.prop("selected",!1):k=c;g?a.$watch(g,function(a,c){e.$set("value",a);a!==c&&k.removeOption(c);k.addOption(a)}):k.addOption(e.value);d.bind("$destroy",function(){k.removeOption(e.value)})}}}}],Vd=H({restrict:"E",
|
||||
terminal:!0});(ja=T.jQuery)?(z=ja,y(ja.fn,{scope:ta.scope,controller:ta.controller,injector:ta.injector,inheritedData:ta.inheritedData}),bb("remove",!0),bb("empty"),bb("html")):z=O;Zb.element=z;(function(a){y(a,{bootstrap:qb,copy:U,extend:y,equals:ha,element:z,forEach:m,injector:rb,noop:C,bind:Va,toJson:da,fromJson:ob,identity:ma,isUndefined:t,isDefined:v,isString:E,isFunction:L,isObject:M,isNumber:va,isElement:gc,isArray:I,version:hd,isDate:na,lowercase:D,uppercase:la,callbacks:{counter:0}});sa=
|
||||
lc(T);try{sa("ngLocale")}catch(c){sa("ngLocale",[]).provider("$locale",Yc)}sa("ng",["ngLocale"],["$provide",function(a){a.provider("$compile",Cb).directive({a:id,input:cc,textarea:cc,form:jd,script:Rd,select:Td,style:Vd,option:Ud,ngBind:ud,ngBindHtmlUnsafe:wd,ngBindTemplate:vd,ngClass:xd,ngClassEven:zd,ngClassOdd:yd,ngCsp:Cd,ngCloak:Ad,ngController:Bd,ngForm:kd,ngHide:Kd,ngInclude:Ed,ngInit:Fd,ngNonBindable:Gd,ngPluralize:Hd,ngRepeat:Id,ngShow:Jd,ngSubmit:Dd,ngStyle:Ld,ngSwitch:Md,ngSwitchWhen:Nd,
|
||||
ngSwitchDefault:Od,ngOptions:Sd,ngView:Qd,ngTransclude:Pd,ngModel:pd,ngList:rd,ngChange:qd,required:dc,ngRequired:dc,ngValue:td}).directive(lb).directive(ec);a.provider({$anchorScroll:uc,$browser:wc,$cacheFactory:xc,$controller:Ac,$document:Bc,$exceptionHandler:Cc,$filter:Qb,$interpolate:Dc,$http:Uc,$httpBackend:Vc,$location:Hc,$log:Ic,$parse:Mc,$route:Pc,$routeParams:Qc,$rootScope:Rc,$q:Nc,$sniffer:Sc,$templateCache:yc,$timeout:Zc,$window:Tc})}])})(Zb);z(Y).ready(function(){jc(Y,qb)})})(window,document);
|
||||
angular.element(document).find("head").append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak{display:none;}ng\\:form{display:block;}</style>');
|
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="fr" ng-app="$strap">
|
||||
<head>
|
||||
<!-- Title -->
|
||||
<title>Entries</title>
|
||||
@ -20,38 +20,39 @@
|
||||
<div class="span12">
|
||||
<!-- Navbar with accounts -->
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="navbar-inner" ng-controller="AccountController">
|
||||
<!-- Title -->
|
||||
<a class="brand" href="#"> Comptes</a>
|
||||
|
||||
<!-- Account list -->
|
||||
<div class="nav" data-bind="foreach: accounts, value: account">
|
||||
<div class="nav" ng-repeat="account in accounts">
|
||||
<div class="btn-group">
|
||||
<!-- Account button -->
|
||||
<button class="btn btn-nav" data-bind="css: { active: $data === $root.account() }, click: $parent.selectAccount"><span data-bind="text: name"></span> (<span data-bind="text: current, css: {'text-warning': $data.current < 0 && $data.current >= $data.authorized_overdraft, 'text-error': $data.current < $data.authorized_overdraft }"></span> / <span data-bind="text: pointed"></span>)</button>
|
||||
<button class="btn btn-nav" ng-class="accountClass(account)" ng-click="selectAccount(account)">{{account.name}} (<span ng-class="valueClass(account, account.current)">{{account.current}}</span> / <span ng-class="valueClass(account, account.pointed)">{{account.pointed}}</span>)</button>
|
||||
<!-- Dropdown button -->
|
||||
<button class="btn btn-nav dropdown-toggle" data-toggle="dropdown"><b class="caret"></b></button>
|
||||
|
||||
<!-- Dropdown menu -->
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#" data-bind="click: $root.editAccount">Modifier</a></li>
|
||||
<li><a href="#" data-bind="click: $root.removeAccount">Supprimer</a></li>
|
||||
<li><a href="#" ng-click="editAccount(account)" bs-modal="'templates/account_edit.html'">Modifier</a></li>
|
||||
<li><a href="#" bs-modal="'templates/account_remove.html'">Supprimer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- New account button -->
|
||||
<div class="btn btn-nav">
|
||||
<a data-bind="click: $root.addAccount" href="#"><i class="icon-plus"></i></a>
|
||||
<a bs-modal="'templates/account_new.html'" href="#"><i class="icon-plus"></i></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Navbar with the months of the selected account -->
|
||||
<div class="navbar navbar-fixed-bottom">
|
||||
<div class="navbar-inner">
|
||||
<ul data-bind="foreach: months()" class="nav">
|
||||
<li data-bind="css: {'active': $data == $root.month()}"><a href="#" data-bind="click: $parent.selectMonth"><span data-bind="text: $data.year"></span>-<span data-bind="text: $data.month"></span></a></li>
|
||||
<div class="navbar-inner" ng-controller="MonthController">
|
||||
<ul ng-repeat="month in months" class="nav">
|
||||
<li ng-class="monthClass(month)"><a href="#" ng-click="selectMonth(month)">{{month.year}}-{{month.month}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -63,12 +64,12 @@
|
||||
<div class="row-fluid">
|
||||
<!-- Sold evolution chart placeholder -->
|
||||
<div class="span8">
|
||||
<div id="entries-chart-placeholder" data-bind="chart: $root.entriesChart"></div>
|
||||
<div id="entries-chart-placeholder"></div>
|
||||
</div>
|
||||
|
||||
<!-- Expense category piechart -->
|
||||
<div class="span4">
|
||||
<div id="expense-categories-chart-placeholder" data-bind="pieChart: $root.expenseCategoriesChart"></div>
|
||||
<div id="expense-categories-chart-placeholder"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -78,13 +79,12 @@
|
||||
</div>
|
||||
|
||||
<!-- Row with entry table -->
|
||||
<div class="row-fluid">
|
||||
<div class="row-fluid" ng-controller="EntryController">
|
||||
<table class="table table-striped table-condensed table-hover">
|
||||
<!-- Head of the table containing column headers and size -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 100px">Date de valeur</th>
|
||||
<!--<th style="width: 100px">Date de l'op.</th>-->
|
||||
<th style="width: 100px">Date d'op.</th>
|
||||
<th>Libellé de l'opération</th>
|
||||
<th style="width: 50px">Montant</th>
|
||||
<th style="width: 50px">Solde</th>
|
||||
@ -94,156 +94,48 @@
|
||||
</thead>
|
||||
|
||||
<!-- Body of the table containing the entries -->
|
||||
<tbody data-bind="template:{name: templateToUse, foreach: entries}"></tbody>
|
||||
<tbody>
|
||||
<tr id="entry_{{entry.id}}" class="form-inline" ng-class="entryRowClass(entry.sold)" ng-repeat="entry in entries">
|
||||
<td>
|
||||
<input ng-show="isEditing(entry)" type="text" class="input-small" ng-model="entry.operation_date" data-date-format="yyyy-mm-dd" bs-datepicker/>
|
||||
<span ng-show="isDisplaying(entry)">{{entry.operation_date}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<input ng-show="isEditing(entry)" type="text" class="input-xxlarge" ng-model="entry.label"/>
|
||||
<span ng-show="isDisplaying(entry)">{{entry.label}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<input ng-show="isEditing(entry)" type="text" class="input-mini" ng-model="entry.value"/>
|
||||
<span ng-show="isDisplaying(entry)">{{entry.value}}</span>
|
||||
</td>
|
||||
<td ng-class="entryValueClass(entry.sold)">{{entry.sold}}</td>
|
||||
<td>
|
||||
<input ng-show="isEditing(entry)" type="text" class="input-small" ng-model="entry.category" bs-typeahead="categories"/>
|
||||
<span ng-show="isDisplaying(entry)">{{entry.category}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group" ng-show="isEditing(entry)">
|
||||
<a class="btn btn-mini btn-success" ng-click="saveEntry(entry)" href="#entry_{{entry.id}}" title="Save"><i ng-class="iconSaveClass(entry)"><span style="display: none">Save</span></i></a>
|
||||
<a class="btn btn-mini" ng-click="cancelEditEntry(entry)" href="#entry_{{entry.id}}" title="Cancel"><i ng-class="iconCancelClass(entry)"><span style="display: none">Cancel</span></i></a>
|
||||
<a class="btn btn-mini" ng-click="pointEntry(entry)" ng-class="pointedEntryClass(entry)" href="#entry_{{entry.id}}" title="point"><i class="icon-pencil"><span style="display: none">Point</span></i></a>
|
||||
</div>
|
||||
<div class="btn-group" ng-show="isDisplaying(entry)">
|
||||
<a class="btn btn-mini" ng-click="editEntry(entry)" href="#entry_{{entry.id}}" title="edit"><i class="icon-edit"><span style="display: none">Edit</span></i></a>
|
||||
<a class="btn btn-mini" bs-modal="'templates/entry_remove.html'" href="#entry_{{entry.id}}" title="remove"><i class="icon-trash"><span style="display: none">Remove</span></i></a>
|
||||
<a class="btn btn-mini" ng-click="pointEntry(entry)" ng-class="pointedEntryClass(entry)" href="#entry_{{entry.id}}" title="point"><i class="icon-pencil"><span style="display: none">Point</span></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Emtpy row with bottom margin to avoid data undur the fixed bottom navbar -->
|
||||
<!-- Emtpy row with bottom margin to avoid data under the fixed bottom navbar -->
|
||||
<div class="row-fluid" style="margin-bottom: 21px"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Confirm entry removal modal dialog -->
|
||||
<div id="remove-confirm" class="modal hide fade">
|
||||
<!-- Dialog header with title -->
|
||||
<div class="modal-header">
|
||||
<h3>Confirmer la suppression</h3>
|
||||
</div>
|
||||
|
||||
<!-- Dialog body -->
|
||||
<div class="modal-body">
|
||||
<p>Confirmez-vous la suppression de cette entrée ?</p>
|
||||
</div>
|
||||
|
||||
<!-- Dialog footer with buttons -->
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Non</a>
|
||||
<a href="#" class="btn" data-bind="click: confirmRemove">Oui</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Confirm account removal modal dialog -->
|
||||
<div id="remove-account-confirm" class="modal hide fade">
|
||||
<!-- Dialog header with title -->
|
||||
<div class="modal-header">
|
||||
<h3>Confirmer la suppression</h3>
|
||||
</div>
|
||||
|
||||
<!-- Dialog body -->
|
||||
<div class="modal-body">
|
||||
<p>Confirmez-vous la suppression de ce compte ?</p>
|
||||
</div>
|
||||
|
||||
<!-- Dialog footer with buttons -->
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Non</a>
|
||||
<a href="#" class="btn" data-bind="click: confirmAccountRemove">Oui</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Account edit modal dialog -->
|
||||
<div id="edit-account" class="modal hide fade">
|
||||
<!-- Dialog header with title -->
|
||||
<div class="modal-header">
|
||||
<h3>Éditer le compte</h3>
|
||||
</div>
|
||||
|
||||
<!-- Dialog body -->
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" data-bind="with: editingAccount">
|
||||
<div class="control-group">
|
||||
<!-- Account name field -->
|
||||
<label class="control-label" for="inputName">Nom du compte</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="inputName" data-bind="value: name"></input>
|
||||
</div>
|
||||
|
||||
<!-- Authorized overdraft field -->
|
||||
<label class="control-label" for="inputAuthorizedOverdraft">Découvert authorisé</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="inputAuthorizedOverdraft" data-bind="value: authorized_overdraft"></input>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Dialog footer with buttons -->
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-primary" data-bind="click: saveAccount">OK</a>
|
||||
<a href="#" class="btn" data-bind="click: cancelEditAccount">Annuler</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Displayed item template -->
|
||||
<script id="itemsTmpl" type="text/html">
|
||||
<tr data-bind="css: { 'warning': sold() < 0 && sold() >= $root.account().authorized_overdraft(), 'error': sold() < $root.account().authorized_overdraft() }">
|
||||
<td data-bind="text: operation_date"></td>
|
||||
|
||||
<td data-bind="text: label"></td>
|
||||
|
||||
<td data-bind="text: value, css: {'text-error': value() < 0 }"></td>
|
||||
|
||||
<td data-bind="text: sold, css: {'text-warning': sold() < 0 && sold() >= $root.account().authorized_overdraft(), 'text-error': sold() < $root.account().authorized_overdraft() }"></td>
|
||||
|
||||
<td data-bind="text: category"></td>
|
||||
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-mini" data-bind="click: $root.edit" href="#" title="edit"><i class="icon-edit"></i></a>
|
||||
<a class="btn btn-mini" data-bind="click: $root.remove" href="#" title="remove"><i class="icon-trash"></i></a>
|
||||
<a class="btn btn-mini" data-bind="css: {'active': pointed}, click: $root.pointEntry" href="#" title="point"><i class="icon-pencil"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<!-- New item template -->
|
||||
<script id="newTmpl" type="text/html">
|
||||
<tr class="form-inline">
|
||||
<td><input type="text" class="input-small" data-bind="value: operation_date" data-date-format="yyyy-mm-dd" id="new_operation_date" /></td>
|
||||
|
||||
<td><input type="text" class="input-xxlarge" data-bind="value: label"/></td>
|
||||
|
||||
<td><input type="text" class="input-mini" data-bind="value: value"/></td>
|
||||
|
||||
<td></td>
|
||||
|
||||
<td><input type="text" class="input-small" data-bind="value: category, typeahead: {source: $root.categories }"/></td>
|
||||
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-mini btn-success" data-bind="click: $root.save" href="#" title="Add"><i class="icon-plus"></i></a>
|
||||
<a class="btn btn-mini" data-bind="click: $root.cancel" href="#" title="Clear"><i class="icon-remove"></i></a>
|
||||
<a class="btn btn-mini" data-bind="css: {'active': pointed}, click: $root.pointEntry" href="#" title="point"><i class="icon-pencil"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<!-- Edit item template -->
|
||||
<script id="editTmpl" type="text/html">
|
||||
<tr class="form-inline" data-bind="css: { 'warning': sold() < 0 && sold() >= $root.account().authorized_overdraft(), 'error': sold() < $root.account().authorized_overdraft() }">
|
||||
<td><input type="text" class="input-small" data-bind="value: operation_date" data-date-format="yyyy-mm-dd" id="operation_date" /></td>
|
||||
|
||||
<td><input type="text" class="input-xxlarge" data-bind="value: label"/></td>
|
||||
|
||||
<td><input type="text" class="input-mini" data-bind="value: value"/></td>
|
||||
|
||||
<td data-bind="text: sold, css: {'text-warning': sold() < 0 && sold() >= $root.account().authorized_overdraft(), 'text-error': sold() < $root.account().authorized_overdraft() }"></td>
|
||||
|
||||
<td><input type="text" class="input-small" data-bind="value: category, typeahead: {source: $root.categories }" /></td>
|
||||
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-mini btn-success" data-bind="click: $root.save" href="#" title="Save"><i class="icon-ok"></i></a>
|
||||
<a class="btn btn-mini" data-bind="click: $root.cancel" href="#" title="Cancel"><i class="icon-ban-circle"></i></a>
|
||||
<a class="btn btn-mini" data-bind="css: {'active': pointed}, click: $root.pointEntry" href="#" title="point"><i class="icon-pencil"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<!-- JQuery Javascript library -->
|
||||
<script type="text/javascript" src="jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="jquery/jquery-migrate.min.js"></script>
|
||||
@ -253,9 +145,10 @@
|
||||
<!-- Bootstrap datepicker module -->
|
||||
<script type="text/javascript" src="datepicker/js/bootstrap-datepicker.js"></script>
|
||||
|
||||
<!-- Knockoutjs.com Javascript library -->
|
||||
<script type="text/javascript" src="knockout/knockout.min.js"></script>
|
||||
<script type="text/javascript" src="knockout/knockout-mapping.min.js"></script>
|
||||
<!-- Angular Javascript library -->
|
||||
<!--<script type="text/javascript" src="angular/angular.min.js"></script>-->
|
||||
<script type="text/javascript" src="angular/angular.min.js"></script>
|
||||
<script type="text/javascript" src="angular/angular-strap.min.js"></script>
|
||||
|
||||
<!-- JQPlot Javascript library and needed modules -->
|
||||
<script type="text/javascript" src="jqplot/jquery.jqplot.js"></script>
|
||||
@ -268,9 +161,11 @@
|
||||
<script type="text/javascript" src="jqplot/plugins/jqplot.canvasOverlay.min.js"></script>
|
||||
|
||||
<!-- Custom Javascript library for date manipulation -->
|
||||
<script type="text/javascript" src="js/date.js"></script>
|
||||
<!--<script type="text/javascript" src="js/date.js"></script>-->
|
||||
|
||||
<!-- Custom Javascript library for entries -->
|
||||
<script type="text/javascript" src="js/months.js"></script>
|
||||
<script type="text/javascript" src="js/accounts.js"></script>
|
||||
<script type="text/javascript" src="js/entries.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
154
src/html/js/accounts.js
Normal file
154
src/html/js/accounts.js
Normal file
@ -0,0 +1,154 @@
|
||||
// Account object
|
||||
function account() {
|
||||
this.id=ko.observable();
|
||||
this.name=ko.observable();
|
||||
this.authorized_overdraft=ko.observable();
|
||||
this.future=ko.observable();
|
||||
this.current=ko.observable();
|
||||
this.pointed=ko.observable();
|
||||
};
|
||||
|
||||
// The AccountController.
|
||||
var AccountController = function($scope, $http, $rootScope) {
|
||||
// Account store and selection
|
||||
$scope.account = null;
|
||||
$scope.accounts = [];
|
||||
|
||||
$scope.savedAccount = null;
|
||||
$scope.editingAccount = null;
|
||||
$scope.removedAccount = null;
|
||||
|
||||
$scope.accountClass = function(account) {
|
||||
if(account == $scope.account) {
|
||||
return "active";
|
||||
}
|
||||
};
|
||||
|
||||
$scope.valueClass = function(account, value) {
|
||||
if(value < account.authorized_overdraft) {
|
||||
return "text-error";
|
||||
} else if(value < 0) {
|
||||
return "text-warning";
|
||||
}
|
||||
};
|
||||
|
||||
$scope.addAccount = function() {
|
||||
$scope.editingAccount = {
|
||||
id: null,
|
||||
name: null,
|
||||
authorized_overdraft: null
|
||||
};
|
||||
|
||||
angular.element("#edit-account").modal();
|
||||
};
|
||||
|
||||
$scope.show = function() {
|
||||
console.debug("show");
|
||||
};
|
||||
|
||||
$scope.editAccount = function(account) {
|
||||
if(account) {
|
||||
$scope.editingAccount = account;
|
||||
$scope.savedAccount = angular.copy(account);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.cancelEditAccount = function(account, modalScope) {
|
||||
if($scope.savedAccount) {
|
||||
account.name = $scope.savedAccount.name;
|
||||
account.authorized_overdraft = $scope.savedAccount.authorized_overdraft;
|
||||
}
|
||||
|
||||
$scope.editingAccount = null;
|
||||
$scope.savedAccount = null;
|
||||
|
||||
if(modalScope && modalScope.dismiss) {
|
||||
modalScope.dismiss();
|
||||
}
|
||||
};
|
||||
|
||||
$scope.saveAccount = function(account, modalScope) {
|
||||
// Ajax call to save the entry.
|
||||
var type;
|
||||
var url = "api/accounts";
|
||||
|
||||
if(account.id) {
|
||||
url += "/" + account.id;
|
||||
}
|
||||
|
||||
$http.put(url, angular.toJson(account)).success(function(data) {
|
||||
message("success", "Save", data);
|
||||
|
||||
$scope.editingAccount = null;
|
||||
$scope.savedAccount = null;
|
||||
|
||||
if(modalScope && modalScope.dismiss) {
|
||||
modalScope.dismiss();
|
||||
}
|
||||
|
||||
// Reload accounts to update solds.
|
||||
$scope.loadAccounts();
|
||||
});
|
||||
};
|
||||
|
||||
// Function to remove of an entry.
|
||||
$scope.accountRemove = function(account, modalScope) {
|
||||
$http.delete("api/accounts/" + account.id).success(function (data) {
|
||||
message("success", "Save", data);
|
||||
|
||||
// Reload accounts to update solds.
|
||||
$scope.loadAccounts();
|
||||
|
||||
if(modalScope && modalScope.dismiss) {
|
||||
modalScope.dismiss();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Function to load accounts
|
||||
$scope.loadAccounts = function() {
|
||||
$http.get("api/accounts").success($scope.loadAccounts_success);
|
||||
};
|
||||
|
||||
$scope.loadAccounts_success = function (data) {
|
||||
// Update accounts
|
||||
$scope.accounts = angular.fromJson(data);
|
||||
|
||||
var accountToSelect = null
|
||||
|
||||
// Reset selected account to the new instance corresponding to the old one.
|
||||
if($scope.account) {
|
||||
// Find the new instance of the previously selected account.
|
||||
angular.forEach($scope.accounts, function(account) {
|
||||
if(account.id == $scope.account.id) {
|
||||
accountToSelect = account;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Set selected account to first one if not yet selected
|
||||
if(!accountToSelect && $scope.accounts.length > 0){
|
||||
accountToSelect = $scope.accounts[0];
|
||||
}
|
||||
|
||||
// Reset to account to select
|
||||
$scope.account = accountToSelect;
|
||||
|
||||
$scope.$emit("accountsLoadedEvent", {account: $scope.account});
|
||||
};
|
||||
|
||||
// Callback function to select a new account.
|
||||
$scope.selectAccount = function(account) {
|
||||
if(account) {
|
||||
$scope.account = account;
|
||||
|
||||
$scope.$emit("accountsLoadedEvent", {account: $scope.account});
|
||||
}
|
||||
};
|
||||
|
||||
$rootScope.$on("entrySavedEvent", $scope.loadAccounts);
|
||||
$rootScope.$on("entryRemovedEvent", $scope.loadAccounts);
|
||||
|
||||
$scope.loadAccounts();
|
||||
};
|
||||
|
@ -11,22 +11,6 @@ function entry(){
|
||||
this.category=ko.observable();
|
||||
}
|
||||
|
||||
// Account object
|
||||
function account() {
|
||||
this.id=ko.observable();
|
||||
this.name=ko.observable();
|
||||
this.authorized_overdraft=ko.observable();
|
||||
this.future=ko.observable();
|
||||
this.current=ko.observable();
|
||||
this.pointed=ko.observable();
|
||||
}
|
||||
|
||||
// Month object
|
||||
function month() {
|
||||
this.year=ko.observable();
|
||||
this.month=ko.observable();
|
||||
}
|
||||
|
||||
// Util function to show a message in message placeholder.
|
||||
function message(alertType, title, message) {
|
||||
$(".alert").alert('close');
|
||||
@ -34,25 +18,84 @@ function message(alertType, title, message) {
|
||||
}
|
||||
|
||||
// The ListViewModel used to instanciate viewmodel.
|
||||
var ListViewModel = function() {
|
||||
var self = this;
|
||||
|
||||
// Account store and selection
|
||||
self.account = ko.observable();
|
||||
self.accounts = ko.observableArray([]);
|
||||
|
||||
self.savedAccount = null;
|
||||
self.editingAccount = ko.observable();
|
||||
self.removedAccount = null;
|
||||
|
||||
// Month store and selection
|
||||
self.months = ko.observableArray();
|
||||
self.month = ko.observable();
|
||||
|
||||
var EntryController = function($scope, $http, $rootScope, $filter) {
|
||||
// Entry store and selection
|
||||
self.entries = ko.observableArray([]);
|
||||
self.selectedItem = ko.observable();
|
||||
self.newEntry = ko.observable(ko.mapping.fromJS({
|
||||
$scope.entries = [];
|
||||
$scope.selectedItem = null;
|
||||
|
||||
$scope.account = null;
|
||||
|
||||
// Placeholder for saved value to cancel entry edition
|
||||
$scope.savedItem = null;
|
||||
|
||||
$scope.entriesLoaded = function(entries) {
|
||||
var entriesReversed = entries.slice().reverse();
|
||||
|
||||
var categories = [];
|
||||
|
||||
var chartValues = [];
|
||||
|
||||
var pieChartValuesTmp = {};
|
||||
var pieChartValues = [];
|
||||
|
||||
angular.forEach(entriesReversed, function(entry) {
|
||||
var category = entry.category;
|
||||
var value = entry.value ? Number(entry.value) : null;
|
||||
var sold = entry.sold ? Number(entry.sold) : null;
|
||||
var operation_date = entry.operation_date;
|
||||
|
||||
if(operation_date && sold) {
|
||||
chartValues.push([entry.operation_date, sold]);
|
||||
}
|
||||
|
||||
if(category && category != '') {
|
||||
if(categories.indexOf(category) == -1) {
|
||||
categories.push(category);
|
||||
}
|
||||
|
||||
if(value && value < 0.0) {
|
||||
var oldValue = 0.0;
|
||||
|
||||
if(pieChartValuesTmp[category]) {
|
||||
oldValue = pieChartValuesTmp[category];
|
||||
}
|
||||
|
||||
pieChartValuesTmp[category] = oldValue - value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Second pass: transform to an array readable by jqplot.
|
||||
angular.forEach(pieChartValuesTmp, function(value, key) {
|
||||
pieChartValues.push([key, value]);
|
||||
});
|
||||
|
||||
$scope.categories = categories;
|
||||
|
||||
$scope.drawChart({account: $scope.account, entries: chartValues}, "#entries-chart-placeholder");
|
||||
$scope.drawPieChart(pieChartValues, "#expense-categories-chart-placeholder");
|
||||
};
|
||||
|
||||
// Function to load entries from server for a specific account and month.
|
||||
$scope.loadEntries = function(account, month) {
|
||||
if(account) {
|
||||
$scope.account = account;
|
||||
}
|
||||
|
||||
// Clean up selected entry.
|
||||
$scope.selectedItem = null;
|
||||
$scope.savedItem = null;
|
||||
|
||||
if(account && month) {
|
||||
$http.get("api/entries/" + account.id + "/" + month.year + "/" + month.month).success($scope.loadEntries_success);
|
||||
} else {
|
||||
$scope.loadEntries_success(null);
|
||||
}
|
||||
};
|
||||
|
||||
// Load entries success callback
|
||||
$scope.loadEntries_success = function(data) {
|
||||
var entries = [{
|
||||
id: null,
|
||||
pointed: false,
|
||||
operation_date: null,
|
||||
@ -61,429 +104,196 @@ var ListViewModel = function() {
|
||||
sold: null,
|
||||
pointedsold: null,
|
||||
category: null,
|
||||
account_id: null
|
||||
}));
|
||||
account_id: null,
|
||||
state: 'edit'
|
||||
}];
|
||||
|
||||
// Placeholder for saved value to cancel entry edition
|
||||
self.savedItem = null;
|
||||
if(data) {
|
||||
entries = entries.concat(angular.fromJson(data));
|
||||
}
|
||||
|
||||
// Placeholder for entry to remove to be available in modal function "yes" click callback
|
||||
self.removedItem = null;
|
||||
$scope.entries = entries;
|
||||
|
||||
self.addAccount = function() {
|
||||
self.editingAccount(ko.mapping.fromJS({
|
||||
id: null,
|
||||
name: null,
|
||||
authorized_overdraft: null
|
||||
}));
|
||||
|
||||
$("#edit-account").modal();
|
||||
$scope.$emit("entriesLoadedEvent", {entries: entries});
|
||||
};
|
||||
|
||||
self.editAccount = function(account) {
|
||||
self.editingAccount(account);
|
||||
self.savedAccount = ko.toJS(account);
|
||||
|
||||
$("#edit-account").modal();
|
||||
};
|
||||
|
||||
self.cancelEditAccount = function() {
|
||||
if(self.editingAccount() && self.savedAccount) {
|
||||
self.editingAccount().name(self.savedAccount.name);
|
||||
self.editingAccount().authorized_overdraft(self.savedAccount.authorized_overdraft);
|
||||
}
|
||||
|
||||
self.editingAccount(null);
|
||||
self.savedAccount = null;
|
||||
|
||||
$("#edit-account").modal('hide');
|
||||
};
|
||||
|
||||
self.saveAccount = function() {
|
||||
var account = self.editingAccount();
|
||||
|
||||
// Ajax call to save the entry.
|
||||
var type;
|
||||
var url = "api/accounts";
|
||||
|
||||
if(account.id()) {
|
||||
url += "/" + account.id();
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "PUT",
|
||||
data: ko.toJSON(account),
|
||||
dataType: "json",
|
||||
contentType: "application/json"
|
||||
}).success(function(data) {
|
||||
message("success", "Save", data);
|
||||
|
||||
self.editingAccount(null);
|
||||
self.savedAccount = null;
|
||||
|
||||
$("#edit-account").modal('hide');
|
||||
|
||||
// Reload accounts to update solds.
|
||||
self.loadAccounts();
|
||||
});
|
||||
};
|
||||
|
||||
self.removeAccount = function(account) {
|
||||
// Cancel current editing.
|
||||
self.removedAccount = account;
|
||||
$('#remove-account-confirm').modal();
|
||||
};
|
||||
|
||||
// Function to confirm the removal of an entry.
|
||||
self.confirmAccountRemove = function() {
|
||||
var account = self.removedAccount;
|
||||
|
||||
$.ajax("api/accounts/" + ko.utils.unwrapObservable(account.id), {type: "DELETE"}).success(function (data) {
|
||||
message("success", "Save", data);
|
||||
|
||||
// Reload accounts to update solds.
|
||||
self.loadAccounts();
|
||||
}).complete(function (data) {
|
||||
// Reset removed item to null and hide the modal dialog.
|
||||
self.removedAccount = null;
|
||||
$('#remove-account-confirm').modal('hide');
|
||||
});
|
||||
};
|
||||
|
||||
self.categories = ko.computed(function() {
|
||||
var unwrap = ko.utils.unwrapObservable;
|
||||
|
||||
var entries=unwrap(self.entries);
|
||||
|
||||
var categories = ko.observableArray([]);
|
||||
|
||||
$.each(entries, function(index, entry) {
|
||||
if(entry.category() && entry.category() != '' && categories.indexOf(entry.category()) == -1) {
|
||||
categories.push(entry.category());
|
||||
}
|
||||
});
|
||||
|
||||
return categories();
|
||||
});
|
||||
|
||||
// Returns the data for the categories by summing values with same category
|
||||
self.expenseCategoriesChart = ko.computed(function() {
|
||||
var unwrap = ko.utils.unwrapObservable;
|
||||
|
||||
var entries=unwrap(self.entries);
|
||||
|
||||
// First pass: get sum values for each category.
|
||||
var chartValuesTmp = {};
|
||||
$.each(entries, function(index, entry) {
|
||||
var category = unwrap(entry.category);
|
||||
var value = unwrap(entry.value) ? Number(unwrap(entry.value)) : null;
|
||||
|
||||
if(category && value && value < 0.0) {
|
||||
var oldValue = 0.0;
|
||||
|
||||
if(chartValuesTmp[category]) {
|
||||
oldValue = chartValuesTmp[category];
|
||||
}
|
||||
|
||||
chartValuesTmp[category] = oldValue - value
|
||||
}
|
||||
});
|
||||
|
||||
// Second pass: transform to an array readable by jqplot.
|
||||
var chartValues = [];
|
||||
$.each(chartValuesTmp, function(key, value) {
|
||||
chartValues.push([key, value]);
|
||||
});
|
||||
|
||||
return chartValues;
|
||||
});
|
||||
|
||||
// Return the data for the sold chart.
|
||||
self.entriesChart = ko.computed(function() {
|
||||
var unwrap = ko.utils.unwrapObservable;
|
||||
|
||||
// We assume that entries are sorted by value date descending.
|
||||
var entries = unwrap(self.entries).slice().reverse();
|
||||
|
||||
// Transform to an array readable by jqplot Line renderer.
|
||||
var chartValues = [];
|
||||
$.each(entries, function(index, entry) {
|
||||
if(unwrap(entry.operation_date) && unwrap(entry.sold)) {
|
||||
chartValues.push([unwrap(entry.operation_date), Number(unwrap(entry.sold))]);
|
||||
}
|
||||
});
|
||||
|
||||
return {account: self.account(), entries: chartValues};
|
||||
}, self);
|
||||
|
||||
// Function to load entries from server for a specific account and month.
|
||||
self.loadEntries = function(account, month) {
|
||||
// Clean up selected entry.
|
||||
self.selectedItem(null);
|
||||
|
||||
// An account may not have any month (new account)
|
||||
self.clearNewEntry()
|
||||
var entries = [self.newEntry()];
|
||||
|
||||
if(month) {
|
||||
$.get("api/entries/" + account.id() + "/" + month.year() + "/" + month.month()).success(function(data) {
|
||||
// Update entries
|
||||
var dataArray = ko.utils.arrayMap($.parseJSON(data), ko.mapping.fromJS);
|
||||
|
||||
if(dataArray.length > 0) {
|
||||
entries = entries.concat(dataArray);
|
||||
}
|
||||
|
||||
self.entries(entries);
|
||||
|
||||
// Initialize date picker for operation date column.
|
||||
$("#new_operation_date").datepicker().on('changeDate', function(ev){
|
||||
self.newEntry().operation_date(ev.date.format(ev.currentTarget.dataset.dateFormat));
|
||||
});
|
||||
});
|
||||
} else {
|
||||
self.entries(entries);
|
||||
|
||||
// Initialize date picker for operation date column.
|
||||
$("#new_operation_date").datepicker().on('changeDate', function(ev){
|
||||
self.newEntry().operation_date(ev.date.format(ev.currentTarget.dataset.dateFormat));
|
||||
});
|
||||
// Returns the CSS class for a pointed entry.
|
||||
$scope.pointedEntryClass = function(entry) {
|
||||
if(entry.pointed) {
|
||||
return "active";
|
||||
}
|
||||
};
|
||||
|
||||
// Function to load accounts
|
||||
self.loadAccounts = function() {
|
||||
$.get("api/accounts").success(function (data) {
|
||||
// Update accounts
|
||||
self.accounts(ko.utils.arrayMap($.parseJSON(data), ko.mapping.fromJS));
|
||||
|
||||
var accountToSelect = null
|
||||
|
||||
// Reset selected account to the new instance corresponding to the old one.
|
||||
if(self.account()) {
|
||||
// Find the new instance of the previously selected account.
|
||||
$.each(self.accounts(), function(index, account) {
|
||||
if(account.id() == self.account().id()) {
|
||||
accountToSelect = account;
|
||||
// Returns the CSS class for an entry row.
|
||||
$scope.entryRowClass = function(sold) {
|
||||
if(sold < $scope.account.authorized_overdraft) {
|
||||
return 'error';
|
||||
} else if (entry.sold < 0) {
|
||||
return 'warning';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Set selected account to first one if not yet selected
|
||||
if(!accountToSelect && self.accounts().length > 0){
|
||||
accountToSelect = self.accounts()[0];
|
||||
}
|
||||
|
||||
// Reset to account to select
|
||||
self.account(accountToSelect);
|
||||
|
||||
// Load months if there is any account, or remove months.
|
||||
if(self.account()) {
|
||||
self.loadMonths(self.account());
|
||||
} else {
|
||||
self.months.removeAll();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Function to load months
|
||||
self.loadMonths = function(account){
|
||||
$.get("api/accounts/" + account.id() + "/months").success(function (data) {
|
||||
// Update months
|
||||
self.months(ko.utils.arrayMap($.parseJSON(data), ko.mapping.fromJS));
|
||||
|
||||
var monthToSelect = null;
|
||||
|
||||
var today = new Date();
|
||||
var currentYear = today.getFullYear().toString();
|
||||
var currentMonth = (today.getMonth() + 1 < 10 ? "0" : "") + (today.getMonth() + 1);
|
||||
|
||||
// Find the new instance of the previously selected month.
|
||||
$.each(self.months(), function(index, month) {
|
||||
// Reset selected month to the new instance corresponding to the old one
|
||||
if(self.month()) {
|
||||
if(month.year() === self.month().year() && month.month() === self.month().month()) {
|
||||
monthToSelect = month;
|
||||
// Returns the CSS class for an entry sold.
|
||||
$scope.entryValueClass = function(sold) {
|
||||
if(sold < $scope.account.authorized_overdraft) {
|
||||
return 'text-error';
|
||||
} else if (sold < 0) {
|
||||
return 'text-warning';
|
||||
}
|
||||
} else {
|
||||
if(month.year() === currentYear && month.month() === currentMonth) {
|
||||
monthToSelect = month;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Set selected month to the last one if not yet selected.
|
||||
if(!monthToSelect && self.months().length > 0) {
|
||||
monthToSelect = self.months()[self.months().length - 1];
|
||||
}
|
||||
|
||||
// Reset to month to select
|
||||
self.month(monthToSelect);
|
||||
|
||||
// Load entries if there is a month or remove entries.
|
||||
if(self.month) {
|
||||
self.loadEntries(self.account(), self.month());
|
||||
} else {
|
||||
self.entries.removeAll();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Function to select template in function of selected item.
|
||||
self.templateToUse = function (item) {
|
||||
return self.newEntry() === item ? 'newTmpl' : self.selectedItem() === item ? 'editTmpl' : 'itemsTmpl';
|
||||
};
|
||||
|
||||
// Function to edit an item
|
||||
self.edit = function(item) {
|
||||
// Starts editing an entry
|
||||
$scope.editEntry = function(entry) {
|
||||
// Cancel previous editing.
|
||||
if(self.savedItem) {
|
||||
self.cancel();
|
||||
if($scope.selectedItem) {
|
||||
$scope.cancelEditEntry($scope.selectedItem);
|
||||
}
|
||||
|
||||
// Save current item
|
||||
self.savedItem=ko.toJS(item);
|
||||
self.selectedItem(item);
|
||||
// Save current entry values.
|
||||
$scope.savedItem = angular.copy(entry);
|
||||
$scope.selectedItem = entry;
|
||||
|
||||
// Initialize date picker for operation date column.
|
||||
$("#operation_date").datepicker().on('changeDate', function(ev){
|
||||
self.selectedItem().operation_date(ev.date.format(ev.currentTarget.dataset.dateFormat));
|
||||
});
|
||||
// Enter edit state.
|
||||
entry.state='edit';
|
||||
};
|
||||
|
||||
self.clearNewEntry = function() {
|
||||
self.newEntry().id(null); // id should not change, but just in case...
|
||||
self.newEntry().pointed(false)
|
||||
self.newEntry().operation_date(null);
|
||||
self.newEntry().label(null);
|
||||
self.newEntry().value(null);
|
||||
self.newEntry().account_id(self.account().id()); // account_id should not change, but just in case...
|
||||
self.newEntry().category(null);
|
||||
// Returns true if the entry is a new one.
|
||||
$scope.isNew = function(entry) {
|
||||
return !entry.id;
|
||||
};
|
||||
|
||||
// Function to cancel current editing.
|
||||
self.cancel = function(item) {
|
||||
// Reset selected item fields to saved item ones.
|
||||
if(item === self.selectedItem() && self.savedItem) {
|
||||
self.selectedItem().id(self.savedItem.id); // id should not change, but just in case...
|
||||
self.selectedItem().pointed(self.savedItem.pointed);
|
||||
self.selectedItem().operation_date(self.savedItem.operation_date);
|
||||
self.selectedItem().label(self.savedItem.label);
|
||||
self.selectedItem().value(self.savedItem.value);
|
||||
self.selectedItem().account_id(self.savedItem.account_id); // account_id should not change, but just in case...
|
||||
self.selectedItem().category(self.savedItem.category);
|
||||
// Returns true if the entry is in editing state.
|
||||
$scope.isEditing = function(entry) {
|
||||
return entry.state === 'edit';
|
||||
};
|
||||
|
||||
// Returns true if the entry is in displaying state.
|
||||
$scope.isDisplaying = function(entry) {
|
||||
return entry.id && (!entry.state || entry.state === 'display');
|
||||
};
|
||||
|
||||
$scope.iconSaveClass = function(entry) {
|
||||
if($scope.isNew(entry)) {
|
||||
return "icon-plus";
|
||||
} else if ($scope.isEditing(entry)) {
|
||||
return "icon-ok";
|
||||
}
|
||||
};
|
||||
|
||||
$scope.iconCancelClass = function(entry) {
|
||||
if($scope.isNew(entry)) {
|
||||
return "icon-remove";
|
||||
} else if ($scope.isEditing(entry)) {
|
||||
return "icon-ban-circle";
|
||||
}
|
||||
};
|
||||
|
||||
// Cancel current editing entry or clears field if a new one.
|
||||
$scope.cancelEditEntry = function(entry) {
|
||||
if ($scope.isNew(entry)) {
|
||||
// We are cancelling the new entry, just reset it.
|
||||
if(item === self.newEntry()) {
|
||||
self.clearNewEntry();
|
||||
entry.id = null; // id should not change, but just in case...
|
||||
entry.pointed = false;
|
||||
entry.operation_date = null;
|
||||
entry.label = null;
|
||||
entry.value = null;
|
||||
entry.account_id = $scope.account.id; // account_id should not change, but just in case...
|
||||
entry.category = null;
|
||||
} else if($scope.isEditing(entry)) {
|
||||
if($scope.savedItem) {
|
||||
// Reset selected item fields to saved item ones.
|
||||
entry.id = $scope.savedItem.id; // id should not change, but just in case...
|
||||
entry.pointed = $scope.savedItem.pointed;
|
||||
entry.operation_date = $scope.savedItem.operation_date;
|
||||
entry.label = $scope.savedItem.label;
|
||||
entry.value = $scope.savedItem.value;
|
||||
entry.account_id = $scope.savedItem.account_id; // account_id should not change, but just in case...
|
||||
entry.category = $scope.savedItem.category;
|
||||
}
|
||||
|
||||
// Reset saved and selected items to null.
|
||||
self.savedItem = null;
|
||||
self.selectedItem(null);
|
||||
$scope.savedItem = null;
|
||||
$scope.selectedItem = null;
|
||||
|
||||
// Enter display state.
|
||||
entry.state = 'display';
|
||||
}
|
||||
};
|
||||
|
||||
self.pointEntry = function(entry) {
|
||||
if(entry.pointed()) {
|
||||
entry.pointed(false);
|
||||
// Points an entry.
|
||||
$scope.pointEntry = function(entry) {
|
||||
if(entry.pointed) {
|
||||
entry.pointed = false;
|
||||
} else {
|
||||
entry.pointed(true);
|
||||
entry.pointed = true;
|
||||
}
|
||||
|
||||
if(entry != self.newEntry()) {
|
||||
self.save(entry);
|
||||
// Save the entry if not new.
|
||||
if(!$scope.isNew(entry)) {
|
||||
$scope.saveEntry(entry);
|
||||
}
|
||||
};
|
||||
|
||||
// Function to save the current selected entry.
|
||||
self.save = function(item) {
|
||||
//var item = self.selectedItem();
|
||||
if(item === self.newEntry()) {
|
||||
item.account_id(self.account().id());
|
||||
// Saves an entry.
|
||||
$scope.saveEntry = function(entry) {
|
||||
// Affects the account ID if not (should never happen)
|
||||
if(!entry.account_id) {
|
||||
entry.account_id = $scope.account.id;
|
||||
}
|
||||
|
||||
// Ajax call to save the entry.
|
||||
// Prepare the Ajax call to save the entry.
|
||||
var type;
|
||||
var url = "api/entries";
|
||||
|
||||
if(item.id()) {
|
||||
url += "/" + item.id();
|
||||
if(!$scope.isNew(entry)) {
|
||||
url += "/" + entry.id;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "PUT",
|
||||
contentType: "application/json",
|
||||
data:ko.toJSON(item),
|
||||
dataType: "json"
|
||||
}).success(function(data) {
|
||||
// Ajax call to save an entry
|
||||
$http.put(url, angular.toJson(entry)).success(function(data) {
|
||||
message("success", "Save", data);
|
||||
|
||||
self.clearNewEntry();
|
||||
self.selectedItem(null);
|
||||
self.savedItem = null;
|
||||
// $scope.savedItem = null;
|
||||
|
||||
// Reload accounts to update solds.
|
||||
self.loadAccounts();
|
||||
// Send the "entry saved" event.
|
||||
$scope.$emit("entrySavedEvent", entry);
|
||||
});
|
||||
};
|
||||
|
||||
// Function to remove an entry.
|
||||
self.remove = function (item) {
|
||||
// Removes an entry.
|
||||
$scope.removeEntry = function(entry, modalScope) {
|
||||
// Cancel current editing.
|
||||
self.cancel();
|
||||
//$scope.cancelEditEntry(entry);
|
||||
|
||||
if (item.id()) {
|
||||
// This entry is saved in database, we show a modal dialog to confirm the removal.
|
||||
self.removedItem = item;
|
||||
$('#remove-confirm').modal();
|
||||
} else {
|
||||
// This entry was not saved in database yet, we just remove it from the list.
|
||||
self.entries.remove(item);
|
||||
}
|
||||
};
|
||||
if (!$scope.isNew(entry)) {
|
||||
$http.delete("api/entries/" + entry.id).success(function (result) {
|
||||
message("success", "Delete", result);
|
||||
|
||||
// Function to confirm the removal of an entry.
|
||||
self.confirmRemove = function() {
|
||||
var item = self.removedItem;
|
||||
// Send the "entry removed" event.
|
||||
$scope.$emit("entryRemovedEvent", entry);
|
||||
|
||||
$.ajax("api/entries/" + ko.utils.unwrapObservable(item.id), {type: "DELETE"}).success(function (result) {
|
||||
// Reload accounts to update solds.
|
||||
self.loadAccounts();
|
||||
}).success(function (data) {
|
||||
message("success", "Delete", data);
|
||||
}).complete(function (data) {
|
||||
// Reset removed item to null and hide the modal dialog.
|
||||
self.removedItem = null;
|
||||
$('#remove-confirm').modal('hide');
|
||||
$scope.closeModal(modalScope);
|
||||
}).error(function (data) {
|
||||
message("error", "Delete", data);
|
||||
|
||||
$scope.closeModal(modalScope);
|
||||
});
|
||||
};
|
||||
|
||||
// Callback function to select a new month.
|
||||
self.selectMonth = function(month) {
|
||||
if(month) {
|
||||
self.month(month);
|
||||
self.loadEntries(self.account(), month);
|
||||
}
|
||||
};
|
||||
|
||||
// Callback function to select a new account.
|
||||
self.selectAccount = function(account) {
|
||||
if(account) {
|
||||
self.newEntry().account_id(account.id());
|
||||
self.account(account);
|
||||
self.loadMonths(account);
|
||||
$scope.closeModal = function(modalScope) {
|
||||
// Close the modal dialog
|
||||
if(modalScope && modalScope.dismiss) {
|
||||
modalScope.dismiss();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Function to draw the sold evolution chart.
|
||||
drawChart = function(data, element) {
|
||||
// Function to draw the sold evolution chart.
|
||||
$scope.drawChart = function(data, elementId) {
|
||||
// Clear previous chart
|
||||
$(element).html("");
|
||||
element.style.height="0px";
|
||||
var element = angular.element(elementId);
|
||||
element.html("");
|
||||
element.css("height", "0px");
|
||||
|
||||
var entries = data.entries;
|
||||
|
||||
@ -495,11 +305,11 @@ drawChart = function(data, element) {
|
||||
|
||||
// Find first and last days to set limits of the x axis.
|
||||
var day = 24 * 60 * 60 * 1000;
|
||||
var firstDate = new Date(Date.parse(entries[0][0]).valueOf() - day).format('yyyy-mm-dd');
|
||||
var lastDate = new Date(Date.parse(entries[entries.length -1][0]).valueOf() + day).format('yyyy-mm-dd');
|
||||
var firstDate = $filter('date')(new Date(Date.parse(entries[0][0]).valueOf() - day), 'yyyy-MM-dd');
|
||||
var lastDate = $filter('date')(new Date(Date.parse(entries[entries.length -1][0]).valueOf() + day), 'yyyy-MM-dd');
|
||||
|
||||
// Plot chart, and store it in a window parameter for resize callback (need to be done better than it...)
|
||||
window.chart = $.jqplot(element.id, [entries], {
|
||||
window.chart = $.jqplot(element.prop("id"), [entries], {
|
||||
// Title of the chart
|
||||
title: "Évolution du solde",
|
||||
axes:{
|
||||
@ -558,7 +368,7 @@ drawChart = function(data, element) {
|
||||
// Red horizontal line for authorized overdraft limit
|
||||
{dashedHorizontalLine: {
|
||||
name: "overdraft",
|
||||
y: data.account.authorized_overdraft(),
|
||||
y: data.account.authorized_overdraft,
|
||||
lineWidth: 1,
|
||||
color: "red",
|
||||
shadow: false
|
||||
@ -578,17 +388,18 @@ drawChart = function(data, element) {
|
||||
// Reset chart to null to avoid redraw of a non existing chart in resize callback.
|
||||
window.chart = null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Function to draw the expense category pie chart.
|
||||
drawPieChart = function(entries, element) {
|
||||
// Function to draw the expense category pie chart.
|
||||
$scope.drawPieChart = function(entries, elementId) {
|
||||
// Clear previous chart
|
||||
$(element).html("");
|
||||
element.style.height="0px";
|
||||
var element = angular.element(elementId);
|
||||
element.html("");
|
||||
element.css("height", "0px");
|
||||
|
||||
if(entries && entries.length > 1) {
|
||||
// Plot chart, and store it in a window parameter for resize callback (need to be done better than it...)
|
||||
window.pieChart = $.jqplot(element.id, [entries], {
|
||||
window.pieChart = $.jqplot(element.attr("id"), [entries], {
|
||||
// Title of the chart
|
||||
title: "Dépenses",
|
||||
|
||||
@ -623,76 +434,19 @@ drawPieChart = function(entries, element) {
|
||||
// Reset chart to null to avoid redraw of a non existing chart in resize callback.
|
||||
window.pieChart = null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Chart binding to redraw the chart on entries update.
|
||||
ko.bindingHandlers.chart = {
|
||||
init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
// empty - left as placeholder if needed later
|
||||
},
|
||||
$rootScope.$on("monthsLoadedEvent", function(event, args){
|
||||
$scope.loadEntries(args.account, args.month);
|
||||
});
|
||||
|
||||
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var unwrap = ko.utils.unwrapObservable;
|
||||
var dataSource = valueAccessor();
|
||||
|
||||
var data = dataSource ? unwrap(dataSource) : null;
|
||||
drawChart(data, element);
|
||||
}
|
||||
};
|
||||
|
||||
// Pie chart binding to redraw expense chart on entries update.
|
||||
ko.bindingHandlers.pieChart = {
|
||||
init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
// empty - left as placeholder if needed later
|
||||
},
|
||||
|
||||
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var unwrap = ko.utils.unwrapObservable;
|
||||
var dataSource = valueAccessor();
|
||||
|
||||
var entries = dataSource ? unwrap(dataSource) : null;
|
||||
drawPieChart(entries, element);
|
||||
}
|
||||
$scope.$on("entriesLoadedEvent", function(event, args) {
|
||||
$scope.entriesLoaded(args.entries);
|
||||
});
|
||||
};
|
||||
|
||||
// Default AJAX error handler.
|
||||
$(document).ajaxError(function(event, xhr, settings) {
|
||||
message("error", xhr.statusText, xhr.responseText);
|
||||
});
|
||||
|
||||
// Bootstrap.Typeahead binding.
|
||||
// Use like so: data-bind="typeahead: { source: namespaces }"
|
||||
ko.bindingHandlers.typeahead = {
|
||||
init: function(element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
$(element).typeahead({
|
||||
source: function() { return ko.utils.unwrapObservable(valueAccessor().source); },
|
||||
onselect: function(value) { allBindingsAccessor().value(value); }
|
||||
});
|
||||
},
|
||||
|
||||
update: function(element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
$(element).typeahead({
|
||||
source: function() { ko.utils.unwrapObservable(valueAccessor().source); },
|
||||
onselect: function(value) { allBindingsAccessor().value(value); }
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Resize callback.
|
||||
$(window).resize(function() {
|
||||
if(window.chart) {
|
||||
window.chart.replot({resetAxes: true});
|
||||
}
|
||||
|
||||
if(window.pieChart) {
|
||||
window.pieChart.replot({resetAxes: true});
|
||||
}
|
||||
});
|
||||
|
||||
// ViewModal instanciation.
|
||||
var viewModel = new ListViewModel();
|
||||
ko.applyBindings(viewModel);
|
||||
|
||||
// Load accounts after page initialization.
|
||||
$(viewModel.loadAccounts);
|
||||
//$(document).ajaxError(function(event, xhr, settings) {
|
||||
// message("error", xhr.statusText, xhr.responseText);
|
||||
//});
|
||||
|
||||
|
80
src/html/js/months.js
Normal file
80
src/html/js/months.js
Normal file
@ -0,0 +1,80 @@
|
||||
// Month object
|
||||
function month() {
|
||||
this.year = null;
|
||||
this.month = null;
|
||||
}
|
||||
|
||||
|
||||
var MonthController = function($scope, $http, $rootScope) {
|
||||
// Month store and selection
|
||||
$scope.months = null;
|
||||
$scope.month = null;
|
||||
$scope.account = null;
|
||||
|
||||
$scope.monthClass = function(month) {
|
||||
if(month == $scope.month) {
|
||||
return "active";
|
||||
}
|
||||
};
|
||||
|
||||
// Function to load months
|
||||
$scope.loadMonths = function(account) {
|
||||
if(account) {
|
||||
$scope.account = account;
|
||||
}
|
||||
|
||||
if($scope.account) {
|
||||
$http.get("api/accounts/" + $scope.account.id + "/months").success($scope.loadMonths_success);
|
||||
} else {
|
||||
$scope.$emit("monthsLoadedEvent", {account: null, month: null});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.loadMonths_success = function (data) {
|
||||
// Update months
|
||||
$scope.months = angular.fromJson(data);
|
||||
|
||||
var monthToSelect = null;
|
||||
|
||||
var today = new Date();
|
||||
var currentYear = today.getFullYear().toString();
|
||||
var currentMonth = (today.getMonth() + 1 < 10 ? "0" : "") + (today.getMonth() + 1);
|
||||
|
||||
// Find the new instance of the previously selected month.
|
||||
angular.forEach($scope.months, function(month) {
|
||||
// Reset selected month to the new instance corresponding to the old one
|
||||
if($scope.month) {
|
||||
if(month == $scope.month) {
|
||||
monthToSelect = month;
|
||||
}
|
||||
} else {
|
||||
if(month.year === currentYear && month.month === currentMonth) {
|
||||
monthToSelect = month;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Set selected month to the last one if not yet selected.
|
||||
if(!monthToSelect && $scope.months.length > 0) {
|
||||
monthToSelect = $scope.months[$scope.months.length - 1];
|
||||
}
|
||||
|
||||
// Reset to month to select
|
||||
$scope.month = monthToSelect;
|
||||
|
||||
$scope.$emit("monthsLoadedEvent", {account: $scope.account, month: $scope.month});
|
||||
};
|
||||
|
||||
// Callback function to select a new month.
|
||||
$scope.selectMonth = function(month) {
|
||||
if(month) {
|
||||
$scope.month = month;
|
||||
$scope.$emit("monthsLoadedEvent", {account: $scope.account, month: month});
|
||||
}
|
||||
};
|
||||
|
||||
$rootScope.$on("accountsLoadedEvent", function(event, args) {
|
||||
$scope.loadMonths(args.account);
|
||||
});
|
||||
};
|
||||
|
31
src/html/templates/account_edit.html
Normal file
31
src/html/templates/account_edit.html
Normal file
@ -0,0 +1,31 @@
|
||||
<!-- Dialog header with title -->
|
||||
<div class="modal-header">
|
||||
<h3>Éditer le compte {{account.name}}</h3>
|
||||
</div>
|
||||
|
||||
<!-- Dialog body -->
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<!-- Account name field -->
|
||||
<label class="control-label" for="inputName">Nom du compte</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="inputName" ng-model="account.name"></input>
|
||||
</div>
|
||||
|
||||
<!-- Authorized overdraft field -->
|
||||
<label class="control-label" for="inputAuthorizedOverdraft">Découvert authorisé</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="inputAuthorizedOverdraft" ng-model="account.authorized_overdraft"></input>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Dialog footer with buttons -->
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-primary" ng-click="saveAccount(account, this)">OK</a>
|
||||
<a href="#" class="btn" ng-click="cancelEditAccount(account, this)">Annuler</a>
|
||||
</div>
|
||||
|
||||
|
31
src/html/templates/account_new.html
Normal file
31
src/html/templates/account_new.html
Normal file
@ -0,0 +1,31 @@
|
||||
<!-- Dialog header with title -->
|
||||
<div class="modal-header">
|
||||
<h3>Nouveau compte</h3>
|
||||
</div>
|
||||
|
||||
<!-- Dialog body -->
|
||||
<div class="modal-body">
|
||||
<form name="account" class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<!-- Account name field -->
|
||||
<label class="control-label" for="inputName">Nom du compte</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="inputName" ng-model="account.name"></input>
|
||||
</div>
|
||||
|
||||
<!-- Authorized overdraft field -->
|
||||
<label class="control-label" for="inputAuthorizedOverdraft">Découvert authorisé</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="inputAuthorizedOverdraft" ng-model="account.authorized_overdraft"></input>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Dialog footer with buttons -->
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-primary" ng-click="saveAccount(account, this)">OK</a>
|
||||
<a href="#" class="btn" ng-click="cancelEditAccount(account, this)">Annuler</a>
|
||||
</div>
|
||||
|
||||
|
16
src/html/templates/account_remove.html
Normal file
16
src/html/templates/account_remove.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!-- Dialog header with title -->
|
||||
<div class="modal-header">
|
||||
<h3>Supprimer le compte {{account.name}}</h3>
|
||||
</div>
|
||||
|
||||
<!-- Dialog body -->
|
||||
<div class="modal-body">
|
||||
<p>Confirmez-vous la suppression du compte {{account.name}} ?</p>
|
||||
</div>
|
||||
|
||||
<!-- Dialog footer with buttons -->
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Non</a>
|
||||
<a href="#" class="btn" ng-click="accountRemove(account, this)">Oui</a>
|
||||
</div>
|
||||
|
16
src/html/templates/entry_remove.html
Normal file
16
src/html/templates/entry_remove.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!-- Dialog header with title -->
|
||||
<div class="modal-header">
|
||||
<h3>Supprimer l'entrée {{entry.label}}</h3>
|
||||
</div>
|
||||
|
||||
<!-- Dialog body -->
|
||||
<div class="modal-body">
|
||||
<p>Confirmez-vous la suppression de cette entrée ?</p>
|
||||
</div>
|
||||
|
||||
<!-- Dialog footer with buttons -->
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-primary" ng-click="dismiss()">Non</a>
|
||||
<a href="#" class="btn" ng-click="removeEntry(entry, this)">Oui</a>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user