2014-08-28 13:14:31 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
App.controller "AnnualUpgradeController", ($scope, $http, $modal) ->
|
|
|
|
|
|
|
|
MESSAGES_URL = "/user/subscription/upgrade-annual"
|
|
|
|
|
2014-08-29 07:37:00 -04:00
|
|
|
$scope.upgradeComplete = false
|
2014-08-29 07:36:36 -04:00
|
|
|
savings =
|
|
|
|
student:"19.2"
|
|
|
|
collaborator:"36"
|
|
|
|
$scope.$watch $scope.planName, ->
|
|
|
|
$scope.yearlySaving = savings[$scope.planName]
|
2014-08-29 09:13:05 -04:00
|
|
|
if $scope.planName == "annual"
|
|
|
|
$scope.upgradeComplete = true
|
2014-08-28 13:14:31 -04:00
|
|
|
$scope.completeAnnualUpgrade = ->
|
|
|
|
body =
|
|
|
|
planName: $scope.planName
|
|
|
|
_csrf : window.csrfToken
|
|
|
|
|
|
|
|
$scope.inflight = true
|
|
|
|
|
|
|
|
|
|
|
|
$http.post(MESSAGES_URL, body)
|
2017-06-20 06:49:55 -04:00
|
|
|
.then ->
|
2014-08-28 13:14:31 -04:00
|
|
|
$scope.upgradeComplete = true
|
2017-06-20 06:49:55 -04:00
|
|
|
.catch ->
|
2014-08-28 13:14:31 -04:00
|
|
|
console.log "something went wrong changing plan"
|