diff --git a/app/views/employers/_form.html.erb b/app/views/employers/_form.html.erb index ca171a0..d867f39 100644 --- a/app/views/employers/_form.html.erb +++ b/app/views/employers/_form.html.erb @@ -11,19 +11,38 @@ <% end %>
- <%= form.label :first_name, class: 'form-label' %> + <%= form.label :first_name, 'First Name', class: 'form-label' %> <%= form.text_field :first_name, class: 'form-control' %>
- <%= form.label :last_name, class: 'form-label' %> - <%= form.text_field :last_name, class: 'form-control' %> + <%= form.label :last_name, 'Last Name', class: 'form-label' %> + <%= form.text_field :last_name, class: 'form-control' %>
-
- <%= form.label :address, class: 'form-label' %> - <%= form.text_area :address, rows: 1, class: 'form-control auto-expand' %> + <%= form.label :address_line_1, 'Address Line 1' %> + <%= form.text_field :address_line_1, class: 'form-control' %> +
+ +
+ <%= form.label :address_line_2, 'Address Line 2' %> + <%= form.text_field :address_line_2, class: 'form-control' %> +
+ +
+ <%= form.label :city %> + <%= form.text_field :city, class: 'form-control' %> +
+ +
+ <%= form.label :state %> + <%= form.text_field :state, class: 'form-control' %> +
+ +
+ <%= form.label :zip, 'ZIP' %> + <%= form.text_field :zip, class: 'form-control' %>
@@ -56,8 +75,8 @@ <%= form.select :gender, ['Unknown', 'Female', 'Male', 'Non-Binary', 'Other'], {}, { class: 'form-select' } %>
-
- <%= form.submit class: 'btn btn-success' %> +
+ <%= form.submit class: 'btn btn-dark' %>
diff --git a/app/views/employers/index.html.erb b/app/views/employers/index.html.erb index ab7724d..c282731 100644 --- a/app/views/employers/index.html.erb +++ b/app/views/employers/index.html.erb @@ -23,7 +23,7 @@ <% @employers.each do |employer| %> <%= employer.first_name %> <%= employer.last_name %> - <%= employer.address %> + <%= [employer.address_line_1, employer.address_line_2, employer.city, employer.state, employer.zip].compact.join(', ') %> <%= employer.phone %> <%= employer.email %> <%= employer.dob.strftime('%B %d, %Y') if employer.dob %> diff --git a/app/views/employers/new.html.erb b/app/views/employers/new.html.erb index 33da04d..c668b08 100644 --- a/app/views/employers/new.html.erb +++ b/app/views/employers/new.html.erb @@ -5,7 +5,7 @@ <%= render 'form', employer: @employer %> -
+
<%= link_to 'Back to List', employers_path, class: "btn btn-secondary" %>
diff --git a/app/views/employers/show.html.erb b/app/views/employers/show.html.erb index fc21542..e48defb 100644 --- a/app/views/employers/show.html.erb +++ b/app/views/employers/show.html.erb @@ -12,7 +12,7 @@

Address: - <%= @employer.address %> + <%= [employer.address_line_1, employer.address_line_2, employer.city, employer.state, employer.zip].compact.join(', ') %>

diff --git a/app/views/participants/_form.html.erb b/app/views/participants/_form.html.erb index c559321..9e84ea6 100644 --- a/app/views/participants/_form.html.erb +++ b/app/views/participants/_form.html.erb @@ -21,9 +21,34 @@

+ <%# Address Line 1 Field %>
- <%= form.label :address, class: 'form-label' %> - <%= form.text_area :address, rows: 1, class: 'form-control auto-expand' %> + <%= form.label :address_line_1, 'Address Line 1', class: 'form-label' %> + <%= form.text_field :address_line_1, class: 'form-control' %> +
+ + <%# Address Line 2 Field %> +
+ <%= form.label :address_line_2, 'Address Line 2', class: 'form-label' %> + <%= form.text_field :address_line_2, class: 'form-control' %> +
+ + <%# City Field %> +
+ <%= form.label :city, class: 'form-label' %> + <%= form.text_field :city, class: 'form-control' %> +
+ + <%# State Field %> +
+ <%= form.label :state, class: 'form-label' %> + <%= form.text_field :state, class: 'form-control' %> +
+ + <%# Zip Field %> +
+ <%= form.label :zip, 'ZIP', class: 'form-label' %> + <%= form.text_field :zip, class: 'form-control' %>
diff --git a/app/views/participants/index.html.erb b/app/views/participants/index.html.erb index 01479a5..de682f9 100644 --- a/app/views/participants/index.html.erb +++ b/app/views/participants/index.html.erb @@ -27,7 +27,7 @@ <%= participant.first_name %> <%= participant.last_name %> - <%= participant.address %> + <%= [participant.address_line_1, participant.address_line_2, participant.city, participant.state, participant.zip].reject(&:blank?).join(', ') %> <%= participant.phone %> <%= participant.email %> <%= participant.programs.map(&:name).join(", ") %> diff --git a/app/views/participants/show.html.erb b/app/views/participants/show.html.erb index c0b01b4..ad2cbee 100644 --- a/app/views/participants/show.html.erb +++ b/app/views/participants/show.html.erb @@ -13,7 +13,7 @@

