-
Notifications
You must be signed in to change notification settings - Fork 35
[MNOE-616] Impac- Selection of currencies #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.0
Are you sure you want to change the base?
Changes from all commits
589c16d
268837f
ad01eb0
f5b6218
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| angular.module 'mnoEnterpriseAngular' | ||
| .component('dashboardCurrencySelection', { | ||
| templateUrl: 'app/components/dashboard-currency-select/dashboard-currency-select.html', | ||
| controllerAs: "currencySelectCtrl" | ||
| controller: (MnoeCurrentUser, DASHBOARD_CONFIG) -> | ||
| vm = this | ||
| isSelected = (currency) -> | ||
| currency.selected | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be on one line |
||
| # List of availables currencies | ||
| vm.currencies = DASHBOARD_CONFIG.impac.currencies.replace(/ /g,'').split(",").map( (c) -> { id: c, selected: true }) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove empty space before |
||
| # Initialization of the selected currencies: match the user settings if possible, else all are selected (see init above) | ||
| if MnoeCurrentUser.user.settings?.currencies? | ||
| # Is there at least one currency in common with the user' settings? | ||
| if vm.currencies.some((c,i,a) -> MnoeCurrentUser.user.settings.currencies.includes(c.id) ) | ||
| # select the intersection of available currencies from the tenant and the settings | ||
| vm.currencies.map( (c) -> c.selected = MnoeCurrentUser.user.settings.currencies.includes(c.id)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove empty space before |
||
|
|
||
| # Initialization of the default currency | ||
| if MnoeCurrentUser.user.settings?.default_dashboard_currency? | ||
| # Case the user has set his default, verify it is available | ||
| vm.defaultCurrency = vm.currencies.find( (c) -> c.id == MnoeCurrentUser.user.settings.default_dashboard_currency && c.selected) || vm.currencies.find( (c) -> c.selected ) | ||
| else | ||
| # Otherwise return the first selected currency | ||
| vm.defaultCurrency = vm.currencies.find( (c) -> c.selected ) | ||
|
|
||
| vm.changeCurrencyList = () -> | ||
| MnoeCurrentUser.update( | ||
| settings: Object.assign(MnoeCurrentUser.user.settings, | ||
| currencies: vm.currencies.filter(isSelected).map((c) -> c.id), | ||
| default_dashboard_currency: vm.defaultCurrency.id)) | ||
| return | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <div class="form-group"> | ||
| <label>{{ 'mno_enterprise.templates.components.currency_select.checkbox' | translate }}</label> | ||
| <div ng-repeat="currency in currencySelectCtrl.currencies"> | ||
| <label> | ||
| <input type="checkbox" ng-model="currency.selected" style=""> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove empty |
||
| {{currency.id}} | ||
| </label> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="form-group"> | ||
| <label class="control-label" for="currency-select"> | ||
| {{ 'mno_enterprise.templates.components.currency_select.selectbox' | translate }} | ||
| </label> | ||
| <select id="currency-select" class="form-control" ng-model="currencySelectCtrl.defaultCurrency" ng-change="currencySelectCtrl.changeCurrency()" ng-options="currency.id for currency in currencySelectCtrl.currencies | filter:{selected:true}"> | ||
| </select> | ||
| </div> | ||
|
|
||
| <button class="btn btn-warning" type="button" ng-disabled="(currencySelectCtrl.defaultCurrency == null)" ng-click="currencySelectCtrl.changeCurrencyList()">Save</button> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ angular.module 'mnoEnterpriseAngular' | |
| bodyText: 'mno_enterprise.templates.components.language_selectbox.confirm' | ||
| headerTextExtraData: { name: locale.name } | ||
| bodyTextExtraData: { name: locale.name } | ||
| actionCb: -> MnoeCurrentUser.update(settings: {locale: $scope.selectedLangKey}) | ||
| actionCb: -> MnoeCurrentUser.update(settings: Object.assign(MnoeCurrentUser.user.settings, locale: $scope.selectedLangKey)) # WIll destroy the whole previous settings. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need to do this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous call would reset the whole settings |
||
|
|
||
| MnoConfirm.showModal(modalOptions).then( | ||
| -> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -809,7 +809,8 @@ | |
| "mno_enterprise.templates.dashboard.account.passwd_form_confirm": "Confirm Password", | ||
| "mno_enterprise.templates.dashboard.account.passwd_form_save": "Save", | ||
| "mno_enterprise.templates.dashboard.account.passwd_form_cancel": "Cancel", | ||
| "mno_enterprise.templates.dashboard.account.settings": "Settings", | ||
| "mno_enterprise.templates.dashboard.account.locale": "Locale", | ||
| "mno_enterprise.templates.dashboard.account.currencies": "Currencies ", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty space in locale |
||
| "mno_enterprise.templates.dashboard.account.developer": "Developer", | ||
| "mno_enterprise.templates.dashboard.account.are_you_developer": "Are you a Developer looking to contribute to the Maestrano platform?", | ||
| "mno_enterprise.templates.dashboard.account.api_key": "API Key", | ||
|
|
@@ -931,6 +932,8 @@ | |
| "mno_enterprise.templates.components.language_selectbox.change_language": "Change language", | ||
| "mno_enterprise.templates.components.language_selectbox.confirm_header": "Change language to {name}?", | ||
| "mno_enterprise.templates.components.language_selectbox.confirm": "Are you sure you want to change language to {name}?", | ||
| "mno_enterprise.templates.components.currency_select.checkbox": "Currencies available for dashboards", | ||
| "mno_enterprise.templates.components.currency_select.selectbox": "Default currency for dashboards (applies to newly created ones):", | ||
| "mno_enterprise.pages.app_access_unauthorized.title": "App Access Not Granted", | ||
| "mno_enterprise.pages.app_access_unauthorized.explanation": "It looks like the administrator of this application has not granted you access.", | ||
| "mno_enterprise.pages.app_access_unauthorized.recommendation": "You should ask your administrator to share this application with you.", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this configuration and use
$ctrlin the template