Adding founders world discount

This commit is contained in:
Colin McLeod
2015-06-12 23:40:32 -07:00
parent 0d09607d30
commit 5649dc9079
5 changed files with 41 additions and 15 deletions

View File

@@ -12,17 +12,9 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$rootScope', 'Pers
scope.allComparisons = Persist.comparisons;
scope.bs = Persist.state;
// Insurance options and management here for now.
$rootScope.insurance = {
opts: [
{ name: 'Standard', pct: 0.05 },
{ name: 'Alpha', pct: 0.025 },
{ name: 'Beta', pct: 0.035 }
]
};
var insIndex = _.findIndex($rootScope.insurance.opts, 'name', Persist.getInsurance());
$rootScope.insurance.current = $rootScope.insurance.opts[insIndex != -1 ? insIndex : 0];
$rootScope.discounts.current = $rootScope.discounts.opts[Persist.getDiscount() || 0];
// Close menus if a navigation change event occurs
$rootScope.$on('$stateChangeStart', function() {
@@ -42,6 +34,13 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$rootScope', 'Pers
Persist.setInsurance($rootScope.insurance.current.name);
};
/**
* Save selected discount option
*/
scope.updateDiscount = function() {
Persist.setDiscount($rootScope.discounts.opts.indexOf($rootScope.discounts.current));
};
scope.openMenu = function(e, menu) {
e.stopPropagation();
if (menu == scope.openedMenu) {