Can Allow charges only if one card is marked as default

This commit is contained in:
Jean-Baptiste Bellet
2022-07-21 14:42:36 +02:00
parent 89d68c7708
commit a3cb1e6ecc
2 changed files with 5 additions and 0 deletions

View File

@@ -20,3 +20,7 @@ angular.module('Darkswarm').controller "CreditCardsCtrl", ($scope, $http, Credit
).finally ->
window.location.reload()
$scope.hasOneDefaultSavedCards = () ->
$scope.savedCreditCards.length > 0 && $scope.savedCreditCards.some((card) -> card.is_default)

View File

@@ -12,5 +12,6 @@
name: 'allow_charges',
ng: { model: 'customer.allow_charges',
change: 'customer.update()',
disabled: "!hasOneDefaultSavedCards()",
"true-value" => "true",
"false-value" => "false" } }