1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-03-21 12:29:03 +01:00

display that an event reservation was canceled

also: fixed transtions files
This commit is contained in:
Sylvain 2019-11-21 11:15:05 +01:00
parent cabe2e5604
commit ce366beaa2
17 changed files with 109 additions and 25 deletions

View File

@ -431,7 +431,16 @@ Application.Controllers.controller('ShowEventReservationsController', ['$scope',
$scope.event = eventPromise;
// list of reservations for the current event
return $scope.reservations = reservationsPromise;
$scope.reservations = reservationsPromise;
/**
* Test if the provided reservation has been cancelled
* @param reservation {Reservation}
* @returns {boolean}
*/
$scope.isCancelled = function(reservation) {
return !!(reservation.slots[0].canceled_at);
}
}]);
/**

View File

@ -128,7 +128,7 @@ Application.Controllers.controller('EventsController', ['$scope', '$state', 'Eve
Application.Controllers.controller('ShowEventController', ['$scope', '$state', '$stateParams', '$rootScope', 'Event', '$uibModal', 'Member', 'Reservation', 'Price', 'CustomAsset', 'Slot', 'eventPromise', 'growl', '_t', 'Wallet', 'helpers', 'dialogs', 'priceCategoriesPromise', 'settingsPromise',
function ($scope, $state, $stateParams, $rootScope, Event, $uibModal, Member, Reservation, Price, CustomAsset, Slot, eventPromise, growl, _t, Wallet, helpers, dialogs, priceCategoriesPromise, settingsPromise) {
/* PUBLIC SCOPE */
/* PUBLIC SCOPE */
// reservations for the currently shown event
$scope.reservations = [];
@ -352,7 +352,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
* @param reservation {{id:number, reservable_id:number, nb_reserve_places:number}}
*/
$scope.cancelReservation = function(reservation) {
return dialogs.confirm({
dialogs.confirm({
resolve: {
object: function() {
return {
@ -362,20 +362,29 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
}
}
}, function() { // cancel confirmed
return Slot.cancel({
Slot.cancel({
id: reservation.slots[0].id
}, function() { // successfully canceled
var index;
let index;
growl.success(_t('reservation_was_successfully_cancelled'));
index = $scope.reservations.indexOf(reservation);
$scope.event.nb_free_places = $scope.event.nb_free_places + reservation.total_booked_seats;
return $scope.reservations.splice(index, 1);
$scope.reservations[index].slots[0].canceled_at = new Date();
}, function(error) {
return growl.warning(_t('cancellation_failed'));
growl.warning(_t('cancellation_failed'));
});
});
};
/**
* Test if the provided reservation has been cancelled
* @param reservation {Reservation}
* @returns {boolean}
*/
$scope.isCancelled = function(reservation) {
return !!(reservation.slots[0].canceled_at);
}
/**
* Callback to alter an already booked reservation date. A modal window will be opened to allow the user to choose
* a new date for his reservation (if any available)
@ -777,7 +786,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
/**
* What to do after the payment was successful
* @param resveration {Object} booked reservation
* @param reservation {Object} booked reservation
*/
var afterPayment = function (reservation) {
$scope.event.nb_free_places = $scope.event.nb_free_places - reservation.total_booked_seats;

View File

@ -290,6 +290,11 @@
@include border-radius(3px);
padding: 5px 10px;
}
&.well-disabled {
border-color: $gray-lighter;
background-color: $gray-lighter;
color: $gray-light;
}
}
.read {
@ -629,3 +634,20 @@ padding: 10px;
.help-block.error {
color: #ff565d;
}
.disabled {
background-color: $gray-lighter;
color: $gray-light;
& a {
color: $gray;
}
.canceled-marker {
float: right;
top: -13px;
position: relative;
color: red;
text-transform: uppercase;
}
}

View File

@ -27,7 +27,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="reservation in reservations">
<tr ng-repeat="reservation in reservations" ng-class="{'disabled': isCancelled(reservation)}">
<td class="text-c">
<a ui-sref="app.logged.members_show({id: reservation.user_id})">{{ reservation.user_full_name }} </a>
</td>
@ -35,6 +35,7 @@
<td>
<span ng-if="reservation.nb_reserve_places > 0">{{ 'full_price_' | translate }} {{reservation.nb_reserve_places}}<br/></span>
<span ng-repeat="ticket in reservation.tickets">{{ticket.event_price_category.price_category.name}} : {{ticket.booked}}</span>
<div ng-show="isCancelled(reservation)" class="canceled-marker" translate>{{ 'canceled' }}</div>
</td>
<td>
<div class="buttons">

View File

@ -151,17 +151,22 @@
<div ng-if="reserveSuccess" class="alert alert-success">{{ 'thank_you_your_payment_has_been_successfully_registered' | translate }}<br>
{{ 'you_can_find_your_reservation_s_details_on_your_' | translate }} <a ui-sref="app.logged.dashboard.invoices" translate>{{ 'dashboard' }}</a>
</div>
<div class="well well-warning m-t-sm" ng-if="reservations && !reserve.toReserve" ng-repeat="reservation in reservations">
<div class="font-sbold text-u-c text-sm">{{ 'you_booked_DATE' | translate:{DATE:(reservation.created_at | amDateFormat:'L LT')} }}</div>
<div class="font-sbold text-sm" ng-if="reservation.nb_reserve_places > 0">{{ 'full_price_' | translate }} {{reservation.nb_reserve_places}} {{ 'ticket' | translate:{NUMBER:reservation.nb_reserve_places}:"messageformat" }}</div>
<div class="font-sbold text-sm" ng-repeat="ticket in reservation.tickets">
{{ticket.event_price_category.price_category.name}} : {{ticket.booked}} {{ 'ticket' | translate:{NUMBER:ticket.booked}:"messageformat" }}
<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 class="font-sbold text-u-c text-sm">{{ 'you_booked_DATE' | translate:{DATE:(reservation.created_at | amDateFormat:'L LT')} }}</div>
<div class="font-sbold text-sm" ng-if="reservation.nb_reserve_places > 0">{{ 'full_price_' | translate }} {{reservation.nb_reserve_places}} {{ 'ticket' | translate:{NUMBER:reservation.nb_reserve_places}:"messageformat" }}</div>
<div class="font-sbold text-sm" ng-repeat="ticket in reservation.tickets">
{{ticket.event_price_category.price_category.name}} : {{ticket.booked}} {{ 'ticket' | translate:{NUMBER:ticket.booked}:"messageformat" }}
</div>
<div class="clear" ng-if="event.recurrence_events.length > 0 && reservationCanModify(reservation)">
<a class="pull-right m-t-xs text-u-l pointer" ng-click="modifyReservation(reservation, $event)" translate>{{ 'change' }}</a>
</div>
<div class="clear" ng-if="reservationCanCancel(reservation)">
<a class="pull-right m-t-xs text-u-l pointer" ng-click="cancelReservation(reservation, $event)" translate>{{ 'cancel' }}</a>
</div>
</div>
<div class="clear" ng-if="event.recurrence_events.length > 0 && reservationCanModify(reservation)">
<a class="pull-right m-t-xs text-u-l pointer" ng-click="modifyReservation(reservation, $event)" translate>{{ 'change' }}</a>
</div>
<div class="clear" ng-if="reservationCanCancel(reservation)">
<a class="pull-right m-t-xs text-u-l pointer" ng-click="cancelReservation(reservation, $event)" translate>{{ 'cancel' }}</a>
<div ng-show="isCancelled(reservation)" class="well well-disabled">
<div class="text-italic text-sm">{{ 'canceled_reservation_SEATS' | translate:{SEATS:reservation.nb_reserve_places} }}</div>
</div>
</div>

View File

@ -6,6 +6,7 @@ json.slots reservation.slots do |s|
json.id s.id
json.start_at s.start_at.iso8601
json.end_at s.end_at.iso8601
json.canceled_at s.canceled_at&.iso8601
end
json.nb_reserve_places reservation.nb_reserve_places
json.tickets reservation.tickets do |t|

View File

@ -79,6 +79,9 @@ en:
delete_slot: "Delete this slot"
do_you_really_want_to_delete_this_slot: "Do you really want to delete this slot?"
delete_recurring_slot: "You're about to delete a recurring slot. What do you want to do?"
delete_this_slot: "Only this slot"
delete_this_and_next: "This slot and the following"
delete_all: "All slots"
event_in_the_past: "Unable to create a slot in the past."
project_elements:
@ -192,6 +195,7 @@ en:
show_the_event: "Show the event"
no_reservations_for_now: "No reservation for now."
back_to_monitoring: "Back to monitoring"
canceled: "Canceled"
pricing:
# subscriptions, prices, credits and coupons management
@ -325,6 +329,7 @@ en:
display_more_invoices: "Display more invoices..."
no_invoices_for_now: "No invoices for now."
invoicing_settings: "Invoicing settings"
warning_invoices_disabled: "Warning : invoices are not enabled. No invoices will be generated by Fab-manager. Nevertheless, you must correctly fill the information below, especially VAT."
change_logo: "Change logo"
john_smith: "John Smith"
john_smith_at_example_com: "jean.smith@example.com"

View File

@ -79,6 +79,9 @@ es:
delete_slot: "Delete this slot" # translation_missing
do_you_really_want_to_delete_this_slot: "Do you really want to delete this slot?" # translation_missing
delete_recurring_slot: "You're about to delete a recurring slot. What do you want to do?"# translation_missing
delete_this_slot: "Only this slot" # translation_missing
delete_this_and_next: "This slot and the following" # translation_missing
delete_all: "All slots" # translation_missing
event_in_the_past: "Unable to create a slot in the past." # translation_missing
project_elements:
@ -192,6 +195,7 @@ es:
show_the_event: "Mostrar el evento"
no_reservations_for_now: "No hay reservas por ahora."
back_to_monitoring: "Volver a monitorizar"
canceled: "cancelado"
pricing:
# subscriptions, prices, credits and coupons management
@ -325,6 +329,7 @@ es:
display_more_invoices: "Mostrar más facturas..."
no_invoices_for_now: "Sin facturas por ahora."
invoicing_settings: "Configuración de facturación"
warning_invoices_disabled: "Warning : invoices are not enabled. No invoices will be generated by Fab-manager. Nevertheless, you must correctly fill the information below, especially VAT." # missing translation
change_logo: "Cambio de logotipo"
john_smith: "John Smith"
john_smith_at_example_com: "jean.smith@example.com"

View File

@ -195,6 +195,7 @@ fr:
show_the_event: "Afficher l'évènement"
no_reservations_for_now: "Aucune réservation pour le moment."
back_to_monitoring: "Retour au suivi"
canceled: "Annulé"
pricing:
# gestion des abonnements, des tarifs, des crédits et des codes promo

View File

@ -79,6 +79,9 @@ pt:
delete_slot: "Exclua o slot"
do_you_really_want_to_delete_this_slot: "Você realmente quer excluir esse slot?"
delete_recurring_slot: "You're about to delete a recurring slot. What do you want to do?"# translation_missing
delete_this_slot: "Only this slot" # translation_missing
delete_this_and_next: "This slot and the following" # translation_missing
delete_all: "All slots" # translation_missing
event_in_the_past: "Unable to create a slot in the past." # translation_missing
project_elements:
@ -192,6 +195,7 @@ pt:
show_the_event: "Mostrar evento"
no_reservations_for_now: "Nenhuma reserva."
back_to_monitoring: "Voltar ao monitoramento"
canceled: "cancelado"
pricing:
# subscriptions, prices, credits and coupons management
@ -325,6 +329,7 @@ pt:
display_more_invoices: "Mostrar mais faturas..."
no_invoices_for_now: "Nenhuma fatura."
invoicing_settings: "Configurações do faturamento"
warning_invoices_disabled: "Warning : invoices are not enabled. No invoices will be generated by Fab-manager. Nevertheless, you must correctly fill the information below, especially VAT." # missing translation
change_logo: "Mudar o logo"
john_smith: "John Smith"
john_smith_at_example_com: "jean.smith@example.com"

View File

@ -65,8 +65,8 @@ es:
used_for_invoicing: "This data will be used for billing purposes" # translation missing
used_for_reservation: "This data will be used in case of change on one of your bookings" # translation missing
used_for_profile: "This data will only be displayed on your profile" # translation missing
public_profile: "You will have a public profile and other users will be able to associate you in their projects" # translation missing
used_for_pricing_stats: "This data will be used to determine the prices to which you are entitled, and for statistical purposes" # translation missing
public_profile: "You will have a public profile and other users will be able to associate you in their projects" # translation missing
trainings: "Cursos"
no_trainings: "Sin cursos"
subscription: "Suscripción"
@ -130,6 +130,10 @@ es:
i_reserve: "reservo"
i_shift: "reemplazo"
i_change: "cambio"
do_you_really_want_to_cancel_this_reservation: "Do you really want to cancel this reservation?" # translation missing
reservation_was_cancelled_successfully: "Reservation was cancelled successfully." # translation missing
cancellation_failed: "Cancellation failed." # translation missing
a_problem_occured_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later." # translation missing
trainings_reserve:
# book a training

View File

@ -74,11 +74,11 @@ fr:
or: "ou"
confirm_changes: "Valider les modifications"
change_my_data: "Modifier mes données"
sync_my_profile: "Synchroniser mon profil"
once_your_data_are_up_to_date_: "Une fois vos données à jour,"
_click_on_the_synchronization_button_opposite_: "cliquez sur le bouton de synchronisation ci-contre"
_disconnect_then_reconnect_: "déconnectez-vous puis re-connectez vous"
_for_your_changes_to_take_effect: "pour que les modifications soient prises en compte."
sync_my_profile: "Synchroniser mon profil"
projects:
# tableau de bord : mes projets
you_dont_have_any_projects: "Vous n'avez aucun projet."
@ -130,6 +130,10 @@ fr:
i_reserve: "Je réserve"
i_shift: "Je déplace"
i_change: "Je change"
do_you_really_want_to_cancel_this_reservation: "Voulez-vous vraiment annuler cette réservation ?"
reservation_was_cancelled_successfully: "La réservation a bien été annulée."
cancellation_failed: "Échec de l'annulation."
a_problem_occured_during_the_payment_process_please_try_again_later: "Un problème est survenu pendant le processus de paiement. Merci de réessayer ultérieurement."
trainings_reserve:
# réserver une formation

View File

@ -130,6 +130,10 @@ pt:
i_reserve: "Eu reservo"
i_shift: "Eu mudo"
i_change: "Eu altero"
do_you_really_want_to_cancel_this_reservation: "Do you really want to cancel this reservation?" # translation missing
reservation_was_cancelled_successfully: "Reservation was cancelled successfully." # translation missing
cancellation_failed: "Cancellation failed." # translation missing
a_problem_occured_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later." # translation missing
trainings_reserve:
# book a training

View File

@ -272,7 +272,7 @@ en:
# details and booking of an event
event_description: "Event description"
downloadable_documents: "Downloadable documents"
informations_and_booking: "Informations and booking"
information_and_booking: "Information and booking"
beginning: "Beginning:"
ending: "Ending:"
opening_hours: "Opening hours:"
@ -284,6 +284,7 @@ en:
make_a_gift_of_this_reservation: "Make a gift of this reservation"
you_can_find_your_reservation_s_details_on_your_: "You can find your reservation's details on your"
you_booked_DATE: "You booked ({{DATE}}):" # angular interpolation
canceled_reservation_SEATS: "Reservation canceled ({{SEATS}} seats)" # angular interpolation
book: "Book"
change_the_reservation: "Change the reservation"
you_can_shift_this_reservation_on_the_following_slots: "You can shift this reservation on the following slots:"

View File

@ -27,6 +27,7 @@ es:
sign_out: "Salir"
sign_up: "Registrarse"
sign_in: "Entrar"
# left menu
notifications: "Notificaciones"
admin: "Administrador"
@ -271,7 +272,7 @@ es:
# details and booking of an event
event_description: "Descripción del evento"
downloadable_documents: "Archivos descargables"
informations_and_booking: "Información y reservas"
information_and_booking: "Información y reservas"
beginning: "Empieza:"
ending: "Termina:"
opening_hours: "Hora de apertura:"
@ -283,6 +284,7 @@ es:
make_a_gift_of_this_reservation: "Regalar esta reserva"
you_can_find_your_reservation_s_details_on_your_: "Puede encontrar los detalles de su reserva en"
you_booked_DATE: "You booked ({{DATE}}):" # angular interpolation
canceled_reservation_SEATS: "Reservation canceled ({{SEATS}} seats)" # angular interpolation #translation_missing
book: "Reservar"
change_the_reservation: "Cambiar la reserva"
you_can_shift_this_reservation_on_the_following_slots: "Puede cambiar la reserva en los siguientes campos:"
@ -290,6 +292,9 @@ es:
do_you_really_want_to_delete_this_event: "Do you really want to delete this event?" #translation_missing
event_successfully_deleted: "Event successfully deleted" #translation_missing
unable_to_delete_the_event_because_some_users_alredy_booked_it: "Unable to delete this event, it may have been already reserved by some users." #translation_missing
cancel_the_reservation: "Cancel the reservation" #translation_missing
do_you_really_want_to_cancel_this_reservation_this_apply_to_all_booked_tickets: "Do you really want to cancel this reservation? This apply to ALL booked tickets." #translation_missing
cancellation_failed: "Cancellation failed." #translation_missing
calendar:
# public calendar

View File

@ -223,7 +223,6 @@ fr:
unauthorized_operation: "Opération non autorisée"
the_machine_cant_be_deleted_because_it_is_already_reserved_by_some_users: "La machine ne peut pas être supprimée car elle a déjà été réservée par des utilisateurs."
trainings_list:
# liste des formations
the_trainings: "Les formations"
@ -235,7 +234,6 @@ fr:
unauthorized_operation: "Opération non autorisée"
the_training_cant_be_deleted_because_it_is_already_reserved_by_some_users: "La formation ne peut pas être supprimée car elle a déjà été réservée par des utilisateurs."
plans:
# page récapitulative des abonnements
subcriptions: "Les abonnements"
@ -286,6 +284,7 @@ fr:
make_a_gift_of_this_reservation: "Offrir cette réservation"
you_can_find_your_reservation_s_details_on_your_: "Vous pouvez retrouver le détail de votre réservation sur votre"
you_booked_DATE: "Vous avez réservé ({{DATE}}) :" # angular interpolation
canceled_reservation_SEATS: "Réservation annulée ({{SEATS}} places)" # angular interpolation
book: "Réserver"
change_the_reservation: "Modifier la réservation"
you_can_shift_this_reservation_on_the_following_slots: "Vous pouvez déplacer cette réservation sur les créneaux suivants :"

View File

@ -284,6 +284,7 @@ pt:
make_a_gift_of_this_reservation: "Doe esta reserva"
you_can_find_your_reservation_s_details_on_your_: "Você pode encontrar detalhes da sua reserva em seu"
you_booked_DATE: "Sua reserva ({{DATE}}):" # angular interpolation
canceled_reservation_SEATS: "Reservation canceled ({{SEATS}} seats)" # angular interpolation #translation_missing
book: "Reservar"
change_the_reservation: "Alterar reserva"
you_can_shift_this_reservation_on_the_following_slots: "Você pode alterar essa reserva nos campos a seguir:"
@ -291,6 +292,9 @@ pt:
do_you_really_want_to_delete_this_event: "Vocêrealmente deseja remover este evento?"
event_successfully_deleted: "Evento excluído com sucesso"
unable_to_delete_the_event_because_some_users_alredy_booked_it: "Não foi possível excluir este evento, já pode ter sido reservado por alguns usuários."
cancel_the_reservation: "Cancel the reservation" #translation_missing
do_you_really_want_to_cancel_this_reservation_this_apply_to_all_booked_tickets: "Do you really want to cancel this reservation? This apply to ALL booked tickets." #translation_missing
cancellation_failed: "Cancellation failed." #translation_missin
calendar:
# public calendar