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

configuration of book concurrent slots through the settings interface

This commit is contained in:
Sylvain 2020-05-19 17:08:11 +02:00
parent 419605e551
commit ddce7f516a
12 changed files with 32 additions and 15 deletions

View File

@ -140,6 +140,11 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
value: (settingsPromise.phone_required === 'true')
};
$scope.bookOverlappingSlots = {
name: 'book_overlapping_slots',
value: (settingsPromise.book_overlapping_slots === 'true')
}
// By default, we display the currently published privacy policy
$scope.privacyPolicy = {
version: null,

View File

@ -106,6 +106,21 @@
<button name="button" class="btn btn-warning" ng-click="save(cancelDelay)" ng-disabled="cancelDelayForm.$invalid" translate>{{ 'app.shared.buttons.save' }}</button>
</form>
</div>
<div class="row">
<h3 class="m-l m-t-lg" translate>{{ 'app.admin.settings.book_overlapping_slots_info' }}</h3>
<div class="form-group m-l">
<label for="bookOverlappingSlots" class="control-label m-r" translate>{{ 'app.admin.settings.allow_booking' }}</label>
<input bs-switch
ng-model="bookOverlappingSlots.value"
id="bookOverlappingSlots"
type="checkbox"
class="form-control"
switch-on-text="{{ 'app.admin.settings.enabled' | translate }}"
switch-off-text="{{ 'app.admin.settings.disabled' | translate }}"
switch-animate="true"/>
<button name="button" class="btn btn-warning m-l" ng-click="save(bookOverlappingSlots)" translate>{{ 'app.shared.buttons.save' }}</button>
</div>
</div>
</div>
</div>
</div>

View File

@ -77,7 +77,8 @@ class Setting < ApplicationRecord
origin
uuid
phone_required
tracking_id] }
tracking_id
book_overlapping_slots] }
def value
last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first
last_value&.value

View File

@ -29,7 +29,7 @@
Fablab.withoutInvoices = ('<%= Rails.application.secrets.fablab_without_invoices %>' === 'true');
Fablab.phoneRequired = ('<%= Setting.get('phone_required') %>' === 'true');
Fablab.fablabWithoutWallet = ('<%= Rails.application.secrets.fablab_without_wallet %>' === 'true');
Fablab.bookSlotAtSameTime = ('<%= Rails.application.secrets.book_slot_at_same_time %>' === 'true');
Fablab.bookSlotAtSameTime = ('<%= Setting.get('book_overlapping_slots') %>' === 'true');
Fablab.eventsInCalendar = ('<%= Rails.application.secrets.events_in_calendar %>' === 'true');
Fablab.slotDuration = parseInt("<%= ApplicationHelper::SLOT_DURATION %>", 10);
Fablab.featureTourDisplay = "<%= Rails.application.secrets.feature_tour_display %>";

View File

@ -1021,6 +1021,7 @@ en:
fab_analytics: "Fab Analytics"
phone_required: "phone required"
tracking_id: "tracking ID"
book_overlapping_slots: "book overlapping slots"
elements_ordering: "Elements ordering"
machines_order: "Machines order"
display_machines_sorted_by: "Display machines sorted by"
@ -1028,6 +1029,8 @@ en:
customize_home_page_css: "Customise the stylesheet og the home page"
home_css_notice_html: "You can customize the stylesheet which will apply to the home page, using the <a href=\"https://sass-lang.com/documentation\" target=\"_blank\">SASS</a> syntax. These styles will be automatically subordinated to the <code>.home-page</code> selector to prevent any risk of breaking the application. Meanwhile please be careful, any changes in the home page editor at the top of the page may broke your styles, always refer to the HTML code."
an_error_occurred_saving_the_setting: "An error occurred while saving the setting. Please try again later."
book_overlapping_slots_info: "Allow / prevent the reservation of overlapping slots"
allow_booking: "Allow booking"
sort_by:
default: "Default"
name: "Name"

View File

@ -1021,6 +1021,7 @@ fr:
fab_analytics: "Fab Analytics"
phone_required: "téléphone requis"
tracking_id: "ID de suivi"
book_overlapping_slots: "réservation de créneaux simultanés"
elements_ordering: "Ordre d'affichage des éléments"
machines_order: "Ordre des machines"
display_machines_sorted_by: "Afficher les machines triées par"
@ -1028,6 +1029,8 @@ fr:
customize_home_page_css: "Personnaliser la feuille de style de la page d'accueil"
home_css_notice_html: "Vous pouvez personnaliser la feuille de style qui s'appliquera à la page d'accueil en utilisant la syntaxe <a href=\"https://sass-lang.com/documentation\" target=\"_blank\">SASS</a>. Ces styles seront automatiquement subordonnées au sélecteur <code>.home-page</code> pour prévenir tout risque de casse de l'application. Attention toutefois, les modifications de la page d'accueil dans l'éditeur en haut de page peuvent rendre caduque vos styles, référez vous toujours au code HTML."
an_error_occurred_saving_the_setting: "Une erreur est survenue pendant l'enregistrement du paramètre. Veuillez réessayer plus tard."
book_overlapping_slots_info: "Autoriser / empêcher la réservation de créneaux qui se chevauchent"
allow_booking: "Autoriser la réservation"
sort_by:
default: "Défaut"
name: "Nom"

