1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(bug) unable to reserve event

This commit is contained in:
Sylvain 2022-07-20 15:54:04 +02:00
parent 2bd84e623a
commit 29b9399ca3
4 changed files with 16 additions and 6 deletions

View File

@ -662,7 +662,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
reservation.slots_reservations_attributes.push({
offered: event.offered || false,
slot_id: event.slot_id
slot_id: event.availability.slot_id
});
for (let evt_px_cat of Array.from(event.prices)) {
@ -758,9 +758,12 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
cartItems () {
return mkCartItems(reservation, $scope.coupon.applied);
},
event () {
return $scope.event;
}
},
controller: ['$scope', '$uibModalInstance', '$state', 'reservation', 'price', 'Auth', 'LocalPayment', 'wallet', 'helpers', '$filter', 'coupon', 'cartItems',
function ($scope, $uibModalInstance, $state, reservation, price, Auth, LocalPayment, wallet, helpers, $filter, coupon, cartItems) {
controller: ['$scope', '$uibModalInstance', '$state', 'reservation', 'price', 'Auth', 'LocalPayment', 'wallet', 'helpers', '$filter', 'coupon', 'cartItems', 'event',
function ($scope, $uibModalInstance, $state, reservation, price, Auth, LocalPayment, wallet, helpers, $filter, coupon, cartItems, event) {
// User's wallet amount
$scope.wallet = wallet;
@ -776,6 +779,9 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
// Reservation
$scope.reservation = reservation;
// the event
$scope.bookedEvent = event;
// Used in wallet info template to interpolate some translations
$scope.numberFilter = $filter('number');

View File

@ -7,10 +7,11 @@
<uib-alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</uib-alert>
<div class="row">
<div ng-class="{'col-md-6': schedule, 'm-h-sm': !schedule}">
<div ng-if="reservation">
<!-- this modal dialog is only still used in events reservation, so the following workaround can do the trick -->
<div ng-if="reservation && bookedEvent">
<p translate>{{ 'app.shared.valid_reservation_modal.here_is_the_summary_of_the_slots_to_book_for_the_current_user' }}</p>
<ul ng-repeat="sr in reservation.slots_reservations_attributes">
<li><strong>{{sr.slot_attributes.start_at | amDateFormat: 'LL'}} : {{sr.slot_attributes.start_at | amDateFormat:'LT'}} - {{sr.slot_attributes.end_at | amDateFormat:'LT'}}</strong></li>
<ul ng-repeat="sr in reservation.reservation.slots_reservations_attributes">
<li><strong>{{bookedEvent.availability.start_at | amDateFormat: 'LL'}} : {{bookedEvent.availability.start_at | amDateFormat:'LT'}} - {{bookedEvent.availability.end_at | amDateFormat:'LT'}}</strong></li>
</ul>
</div>
<div ng-if="subscription">

View File

@ -109,6 +109,7 @@ class Event < ApplicationRecord
nil
end
r = Recurrence.new(every: recurrence, on: on, starts: availability.start_at + 1.day, until: recurrence_end_at)
service = Availabilities::CreateAvailabilitiesService.new
r.events.each do |date|
days_diff = availability.end_at.day - availability.start_at.day
start_at = DateTime.new(
@ -157,6 +158,7 @@ class Event < ApplicationRecord
recurrence_id: id
)
event.save
service.create_slots(event.availability)
end
update_columns(recurrence_id: id)
end

View File

@ -37,6 +37,7 @@ json.availability do
json.id event.availability.id
json.start_at event.availability.start_at
json.end_at event.availability.end_at
json.slot_id event.availability.slots.first&.id
end
json.availability_id event.availability_id
json.amount (event.amount / 100.0) if event.amount