mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
update multi VAT
This commit is contained in:
parent
c5211e98e3
commit
6019767a3b
@ -92,6 +92,15 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
active: false,
|
||||
templateUrl: '/admin/invoices/settings/editVAT.html'
|
||||
},
|
||||
multiVAT: {
|
||||
rateMachine: '',
|
||||
rateSpace: '',
|
||||
rateTraining: '',
|
||||
rateEvent: '',
|
||||
rateSubscription: '',
|
||||
editTemplateUrl: '/admin/invoices/settings/editMultiVAT.html',
|
||||
historyTemplateUrl: '/admin/invoices/settings/multiVATHistory.html'
|
||||
},
|
||||
text: {
|
||||
content: ''
|
||||
},
|
||||
@ -446,6 +455,9 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
active () {
|
||||
return $scope.invoice.VAT.active;
|
||||
},
|
||||
multiVAT () {
|
||||
return $scope.invoice.multiVAT;
|
||||
},
|
||||
rateHistory () {
|
||||
return Setting.get({ name: 'invoice_VAT-rate', history: true }).$promise;
|
||||
},
|
||||
@ -453,13 +465,74 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
return Setting.get({ name: 'invoice_VAT-active', history: true }).$promise;
|
||||
}
|
||||
},
|
||||
controller: ['$scope', '$uibModalInstance', 'rate', 'active', 'rateHistory', 'activeHistory', function ($scope, $uibModalInstance, rate, active, rateHistory, activeHistory) {
|
||||
controller: ['$scope', '$uibModalInstance', 'rate', 'active', 'rateHistory', 'activeHistory', 'multiVAT', function ($scope, $uibModalInstance, rate, active, rateHistory, activeHistory, multiVAT) {
|
||||
$scope.rate = rate;
|
||||
$scope.isSelected = active;
|
||||
$scope.history = [];
|
||||
|
||||
$scope.ok = function () { $uibModalInstance.close({ rate: $scope.rate, active: $scope.isSelected }); };
|
||||
$scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
|
||||
$scope.editMultiVAT = function () {
|
||||
const editMultiVATModalInstance = $uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: multiVAT.editTemplateUrl,
|
||||
size: 'lg',
|
||||
resolve: {
|
||||
rate () {
|
||||
return $scope.rate;
|
||||
},
|
||||
multiVAT () {
|
||||
return multiVAT;
|
||||
}
|
||||
},
|
||||
controller: ['$scope', '$uibModalInstance', 'rate', 'multiVAT', function ($scope, $uibModalInstance, rate, multiVAT) {
|
||||
$scope.rate = rate;
|
||||
$scope.multiVAT = multiVAT;
|
||||
|
||||
$scope.ok = function () { $uibModalInstance.close({ multiVAT: $scope.multiVAT }); };
|
||||
$scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
|
||||
|
||||
$scope.showMultiRateHistory = function (rateType) {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: multiVAT.historyTemplateUrl,
|
||||
size: 'lg',
|
||||
resolve: {
|
||||
rateHistory () {
|
||||
return Setting.get({ name: `invoice_VAT-rate_${rateType}`, history: true }).$promise;
|
||||
}
|
||||
},
|
||||
controller: ['$scope', '$uibModalInstance', 'rateHistory', function ($scope, $uibModalInstance, rateHistory) {
|
||||
$scope.history = [];
|
||||
|
||||
$scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
|
||||
|
||||
const initialize = function () {
|
||||
rateHistory.setting.history.forEach(function (rate) {
|
||||
$scope.history.push({ date: rate.created_at, rate: rate.value, user: rate.user });
|
||||
});
|
||||
};
|
||||
|
||||
initialize();
|
||||
}]
|
||||
});
|
||||
};
|
||||
}]
|
||||
});
|
||||
return editMultiVATModalInstance.result.then(function (result) {
|
||||
['Machine', 'Space', 'Training', 'Event', 'Subscription'].forEach(rateType => {
|
||||
Setting.update({ name: `invoice_VAT-rate_${rateType}` }, { value: result.multiVAT[`rate${rateType}`] + '' }, function (data) {
|
||||
return growl.success(_t('app.admin.invoices.VAT_rate_successfully_saved'));
|
||||
}
|
||||
, function (error) {
|
||||
if (error.status === 304) return;
|
||||
|
||||
growl.error(_t('app.admin.invoices.an_error_occurred_while_saving_the_VAT_rate'));
|
||||
console.error(error);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const initialize = function () {
|
||||
rateHistory.setting.history.forEach(function (rate) {
|
||||
@ -943,6 +1016,11 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
$scope.invoice.text.content = settings.invoice_text;
|
||||
$scope.invoice.VAT.rate = parseFloat(settings['invoice_VAT-rate']);
|
||||
$scope.invoice.VAT.active = (settings['invoice_VAT-active'] === 'true');
|
||||
$scope.invoice.multiVAT.rateMachine = settings['invoice_VAT-rate_Machine'] ? parseFloat(settings['invoice_VAT-rate_Machine']) : '';
|
||||
$scope.invoice.multiVAT.rateSpace = settings['invoice_VAT-rate_Space'] ? parseFloat(settings['invoice_VAT-rate_Space']) : '';
|
||||
$scope.invoice.multiVAT.rateTraining = settings['invoice_VAT-rate_Training'] ? parseFloat(settings['invoice_VAT-rate_Training']) : '';
|
||||
$scope.invoice.multiVAT.rateEvent = settings['invoice_VAT-rate_Event'] ? parseFloat(settings['invoice_VAT-rate_Event']) : '';
|
||||
$scope.invoice.multiVAT.rateSubscription = settings['invoice_VAT-rate_Subscription'] ? parseFloat(settings['invoice_VAT-rate_Subscription']) : '';
|
||||
$scope.invoice.number.model = settings['invoice_order-nb'];
|
||||
$scope.invoice.code.model = settings['invoice_code-value'];
|
||||
$scope.invoice.code.active = (settings['invoice_code-active'] === 'true');
|
||||
|
@ -20,6 +20,11 @@ export enum SettingName {
|
||||
InvoiceOrderNb = 'invoice_order-nb',
|
||||
InvoiceVATActive = 'invoice_VAT-active',
|
||||
InvoiceVATRate = 'invoice_VAT-rate',
|
||||
InvoiceVATRateMachine = 'invoice_VAT-rate_Machine',
|
||||
InvoiceVATRateTraining = 'invoice_VAT-rate_Training',
|
||||
InvoiceVATRateSpace = 'invoice_VAT-rate_Space',
|
||||
InvoiceVATRateEvent = 'invoice_VAT-rate_Event',
|
||||
InvoiceVATRateSubscription = 'invoice_VAT-rate_Subscription',
|
||||
InvoiceText = 'invoice_text',
|
||||
InvoiceLegals = 'invoice_legals',
|
||||
BookingWindowStart = 'booking_window_start',
|
||||
|
@ -869,7 +869,8 @@ angular.module('application.router', ['ui.router'])
|
||||
resolve: {
|
||||
settings: ['Setting', function (Setting) {
|
||||
return Setting.query({
|
||||
names: "['invoice_legals', 'invoice_text', 'invoice_VAT-rate', 'invoice_VAT-active', 'invoice_order-nb', 'invoice_code-value', " +
|
||||
names: "['invoice_legals', 'invoice_text', 'invoice_VAT-rate', 'invoice_VAT-rate_Machine', 'invoice_VAT-rate_Training', 'invoice_VAT-rate_Space', " +
|
||||
"'invoice_VAT-rate_Event', 'invoice_VAT-rate_Subscription', 'invoice_VAT-active', 'invoice_order-nb', 'invoice_code-value', " +
|
||||
"'invoice_code-active', 'invoice_reference', 'invoice_logo', 'accounting_journal_code', 'accounting_card_client_code', " +
|
||||
"'accounting_card_client_label', 'accounting_wallet_client_code', 'accounting_wallet_client_label', 'invoicing_module', " +
|
||||
"'accounting_other_client_code', 'accounting_other_client_label', 'accounting_wallet_code', 'accounting_wallet_label', " +
|
||||
|
@ -367,3 +367,7 @@ table.export-table-template {
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.multi-vat-rate-input {
|
||||
width: 90% !important;
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
<div class="custom-invoice">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title" translate>{{ 'app.admin.invoices.multiVAT' }}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<uib-alert type="warning">
|
||||
<p class="text-sm">
|
||||
<i class="fa fa-warning"></i>
|
||||
<span ng-bind-html="'app.admin.invoices.multi_VAT_notice' | translate:{ RATE: rate }"></span>
|
||||
</p>
|
||||
</uib-alert>
|
||||
<div class="form-group">
|
||||
<label for="vatRateMachine" class="control-label" translate>{{ 'app.admin.invoices.VAT_rate_machine' }}</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">% </span>
|
||||
<input id="vatRateMachine" type="number" ng-model="multiVAT.rateMachine" class="form-control multi-vat-rate-input" min="0" max="100"/>
|
||||
<button class="btn pull-right" ng-click="showMultiRateHistory('Machine')"><i class="fa fa-history"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="vatRateSpace" class="control-label" translate>{{ 'app.admin.invoices.VAT_rate_space' }}</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">% </span>
|
||||
<input id="vatRateSpace" type="number" ng-model="multiVAT.rateSpace" class="form-control multi-vat-rate-input" min="0" max="100"/>
|
||||
<button class="btn pull-right" ng-click="showMultiRateHistory('Space')"><i class="fa fa-history"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="vatRateTraining" class="control-label" translate>{{ 'app.admin.invoices.VAT_rate_training' }}</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">% </span>
|
||||
<input id="vatRateTraining" type="number" ng-model="multiVAT.rateTraining" class="form-control multi-vat-rate-input" min="0" max="100"/>
|
||||
<button class="btn pull-right" ng-click="showMultiRateHistory('Training')"><i class="fa fa-history"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="vatRateEvent" class="control-label" translate>{{ 'app.admin.invoices.VAT_rate_event' }}</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">% </span>
|
||||
<input id="vatRateEvent" type="number" ng-model="multiVAT.rateEvent" class="form-control multi-vat-rate-input" min="0" max="100"/>
|
||||
<button class="btn pull-right" ng-click="showMultiRateHistory('Event')"><i class="fa fa-history"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="vatRateSubscription" class="control-label" translate>{{ 'app.admin.invoices.VAT_rate_subscription' }}</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">% </span>
|
||||
<input id="vatRateSubscription" type="number" ng-model="multiVAT.rateSubscription" class="form-control multi-vat-rate-input" min="0" max="100"/>
|
||||
<button class="btn pull-right" ng-click="showMultiRateHistory('Subscription')"><i class="fa fa-history"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning" ng-click="ok()" translate>{{ 'app.shared.buttons.confirm' }}</button>
|
||||
<button class="btn btn-default" ng-click="cancel()" translate>{{ 'app.shared.buttons.cancel' }}</button>
|
||||
</div>
|
||||
</div>
|
@ -22,6 +22,12 @@
|
||||
<input id="vatRate" type="number" ng-model="rate" class="form-control" min="0" max="100"/>
|
||||
</div>
|
||||
</div>
|
||||
<uib-alert type="warning" ng-show="isSelected">
|
||||
<p class="text-sm">
|
||||
<i class="fa fa-warning"></i>
|
||||
<span>{{ 'app.admin.invoices.VAT_notice' | translate }}</span>
|
||||
</p>
|
||||
</uib-alert>
|
||||
|
||||
<div class="m-t-lg">
|
||||
<h4 translate>{{ 'app.admin.invoices.VAT_history' }}</h4>
|
||||
@ -48,6 +54,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning pull-left" ng-click="editMultiVAT()" ng-show="isSelected" translate>{{ 'app.admin.invoices.edit_multi_VAT_button' }}</button>
|
||||
<button class="btn btn-warning" ng-click="ok()" translate>{{ 'app.shared.buttons.confirm' }}</button>
|
||||
<button class="btn btn-default" ng-click="cancel()" translate>{{ 'app.shared.buttons.cancel' }}</button>
|
||||
</div>
|
||||
|
@ -0,0 +1,32 @@
|
||||
<div class="custom-invoice">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title" translate>{{ 'app.admin.invoices.VAT_history' }}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div>
|
||||
<table class="table scrollable-3-cols">
|
||||
<thead>
|
||||
<tr>
|
||||
<th translate>{{ 'app.admin.invoices.VAT_rate' }}</th>
|
||||
<th translate>{{ 'app.admin.invoices.changed_at' }}</th>
|
||||
<th translate>{{ 'app.admin.invoices.changed_by' }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="value in history | orderBy:'-date'">
|
||||
<td>
|
||||
<span class="no-user-label" ng-show="value.enabled === false" translate>{{'app.admin.invoices.VAT_disabled'}}</span>
|
||||
<span class="no-user-label" ng-show="value.enabled === true" translate>{{'app.admin.invoices.VAT_enabled'}}</span>
|
||||
<span ng-show="value.rate">{{value.rate}}</span>
|
||||
</td>
|
||||
<td>{{value.date | amDateFormat:'L LT'}}</td>
|
||||
<td>{{value.user.name}}<span class="no-user-label" ng-hide="value.user" translate>{{ 'app.admin.invoices.deleted_user' }}</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-default" ng-click="cancel()" translate>{{ 'app.shared.buttons.cancel' }}</button>
|
||||
</div>
|
||||
</div>
|
@ -522,6 +522,15 @@ de:
|
||||
enable_VAT: "MwSt. aktivieren"
|
||||
VAT_rate: "MwSt.-Satz"
|
||||
VAT_history: "MwSt.-Sätze Historie"
|
||||
VAT_notice: "This parameter configures the general case of the VAT rate and applies to everything sold by the Fablab. It is possible to override this parameter by setting a specific VAT rate for each object."
|
||||
edit_multi_VAT_button: "More options"
|
||||
multiVAT: "Advanced VAT"
|
||||
multi_VAT_notice: "<strong>Please note</strong>: The current general rate is {RATE}%. Here you can define different VAT rates for each category.</br></br>For example, you can override this value, only for machine reservations, by filling in the corresponding field below. If no value is filled in, the general rate will apply."
|
||||
VAT_rate_machine: "Machine reservation"
|
||||
VAT_rate_space: "Space reservation"
|
||||
VAT_rate_training: "Training reservation"
|
||||
VAT_rate_event: "Event reservation"
|
||||
VAT_rate_subscription: "Subscription"
|
||||
changed_at: "Geändert am"
|
||||
changed_by: "Von"
|
||||
deleted_user: "Gelöschter Nutzer"
|
||||
|
@ -551,6 +551,15 @@ en:
|
||||
enable_VAT: "Enable VAT"
|
||||
VAT_rate: "VAT rate"
|
||||
VAT_history: "VAT rates history"
|
||||
VAT_notice: "This parameter configures the general case of the VAT rate and applies to everything sold by the Fablab. It is possible to override this parameter by setting a specific VAT rate for each object."
|
||||
edit_multi_VAT_button: "More options"
|
||||
multiVAT: "Advanced VAT"
|
||||
multi_VAT_notice: "<strong>Please note</strong>: The current general rate is {RATE}%. Here you can define different VAT rates for each category.</br></br>For example, you can override this value, only for machine reservations, by filling in the corresponding field below. If no value is filled in, the general rate will apply."
|
||||
VAT_rate_machine: "Machine reservation"
|
||||
VAT_rate_space: "Space reservation"
|
||||
VAT_rate_training: "Training reservation"
|
||||
VAT_rate_event: "Event reservation"
|
||||
VAT_rate_subscription: "Subscription"
|
||||
changed_at: "Changed at"
|
||||
changed_by: "By"
|
||||
deleted_user: "Deleted user"
|
||||
|
@ -522,6 +522,15 @@ es:
|
||||
enable_VAT: "Habilitar IVA"
|
||||
VAT_rate: "Ratio IVA"
|
||||
VAT_history: "Historial de ratios de IVA"
|
||||
VAT_notice: "This parameter configures the general case of the VAT rate and applies to everything sold by the Fablab. It is possible to override this parameter by setting a specific VAT rate for each object."
|
||||
edit_multi_VAT_button: "More options"
|
||||
multiVAT: "Advanced VAT"
|
||||
multi_VAT_notice: "<strong>Please note</strong>: The current general rate is {RATE}%. Here you can define different VAT rates for each category.</br></br>For example, you can override this value, only for machine reservations, by filling in the corresponding field below. If no value is filled in, the general rate will apply."
|
||||
VAT_rate_machine: "Machine reservation"
|
||||
VAT_rate_space: "Space reservation"
|
||||
VAT_rate_training: "Training reservation"
|
||||
VAT_rate_event: "Event reservation"
|
||||
VAT_rate_subscription: "Subscription"
|
||||
changed_at: "Cambiado en"
|
||||
changed_by: "Por"
|
||||
deleted_user: "Usario eliminado"
|
||||
|
@ -522,6 +522,15 @@ fr:
|
||||
enable_VAT: "Activer la TVA"
|
||||
VAT_rate: "Taux de TVA"
|
||||
VAT_history: "Historique des taux de TVA"
|
||||
VAT_notice: "Ce paramètre configure le cas général du taux de TVA et s'applique à tout ce qui est vendu par le Fablab. Il est possible de surcharger ce paramètre en configurant un taux de TVA spécifique par chaque objet."
|
||||
edit_multi_VAT_button: "Plus d'options"
|
||||
multiVAT: "TVA avancée"
|
||||
multi_VAT_notice: "<strong>Attention</strong>: Le taux général actuellement en vigueur est de {RATE}%. Vous pouvez définir ici des taux de TVA différents pour chaque catégorie.</br></br>Par exemple, vous pouvez surcharger cette valeur, uniquement par les réservations de machines, en renseignant le champ correspondant ci-dessous. Si aucune valeur n'est renseignée, le taux général s'appliquera."
|
||||
VAT_rate_machine: "Réservation de machines"
|
||||
VAT_rate_space: "Réservation d'espaces"
|
||||
VAT_rate_training: "Réservation de formations"
|
||||
VAT_rate_event: "Réservation d'événements"
|
||||
VAT_rate_subscription: "Abonnements"
|
||||
changed_at: "Changé le"
|
||||
changed_by: "Par"
|
||||
deleted_user: "Utilisateur supprimé"
|
||||
|
@ -522,6 +522,15 @@
|
||||
enable_VAT: "Aktiver MVA"
|
||||
VAT_rate: "MVA sats"
|
||||
VAT_history: "MVA-sats, historikk"
|
||||
VAT_notice: "This parameter configures the general case of the VAT rate and applies to everything sold by the Fablab. It is possible to override this parameter by setting a specific VAT rate for each object."
|
||||
edit_multi_VAT_button: "More options"
|
||||
multiVAT: "Advanced VAT"
|
||||
multi_VAT_notice: "<strong>Please note</strong>: The current general rate is {RATE}%. Here you can define different VAT rates for each category.</br></br>For example, you can override this value, only for machine reservations, by filling in the corresponding field below. If no value is filled in, the general rate will apply."
|
||||
VAT_rate_machine: "Machine reservation"
|
||||
VAT_rate_space: "Space reservation"
|
||||
VAT_rate_training: "Training reservation"
|
||||
VAT_rate_event: "Event reservation"
|
||||
VAT_rate_subscription: "Subscription"
|
||||
changed_at: "Endret"
|
||||
changed_by: "Av"
|
||||
deleted_user: "Slettet bruker"
|
||||
|
@ -522,6 +522,15 @@ pt:
|
||||
enable_VAT: "Ativar VAT"
|
||||
VAT_rate: "VAT taxa"
|
||||
VAT_history: "Histórico de taxas"
|
||||
VAT_notice: "This parameter configures the general case of the VAT rate and applies to everything sold by the Fablab. It is possible to override this parameter by setting a specific VAT rate for each object."
|
||||
edit_multi_VAT_button: "More options"
|
||||
multiVAT: "Advanced VAT"
|
||||
multi_VAT_notice: "<strong>Please note</strong>: The current general rate is {RATE}%. Here you can define different VAT rates for each category.</br></br>For example, you can override this value, only for machine reservations, by filling in the corresponding field below. If no value is filled in, the general rate will apply."
|
||||
VAT_rate_machine: "Machine reservation"
|
||||
VAT_rate_space: "Space reservation"
|
||||
VAT_rate_training: "Training reservation"
|
||||
VAT_rate_event: "Event reservation"
|
||||
VAT_rate_subscription: "Subscription"
|
||||
changed_at: "Alterado em"
|
||||
changed_by: "Por"
|
||||
deleted_user: "Usuário deletado"
|
||||
|
@ -522,6 +522,15 @@ zu:
|
||||
enable_VAT: "crwdns7469:0crwdne7469:0"
|
||||
VAT_rate: "crwdns7471:0crwdne7471:0"
|
||||
VAT_history: "crwdns7473:0crwdne7473:0"
|
||||
VAT_notice: "This parameter configures the general case of the VAT rate and applies to everything sold by the Fablab. It is possible to override this parameter by setting a specific VAT rate for each object."
|
||||
edit_multi_VAT_button: "More options"
|
||||
multiVAT: "Advanced VAT"
|
||||
multi_VAT_notice: "<strong>Please note</strong>: The current general rate is {RATE}%. Here you can define different VAT rates for each category.</br></br>For example, you can override this value, only for machine reservations, by filling in the corresponding field below. If no value is filled in, the general rate will apply."
|
||||
VAT_rate_machine: "Machine reservation"
|
||||
VAT_rate_space: "Space reservation"
|
||||
VAT_rate_training: "Training reservation"
|
||||
VAT_rate_event: "Event reservation"
|
||||
VAT_rate_subscription: "Subscription"
|
||||
changed_at: "crwdns7475:0crwdne7475:0"
|
||||
changed_by: "crwdns7477:0crwdne7477:0"
|
||||
deleted_user: "crwdns7479:0crwdne7479:0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user