Skip to content

Commit

Permalink
adding parents for members
Browse files Browse the repository at this point in the history
  • Loading branch information
baldarn committed Aug 28, 2024
1 parent 8dae49e commit f8f680d
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 1 deletion.
24 changes: 24 additions & 0 deletions app/controllers/members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,30 @@ def member_params
:membership_expires_at,
:privacy_disclaimer,
:picture_disclaimer,
:first_parent_first_name,
:first_parent_last_name,
:first_parent_born_at,
:first_parent_born_in,
:first_parent_tax_code,
:first_parent_citizenship,
:first_parent_address,
:first_parent_postal_code,
:first_parent_municipality,
:first_parent_province,
:first_parent_telephone,
:first_parent_email,
:second_parent_first_name,
:second_parent_last_name,
:second_parent_born_at,
:second_parent_born_in,
:second_parent_tax_code,
:second_parent_citizenship,
:second_parent_address,
:second_parent_postal_code,
:second_parent_municipality,
:second_parent_province,
:second_parent_telephone,
:second_parent_email,
group_ids: [],
tag_ids: []
)
Expand Down
50 changes: 50 additions & 0 deletions app/views/members/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,54 @@
<%= f.input :province, wrapper_html: { class: 'col-sm-2' } %>
<%= f.input :telephone, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :email, wrapper_html: { class: 'col-sm-6' } %>
<div class="accordion accordion-flush" id="parents">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#parent-1" aria-expanded="false" aria-controls="parent-1">
<%= I18n.t('members.first_parent')%>
</button>
</h2>
<div id="parent-1" class="accordion-collapse collapse" data-bs-parent="#parents">
<div class="accordion-body row">
<%= f.input :first_parent_first_name, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :first_parent_last_name, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :first_parent_born_at, start_year: Date.today.year - 90, end_year: Date.today.year - 5 %>
<%= f.input :first_parent_born_in %>
<%= f.input :first_parent_tax_code %>
<%= f.input :first_parent_citizenship, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :first_parent_address, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :first_parent_postal_code, wrapper_html: { class: 'col-sm-2' } %>
<%= f.input :first_parent_municipality, wrapper_html: { class: 'col-sm-8' } %>
<%= f.input :first_parent_province, wrapper_html: { class: 'col-sm-2' } %>
<%= f.input :first_parent_telephone, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :first_parent_email, wrapper_html: { class: 'col-sm-6' } %>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#parent-2" aria-expanded="false" aria-controls="parent-2">
<%= I18n.t('members.second_parent')%>
</button>
</h2>
<div id="parent-2" class="accordion-collapse collapse" data-bs-parent="#parents">
<div class="accordion-body row">
<%= f.input :second_parent_first_name, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :second_parent_last_name, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :second_parent_born_at, start_year: Date.today.year - 90, end_year: Date.today.year - 5 %>
<%= f.input :second_parent_born_in %>
<%= f.input :second_parent_tax_code %>
<%= f.input :second_parent_citizenship, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :second_parent_address, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :second_parent_postal_code, wrapper_html: { class: 'col-sm-2' } %>
<%= f.input :second_parent_municipality, wrapper_html: { class: 'col-sm-8' } %>
<%= f.input :second_parent_province, wrapper_html: { class: 'col-sm-2' } %>
<%= f.input :second_parent_telephone, wrapper_html: { class: 'col-sm-6' } %>
<%= f.input :second_parent_email, wrapper_html: { class: 'col-sm-6' } %>
</div>
</div>
</div>
</div>
<h3>
<%= I18n.t('membership.name') %> <span class="dot-<%= member.membership_status %>"></span>
</h3>
Expand All @@ -30,6 +78,8 @@
%>
<%= f.association :tags, collection: @club.tags, as: :check_boxes %>
<%= f.association :groups, collection: @club.groups, as: :check_boxes %>
<%= f.input :privacy_disclaimer %>
<%= f.input :picture_disclaimer %>
<%= f.file_field :picture %>
<%=
if member.picture.present?
Expand Down
24 changes: 24 additions & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ it:
updated: Collaboratore aggiornato
destroyed: Collaboratore cancellato
members:
first_parent: Primo genitore
second_parent: Secondo genitore
header: Membri
select: Seleziona membro
new: Nuovo membro
Expand Down Expand Up @@ -168,6 +170,28 @@ it:
municipality: Comune
groups: Gruppi
tags: Attributi
privacy_disclaimer: liberatoria privacy
picture_disclaimer: liberatoria foto
first_parent_name: Primo genitore Nome
first_parent_first_name: Primo genitore Nome
first_parent_last_name: Primo genitore Cognome
first_parent_born_in: Primo genitore Nato a
first_parent_born_at: Primo genitore Nato il
first_parent_citizenship: Primo genitore Cittadinanza
first_parent_address: Primo genitore Indirizzo
first_parent_postal_code: Primo genitore CAP
first_parent_email: Primo genitore Email
first_parent_municipality: Primo genitore Comune
second_parent_name: Secondo genitore Nome
second_parent_first_name: Secondo genitore Nome
second_parent_last_name: Secondo genitore Cognome
second_parent_born_in: Nato Secondo genitore a
second_parent_born_at: Nato Secondo genitore il
second_parent_citizenship: Secondo genitore Cittadinanza
second_parent_address: Secondo genitore Indirizzo
second_parent_postal_code: Secondo genitore CAP
second_parent_email: Secondo genitore Email
second_parent_municipality: Secondo genitore Comune
event/kind:
training: Allenamento
competition: Partita/Gara
Expand Down
35 changes: 35 additions & 0 deletions db/migrate/20240824101228_add_parents_to_members.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

