From ce366beaa2c15851a263a220ccb986e8f48c366d Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 21 Nov 2019 11:15:05 +0100 Subject: [PATCH] display that an event reservation was canceled also: fixed transtions files --- .../controllers/admin/events.js.erb | 11 +++++++- .../javascripts/controllers/events.js.erb | 23 +++++++++++------ app/assets/stylesheets/app.components.scss | 22 ++++++++++++++++ .../admin/events/reservations.html.erb | 3 ++- app/assets/templates/events/show.html.erb | 25 +++++++++++-------- .../reservations/_reservation.json.jbuilder | 1 + config/locales/app.admin.en.yml | 5 ++++ config/locales/app.admin.es.yml | 5 ++++ config/locales/app.admin.fr.yml | 1 + config/locales/app.admin.pt.yml | 5 ++++ config/locales/app.logged.es.yml | 6 ++++- config/locales/app.logged.fr.yml | 6 ++++- config/locales/app.logged.pt.yml | 4 +++ config/locales/app.public.en.yml | 3 ++- config/locales/app.public.es.yml | 7 +++++- config/locales/app.public.fr.yml | 3 +-- config/locales/app.public.pt.yml | 4 +++ 17 files changed, 109 insertions(+), 25 deletions(-) diff --git a/app/assets/javascripts/controllers/admin/events.js.erb b/app/assets/javascripts/controllers/admin/events.js.erb index 774111ed7..f1893864f 100644 --- a/app/assets/javascripts/controllers/admin/events.js.erb +++ b/app/assets/javascripts/controllers/admin/events.js.erb @@ -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); + } }]); /** diff --git a/app/assets/javascripts/controllers/events.js.erb b/app/assets/javascripts/controllers/events.js.erb index 6bb4c377e..fa2129a3a 100644 --- a/app/assets/javascripts/controllers/events.js.erb +++ b/app/assets/javascripts/controllers/events.js.erb @@ -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; diff --git a/app/assets/stylesheets/app.components.scss b/app/assets/stylesheets/app.components.scss index f477fd3dc..e4b6dde33 100644 --- a/app/assets/stylesheets/app.components.scss +++ b/app/assets/stylesheets/app.components.scss @@ -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; + } +} diff --git a/app/assets/templates/admin/events/reservations.html.erb b/app/assets/templates/admin/events/reservations.html.erb index a4867fee9..954e23d11 100644 --- a/app/assets/templates/admin/events/reservations.html.erb +++ b/app/assets/templates/admin/events/reservations.html.erb @@ -27,7 +27,7 @@ - + {{ reservation.user_full_name }} @@ -35,6 +35,7 @@ {{ 'full_price_' | translate }} {{reservation.nb_reserve_places}}
{{ticket.event_price_category.price_category.name}} : {{ticket.booked}} +
{{ 'canceled' }}
diff --git a/app/assets/templates/events/show.html.erb b/app/assets/templates/events/show.html.erb index 4e70c1713..6dcad7241 100644 --- a/app/assets/templates/events/show.html.erb +++ b/app/assets/templates/events/show.html.erb @@ -151,17 +151,22 @@
{{ 'thank_you_your_payment_has_been_successfully_registered' | translate }}
{{ 'you_can_find_your_reservation_s_details_on_your_' | translate }} {{ 'dashboard' }}
-
-
{{ 'you_booked_DATE' | translate:{DATE:(reservation.created_at | amDateFormat:'L LT')} }}
-
{{ 'full_price_' | translate }} {{reservation.nb_reserve_places}} {{ 'ticket' | translate:{NUMBER:reservation.nb_reserve_places}:"messageformat" }}
-
- {{ticket.event_price_category.price_category.name}} : {{ticket.booked}} {{ 'ticket' | translate:{NUMBER:ticket.booked}:"messageformat" }} +
+
+
{{ 'you_booked_DATE' | translate:{DATE:(reservation.created_at | amDateFormat:'L LT')} }}
+
{{ 'full_price_' | translate }} {{reservation.nb_reserve_places}} {{ 'ticket' | translate:{NUMBER:reservation.nb_reserve_places}:"messageformat" }}
+
+ {{ticket.event_price_category.price_category.name}} : {{ticket.booked}} {{ 'ticket' | translate:{NUMBER:ticket.booked}:"messageformat" }} +
+ +
- -
- {{ 'cancel' }} +
+
{{ 'canceled_reservation_SEATS' | translate:{SEATS:reservation.nb_reserve_places} }}
diff --git a/app/views/api/reservations/_reservation.json.jbuilder b/app/views/api/reservations/_reservation.json.jbuilder index 102da726a..24b545a07 100644 --- a/app/views/api/reservations/_reservation.json.jbuilder +++ b/app/views/api/reservations/_reservation.json.jbuilder @@ -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| diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 4c9640bc7..c69336065 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -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" diff --git a/config/locales/app.admin.es.yml b/config/locales/app.admin.es.yml index c44ecbf2b..3bbd7cb8d 100644 --- a/config/locales/app.admin.es.yml +++ b/config/locales/app.admin.es.yml @@ -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" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index d448b3b30..7f4afa2c1 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -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 diff --git a/config/locales/app.admin.pt.yml b/config/locales/app.admin.pt.yml index 158118490..227e4ed24 100755 --- a/config/locales/app.admin.pt.yml +++ b/config/locales/app.admin.pt.yml @@ -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" diff --git a/config/locales/app.logged.es.yml b/config/locales/app.logged.es.yml index 62eb175c1..02fca5123 100644 --- a/config/locales/app.logged.es.yml +++ b/config/locales/app.logged.es.yml @@ -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 diff --git a/config/locales/app.logged.fr.yml b/config/locales/app.logged.fr.yml index 53f69ad2c..89bc431ef 100644 --- a/config/locales/app.logged.fr.yml +++ b/config/locales/app.logged.fr.yml @@ -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 diff --git a/config/locales/app.logged.pt.yml b/config/locales/app.logged.pt.yml index aa01a9580..dfaf35fdb 100755 --- a/config/locales/app.logged.pt.yml +++ b/config/locales/app.logged.pt.yml @@ -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 diff --git a/config/locales/app.public.en.yml b/config/locales/app.public.en.yml index b9453dda2..ce9a26e9f 100644 --- a/config/locales/app.public.en.yml +++ b/config/locales/app.public.en.yml @@ -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:" diff --git a/config/locales/app.public.es.yml b/config/locales/app.public.es.yml index 7cb326cc1..75aa29a37 100644 --- a/config/locales/app.public.es.yml +++ b/config/locales/app.public.es.yml @@ -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 diff --git a/config/locales/app.public.fr.yml b/config/locales/app.public.fr.yml index 5c7df7c28..522562d10 100644 --- a/config/locales/app.public.fr.yml +++ b/config/locales/app.public.fr.yml @@ -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 :" diff --git a/config/locales/app.public.pt.yml b/config/locales/app.public.pt.yml index 743348e02..ff0fb170f 100755 --- a/config/locales/app.public.pt.yml +++ b/config/locales/app.public.pt.yml @@ -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