Implement button to remind members to pay their initial dues

This commit is contained in:
Hugo Peixoto 2024-03-22 23:34:34 +00:00
parent 931310657a
commit 333b7c02aa
5 changed files with 19 additions and 7 deletions

View File

@ -1,6 +1,6 @@
class MembersController < ApplicationController class MembersController < ApplicationController
before_action :require_login before_action :require_login
before_action :set_member, only: %i[ show edit update delete destroy ] before_action :set_member, only: %i[ show edit update delete destroy resend_registration ]
helper_method :sort_params helper_method :sort_params
include MemberFilter include MemberFilter
@ -38,6 +38,12 @@ class MembersController < ApplicationController
end end
end end
def resend_registration
NotificationMailer.with(member: @member).registration.deliver_now!
redirect_to @member, notice: "Payment reminder sent."
end
# PATCH/PUT /members/1 # PATCH/PUT /members/1
def update def update
if @member.update(member_params) if @member.update(member_params)

View File

@ -19,12 +19,15 @@
<tr><td><%= t('members.attributes.reduced_ifthenpay_link') %></td><td><% if @member.reduced_ifthenpay_link %><%= link_to @member.reduced_ifthenpay_link, @member.reduced_ifthenpay_link %><% end %></td></tr> <tr><td><%= t('members.attributes.reduced_ifthenpay_link') %></td><td><% if @member.reduced_ifthenpay_link %><%= link_to @member.reduced_ifthenpay_link, @member.reduced_ifthenpay_link %><% end %></td></tr>
</table> </table>
<div> <div><%= link_to t('members.show.actions.edit'), edit_member_path(@member) %></div>
<%= link_to t('members.show.actions.edit'), edit_member_path(@member) %> <div><%= link_to t('members.show.actions.delete'), delete_member_path(@member) %></div>
</div> <%- if @member.status == "pending" %>
<div> <div>
<%= link_to t('members.show.actions.delete'), delete_member_path(@member) %> <%= form_with url: resend_registration_member_path(@member) do |form| %>
</div> <%= form.submit t('members.show.actions.resend_registration') %>
<% end %>
</div>
<%- end %>
<h2><%= t('members.show.contribution_history') %></h2> <h2><%= t('members.show.contribution_history') %></h2>

View File

@ -24,6 +24,7 @@ en:
title: "Member details" title: "Member details"
actions: actions:
edit: "Edit" edit: "Edit"
resend_registration: "Send initial payment email reminder"
edit: edit:
title: "Edit member details" title: "Edit member details"
actions: actions:

View File

@ -40,6 +40,7 @@ pt:
edit_contribution: "Editar" edit_contribution: "Editar"
delete_contribution: "Apagar" delete_contribution: "Apagar"
deliver_notification: "Enviar agora" deliver_notification: "Enviar agora"
resend_registration: "Enviar lembrete para pagamento inicial"
contribution_history: "Histórico de contribuições" contribution_history: "Histórico de contribuições"
notifications: "Notificações por correio electrónico" notifications: "Notificações por correio electrónico"
contribution_actions: "Acções" contribution_actions: "Acções"

View File

@ -9,6 +9,7 @@ Rails.application.routes.draw do
resources :members do resources :members do
member do member do
get :delete get :delete
post :resend_registration
end end
resources :contributions, only: [:new, :create] resources :contributions, only: [:new, :create]
end end