Skip to content

Commit

Permalink
feat(exchange): add the current exchange rate
Browse files Browse the repository at this point in the history
This commit adds the current exchange rate to the exchange rate modal
for reference.  This feature was requested by our clients at HEV.

Closes #2387.
  • Loading branch information
jniles committed Jan 15, 2018
1 parent 0164d69 commit 468a134
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 30 deletions.
31 changes: 18 additions & 13 deletions client/src/i18n/en/exchange.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{"EXCHANGE":{"ADDING_RATE":"Adding an exchange Rate",
"ADD_EXCHANGE":"Ajouter taux",
"DESCRIPTION":"This section help you to define an exchange rate",
"ENTERPRISE_CURRENCY":"Enterprise Currency",
"EXCHANGE_RATES":"Exchange Rate(s)",
"NEW_RATE":"New Exchange Rate",
"RATE_SET":"Rate last set",
"REVIEW_RATE":"Review the exchange rate",
"TITLE":"Exchange Rate Management",
"REVIEW":"Review Rates ",
"INVOICE_DISCLAIMER":"Exchange rate based on the latest enterprise exchange:",
"SET_AS":"Set as",
"ON":"on"}}
{
"EXCHANGE":{
"ADDING_RATE" : "Adding an exchange Rate",
"CURRENT_RATE" : "Current Exchange Rate",
"ADD_EXCHANGE" : "Ajouter taux",
"DESCRIPTION" : "This section help you to define an exchange rate",
"ENTERPRISE_CURRENCY" : "Enterprise Currency",
"EXCHANGE_RATES" : "Exchange Rate(s)",
"NEW_RATE" : "New Exchange Rate",
"RATE_SET" : "Rate last set",
"REVIEW_RATE" : "Review the exchange rate",
"TITLE" : "Exchange Rate Management",
"REVIEW" : "Review Rates ",
"INVOICE_DISCLAIMER" : "Exchange rate based on the latest enterprise exchange:",
"SET_AS" : "Set as",
"ON" : "on"
}
}
31 changes: 18 additions & 13 deletions client/src/i18n/fr/exchange.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{"EXCHANGE":{"ADDING_RATE":"Ajout d'un taux",
"ADD_EXCHANGE":"Ajouter taux",
"DESCRIPTION":"Cette interface vous permet d'ajouter un taux d'echange",
"ENTERPRISE_CURRENCY":"Monnaie de l'entreprise",
"EXCHANGE_RATES":"Taux de change",
"NEW_RATE":"Nouveau taux",
"RATE_SET":"Taux configuré",
"REVIEW_RATE":"Revoir le taux",
"TITLE":"Gestion taux d'echange",
"REVIEW":"Revoir le taux",
"INVOICE_DISCLAIMER":"Taux de Change basé sur le dernier taux de l'entreprise",
"SET_AS":"Defini comme",
"ON":"sur"}}
{
"EXCHANGE":{
"ADDING_RATE" : "Ajout d'un taux",
"CURRENT_RATE" : "Taux de Change Actuel",
"ADD_EXCHANGE" : "Ajouter taux",
"DESCRIPTION" : "Cette interface vous permet d'ajouter un taux d'echange",
"ENTERPRISE_CURRENCY" : "Monnaie de l'entreprise",
"EXCHANGE_RATES" : "Taux de change",
"NEW_RATE" : "Nouveau taux",
"RATE_SET" : "Taux configuré",
"REVIEW_RATE" : "Revoir le taux",
"TITLE" : "Gestion taux d'echange",
"REVIEW" : "Revoir le taux",
"INVOICE_DISCLAIMER" : "Taux de Change basé sur le dernier taux de l'entreprise",
"SET_AS" : "Defini comme",
"ON" : "sur"
}
}
7 changes: 5 additions & 2 deletions client/src/modules/enterprises/exchange/exchange.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@
max-date="ModalCtrl.timestamp">
</bh-date-editor>

<p>
<span translate>EXCHANGE.CURRENT_RATE</span>: <i>{{ ModalCtrl.currentExchangeRate | currency:ModalCtrl.rate.currency.id }}</i>
</p>

<div class="form-group"
ng-class="{ 'has-error' : ModalForm.$submitted && ModalForm.rate.$invalid }"
>
ng-class="{ 'has-error' : ModalForm.$submitted && ModalForm.rate.$invalid }">
<label class="control-label">{{ "FORM.LABELS.EXCHANGE_RATE" | translate }}</label>
<div class="row">
<div class="col-xs-2">
Expand Down
7 changes: 5 additions & 2 deletions client/src/modules/enterprises/exchange/exchange.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ angular.module('bhima.controllers')
.controller('ExchangeRateModalController', ExchangeRateModalController);

ExchangeRateModalController.$inject = [
'$uibModalInstance', 'ExchangeRateService', 'CurrencyService', 'SessionService', 'NotifyService'
'$uibModalInstance', 'ExchangeRateService', 'CurrencyService',
'SessionService', 'NotifyService',
];

/**
Expand All @@ -25,7 +26,7 @@ function ExchangeRateModalController(ModalInstance, Exchange, Currencies, Sessio
vm.submit = submit;
vm.format = Currencies.format;
vm.symbol = Currencies.symbol;
vm.cancel = function () { ModalInstance.dismiss(); };
vm.cancel = function cancel() { ModalInstance.dismiss(); };

// this turns on and off the currency select input
vm.hasMultipleCurrencies = false;
Expand All @@ -45,6 +46,8 @@ function ExchangeRateModalController(ModalInstance, Exchange, Currencies, Sessio
if (vm.currencies.length > 1) {
vm.hasMultipleCurrencies = true;
}

vm.currentExchangeRate = Exchange.getCurrentRate(vm.rate.currency.id);
})
.catch(Notify.handleError);

Expand Down

0 comments on commit 468a134

Please sign in to comment.