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

(feat) new pre registration mail and notification

This commit is contained in:
Du Peng 2023-06-28 15:33:51 +02:00
parent 2a57a7e505
commit ab35fdf976
12 changed files with 99 additions and 14 deletions

View File

@ -91,7 +91,7 @@
<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>
<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>
<dd ng-if="event.pre_registration_end_date"><span class="text-u-l">{{event.pre_registration_end_date | amDateFormat:'L'}}</span></dd>
</dl>
<div class="text-sm" ng-if="event.amount">
@ -222,7 +222,7 @@
{{ 'app.public.events_show.you_can_find_your_reservation_s_details_on_your_' | translate }} <a ui-sref="app.logged.dashboard.invoices" translate>{{ 'app.public.events_show.dashboard' }}</a>
</div>
<div ng-if="reserveSuccess && event.pre_registration" class="alert alert-success">{{ 'app.public.events_show.thank_you_your_pre_registration_has_been_successfully_saved' | translate }}<br>
{{ 'app.public.events_show.you_can_find_your_reservation_s_details_on_your_' | translate }} <a ui-sref="app.logged.dashboard.invoices" translate>{{ 'app.public.events_show.dashboard' }}</a>
{{ 'app.public.events_show.informed_by_email_your_pre_registration' | translate }}
</div>
<div class="m-t-sm" ng-if="reservations && !reserve.toReserve" ng-repeat="reservation in reservations">
<div ng-hide="isCancelled(reservation)" class="well well-warning">

View File

@ -131,16 +131,28 @@ class Reservation < ApplicationRecord
end
def notify_member_create_reservation
if reservable_type == 'Event' && reservable.pre_registration?
NotificationCenter.call type: 'notify_member_pre_booked_reservation',
receiver: user,
attached_object: self
else
NotificationCenter.call type: 'notify_member_create_reservation',
receiver: user,
attached_object: self
end
end
def notify_admin_member_create_reservation
if reservable_type == 'Event' && reservable.pre_registration?
NotificationCenter.call type: 'notify_admin_member_pre_booked_reservation',
receiver: User.admins_and_managers,
attached_object: self
else
NotificationCenter.call type: 'notify_admin_member_create_reservation',
receiver: User.admins_and_managers,
attached_object: self
end
end
def notify_member_limitation_reached
date = ReservationLimitService.reached_limit_date(self)

View File

@ -0,0 +1,5 @@
json.title notification.notification_type
json.description t('.a_RESERVABLE_reservation_was_made_by_USER_html',
RESERVABLE: notification.attached_object.reservable.name,
USER: 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_successfully_saved_html',
RESERVABLE: notification.attached_object.reservable.name)

View File

@ -0,0 +1,19 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p>
<%= t('.body.member_reserved_html',
NAME: @attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'),
RESERVABLE: @attached_object.reservable.name) %>
</p>
<p><%= t('.body.reserved_slots') %></p>
<ul>
<% @attached_object.slots.each do |slot| %>
<% if @attached_object.reservable_type == 'Event' %>
<% (slot.start_at.to_date..slot.end_at.to_date).each do |d| %>
<li><%= "#{I18n.l d, format: :long} #{I18n.l slot.start_at, format: :hour_minute} - #{I18n.l slot.end_at, format: :hour_minute}" %></li>
<% end %>
<% else %>
<li><%= "#{I18n.l slot.start_at, format: :long} - #{I18n.l slot.end_at, format: :hour_minute}" %></li>
<% end %>
<% end %>
</ul>

View File

@ -0,0 +1,16 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p><%= t('.body.reservation_saved_html', RESERVATION: @attached_object.reservable.name) %></p>
<p><%= t('.body.your_reserved_slots') %> </p>
<ul>
<% @attached_object.slots.each do |slot| %>
<% if @attached_object.reservable_type == 'Event' %>
<% (slot.start_at.to_date..slot.end_at.to_date).each do |d| %>
<li><%= "#{I18n.l d, format: :long} #{I18n.l slot.start_at, format: :hour_minute} - #{I18n.l slot.end_at, format: :hour_minute}" %></li>
<% end %>
<% else %>
<li><%= "#{I18n.l slot.start_at, format: :long} - #{I18n.l slot.end_at, format: :hour_minute}" %></li>
<% end %>
<% end %>
</ul>

View File