View File

@ -21,7 +21,6 @@ development:
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
book_slot_at_same_time: <%= ENV["BOOK_SLOT_AT_SAME_TIME"] %>
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
events_in_calendar: <%= ENV["EVENTS_IN_CALENDAR"] %>
slot_duration: <%= ENV["SLOT_DURATION"] %>
@ -68,7 +67,6 @@ test:
fablab_without_online_payments: false
fablab_without_invoices: false
fablab_without_wallet: false
book_slot_at_same_time: true
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
events_in_calendar: false
slot_duration: 60
@ -115,7 +113,6 @@ staging:
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
book_slot_at_same_time: <%= ENV["BOOK_SLOT_AT_SAME_TIME"] %>
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
events_in_calendar: <%= ENV["EVENTS_IN_CALENDAR"] %>
slot_duration: <%= ENV["SLOT_DURATION"] %>
@ -173,7 +170,6 @@ production:
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
book_slot_at_same_time: <%= ENV["BOOK_SLOT_AT_SAME_TIME"] %>
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
events_in_calendar: <%= ENV["EVENTS_IN_CALENDAR"] %>
slot_duration: <%= ENV["SLOT_DURATION"] %>

View File

@ -112,11 +112,6 @@ This is useful if you have your own invoicing system and you want to prevent Fab
If set to 'true', the wallet will be disabled.
This is useful if you won't use wallet system.
<a name="BOOK_SLOT_AT_SAME_TIME"></a>
BOOK_SLOT_AT_SAME_TIME
If set to 'true', users will be able to book a machine/formation/event slot, even if they already have a reservation the same day at the same time.
<a name="USER_CONFIRMATION_NEEDED_TO_SIGN_IN"></a>
USER_CONFIRMATION_NEEDED_TO_SIGN_IN

View File

@ -22,7 +22,6 @@ FABLAB_WITHOUT_ONLINE_PAYMENT=false
FABLAB_WITHOUT_INVOICES=false
PHONE_REQUIRED=true
FABLAB_WITHOUT_WALLET=false
BOOK_SLOT_AT_SAME_TIME=true
USER_CONFIRMATION_NEEDED_TO_SIGN_IN=false

View File

@ -105,7 +105,8 @@ namespace :fablab do
task env_to_db: :environment do
mapping = [
%w[PHONE_REQUIRED phone_required true],
%w[GA_ID tracking_id]
%w[GA_ID tracking_id],
%w[BOOK_SLOT_AT_SAME_TIME book_overlapping_slots true]
]
mapping.each do |m|

View File

@ -15,7 +15,6 @@ FABLAB_WITHOUT_ONLINE_PAYMENT=false
FABLAB_WITHOUT_INVOICES=false
PHONE_REQUIRED=false
FABLAB_WITHOUT_WALLET=false
BOOK_SLOT_AT_SAME_TIME=true
EVENTS_IN_CALENDAR=true
SLOT_DURATION=60

View File

@ -235,7 +235,7 @@ configure_env_file()
local doc variables secret
doc=$(\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/doc/environment.md)
variables=(STRIPE_API_KEY STRIPE_PUBLISHABLE_KEY STRIPE_CURRENCY INVOICE_PREFIX FABLAB_WITHOUT_PLANS FABLAB_WITHOUT_SPACES FABLAB_WITHOUT_ONLINE_PAYMENT FABLAB_WITHOUT_INVOICES FABLAB_WITHOUT_WALLET \
PHONE_REQUIRED BOOK_SLOT_AT_SAME_TIME USER_CONFIRMATION_NEEDED_TO_SIGN_IN EVENTS_IN_CALENDAR SLOT_DURATION DEFAULT_MAIL_FROM DELIVERY_METHOD DEFAULT_HOST DEFAULT_PROTOCOL SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
USER_CONFIRMATION_NEEDED_TO_SIGN_IN EVENTS_IN_CALENDAR SLOT_DURATION DEFAULT_MAIL_FROM DELIVERY_METHOD DEFAULT_HOST DEFAULT_PROTOCOL SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME TWITTER_NAME \
FACEBOOK_APP_ID LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT FEATURE_TOUR_DISPLAY \
SUPERADMIN_EMAIL APP_LOCALE RAILS_LOCALE MOMENT_LOCALE SUMMERNOTE_LOCALE ANGULAR_LOCALE FULLCALENDAR_LOCALE ELASTICSEARCH_LANGUAGE_ANALYZER TIME_ZONE \