All current models have updated address fields and editing for new views is complete for color and object placement.

This commit is contained in:
Ben 2024-01-29 23:51:42 -06:00
parent 1656508ccd
commit d5e19f561e
18 changed files with 175 additions and 34 deletions

View File

@ -11,19 +11,38 @@
<% end %>
<div class="mb-3">
<%= form.label :first_name, class: 'form-label' %>
<%= form.label :first_name, 'First Name', class: 'form-label' %>
<%= form.text_field :first_name, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :last_name, class: 'form-label' %>
<%= form.label :last_name, 'Last Name', class: 'form-label' %>
<%= form.text_field :last_name, class: 'form-control' %>
</div>
<!-- Repeat for other attributes -->
<div class="mb-3">
<%= 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' %>
</div>
<div class="mb-3">
<%= form.label :address_line_2, 'Address Line 2' %>
<%= form.text_field :address_line_2, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :city %>
<%= form.text_field :city, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :state %>
<%= form.text_field :state, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :zip, 'ZIP' %>
<%= form.text_field :zip, class: 'form-control' %>
</div>
<div class="mb-3">
@ -56,8 +75,8 @@
<%= form.select :gender, ['Unknown', 'Female', 'Male', 'Non-Binary', 'Other'], {}, { class: 'form-select' } %>
</div>
<div class="actions text-center">
<%= form.submit class: 'btn btn-success' %>
<div class="actions">
<%= form.submit class: 'btn btn-dark' %>
</div>

View File

@ -23,7 +23,7 @@
<% @employers.each do |employer| %>
<tr>
<td><%= employer.first_name %> <%= employer.last_name %></td>
<td><%= employer.address %></td>
<td><%= [employer.address_line_1, employer.address_line_2, employer.city, employer.state, employer.zip].compact.join(', ') %></td>
<td><%= employer.phone %></td>
<td><%= employer.email %></td>
<td><%= employer.dob.strftime('%B %d, %Y') if employer.dob %></td>

View File

@ -5,7 +5,7 @@
<%= render 'form', employer: @employer %>
<div class="mt-3">
<div class="mt-3 text-center">
<%= link_to 'Back to List', employers_path, class: "btn btn-secondary" %>
</div>
</div>

View File

@ -12,7 +12,7 @@
<p class="card-text">
<strong>Address:</strong>
<%= @employer.address %>
<%= [employer.address_line_1, employer.address_line_2, employer.city, employer.state, employer.zip].compact.join(', ') %>
</p>
<p class="card-text">

View File

@ -21,9 +21,34 @@
</div>
<%# Address Line 1 Field %>
<div class="mb-3">
<%= 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' %>
</div>
<%# Address Line 2 Field %>
<div class="mb-3">
<%= form.label :address_line_2, 'Address Line 2', class: 'form-label' %>
<%= form.text_field :address_line_2, class: 'form-control' %>
</div>
<%# City Field %>
<div class="mb-3">
<%= form.label :city, class: 'form-label' %>
<%= form.text_field :city, class: 'form-control' %>
</div>
<%# State Field %>
<div class="mb-3">
<%= form.label :state, class: 'form-label' %>
<%= form.text_field :state, class: 'form-control' %>
</div>
<%# Zip Field %>
<div class="mb-3">
<%= form.label :zip, 'ZIP', class: 'form-label' %>
<%= form.text_field :zip, class: 'form-control' %>
</div>
<div class="mb-3">

View File

@ -27,7 +27,7 @@
<tr>
<td><%= participant.first_name %></td>
<td><%= participant.last_name %></td>
<td><%= participant.address %></td>
<td><%= [participant.address_line_1, participant.address_line_2, participant.city, participant.state, participant.zip].reject(&:blank?).join(', ') %></td>
<td><%= participant.phone %></td>
<td><%= participant.email %></td>
<td><%= participant.programs.map(&:name).join(", ") %></td>

View File

