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
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
include MemberFilter
@ -38,6 +38,12 @@ class MembersController < ApplicationController
end
end
def resend_registration
NotificationMailer.with(member: @member).registration.deliver_now!
redirect_to @member, notice: "Payment reminder sent."
end
# PATCH/PUT /members/1
def update
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>
</table>
<div><%= link_to t('members.show.actions.edit'), edit_member_path(@member) %></div>
<div><%= link_to t('members.show.actions.delete'), delete_member_path(@member) %></div>
<%- if @member.status == "pending" %>
<div>
<%= link_to t('members.show.actions.edit'), edit_member_path(@member) %>
</div>
<div>
<%= link_to t('members.show.actions.delete'), delete_member_path(@member) %>
<%= form_with url: resend_registration_member_path(@member) do |form| %>
<%= form.submit t('members.show.actions.resend_registration') %>
<% end %>
</div>
<%- end %>
<h2><%= t('members.show.contribution_history') %></h2>

View File

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

View File

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

View File

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