Address: - <%= @participant.address %> + <%= [@participant.address_line_1, @participant.address_line_2, @participant.city, @participant.state, @participant.zip].reject(&:blank?).join(', ') %>

diff --git a/app/views/vendors/_form.html.erb b/app/views/vendors/_form.html.erb index eefcc98..bb962e5 100644 --- a/app/views/vendors/_form.html.erb +++ b/app/views/vendors/_form.html.erb @@ -16,8 +16,28 @@

- <%= form.label :address, class: 'form-label' %> - <%= form.text_area :address, rows: 1, class: 'form-control auto-expand' %> + <%= form.label :address_line_1, 'Address Line 1' %> + <%= form.text_field :address_line_1, class: 'form-control' %> +
+ +
+ <%= form.label :address_line_2, 'Address Line 2' %> + <%= form.text_field :address_line_2, class: 'form-control' %> +
+ +
+ <%= form.label :city %> + <%= form.text_field :city, class: 'form-control' %> +
+ +
+ <%= form.label :state %> + <%= form.text_field :state, class: 'form-control' %> +
+ +
+ <%= form.label :zip, 'ZIP' %> + <%= form.text_field :zip, class: 'form-control' %>
@@ -45,8 +65,8 @@ <%= form.text_field :contact, class: 'form-control', placeholder: 'Enter Contact Person here' %>
-
- <%= form.submit class: 'btn btn-primary' %> +
+ <%= form.submit class: 'btn btn-dark' %>
<% end %> diff --git a/app/views/vendors/index.html.erb b/app/views/vendors/index.html.erb index 24dac43..95d6619 100644 --- a/app/views/vendors/index.html.erb +++ b/app/views/vendors/index.html.erb @@ -22,7 +22,7 @@ <% @vendors.each do |vendor| %> <%= vendor.name %> - <%= vendor.address %> + <%= [vendor.address_line_1, vendor.address_line_2, vendor.city, vendor.state, vendor.zip].compact.join(', ') %> <%= vendor.phone %> <%= vendor.email %> <%= vendor.dba %> diff --git a/app/views/vendors/show.html.erb b/app/views/vendors/show.html.erb index 68e3bd6..5622aa7 100644 --- a/app/views/vendors/show.html.erb +++ b/app/views/vendors/show.html.erb @@ -11,7 +11,7 @@

Address: - <%= @vendor.address %> + <%= [vendor.address_line_1, vendor.address_line_2, vendor.city, vendor.state, vendor.zip].compact.join(', ') %>

Phone: diff --git a/app/views/workers/_form.html.erb b/app/views/workers/_form.html.erb index 429336e..e5e06af 100644 --- a/app/views/workers/_form.html.erb +++ b/app/views/workers/_form.html.erb @@ -11,18 +11,38 @@ <% end %>

- <%= form.label :first_name, class: 'form-label' %> + <%= form.label :first_name, 'First Name', class: 'form-label' %> <%= form.text_field :first_name, class: 'form-control' %>
- <%= form.label :last_name, class: 'form-label' %> + <%= form.label :last_name, 'Last Name', class: 'form-label' %> <%= form.text_field :last_name, class: 'form-control' %>
- <%= form.label :address, class: 'form-label' %> - <%= form.text_area :address, rows: 1, class: 'form-control auto-expand' %> + <%= form.label :address_line_1, 'Address Line 1' %> + <%= form.text_field :address_line_1, class: 'form-control' %> +
+ +
+ <%= form.label :address_line_2, 'Address Line 2' %> + <%= form.text_field :address_line_2, class: 'form-control' %> +
+ +
+ <%= form.label :city %> + <%= form.text_field :city, class: 'form-control' %> +
+ +
+ <%= form.label :state %> + <%= form.text_field :state, class: 'form-control' %> +
+ +
+ <%= form.label :zip, 'ZIP' %> + <%= form.text_field :zip, class: 'form-control' %>
@@ -50,8 +70,8 @@ <%= form.select :gender, ['Unknown', 'Female', 'Male', 'Non-Binary', 'Other'], {}, class: 'form-select' %>
-
- <%= form.submit class: 'btn btn-primary' %> +
+ <%= form.submit class: 'btn btn-dark' %>
<% end %> diff --git a/app/views/workers/index.html.erb b/app/views/workers/index.html.erb index 89637aa..7237f37 100644 --- a/app/views/workers/index.html.erb +++ b/app/views/workers/index.html.erb @@ -22,7 +22,7 @@ <%= worker.first_name %> <%= worker.last_name %> - <%= worker.address %> + <%= [worker.address_line_1, worker.address_line_2, worker.city, worker.state, worker.zip].compact.join(', ') %> <%= worker.phone %> <%= worker.email %> <%= worker.dob.strftime('%B %d, %Y') if worker.dob %> diff --git a/app/views/workers/show.html.erb b/app/views/workers/show.html.erb index 23114dd..a618d48 100644 --- a/app/views/workers/show.html.erb +++ b/app/views/workers/show.html.erb @@ -11,7 +11,7 @@