@ -13,7 +13,7 @@
<p class="card-text">
<strong>Address:</strong>
<%= @participant.address %>
<%= [@participant.address_line_1, @participant.address_line_2, @participant.city, @participant.state, @participant.zip].reject(&:blank?).join(', ') %>
</p>
<p class="card-text">

View File

@ -16,8 +16,28 @@
</div>
<div class="mb-3">
<%= 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' %>
</div>
<div class="mb-3">
<%= form.label :address_line_2, 'Address Line 2' %>
<%= form.text_field :address_line_2, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :city %>
<%= form.text_field :city, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :state %>
<%= form.text_field :state, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :zip, 'ZIP' %>
<%= form.text_field :zip, class: 'form-control' %>
</div>
<div class="mb-3">
@ -45,8 +65,8 @@
<%= form.text_field :contact, class: 'form-control', placeholder: 'Enter Contact Person here' %>
</div>
<div class="actions text-center">
<%= form.submit class: 'btn btn-primary' %>
<div class="actions">
<%= form.submit class: 'btn btn-dark' %>
</div>
<% end %>

View File

@ -22,7 +22,7 @@
<% @vendors.each do |vendor| %>
<tr>
<td><%= vendor.name %></td>
<td><%= vendor.address %></td>
<td><%= [vendor.address_line_1, vendor.address_line_2, vendor.city, vendor.state, vendor.zip].compact.join(', ') %></td>
<td><%= vendor.phone %></td>
<td><%= vendor.email %></td>
<td><%= vendor.dba %></td>

View File

@ -11,7 +11,7 @@
</p>
<p class="card-text">
<strong>Address:</strong>
<%= @vendor.address %>
<%= [vendor.address_line_1, vendor.address_line_2, vendor.city, vendor.state, vendor.zip].compact.join(', ') %>
</p>
<p class="card-text">
<strong>Phone:</strong>

View File

@ -11,18 +11,38 @@
<% end %>
<div class="mb-3">
<%= form.label :first_name, class: 'form-label' %>
<%= form.label :first_name, 'First Name', class: 'form-label' %>
<%= form.text_field :first_name, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :last_name, class: 'form-label' %>
<%= form.label :last_name, 'Last Name', class: 'form-label' %>
<%= form.text_field :last_name, class: 'form-control' %>
</div>
<div class="mb-3">
<%= 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' %>
</div>
<div class="mb-3">
<%= form.label :address_line_2, 'Address Line 2' %>
<%= form.text_field :address_line_2, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :city %>
<%= form.text_field :city, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :state %>
<%= form.text_field :state, class: 'form-control' %>
</div>
<div class="mb-3">
<%= form.label :zip, 'ZIP' %>
<%= form.text_field :zip, class: 'form-control' %>
</div>
<div class="mb-3">
@ -50,8 +70,8 @@
<%= form.select :gender, ['Unknown', 'Female', 'Male', 'Non-Binary', 'Other'], {}, class: 'form-select' %>
</div>
<div class="actions text-center">
<%= form.submit class: 'btn btn-primary' %>
<div class="actions">
<%= form.submit class: 'btn btn-dark' %>
</div>
<% end %>

View File

@ -22,7 +22,7 @@
<tr>
<td><%= worker.first_name %></td>
<td><%= worker.last_name %></td>
<td><%= worker.address %></td>
<td><%= [worker.address_line_1, worker.address_line_2, worker.city, worker.state, worker.zip].compact.join(', ') %></td>
<td><%= worker.phone %></td>
<td><%= worker.email %></td>
<td><%= worker.dob.strftime('%B %d, %Y') if worker.dob %></td>

View File

@ -11,7 +11,7 @@
</p>
<p class="card-text">
<strong>Address:</strong>
<%= @worker.address %>
<%= [worker.address_line_1, worker.address_line_2, worker.city, worker.state, worker.zip].compact.join(', ') %>
</p>
<p class="card-text">
<strong>Phone:</strong>

View File

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

View File

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

View File

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

View File

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

26
db/schema.rb generated
View File

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