diff --git a/app/assets/javascripts/controllers/admin/members.coffee.erb b/app/assets/javascripts/controllers/admin/members.coffee.erb index 55d79c0ec..14b2c42a9 100644 --- a/app/assets/javascripts/controllers/admin/members.coffee.erb +++ b/app/assets/javascripts/controllers/admin/members.coffee.erb @@ -423,11 +423,40 @@ Application.Controllers.controller "EditMemberController", ["$scope", "$state", templateUrl: '<%= asset_path "wallet/credit_modal.html" %>' controller: ['$scope', '$uibModalInstance', 'Wallet', ($scope, $uibModalInstance, Wallet) -> + # default: do not generate a refund invoice + $scope.generate_avoir = false + + # date of the generated refund invoice + $scope.avoir_date = null + + # optional description shown on the refund invoice + $scope.description = '' + + # default configuration for the avoir date selector widget + $scope.datePicker = + format: Fablab.uibDateFormat + opened: false + options: + startingDay: Fablab.weekStartingDay + + ## + # Callback to open/close the date picker + ## + $scope.toggleDatePicker = ($event) -> + $event.preventDefault() + $event.stopPropagation() + $scope.datePicker.opened = !$scope.datePicker.opened + ## # Modal dialog validation callback ## $scope.ok = -> - Wallet.credit { id: wallet.id }, { amount: $scope.amount }, (_wallet)-> + Wallet.credit { id: wallet.id }, + amount: $scope.amount + avoir: $scope.generate_avoir + avoir_date: $scope.avoir_date + avoir_description: $scope.description + , (_wallet)-> growl.success(_t('wallet_credit_successfully')) $uibModalInstance.close(_wallet) diff --git a/app/assets/templates/wallet/credit_modal.html.erb b/app/assets/templates/wallet/credit_modal.html.erb index 7624e12a9..80e0baf54 100644 --- a/app/assets/templates/wallet/credit_modal.html.erb +++ b/app/assets/templates/wallet/credit_modal.html.erb @@ -3,11 +3,18 @@

{{ 'credit_title' }}