diff --git a/app/assets/javascripts/controllers/admin/invoices.js.erb b/app/assets/javascripts/controllers/admin/invoices.js.erb index ce8c9667a..3fb9de5e5 100644 --- a/app/assets/javascripts/controllers/admin/invoices.js.erb +++ b/app/assets/javascripts/controllers/admin/invoices.js.erb @@ -17,8 +17,8 @@ /** * Controller used in the admin invoices listing page */ -Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'Invoice', 'AccountingPeriod', 'AuthService', 'invoices', 'closedPeriods', '$uibModal', 'growl', '$filter', 'Setting', 'settings', 'stripeSecretKey', '_t', 'Member', 'uiTourService', - function ($scope, $state, Invoice, AccountingPeriod, AuthService, invoices, closedPeriods, $uibModal, growl, $filter, Setting, settings, stripeSecretKey, _t, Member, uiTourService) { +Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'Invoice', 'AccountingPeriod', 'AuthService', 'invoices', 'closedPeriods', '$uibModal', 'growl', '$filter', 'Setting', 'settings', 'stripeSecretKey', '_t', 'Member', 'uiTourService', 'Payment', 'onlinePaymentStatus', + function ($scope, $state, Invoice, AccountingPeriod, AuthService, invoices, closedPeriods, $uibModal, growl, $filter, Setting, settings, stripeSecretKey, _t, Member, uiTourService, Payment, onlinePaymentStatus) { /* PRIVATE STATIC CONSTANTS */ // number of invoices loaded each time we click on 'load more...' @@ -178,6 +178,9 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I // is the stripe private set? $scope.stripeSecretKey = (stripeSecretKey.isPresent ? STRIPE_SK_HIDDEN : ''); + // has any online payment been already made? + $scope.onlinePaymentStatus = onlinePaymentStatus.status; + // Placeholding date for the invoice creation $scope.today = moment(); @@ -619,6 +622,9 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I Setting.isPresent({ name: 'stripe_secret_key' }, function (res) { $scope.stripeSecretKey = (res.isPresent ? STRIPE_SK_HIDDEN : ''); }) + Payment.onlinePaymentStatus(function (res) { + $scope.onlinePaymentStatus = res.status; + }); } }) diff --git a/app/assets/javascripts/directives/settings/text-setting.js.erb b/app/assets/javascripts/directives/settings/text-setting.js.erb index d95c9cb92..bd9dc9215 100644 --- a/app/assets/javascripts/directives/settings/text-setting.js.erb +++ b/app/assets/javascripts/directives/settings/text-setting.js.erb @@ -10,7 +10,10 @@ Application.Directives.directive('textSetting', ['Setting', 'growl', '_t', faIcon: '@', placeholder: '@', required: '<', - type: '@' + type: '@', + maxLength: '@', + minLength: '@', + readOnly: '<' }, templateUrl: '<%= asset_path "admin/settings/text.html" %>', link ($scope, element, attributes) { diff --git a/app/assets/javascripts/router.js.erb b/app/assets/javascripts/router.js.erb index 90cf88eee..c959dc9b7 100644 --- a/app/assets/javascripts/router.js.erb +++ b/app/assets/javascripts/router.js.erb @@ -839,9 +839,10 @@ angular.module('application.router', ['ui.router']) 'accounting_VAT_code', 'accounting_VAT_label', 'accounting_subscription_code', 'accounting_subscription_label', \ 'accounting_Machine_code', 'accounting_Machine_label', 'accounting_Training_code', 'accounting_Training_label', \ 'accounting_Event_code', 'accounting_Event_label', 'accounting_Space_code', 'accounting_Space_label', \ - 'feature_tour_display', 'online_payment_module', 'stripe_public_key']` }).$promise; + 'feature_tour_display', 'online_payment_module', 'stripe_public_key', 'stripe_currency']` }).$promise; }], stripeSecretKey: ['Setting', function (Setting) { return Setting.isPresent({ name: 'stripe_secret_key' }).$promise; }], + onlinePaymentStatus: ['Payment', function (Payment) { return Payment.onlinePaymentStatus().$promise; }], invoices: [ 'Invoice', function (Invoice) { return Invoice.list({ query: { number: '', customer: '', date: null, order_by: '-reference', page: 1, size: 20 } diff --git a/app/assets/javascripts/services/payment.js b/app/assets/javascripts/services/payment.js index c3fd1883d..69c80d865 100644 --- a/app/assets/javascripts/services/payment.js +++ b/app/assets/javascripts/services/payment.js @@ -7,6 +7,10 @@ Application.Services.factory('Payment', ['$resource', function ($resource) { method: 'POST', url: '/api/payments/confirm_payment', isArray: false + }, + onlinePaymentStatus: { + method: 'GET', + url: '/api/payments/online_payment_status' } } ); diff --git a/app/assets/templates/admin/invoices/payment.html.erb b/app/assets/templates/admin/invoices/payment.html.erb index 7498bffc4..019845fc0 100644 --- a/app/assets/templates/admin/invoices/payment.html.erb +++ b/app/assets/templates/admin/invoices/payment.html.erb @@ -42,6 +42,23 @@ +