mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-23 12:52:20 +01:00
(feat) pre-book a event
This commit is contained in:
parent
e28286d3cc
commit
f9c25d521e
@ -298,10 +298,15 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.isShowReserveEventButton = () => {
|
$scope.isShowReserveEventButton = () => {
|
||||||
return $scope.event.nb_free_places > 0 &&
|
const bookable = $scope.event.nb_free_places > 0 &&
|
||||||
!$scope.reserve.toReserve &&
|
!$scope.reserve.toReserve &&
|
||||||
$scope.now.isBefore($scope.eventEndDateTime) &&
|
$scope.now.isBefore($scope.eventEndDateTime) &&
|
||||||
helpers.isUserValidatedByType($scope.ctrl.member, $scope.settings, 'event');
|
helpers.isUserValidatedByType($scope.ctrl.member, $scope.settings, 'event');
|
||||||
|
if ($scope.event.pre_registration) {
|
||||||
|
return bookable && $scope.event.pre_registration_end_date && $scope.now.isSameOrBefore($scope.event.pre_registration_end_date, 'day');
|
||||||
|
} else {
|
||||||
|
return bookable;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,6 +89,8 @@
|
|||||||
<dt><i class="fas fa-clock"></i> {{ 'app.public.events_show.opening_hours' | translate }}</dt>
|
<dt><i class="fas fa-clock"></i> {{ 'app.public.events_show.opening_hours' | translate }}</dt>
|
||||||
<dd ng-if="event.all_day"><span translate>{{ 'app.public.events_show.all_day' }}</span></dd>
|
<dd ng-if="event.all_day"><span translate>{{ 'app.public.events_show.all_day' }}</span></dd>
|
||||||
<dd ng-if="!event.all_day">{{ 'app.public.events_show.from_time' | translate }} <span class="text-u-l">{{event.start_time}}</span> {{ 'app.public.events_show.to_time' | translate }} <span class="text-u-l">{{event.end_time}}</span></dd>
|
<dd ng-if="!event.all_day">{{ 'app.public.events_show.from_time' | translate }} <span class="text-u-l">{{event.start_time}}</span> {{ 'app.public.events_show.to_time' | translate }} <span class="text-u-l">{{event.end_time}}</span></dd>
|
||||||
|
<dt ng-if="event.pre_registration_end_date"><i class="fa fa-calendar" aria-hidden="true"></i> {{ 'app.public.events_show.pre_registration_end_date' | translate }}</dt>
|
||||||
|
<dd ng-if="event.pre_registration_end_date">{{ 'app.public.events_show.ending' | translate }} <span class="text-u-l">{{event.pre_registration_end_date | amDateFormat:'L'}}</span></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<div class="text-sm" ng-if="event.amount">
|
<div class="text-sm" ng-if="event.amount">
|
||||||
@ -220,7 +222,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="m-t-sm" ng-if="reservations && !reserve.toReserve" ng-repeat="reservation in reservations">
|
<div class="m-t-sm" ng-if="reservations && !reserve.toReserve" ng-repeat="reservation in reservations">
|
||||||
<div ng-hide="isCancelled(reservation)" class="well well-warning">
|
<div ng-hide="isCancelled(reservation)" class="well well-warning">
|
||||||
<div class="font-sbold text-u-c text-sm">{{ 'app.public.events_show.you_booked_DATE' | translate:{DATE:(reservation.created_at | amDateFormat:'L LT')} }}</div>
|
<div class="font-sbold text-u-c text-sm" ng-if="!event.pre_registration">{{ 'app.public.events_show.you_booked_DATE' | translate:{DATE:(reservation.created_at | amDateFormat:'L LT')} }}</div>
|
||||||
|
<div class="font-sbold text-u-c text-sm" ng-if="event.pre_registration">{{ 'app.public.events_show.you_pre_booked_DATE' | translate:{DATE:(reservation.created_at | amDateFormat:'L LT')} }}</div>
|
||||||
<div class="font-sbold text-sm" ng-if="reservation.nb_reserve_places > 0">{{ 'app.public.events_show.full_price_' | translate }} {{reservation.nb_reserve_places}} {{ 'app.public.events_show.ticket' | translate:{NUMBER:reservation.nb_reserve_places} }}</div>
|
<div class="font-sbold text-sm" ng-if="reservation.nb_reserve_places > 0">{{ 'app.public.events_show.full_price_' | translate }} {{reservation.nb_reserve_places}} {{ 'app.public.events_show.ticket' | translate:{NUMBER:reservation.nb_reserve_places} }}</div>
|
||||||
<div class="font-sbold text-sm" ng-repeat="ticket in reservation.tickets_attributes">
|
<div class="font-sbold text-sm" ng-repeat="ticket in reservation.tickets_attributes">
|
||||||
{{ticket.event_price_category.price_category.name}} : {{ticket.booked}} {{ 'app.public.events_show.ticket' | translate:{NUMBER:ticket.booked} }}
|
{{ticket.event_price_category.price_category.name}} : {{ticket.booked}} {{ 'app.public.events_show.ticket' | translate:{NUMBER:ticket.booked} }}
|
||||||
@ -243,7 +246,10 @@
|
|||||||
<span ng-show="reservations.length > 0" translate>{{ 'app.public.events_show.thanks_for_coming' }}</span>
|
<span ng-show="reservations.length > 0" translate>{{ 'app.public.events_show.thanks_for_coming' }}</span>
|
||||||
<a ui-sref="app.public.events_list" translate>{{ 'app.public.events_show.view_event_list' }}</a>
|
<a ui-sref="app.public.events_list" translate>{{ 'app.public.events_show.view_event_list' }}</a>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-warning-full rounded btn-block text-sm" ng-click="reserveEvent()" ng-show="isShowReserveEventButton()">{{ 'app.public.events_show.book' | translate }}</button>
|
<button class="btn btn-warning-full rounded btn-block text-sm" ng-click="reserveEvent()" ng-show="isShowReserveEventButton()">
|
||||||
|
<span ng-if="event.pre_registration">{{ 'app.public.events_show.pre_book' | translate }}</span>
|
||||||
|
<span ng-if="!event.pre_registration">{{ 'app.public.events_show.book' | translate }}</span>
|
||||||
|
</button>
|
||||||
<uib-alert type="danger" ng-if="ctrl.member.id && !isUserValidatedByType()">
|
<uib-alert type="danger" ng-if="ctrl.member.id && !isUserValidatedByType()">
|
||||||
<p class="text-sm">
|
<p class="text-sm">
|
||||||
<i class="fa fa-warning"></i>
|
<i class="fa fa-warning"></i>
|
||||||
|
@ -60,6 +60,16 @@ class ShoppingCart
|
|||||||
items.each do |item|
|
items.each do |item|
|
||||||
objects.push(save_item(item))
|
objects.push(save_item(item))
|
||||||
end
|
end
|
||||||
|
event_reservation = objects.find { |o| o.is_a?(Reservation) && o.reservable_type == 'Event' }
|
||||||
|
if event_reservation&.reservable&.pre_registration
|
||||||
|
payment = Invoice.new(
|
||||||
|
invoicing_profile: @customer.invoicing_profile,
|
||||||
|
statistic_profile: @customer.statistic_profile,
|
||||||
|
operator_profile_id: @operator.invoicing_profile.id,
|
||||||
|
payment_method: @payment_method,
|
||||||
|
total: 0
|
||||||
|
)
|
||||||
|
else
|
||||||
update_credits(objects)
|
update_credits(objects)
|
||||||
update_packs(objects)
|
update_packs(objects)
|
||||||
|
|
||||||
@ -70,6 +80,7 @@ class ShoppingCart
|
|||||||
payment.save
|
payment.save
|
||||||
payment.post_save(payment_id, payment_type)
|
payment.post_save(payment_id, payment_type)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
success = !payment.nil? && objects.map(&:errors).flatten.map(&:empty?).all? && items.map(&:errors).map(&:blank?).all?
|
success = !payment.nil? && objects.map(&:errors).flatten.map(&:empty?).all? && items.map(&:errors).map(&:blank?).all?
|
||||||
errors = objects.map(&:errors).flatten.concat(items.map(&:errors))
|
errors = objects.map(&:errors).flatten.concat(items.map(&:errors))
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
json.extract! event, :id, :title, :description, :event_type, :pre_registration, :pre_registration_end_date
|
json.extract! event, :id, :title, :description, :event_type, :pre_registration, :pre_registration_end_date
|
||||||
|
json.pre_registration_end_date event.pre_registration_end_date&.to_date
|
||||||
if event.event_image
|
if event.event_image
|
||||||
json.event_image_attributes do
|
json.event_image_attributes do
|
||||||
json.id event.event_image.id
|
json.id event.event_image.id
|
||||||
|
@ -11,8 +11,8 @@ json.is_online_card invoice.paid_by_card?
|
|||||||
json.date invoice.is_a?(Avoir) ? invoice.avoir_date : invoice.created_at
|
json.date invoice.is_a?(Avoir) ? invoice.avoir_date : invoice.created_at
|
||||||
json.chained_footprint invoice.check_footprint
|
json.chained_footprint invoice.check_footprint
|
||||||
json.main_object do
|
json.main_object do
|
||||||
json.type invoice.invoice_items.find(&:main).object_type
|
json.type invoice.invoice_items.find(&:main)&.object_type
|
||||||
json.id invoice.invoice_items.find(&:main).object_id
|
json.id invoice.invoice_items.find(&:main)&.object_id
|
||||||
end
|
end
|
||||||
json.items invoice.invoice_items do |item|
|
json.items invoice.invoice_items do |item|
|
||||||
json.id item.id
|
json.id item.id
|
||||||
|
@ -333,6 +333,7 @@ en:
|
|||||||
you_can_find_your_reservation_s_details_on_your_: "You can find your reservation's details on your"
|
you_can_find_your_reservation_s_details_on_your_: "You can find your reservation's details on your"
|
||||||
dashboard: "dashboard"
|
dashboard: "dashboard"
|
||||||
you_booked_DATE: "You booked ({DATE}):"
|
you_booked_DATE: "You booked ({DATE}):"
|
||||||
|
you_pre_booked_DATE: "You pre-booked ({DATE}):"
|
||||||
canceled_reservation_SEATS: "Reservation canceled ({SEATS} seats)"
|
canceled_reservation_SEATS: "Reservation canceled ({SEATS} seats)"
|
||||||
book: "Book"
|
book: "Book"
|
||||||
confirm_and_pay: "Confirm and pay"
|
confirm_and_pay: "Confirm and pay"
|
||||||
@ -361,6 +362,8 @@ en:
|
|||||||
share_on_facebook: "Share on Facebook"
|
share_on_facebook: "Share on Facebook"
|
||||||
share_on_twitter: "Share on Twitter"
|
share_on_twitter: "Share on Twitter"
|
||||||
last_name_and_first_name: "Last name and first name"
|
last_name_and_first_name: "Last name and first name"
|
||||||
|
pre_book: "Pre-book"
|
||||||
|
pre_registration_end_date: "Pre-registration end date"
|
||||||
#public calendar
|
#public calendar
|
||||||
calendar:
|
calendar:
|
||||||
calendar: "Calendar"
|
calendar: "Calendar"
|
||||||
|
@ -333,6 +333,7 @@ fr:
|
|||||||
you_can_find_your_reservation_s_details_on_your_: "Vous pouvez retrouver le détail de votre réservation sur votre"
|
you_can_find_your_reservation_s_details_on_your_: "Vous pouvez retrouver le détail de votre réservation sur votre"
|
||||||
dashboard: "tableau de bord"
|
dashboard: "tableau de bord"
|
||||||
you_booked_DATE: "Vous avez réservé ({DATE}) :"
|
you_booked_DATE: "Vous avez réservé ({DATE}) :"
|
||||||
|
you_pre_booked_DATE: "Vous avez pré-réservé ({DATE}) :"
|
||||||
canceled_reservation_SEATS: "Réservation annulée ({SEATS} places)"
|
canceled_reservation_SEATS: "Réservation annulée ({SEATS} places)"
|
||||||
book: "Réserver"
|
book: "Réserver"
|
||||||
confirm_and_pay: "Valider et payer"
|
confirm_and_pay: "Valider et payer"
|
||||||
@ -361,6 +362,8 @@ fr:
|
|||||||
share_on_facebook: "Partager sur Facebook"
|
share_on_facebook: "Partager sur Facebook"
|
||||||
share_on_twitter: "Partager sur Twitter"
|
share_on_twitter: "Partager sur Twitter"
|
||||||
last_name_and_first_name: "Nom et prénom"
|
last_name_and_first_name: "Nom et prénom"
|
||||||
|
pre_book: "Pré-réserver"
|
||||||
|
pre_registration_end_date: "Date de fin de pré-réservation"
|
||||||
#public calendar
|
#public calendar
|
||||||
calendar:
|
calendar:
|
||||||
calendar: "Calendrier"
|
calendar: "Calendrier"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user