@ -338,9 +338,10 @@ en:
thank_you_your_payment_has_been_successfully_registered: "Thank you. Your payment has been successfully registered!"
thank_you_your_pre_registration_has_been_successfully_saved: "Thank you. Your pre-registration has been successfully saved!"
you_can_find_your_reservation_s_details_on_your_: "You can find your reservation's details on your"
informed_by_email_your_pre_registration: "You will be kept informed by email of the progress made regarding your pre-registration."
dashboard: "dashboard"
you_booked_DATE: "You booked ({DATE}):"
you_pre_booked_DATE: "You pre-booked ({DATE}):"
you_pre_booked_DATE: "Your pre-registration ({DATE}):"
canceled_reservation_SEATS: "Reservation canceled ({SEATS} seats)"
book: "Book"
confirm_and_pay: "Confirm and pay"
@ -370,7 +371,7 @@ en:
share_on_twitter: "Share on Twitter"
last_name_and_first_name: "Last name and first name"
pre_book: "Pre-book"
pre_registration_end_date: "Pre-registration end date"
pre_registration_end_date: "Deadline for pre-registration"
pre_registration: "Pre-registration"
#public calendar
calendar:

View File

@ -336,11 +336,12 @@ fr:
ticket: "{NUMBER, plural, =0{place} one{place} other{places}}"
make_a_gift_of_this_reservation: "Offrir cette réservation"
thank_you_your_payment_has_been_successfully_registered: "Merci. Votre paiement a bien été pris en compte !"
thank_you_your_pre_registration_has_been_successfully_saved: "Merci. Votre pré-inscription a bien été pris en compte !"
thank_you_your_pre_registration_has_been_successfully_saved: "Merci. Votre demande a bien été pris en compte !"
you_can_find_your_reservation_s_details_on_your_: "Vous pouvez retrouver le détail de votre réservation sur votre"
informed_by_email_your_pre_registration: "vous serez tenu informé par email de la suite donnée à votre pré-inscription"
dashboard: "tableau de bord"
you_booked_DATE: "Vous avez réservé ({DATE}) :"
you_pre_booked_DATE: "Vous avez pré-réservé ({DATE}) :"
you_pre_booked_DATE: "Votre pré-inscription ({DATE}) :"
canceled_reservation_SEATS: "Réservation annulée ({SEATS} places)"
book: "Réserver"
confirm_and_pay: "Valider et payer"
@ -369,8 +370,8 @@ fr:
share_on_facebook: "Partager sur Facebook"
share_on_twitter: "Partager sur Twitter"
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"
pre_book: "Pré-inscrire"
pre_registration_end_date: "Date limite de pré-inscription"
pre_registration: "Pré-réservation"
#public calendar
calendar:

View File

@ -286,6 +286,8 @@ en:
an_abuse_was_reported_on_TYPE_ID_NAME_html: "An abuse was reported on <strong>%{TYPE} %{ID}: <em>%{NAME}</em></strong>."
notify_admin_member_create_reservation:
a_RESERVABLE_reservation_was_made_by_USER_html: "A <strong><em>%{RESERVABLE}</em></strong> reservation was made by <strong><em>%{USER}</em></strong>."
notify_admin_member_pre_booked_reservation:
a_RESERVABLE_reservation_was_made_by_USER_html: "A <strong><em>%{RESERVABLE}</em></strong> pre-registration was made by <strong><em>%{USER}</em></strong>."
notify_admin_profile_complete:
account_imported_from_PROVIDER_UID_has_completed_its_information_html: "Account imported from <strong><em>%{PROVIDER}</strong> (%{UID})</em> has completed its information."
notify_admin_slot_is_canceled:
@ -320,6 +322,8 @@ en:
a_new_user_account_has_been_imported_from_PROVIDER_UID_html: "A new user account has been imported from: <strong><em>%{PROVIDER}</strong> (%{UID})</em>."
notify_member_create_reservation:
your_reservation_RESERVABLE_was_successfully_saved_html: "Your reservation <strong><em>%{RESERVABLE}</em></strong> was successfully saved."
notify_member_pre_booked_reservation:
your_reservation_RESERVABLE_was_successfully_saved_html: "Your pre-registration <strong><em>%{RESERVABLE}</em></strong> was successfully saved."
notify_member_reservation_reminder:
reminder_you_have_a_reservation_RESERVABLE_to_be_held_on_DATE_html: "Reminder: You have a reservation <strong>%{RESERVABLE}</strong> to be held on <em>%{DATE}</em>"
notify_member_slot_is_canceled:

