1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

WIP: move events reservation to use the cart directive

This commit is contained in:
Sylvain 2021-04-28 17:26:07 +02:00
parent 23e38238c8
commit ee1cdb417e
3 changed files with 22 additions and 6 deletions

View File

@ -13,8 +13,8 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
Application.Controllers.controller('EventsController', ['$scope', '$state', 'Event', 'categoriesPromise', 'themesPromise', 'ageRangesPromise', 'settingsPromise',
function ($scope, $state, Event, categoriesPromise, themesPromise, ageRangesPromise, settingsPromise) {
Application.Controllers.controller('EventsController', ['$scope', '$state', 'Event', 'categoriesPromise', 'themesPromise', 'ageRangesPromise',
function ($scope, $state, Event, categoriesPromise, themesPromise, ageRangesPromise) {
/* PUBLIC SCOPE */
// The events displayed on the page
@ -178,11 +178,16 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
// Message displayed to the end user about rules that applies to events reservations
$scope.eventExplicationsAlert = settingsPromise.event_explications_alert;
// the application global settings, required in <cart>
$scope.settings = settingsPromise
// the moment when the slot selection changed for the last time, used to trigger changes in the cart
$scope.selectionTime = null;
/**
* Callback to delete the provided event (admins only)
* @param event {$resource} angular's Event $resource
*/
$scope.deleteEvent = function (event) {
$scope.deleteEvent = function () {
// open a confirmation dialog
const modalInstance = $uibModal.open({
animation: true,
@ -205,7 +210,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
* Callback to call when the number of tickets to book changes in the current booking
*/
$scope.changeNbPlaces = function () {
// compute the total remaning places
// compute the total remaining places
let remain = $scope.event.nb_free_places - $scope.reserve.nbReservePlaces;
for (let ticket in $scope.reserve.tickets) {
remain -= $scope.reserve.tickets[ticket];

View File

@ -550,7 +550,6 @@ angular.module('application.router', ['ui.router'])
categoriesPromise: ['Category', function (Category) { return Category.query().$promise; }],
themesPromise: ['EventTheme', function (EventTheme) { return EventTheme.query().$promise; }],
ageRangesPromise: ['AgeRange', function (AgeRange) { return AgeRange.query().$promise; }],
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['online_payment_module']" }).$promise; }]
}
})
.state('app.public.events_show', {

View File

@ -66,6 +66,18 @@
<select-member></select-member>
</div>
<cart slot="reserve"
slot-selection-time="selectionTime"
events="events"
user="ctrl.member"
settings="settings"
after-payment="afterPayment"
reservable-id="{{event.id}}"
reservable-type="Event"
reservable-name="{{event.title}}"
limit-to-one-slot="true"></cart>
<section class="widget panel b-a m m-t-lg">
<div class="panel-heading b-b small">
<h3 translate>{{ 'app.public.events_show.information_and_booking' }}</h3>