1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-30 19:52:20 +01:00

retrieve book_overlapping_slots directly from the api

This commit is contained in:
Sylvain 2020-05-25 15:28:06 +02:00
parent 54d9b348e0
commit ed287884de
3 changed files with 6 additions and 5 deletions

View File

@ -859,6 +859,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
controller: 'ReserveSlotSameTimeController', controller: 'ReserveSlotSameTimeController',
resolve: { resolve: {
sameTimeReservations: function() { return sameTimeReservations; }, sameTimeReservations: function() { return sameTimeReservations; },
bookOverlappingSlotsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'book_overlapping_slots' }).$promise; }]
} }
}); });
modalInstance.result.then(callback); modalInstance.result.then(callback);

View File

@ -361,7 +361,8 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
size: 'md', size: 'md',
controller: 'ReserveSlotSameTimeController', controller: 'ReserveSlotSameTimeController',
resolve: { resolve: {
sameTimeReservations: function() { return sameTimeReservations; } sameTimeReservations: function() { return sameTimeReservations; },
bookOverlappingSlotsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'book_overlapping_slots' }).$promise; }]
} }
}); });
modalInstance.result.then(function(res) { modalInstance.result.then(function(res) {
@ -783,10 +784,10 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
/** /**
* Controller of the modal showing the reservations the same date at the same time * Controller of the modal showing the reservations the same date at the same time
*/ */
Application.Controllers.controller('ReserveSlotSameTimeController', ['$scope', '$uibModalInstance', 'AuthService', 'sameTimeReservations', Application.Controllers.controller('ReserveSlotSameTimeController', ['$scope', '$uibModalInstance', 'AuthService', 'sameTimeReservations', 'bookOverlappingSlotsPromise',
function ($scope, $uibModalInstance, AuthService, sameTimeReservations) { function ($scope, $uibModalInstance, AuthService, sameTimeReservations, bookOverlappingSlotsPromise) {
$scope.sameTimeReservations = sameTimeReservations; $scope.sameTimeReservations = sameTimeReservations;
$scope.bookSlotAtSameTime = Fablab.bookSlotAtSameTime; $scope.bookSlotAtSameTime = (bookOverlappingSlotsPromise.setting.value === 'true');
$scope.isAuthorized = AuthService.isAuthorized; $scope.isAuthorized = AuthService.isAuthorized;
/** /**
* Confirmation callback * Confirmation callback

View File

@ -29,7 +29,6 @@
Fablab.withoutInvoices = ('<%= Rails.application.secrets.fablab_without_invoices %>' === 'true'); Fablab.withoutInvoices = ('<%= Rails.application.secrets.fablab_without_invoices %>' === 'true');
Fablab.phoneRequired = ('<%= Setting.get('phone_required') %>' === 'true'); Fablab.phoneRequired = ('<%= Setting.get('phone_required') %>' === 'true');
Fablab.fablabWithoutWallet = ('<%= Rails.application.secrets.fablab_without_wallet %>' === 'true'); Fablab.fablabWithoutWallet = ('<%= Rails.application.secrets.fablab_without_wallet %>' === 'true');
Fablab.bookSlotAtSameTime = ('<%= Setting.get('book_overlapping_slots') %>' === 'true');
Fablab.eventsInCalendar = ('<%= Rails.application.secrets.events_in_calendar %>' === 'true'); Fablab.eventsInCalendar = ('<%= Rails.application.secrets.events_in_calendar %>' === 'true');
Fablab.featureTourDisplay = "<%= Rails.application.secrets.feature_tour_display %>"; Fablab.featureTourDisplay = "<%= Rails.application.secrets.feature_tour_display %>";
Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>"; Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>";