View File

@ -286,6 +286,8 @@ fr:
an_abuse_was_reported_on_TYPE_ID_NAME_html: "Un abus a été signalé sur <strong>%{TYPE} %{ID} : <em>%{NAME}</em></strong>."
notify_admin_member_create_reservation:
a_RESERVABLE_reservation_was_made_by_USER_html: "Une réservation <strong><em>%{RESERVABLE}</em></strong> a été effectuée par <strong><em>%{USER}</em></strong>."
notify_admin_member_pre_booked_reservation:
a_RESERVABLE_reservation_was_made_by_USER_html: "Une pre-inscription <strong><em>%{RESERVABLE}</em></strong> a été effectuée par <strong><em>%{USER}</em></strong>."
notify_admin_profile_complete:
account_imported_from_PROVIDER_UID_has_completed_its_information_html: "Le compte importé depuis <strong><em>%{PROVIDER}</strong> (%{UID})</em> a complété ses informations."
notify_admin_slot_is_canceled:
@ -320,6 +322,8 @@ fr:
a_new_user_account_has_been_imported_from_PROVIDER_UID_html: "Un nouveau compte utilisateur vient d'être importé depuis : <strong><em>%{PROVIDER}</strong> (%{UID})</em>."
notify_member_create_reservation:
your_reservation_RESERVABLE_was_successfully_saved_html: "Votre réservation <strong><em>%{RESERVABLE}</em></strong> a bien été enregistrée."
notify_member_pre_booked_reservation:
your_reservation_RESERVABLE_was_successfully_saved_html: "Votre pré-inscription <strong><em>%{RESERVABLE}</em></strong> a bien été pris en compte."
notify_member_reservation_reminder:
reminder_you_have_a_reservation_RESERVABLE_to_be_held_on_DATE_html: "Rappel : Vous avez une réservation <strong>%{RESERVABLE}</strong> qui aura lieu le <em>%{DATE}</em>"
notify_member_slot_is_canceled:

View File

@ -78,6 +78,11 @@ en:
body:
reservation_saved_html: "You reservation <strong><em>%{RESERVATION}</em></strong> has been successfully saved"
your_reserved_slots: "Your reserved slots are:"
notify_member_pre_booked_reservation:
subject: "Your pre-registration has been successfully saved"
body:
reservation_saved_html: "You pre-registration <strong><em>%{RESERVATION}</em></strong> has been successfully saved"
your_reserved_slots: "Your pre-booked slots are:"
notify_member_subscribed_plan_is_changed:
subject: "Your subscription has been updated"
body:
@ -87,6 +92,11 @@ en:
body:
member_reserved_html: "User %{NAME} has reserved <strong><em>%{RESERVABLE}</em></strong>."
reserved_slots: "Reserved slots are:"
notify_admin_member_pre_booked_reservation:
subject: "New pre-registration"
body:
member_reserved_html: "User %{NAME} has pre-reserved <strong><em>%{RESERVABLE}</em></strong>."
reserved_slots: "Pre-reserved slots are:"
notify_member_slot_is_modified:
subject: "Your reservation slot has been successfully changed"
body:

View File

@ -78,6 +78,11 @@ fr:
body:
reservation_saved_html: "Votre réservation <strong><em>%{RESERVATION}</em></strong> a bien été enregistrée."
your_reserved_slots: "Les créneaux que vous avez réservés sont :"
notify_member_pre_booked_reservation:
subject: "Votre pré-inscription a bien été pris en compte"
body:
reservation_saved_html: "Votre réservation <strong><em>%{RESERVATION}</em></strong> a bien été pris en compte."
your_reserved_slots: "Les créneaux que vous avez pré-inscrit sont :"
notify_member_subscribed_plan_is_changed:
subject: "Votre abonnement a été mis à jour"
body:
@ -87,6 +92,11 @@ fr:
body:
member_reserved_html: "Le membre %{NAME} a réservé <strong><em>%{RESERVABLE}</em></strong>."
reserved_slots: "Les créneaux réservés sont :"
notify_admin_member_pre_booked_reservation:
subject: "Nouvelle pre-inscription"
body:
member_reserved_html: "Le membre %{NAME} a pre-inscrit <strong><em>%{RESERVABLE}</em></strong>."
reserved_slots: "Les créneaux pre-inscrit sont :"
notify_member_slot_is_modified:
subject: "Votre créneau de réservation a bien été modifié"
body: