1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

update setting in memory after save

This commit is contained in:
Sylvain 2020-05-20 15:57:03 +02:00
parent af45f5bbcd
commit cb2ad950b5
2 changed files with 9 additions and 6 deletions

View File

@ -27,12 +27,15 @@ Application.Directives.directive('booleanSetting', ['Setting', 'growl', '_t',
* @param setting {{value:*, name:string}} note that the value will be stringified
*/
$scope.save = function (setting) {
const { value } = setting;
const value = setting.value.toString();
Setting.update(
{ name: setting.name },
{ value: value.toString() },
function () { growl.success(_t('app.admin.settings.customization_of_SETTING_successfully_saved', { SETTING: _t(`app.admin.settings.${setting.name}`) })); },
{ value },
function () {
growl.success(_t('app.admin.settings.customization_of_SETTING_successfully_saved', { SETTING: _t(`app.admin.settings.${setting.name}`) }));
$scope.settings[$scope.name] = value;
},
function (error) {
if (error.status === 304) return;

View File

@ -52,7 +52,7 @@
<h3 class="m-l m-t-lg" translate>{{ 'app.admin.settings.ability_for_the_users_to_move_their_reservations' }}</h3>
<boolean-setting name="booking_move_enable" settings="allSettings" label="app.admin.settings.reservations_shifting" classes="m-l"></boolean-setting>
</div>
<div class="row" ng-show="enableMove.value">
<div class="row" ng-show="allSettings.booking_move_enable === 'true'">
<form class="col-md-4" name="moveDelayForm">
<label for="moveDelay" class="control-label m-r" translate>{{ 'app.admin.settings.prior_period_hours' }}</label>
<div class="form-group">
@ -70,7 +70,7 @@
<h3 class="m-l m-t-lg" translate>{{ 'app.admin.settings.ability_for_the_users_to_cancel_their_reservations' }}</h3>
<boolean-setting name="booking_cancel_enable" settings="allSettings" label="app.admin.settings.reservations_cancelling" classes="m-l"></boolean-setting>
</div>
<div class="row" ng-show="enableCancel.value">
<div class="row" ng-show="allSettings.booking_cancel_enable === 'true'">
<form class="col-md-4" name="cancelDelayForm">
<label for="cancelDelay" class="control-label m-r" translate>{{ 'app.admin.settings.prior_period_hours' }}</label>
<div class="form-group">
@ -101,7 +101,7 @@
<h3 class="m-l" translate>{{ 'app.admin.settings.notification_sending_before_the_reservation_occurs' }}</h3>
<boolean-setting name="reminder_enable" settings="allSettings" label="app.admin.settings.reservations_reminders" classes="m-l"></boolean-setting>
</div>
<div class="row" ng-show="enableReminder.value">
<div class="row" ng-show="allSettings.reminder_enable === 'true'">
<form class="col-md-4" name="reminderDelayForm">
<label for="reminderDelay" class="control-label m-r" translate>{{ 'app.admin.settings.prior_period_hours' }}</label>
<div class="form-group">