class AddParentsToMembers < ActiveRecord::Migration[7.2]
def change
change_table :members, bulk: true do |t|
# first parent
t.string :first_parent_first_name
t.string :first_parent_last_name
t.date :first_parent_born_at
t.string :first_parent_born_in
t.string :first_parent_tax_code
t.string :first_parent_citizenship
t.string :first_parent_address
t.string :first_parent_postal_code
t.string :first_parent_municipality
t.string :first_parent_province
t.string :first_parent_telephone
t.string :first_parent_email

# second parent
t.string :second_parent_first_name
t.string :second_parent_last_name
t.date :second_parent_born_at
t.string :second_parent_born_in
t.string :second_parent_tax_code
t.string :second_parent_citizenship
t.string :second_parent_address
t.string :second_parent_postal_code
t.string :second_parent_municipality
t.string :second_parent_province
t.string :second_parent_telephone
t.string :second_parent_email
end
end
end
26 changes: 25 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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_08_18_161003) do
ActiveRecord::Schema[7.2].define(version: 2024_08_24_101228) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -142,6 +142,30 @@
t.boolean "picture_disclaimer", default: false, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "first_parent_first_name"
t.string "first_parent_last_name"
t.date "first_parent_born_at"
t.string "first_parent_born_in"
t.string "first_parent_tax_code"
t.string "first_parent_citizenship"
t.string "first_parent_address"
t.string "first_parent_postal_code"
t.string "first_parent_municipality"
t.string "first_parent_province"
t.string "first_parent_telephone"
t.string "first_parent_email"
t.string "second_parent_first_name"
t.string "second_parent_last_name"
t.date "second_parent_born_at"
t.string "second_parent_born_in"
t.string "second_parent_tax_code"
t.string "second_parent_citizenship"
t.string "second_parent_address"
t.string "second_parent_postal_code"
t.string "second_parent_municipality"
t.string "second_parent_province"
t.string "second_parent_telephone"
t.string "second_parent_email"
t.index ["club_id"], name: "index_members_on_club_id"
end

Expand Down

0 comments on commit f8f680d

Please sign in to comment.