mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 09:11:15 +00:00
53 lines
No EOL
1.2 KiB
CoffeeScript
53 lines
No EOL
1.2 KiB
CoffeeScript
define [
|
|
"base"
|
|
], (App)->
|
|
SUBSCRIPTION_URL = "/user/subscription/update"
|
|
|
|
|
|
App.controller "CurrenyDropdownController", ($scope, MultiCurrencyPricing)->
|
|
|
|
$scope.plans = MultiCurrencyPricing.plans
|
|
$scope.currencyCode = MultiCurrencyPricing.currencyCode
|
|
|
|
$scope.changeCurrency = (newCurrency)->
|
|
MultiCurrencyPricing.currencyCode = newCurrency
|
|
|
|
|
|
App.controller "ChangePlanFormController", ($scope, $modal, MultiCurrencyPricing)->
|
|
|
|
$scope.changePlan = ->
|
|
$modal.open(
|
|
templateUrl: "confirmChangePlanModalTemplate"
|
|
controller: "ConfirmChangePlanController"
|
|
scope: $scope
|
|
)
|
|
|
|
$scope.$watch "pricing.currencyCode", ->
|
|
$scope.currencyCode = MultiCurrencyPricing.currencyCode
|
|
|
|
$scope.pricing = MultiCurrencyPricing
|
|
$scope.plans = MultiCurrencyPricing.plans
|
|
|
|
$scope.currencyCode = MultiCurrencyPricing.currencyCode
|
|
|
|
|
|
|
|
|
|
App.controller "ConfirmChangePlanController", ($scope, $modalInstance, $http)->
|
|
$scope.confirmChangePlan = ->
|
|
|
|
body =
|
|
plan_code: $scope.plan.planCode
|
|
_csrf : window.csrfToken
|
|
|
|
$scope.inflight = true
|
|
|
|
|
|
$http.post(SUBSCRIPTION_URL, body)
|
|
.success ->
|
|
location.reload()
|
|
.error ->
|
|
console.log "something went wrong changing plan"
|
|
|
|
$scope.cancel = () ->
|
|
$modalInstance.dismiss('cancel') |