mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-07 01:54:16 +01:00
(bug) unable to reserve event
This commit is contained in:
parent
2bd84e623a
commit
29b9399ca3
@ -662,7 +662,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
|
|||||||
|
|
||||||
reservation.slots_reservations_attributes.push({
|
reservation.slots_reservations_attributes.push({
|
||||||
offered: event.offered || false,
|
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)) {
|
for (let evt_px_cat of Array.from(event.prices)) {
|
||||||
@ -758,9 +758,12 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
|
|||||||
cartItems () {
|
cartItems () {
|
||||||
return mkCartItems(reservation, $scope.coupon.applied);
|
return mkCartItems(reservation, $scope.coupon.applied);
|
||||||
},
|
},
|
||||||
|
event () {
|
||||||
|
return $scope.event;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
controller: ['$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) {
|
function ($scope, $uibModalInstance, $state, reservation, price, Auth, LocalPayment, wallet, helpers, $filter, coupon, cartItems, event) {
|
||||||
// User's wallet amount
|
// User's wallet amount
|
||||||
$scope.wallet = wallet;
|
$scope.wallet = wallet;
|
||||||
|
|
||||||
@ -776,6 +779,9 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
|
|||||||
// Reservation
|
// Reservation
|
||||||
$scope.reservation = reservation;
|
$scope.reservation = reservation;
|
||||||
|
|
||||||
|
// the event
|
||||||
|
$scope.bookedEvent = event;
|
||||||
|
|
||||||
// Used in wallet info template to interpolate some translations
|
// Used in wallet info template to interpolate some translations
|
||||||
$scope.numberFilter = $filter('number');
|
$scope.numberFilter = $filter('number');
|
||||||
|
|
||||||
|
@ -7,10 +7,11 @@
|
|||||||
<uib-alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</uib-alert>
|
<uib-alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</uib-alert>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div ng-class="{'col-md-6': schedule, 'm-h-sm': !schedule}">
|
<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>
|
<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">
|
<ul ng-repeat="sr in reservation.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>
|
<li><strong>{{bookedEvent.availability.start_at | amDateFormat: 'LL'}} : {{bookedEvent.availability.start_at | amDateFormat:'LT'}} - {{bookedEvent.availability.end_at | amDateFormat:'LT'}}</strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="subscription">
|
<div ng-if="subscription">
|
||||||
|
@ -109,6 +109,7 @@ class Event < ApplicationRecord
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
r = Recurrence.new(every: recurrence, on: on, starts: availability.start_at + 1.day, until: recurrence_end_at)
|
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|
|
r.events.each do |date|
|
||||||
days_diff = availability.end_at.day - availability.start_at.day
|
days_diff = availability.end_at.day - availability.start_at.day
|
||||||
start_at = DateTime.new(
|
start_at = DateTime.new(
|
||||||
@ -157,6 +158,7 @@ class Event < ApplicationRecord
|
|||||||
recurrence_id: id
|
recurrence_id: id
|
||||||
)
|
)
|
||||||
event.save
|
event.save
|
||||||
|
service.create_slots(event.availability)
|
||||||
end
|
end
|
||||||
update_columns(recurrence_id: id)
|
update_columns(recurrence_id: id)
|
||||||
end
|
end
|
||||||
|
@ -37,6 +37,7 @@ json.availability do
|
|||||||
json.id event.availability.id
|
json.id event.availability.id
|
||||||
json.start_at event.availability.start_at
|
json.start_at event.availability.start_at
|
||||||
json.end_at event.availability.end_at
|
json.end_at event.availability.end_at
|
||||||
|
json.slot_id event.availability.slots.first&.id
|
||||||
end
|
end
|
||||||
json.availability_id event.availability_id
|
json.availability_id event.availability_id
|
||||||
json.amount (event.amount / 100.0) if event.amount
|
json.amount (event.amount / 100.0) if event.amount
|
||||||
|
Loading…
x
Reference in New Issue
Block a user