1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

display VAT rates history

This commit is contained in:
Sylvain 2019-01-14 15:00:33 +01:00
parent 7ca72f53f2
commit 77797db2f1
8 changed files with 47 additions and 1 deletions

View File

@ -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'); };

View File

@ -384,6 +384,26 @@
<input id="vatRate" type="number" ng-model="rate" class="form-control" min="0" max="100"/>
</div>
</div>
<div class="m-t-lg">
<h4 translate>{{ 'invoices.VAT_history' }}</h4>
<table class="table">
<head>
<tr>
<th translate>{{ 'invoices.VAT_rate' }}</th>
<th translate>{{ 'invoices.changed_at' }}</th>
<th translate>{{ 'invoices.changed_by' }}</th>
</tr>
</head>
<tbody>
<tr ng-repeat="value in history">
<td>{{value.value}} %</td>
<td>{{value.created_at | amDateFormat:'L LT'}}</td>
<td>{{value.user.name}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-warning" ng-click="ok()" translate>{{ 'confirm' }}</button>

View File

@ -17,6 +17,7 @@ class API::SettingsController < API::ApiController
def show
@setting = Setting.find_or_create_by(name: params[:name])
@show_history = params[:history] == 'true' && current_user.admin?
end
private

View File

@ -1,3 +1,12 @@
json.setting do
json.partial! 'api/settings/setting', setting: @setting
if @show_history
json.history @setting.history_values do |value|
json.extract! value, :value, :created_at
json.user do
json.id value.user_id
json.name "#{value.user.first_name} #{value.user.last_name}"
end
end
end
end

View File

@ -364,6 +364,9 @@ en:
VAT: "VAT"
enable_VAT: "Enable VAT"
VAT_rate: "VAT rate"
VAT_history: "VAT rates history"
changed_at: "Changed at"
changed_by: "By"
refund_invoice_successfully_created: "Refund invoice successfully created."
create_a_refund_on_this_invoice: "Create a refund on this invoice"
creation_date_for_the_refund: "Creation date for the refund"

View File

@ -364,6 +364,9 @@ es:
VAT: "IVA"
enable_VAT: "Habilitar IVA"
VAT_rate: "Ratio IVA"
VAT_history: "Historial de ratios de IVA"
changed_at: "Cambiado en"
changed_by: "Por"
refund_invoice_successfully_created: "Factura de reembolso creada correctamente."
create_a_refund_on_this_invoice: "Crear un reembolso en esta factura"
creation_date_for_the_refund: "Fecha de creación del reembolso"

View File

@ -364,6 +364,9 @@ fr:
VAT: "TVA"
enable_VAT: "Activer la TVA"
VAT_rate: "Taux de TVA"
VAT_history: "Historique des taux de TVA"
changed_at: "Changé le"
changed_by: "Par"
refund_invoice_successfully_created: "La facture d'avoir a bien été créée."
create_a_refund_on_this_invoice: "Générer un avoir sur cette facture"
creation_date_for_the_refund: "Date d'émission de l'avoir"

View File

@ -364,6 +364,9 @@ pt:
VAT: "VAT"
enable_VAT: "Ativar VAT"
VAT_rate: "VAT taxa"
VAT_history: "VAT rates history" #translation_missing
changed_at: "Changed at" #translation_missing
changed_by: "By" #translation_missing
refund_invoice_successfully_created: "Restituição de fatura criada com sucesso."
create_a_refund_on_this_invoice: "Criar restituição de fatura"
creation_date_for_the_refund: "Criação de data de restituição"