mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Can Allow charges only if one card is marked as default
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -12,5 +12,6 @@
|
||||
name: 'allow_charges',
|
||||
ng: { model: 'customer.allow_charges',
|
||||
change: 'customer.update()',
|
||||
disabled: "!hasOneDefaultSavedCards()",
|
||||
"true-value" => "true",
|
||||
"false-value" => "false" } }
|
||||
|
||||
Reference in New Issue
Block a user