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 @@
-
-

JAKU KAI

-

ASSOCIAZIONE SPORTIVA DILETTANTISTICA CULTURALE

-

Cod. Fisc. 95084300102

-

Via Fieschi 20° canc., 16128 GENOVA

-

Tel. 010 9845366

-

e-mail: info@jakukai.it | www.jakukai.it

-
+ + + + + + +
+ <% 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 %> +

- - - + + diff --git a/config/initializers/rucaptcha.rb b/config/initializers/rucaptcha.rb index 0b1917d..55795e1 100644 --- a/config/initializers/rucaptcha.rb +++ b/config/initializers/rucaptcha.rb @@ -14,7 +14,7 @@ # If you wants disable `cache_store` check warning, you can do it, default: false # 如果想要 disable cache_store 的 warning,就设置为 true,default false - # self.skip_cache_store_check = true + self.skip_cache_store_check = true # Chars length, default: 5, allows: [3 - 7] # self.length = 5 diff --git a/config/locales/it.yml b/config/locales/it.yml index b753981..e9434fe 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -216,6 +216,7 @@ it: payment: amount: Quota payment_reason: Causale + note: Note created_at: Data payment/kind: cash: Contanti diff --git a/db/migrate/20240916085436_add_note_to_payment.rb b/db/migrate/20240916085436_add_note_to_payment.rb new file mode 100644 index 0000000..41d8edd --- /dev/null +++ b/db/migrate/20240916085436_add_note_to_payment.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddNoteToPayment < ActiveRecord::Migration[7.2] + def change + add_column :payments, :note, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 4e76e0c..e3c8752 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_09_04_123152) do +ActiveRecord::Schema[7.2].define(version: 2024_09_16_085436) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -193,6 +193,7 @@ t.datetime "updated_at", null: false t.integer "number", default: 0, null: false t.integer "kind", default: 0, null: false + t.text "note" t.index ["member_id"], name: "index_payments_on_member_id" t.index ["payment_reason_id"], name: "index_payments_on_payment_reason_id" end