From 77797db2f138624cefd8f45af08d0194b78a8ce1 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 14 Jan 2019 15:00:33 +0100 Subject: [PATCH] display VAT rates history --- .../controllers/admin/invoices.js.erb | 6 +++++- .../templates/admin/invoices/index.html.erb | 20 +++++++++++++++++++ app/controllers/api/settings_controller.rb | 1 + app/views/api/settings/show.json.jbuilder | 9 +++++++++ config/locales/app.admin.en.yml | 3 +++ config/locales/app.admin.es.yml | 3 +++ config/locales/app.admin.fr.yml | 3 +++ config/locales/app.admin.pt.yml | 3 +++ 8 files changed, 47 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/controllers/admin/invoices.js.erb b/app/assets/javascripts/controllers/admin/invoices.js.erb index e4a3fe1b8..aab7f9fc0 100644 --- a/app/assets/javascripts/controllers/admin/invoices.js.erb +++ b/app/assets/javascripts/controllers/admin/invoices.js.erb @@ -301,11 +301,15 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I }, active () { return $scope.invoice.VAT.active; + }, + history () { + return Setting.get({ name: 'invoice_VAT-rate', history: true }).$promise; } }, - controller: ['$scope', '$uibModalInstance', 'rate', 'active', function ($scope, $uibModalInstance, rate, active) { + controller: ['$scope', '$uibModalInstance', 'rate', 'active', 'history', function ($scope, $uibModalInstance, rate, active, history) { $scope.rate = rate; $scope.isSelected = active; + $scope.history = history.setting.history; $scope.ok = function () { $uibModalInstance.close({ rate: $scope.rate, active: $scope.isSelected }); }; return $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); }; diff --git a/app/assets/templates/admin/invoices/index.html.erb b/app/assets/templates/admin/invoices/index.html.erb index 1f5288635..78baf8b7e 100644 --- a/app/assets/templates/admin/invoices/index.html.erb +++ b/app/assets/templates/admin/invoices/index.html.erb @@ -384,6 +384,26 @@ + +
+

{{ 'invoices.VAT_history' }}

+ + + + + + + + + + + + + + + +
{{ 'invoices.VAT_rate' }}{{ 'invoices.changed_at' }}{{ 'invoices.changed_by' }}
{{value.value}} %{{value.created_at | amDateFormat:'L LT'}}{{value.user.name}}
+