diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb
index a306231..83ab7ff 100644
--- a/app/controllers/payments_controller.rb
+++ b/app/controllers/payments_controller.rb
@@ -60,7 +60,7 @@ def send_receipt
private
def payment_params
- params.require(:payment).permit(:amount, :number, :kind, :payment_reason_id)
+ params.require(:payment).permit(:amount, :number, :kind, :note, :payment_reason_id)
end
def set_member
diff --git a/app/models/club.rb b/app/models/club.rb
index 3d72abd..e8c8210 100644
--- a/app/models/club.rb
+++ b/app/models/club.rb
@@ -27,8 +27,7 @@ def full_name_and_address_for_receipt
[name, full_address, email].join('
')
end
- # TODO
def full_address
- 'via Roma 139, Livorno'
+ [address, municipality, postal_code, province].join(', ')
end
end
diff --git a/app/views/payments/_form.html.erb b/app/views/payments/_form.html.erb
index 13e6379..77e34f9 100644
--- a/app/views/payments/_form.html.erb
+++ b/app/views/payments/_form.html.erb
@@ -9,5 +9,6 @@
<% if payment.created_at %>
<%= f.input :created_at, disabled: true, as: :date %>
<% end %>
+ <%= f.input :note %>
<%= f.button :submit, 'Salva pagamento' %>
<% end %>
diff --git a/app/views/payments/index.html.erb b/app/views/payments/index.html.erb
index d01b5ef..a512faa 100644
--- a/app/views/payments/index.html.erb
+++ b/app/views/payments/index.html.erb
@@ -53,6 +53,7 @@
<%= I18n.t('activerecord.attributes.payment.amount') %> |
<%= I18n.t('activerecord.attributes.payment.payment_reason') %> |
<%= I18n.t('activerecord.attributes.payment.created_at') %> |
+ <%= I18n.t('activerecord.attributes.payment.note') %> |
<%= I18n.t('actions') %> |
@@ -63,6 +64,7 @@
<%= number_to_currency(payment.amount) %> |
<%= payment.payment_reason.reason %> |
<%= payment.created_at %> |
+ <%= truncate(payment.note, length: 25) %> |
<%= link_to club_payment_send_receipt_path(@club, payment), data: { turbo_method: :get, turbo_confirm: I18n.t('payments.confirm_send')}, class: 'text-decoration-none' do %>
<%= image_tag "send.svg", aria: { hidden: true }, size: 24 %>
diff --git a/app/views/pdf/payments/receipt.html.erb b/app/views/pdf/payments/receipt.html.erb
index 6b6870b..c71c97f 100644
--- a/app/views/pdf/payments/receipt.html.erb
+++ b/app/views/pdf/payments/receipt.html.erb
@@ -13,17 +13,6 @@
margin: auto;
border: 1px solid #ccc;
}
- .header {
- text-align: center;
- margin-bottom: 30px;
- }
- .header h1 {
- font-size: 24px;
- margin-bottom: 5px;
- }
- .header p {
- margin: 5px 0;
- }
.content {
margin-bottom: 20px;
}
@@ -41,18 +30,21 @@
-
+
+
+
+ <% if club.errors[:picture].blank? && club.picture.present? %>
+
+ <% end %>
+ |
+ RICEVUTA NOTA SPESE |
+ <%= club.full_name_and_address_for_receipt %> |
+
+
- RICEVUTA n.°
- Genova
+ RICEVUTA n.°<%= payment.number %>
+ <%= club.municipality %>
Riceviamo da: <%= member.full_name %>
CF: <%= member.tax_code %>
La somma di: <%= payment.in_eur %>
@@ -64,8 +56,11 @@
VERSAMENTO ESEGUITO DA: <%= member.full_name %>
CODICE FISCALE: <%= member.tax_code %>
Tipo di Pagamento: <%= payment.kind %>
- Nota:
+ <% if payment.note? %>
+ Nota:
+ <%= payment.note %>
+ <% end %>
+
-
-
- |