Address: - <%= @worker.address %> + <%= [worker.address_line_1, worker.address_line_2, worker.city, worker.state, worker.zip].compact.join(', ') %>

Phone: diff --git a/db/migrate/20240130041504_update_address_in_participants.rb b/db/migrate/20240130041504_update_address_in_participants.rb new file mode 100644 index 0000000..871e566 --- /dev/null +++ b/db/migrate/20240130041504_update_address_in_participants.rb @@ -0,0 +1,10 @@ +class UpdateAddressInParticipants < ActiveRecord::Migration[7.1] + def change + add_column :participants, :address_line_1, :string + add_column :participants, :address_line_2, :string + add_column :participants, :city, :string + add_column :participants, :state, :string + add_column :participants, :zip, :string + remove_column :participants, :address, :string + end +end diff --git a/db/migrate/20240130042522_update_address_in_employers.rb b/db/migrate/20240130042522_update_address_in_employers.rb new file mode 100644 index 0000000..b5c044b --- /dev/null +++ b/db/migrate/20240130042522_update_address_in_employers.rb @@ -0,0 +1,10 @@ +class UpdateAddressInEmployers < ActiveRecord::Migration[7.1] + def change + add_column :employers, :address_line_1, :string + add_column :employers, :address_line_2, :string + add_column :employers, :city, :string + add_column :employers, :state, :string + add_column :employers, :zip, :string + remove_column :employers, :address, :string + end +end diff --git a/db/migrate/20240130043224_update_address_in_workers.rb b/db/migrate/20240130043224_update_address_in_workers.rb new file mode 100644 index 0000000..b7ca179 --- /dev/null +++ b/db/migrate/20240130043224_update_address_in_workers.rb @@ -0,0 +1,11 @@ +class UpdateAddressInWorkers < ActiveRecord::Migration[7.1] + def change + add_column :workers, :address_line_1, :string + add_column :workers, :address_line_2, :string + add_column :workers, :city, :string + add_column :workers, :state, :string + add_column :workers, :zip, :string + remove_column :workers, :address, :string + end +end + diff --git a/db/migrate/20240130051346_update_address_in_vendors.rb b/db/migrate/20240130051346_update_address_in_vendors.rb new file mode 100644 index 0000000..c10cf83 --- /dev/null +++ b/db/migrate/20240130051346_update_address_in_vendors.rb @@ -0,0 +1,10 @@ +class UpdateAddressInVendors < ActiveRecord::Migration[7.1] + def change + add_column :vendors, :address_line_1, :string + add_column :vendors, :address_line_2, :string + add_column :vendors, :city, :string + add_column :vendors, :state, :string + add_column :vendors, :zip, :string + remove_column :vendors, :address, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 7ae1686..b27529d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,10 +10,9 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_01_30_033832) do +ActiveRecord::Schema[7.1].define(version: 2024_01_30_051346) do create_table "employers", force: :cascade do |t| t.string "first_name" - t.string "address" t.string "phone" t.string "email" t.string "tin" @@ -23,6 +22,11 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_30_033832) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "last_name" + t.string "address_line_1" + t.string "address_line_2" + t.string "city" + t.string "state" + t.string "zip" end create_table "employers_vendors", id: false, force: :cascade do |t| @@ -43,7 +47,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_30_033832) do create_table "participants", force: :cascade do |t| t.string "first_name" - t.string "address" t.string "phone" t.string "email" t.string "mci" @@ -55,6 +58,11 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_30_033832) do t.datetime "updated_at", null: false t.integer "worker_id" t.string "last_name" + t.string "address_line_1" + t.string "address_line_2" + t.string "city" + t.string "state" + t.string "zip" t.index ["employer_id"], name: "index_participants_on_employer_id" t.index ["last_name"], name: "index_participants_on_last_name" t.index ["mci"], name: "index_participants_on_mci" @@ -92,7 +100,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_30_033832) do create_table "vendors", force: :cascade do |t| t.string "name" - t.string "address" t.string "phone" t.string "email" t.string "dba" @@ -101,11 +108,15 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_30_033832) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "contact" + t.string "address_line_1" + t.string "address_line_2" + t.string "city" + t.string "state" + t.string "zip" end create_table "workers", force: :cascade do |t| t.string "name" - t.string "address" t.string "phone" t.string "email" t.date "dob" @@ -115,6 +126,11 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_30_033832) do t.datetime "updated_at", null: false t.string "first_name" t.string "last_name" + t.string "address_line_1" + t.string "address_line_2" + t.string "city" + t.string "state" + t.string "zip" end add_foreign_key "employments", "participants"