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

admin can configure renew threshold

This commit is contained in:
Sylvain 2021-06-29 09:07:11 +02:00
parent 1aad4891c1
commit f56b8eae75
7 changed files with 24 additions and 4 deletions

View File

@ -10,6 +10,7 @@ Application.Directives.directive('numberSetting', ['Setting', 'growl', '_t',
faIcon: '@',
helperText: '@',
min: '@',
step: '@',
required: '<'
},
templateUrl: '/admin/settings/number.html',
@ -17,7 +18,7 @@ Application.Directives.directive('numberSetting', ['Setting', 'growl', '_t',
// The setting
$scope.setting = {
name: $scope.name,
value: parseInt($scope.settings[$scope.name], 10)
value: parseFloat($scope.settings[$scope.name])
};
/**

View File

@ -1078,7 +1078,8 @@ angular.module('application.router', ['ui.router'])
"'fablab_name', 'name_genre', 'reminder_enable', 'plans_module', 'confirmation_required', " +
"'reminder_delay', 'visibility_yearly', 'visibility_others', 'wallet_module', 'trainings_module', " +
"'display_name_enable', 'machines_sort_by', 'fab_analytics', 'statistics_module', 'address_required', " +
"'link_name', 'home_content', 'home_css', 'phone_required', 'upcoming_events_shown', 'public_agenda_module']"
"'link_name', 'home_content', 'home_css', 'phone_required', 'upcoming_events_shown', 'public_agenda_module'," +
"'renew_pack_threshold']"
}).$promise;
}],
privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }],

View File

@ -5,7 +5,7 @@
<div class="input-group-addon">
<i class="fa {{faIcon}}"></i>
</div>
<input type="number" class="form-control" id="setting-{{setting.name}}" ng-model="setting.value" min="{{min}}" ng-required="true">
<input type="number" class="form-control" id="setting-{{setting.name}}" ng-model="setting.value" min="{{min}}" step="{{step}}" ng-required="true">
</div>
<span class="help-block text-info text-xs" ng-show="helperText">
<i class="fa fa-lightbulb-o"></i> {{ helperText | translate }}

View File

@ -157,5 +157,17 @@
label="app.admin.settings.show_event"
classes="m-l"></boolean-setting>
</div>
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.display_invite_to_renew_pack' }}</h3>
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.packs_threshold_info_html' | translate"></p>
<number-setting name="renew_pack_threshold"
settings="allSettings"
label="app.admin.settings.renew_pack_threshold"
classes="col-md-4"
fa-icon="fa-sliders-h"
min="0"
step="0.01">
</number-setting>
</div>
</div>
</div>

View File

@ -23,7 +23,7 @@ class PrepaidPackService
.includes(:prepaid_pack)
.references(:prepaid_packs)
.where('statistic_profile_id = ?', user.statistic_profile.id)
.where('expires_at < ?', DateTime.current)
.where('expires_at > ?', DateTime.current)
.where('prepaid_packs.priceable_id = ?', priceable.id)
.where('prepaid_packs.priceable_type = ?', priceable.class.name)

View File

@ -1205,6 +1205,9 @@ en:
public_agenda_module: "public agenda module"
statistics_module: "statistics module"
upcoming_events_shown: "display limit for upcoming events"
display_invite_to_renew_pack: "Display the invite to renew prepaid-packs"
packs_threshold_info_html: "You can define under how many hours the user will be invited to buy a prepaid-pack, if his stock of prepaid hours in under this threshold.<br/>You can set a <strong>number of hours</strong> (<em>eg. 5</em>) or a <strong>percentage</strong> of his current pack pack (<em>eg. 0.05 means 5%</em>)."
renew_pack_threshold: "threshold for packs renewal"
general:
general: "General"
title: "Title"

View File

@ -1170,6 +1170,9 @@ fr:
public_agenda_module: "module d'agenda public"
statistics_module: "module de statistiques"
upcoming_events_shown: "la limite d'affichage des événements à venir"
display_invite_to_renew_pack: "Display the invite to renew prepaid-packs"
packs_threshold_info_html: "You can define under how many hours the user will be invited to buy a prepaid-pack, if his stock of prepaid hours in under this threshold.<br/>You can set a <strong>number of hours</strong> (<em>eg. 5</em>) or a <strong>percentage</strong> of his current pack pack (<em>eg. 0.05 means 5%</em>)."
renew_pack_threshold: "Threshold for packs renewal"
general:
general: "Général"
title: "Titre"