1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-02 13:24:20 +01:00

(feat) add invalidate pre registration notification

This commit is contained in:
Du Peng 2023-07-11 14:57:38 +02:00
parent 8b4150a888
commit 61fbb37fb2
10 changed files with 51 additions and 2 deletions

View File

@ -47,6 +47,12 @@ class SlotsReservationsService
reservable.update_nb_free_places reservable.update_nb_free_places
reservable.save reservable.save
end end
NotificationCenter.call type: 'notify_member_reservation_invalidated',
receiver: slot_reservation.reservation.user,
attached_object: slot_reservation.reservation
NotificationCenter.call type: 'notify_admin_reservation_invalidated',
receiver: User.admins_and_managers,
attached_object: slot_reservation.reservation
return true return true
end end
false false

View File

@ -0,0 +1,4 @@
json.title notification.notification_type
json.description t('.a_RESERVABLE_reservation_was_invalidated_html',
RESERVABLE: notification.attached_object.reservable.name,
NAME: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))

View File

@ -0,0 +1,3 @@
json.title notification.notification_type
json.description t('.your_reservation_RESERVABLE_was_invalidated_html',
RESERVABLE: notification.attached_object.reservable.name)

View File

@ -0,0 +1,7 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p>
<%= t('.body.reservation_invalidated_html',
NAME: @attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'),
RESERVABLE: @attached_object.reservable.name) %>
</p>

View File

@ -0,0 +1,3 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p><%= t('.body.reservation_invalidated_html', RESERVATION: @attached_object.reservable.name) %></p>

View File

@ -477,6 +477,10 @@ en:
your_reservation_RESERVABLE_was_validated_html: "Your reservation <strong><em>%{RESERVABLE}</em></strong> was successfully validated." your_reservation_RESERVABLE_was_validated_html: "Your reservation <strong><em>%{RESERVABLE}</em></strong> was successfully validated."
notify_admin_reservation_validated: notify_admin_reservation_validated:
a_RESERVABLE_reservation_was_validated_html: "A <strong><em>%{RESERVABLE}</em></strong> reservation of <strong><em>%{USER}</em></strong> was validated." a_RESERVABLE_reservation_was_validated_html: "A <strong><em>%{RESERVABLE}</em></strong> reservation of <strong><em>%{USER}</em></strong> was validated."
notify_member_reservation_invalidated:
your_reservation_RESERVABLE_was_invalidated_html: "Your pre-registration of <strong><em>%{RESERVABLE}</em></strong> wasn't validated."
notify_admin_reservation_invalidated:
a_RESERVABLE_reservation_was_invalidated_html: "A <strong><em>%{RESERVABLE}</em></strong> pre-registration of <strong><em>%{USER}</em></strong> was invalidated."
#statistics tools for admins #statistics tools for admins
statistics: statistics:
subscriptions: "Subscriptions" subscriptions: "Subscriptions"

View File

@ -477,6 +477,10 @@ fr:
your_reservation_RESERVABLE_was_validated_html: "Votre réservation de <strong><em>%{RESERVABLE}</em></strong> a été validée." your_reservation_RESERVABLE_was_validated_html: "Votre réservation de <strong><em>%{RESERVABLE}</em></strong> a été validée."
notify_admin_reservation_validated: notify_admin_reservation_validated:
a_RESERVABLE_reservation_was_validated_html: "La réservation de <strong><em>%{RESERVABLE}</em></strong> de <strong><em>%{NAME}</em></strong> a été validée." a_RESERVABLE_reservation_was_validated_html: "La réservation de <strong><em>%{RESERVABLE}</em></strong> de <strong><em>%{NAME}</em></strong> a été validée."
notify_member_reservation_invalidated:
your_reservation_RESERVABLE_was_invalidated_html: "Votre demande de pré-inscription de <strong><em>%{RESERVABLE}</em></strong> n'a pas été validée."
notify_admin_reservation_invalidated:
a_RESERVABLE_reservation_was_invalidated_html: "La réservation de <strong><em>%{RESERVABLE}</em></strong> de <strong><em>%{NAME}</em></strong> a été invalidée."
#statistics tools for admins #statistics tools for admins
statistics: statistics:
subscriptions: "Abonnements" subscriptions: "Abonnements"

View File

@ -467,7 +467,15 @@ en:
reservation_validated_html: "<strong><em>%{RESERVABLE}</em></strong> was validated." reservation_validated_html: "<strong><em>%{RESERVABLE}</em></strong> was validated."
your_reserved_slots: "Your reserved slots are:" your_reserved_slots: "Your reserved slots are:"
notify_admin_reservation_validated: notify_admin_reservation_validated:
subject: "Réservation a bien été validé" subject: "Pre-registration was validated"
body: body:
reservation_validated_html: "<strong><em>%{RESERVABLE}</em></strong> of %{NAME} was validated." reservation_validated_html: "<strong><em>%{RESERVABLE}</em></strong> of %{NAME} was validated."
reserved_slots: "Reserved slots are:" reserved_slots: "Reserved slots are:"
notify_member_reservation_invalidated:
subject: "Your pre-registration wasn't validated"
body:
reservation_invalidated_html: "<strong><em>%{RESERVABLE}</em></strong> wasn't validated."
notify_admin_reservation_invalidated:
subject: "Pre-registration wasn't validated"
body:
reservation_invalidated_html: "<strong><em>%{RESERVABLE}</em></strong> of %{NAME} wasn't validated."

View File

@ -471,3 +471,11 @@ fr:
body: body:
reservation_validated_html: "<strong><em>%{RESERVABLE}</em></strong> du membre %{NAME} a bien été validé." reservation_validated_html: "<strong><em>%{RESERVABLE}</em></strong> du membre %{NAME} a bien été validé."
reserved_slots: "Les créneaux réservés sont :" reserved_slots: "Les créneaux réservés sont :"
notify_member_reservation_invalidated:
subject: "Votre demande of pré-inscription n'a pas été validée"
body:
reservation_invalidated_html: "Votre réservation <strong><em>%{RESERVATION}</em></strong> n'a pas été validée."
notify_admin_reservation_invalidated:
subject: "Demande of pré-inscription n'a pas été validée"
body:
reservation_invalidated_html: "<strong><em>%{RESERVABLE}</em></strong> du membre %{NAME} n'a pas été validée."

View File

@ -92,7 +92,9 @@ NOTIFICATIONS_TYPES = [
{ name: 'notify_member_reservation_validated', category: 'agenda', is_configurable: false }, { name: 'notify_member_reservation_validated', category: 'agenda', is_configurable: false },
{ name: 'notify_admin_reservation_validated', category: 'agenda', is_configurable: true }, { name: 'notify_admin_reservation_validated', category: 'agenda', is_configurable: true },
{ name: 'notify_member_pre_booked_reservation', category: 'agenda', is_configurable: false }, { name: 'notify_member_pre_booked_reservation', category: 'agenda', is_configurable: false },
{ name: 'notify_admin_member_pre_booked_reservation', category: 'agenda', is_configurable: true } { name: 'notify_admin_member_pre_booked_reservation', category: 'agenda', is_configurable: true },
{ name: 'notify_member_reservation_invalidated', category: 'agenda', is_configurable: false },
{ name: 'notify_admin_reservation_invalidated', category: 'agenda', is_configurable: true }
].freeze ].freeze
NOTIFICATIONS_TYPES.each do |notification_type| NOTIFICATIONS_TYPES.each do |notification_type|