-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
me-1 back, thats spacing, update seeds
- Loading branch information
1 parent
c8a8421
commit 97bf854
Showing
15 changed files
with
116 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,9 @@ DB_NAME=employee360 | |
DB_USER=postgres | ||
DB_TEST_NAME=employee360_test | ||
HOST_URL=http://localhost:3001 | ||
INITIAL_SUPER_ADMIN_EMAIL = '[email protected]' | ||
INITIAL_SUPER_ADMIN_PASSWORD = 'testing123' | ||
INITIAL_ADMIN_EMAIL = '[email protected]' | ||
INITIAL_ADMIN_PASSWORD = 'testing123' | ||
INITIAL_USER_EMAIL = '[email protected]' | ||
INITIAL_USER_PASSWORD = 'testing123' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<h1 class="mt-3"><%= @salary_history.job_title %></h1> | ||
|
||
<p><strong>Salary:</strong> <%= @salary_history.salary %></p> | ||
<p><strong>Salary:</strong> <%= number_to_currency(@salary_history.salary) %></p> | ||
<p><strong>Change Date:</strong> <%= @salary_history.change_date %></p> | ||
<p><strong>Change Reason:</strong> <%= @salary_history.change_reason %></p> | ||
<p><strong>Current Salary:</strong> <%= @salary_history.current_salary %></p> | ||
<div class="btn-group" role="group" aria-label="Basic example"> | ||
<%= button_to "Edit", edit_user_salary_history_path(@user, @salary_history), class: "btn btn-secondary", method: :get %> | ||
<%= button_to "Delete", user_salary_history_path(@user, @salary_history), class: "btn btn-danger", method: :delete, data: { confirm: "Are you sure?" } %> | ||
<%= button_to "Back to Salary Histories", user_salary_histories_path(@user, @salary_histories), class: "btn btn-success", method: :get %> | ||
<%= button_to "Edit", edit_user_salary_history_path(@user, @salary_history), class: "btn btn-secondary me-1", method: :get %> | ||
<%= button_to "Delete", user_salary_history_path(@user, @salary_history), class: "btn btn-danger me-1", method: :delete, data: { confirm: "Are you sure?" } %> | ||
<%= button_to "Back to Salary Histories", user_salary_histories_path(@user, @salary_histories), class: "btn btn-success me-1", method: :get %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
<tr> | ||
<th>Start Date</th> | ||
<th>Last Promotion</th> | ||
<th>Due for Promotion</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
<div class="col-sm m-3"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h4 class="card-title">Salary History</h4> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Date</th> | ||
<th>Title</th> | ||
<th>Salary</th> | ||
<th>Change Reason</th> | ||
<th>Current Salary</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @user.salary_histories.order(change_date: :desc).each do |salary_history| %> | ||
<tr> | ||
<td><%= salary_history.change_date %></td> | ||
<td><%= salary_history.job_title %></td> | ||
<td> | ||
<details> | ||
<summary>Salary</summary> | ||
<%= salary_history.salary %> | ||
</details> | ||
</td> | ||
<td><%= salary_history.change_reason %></td> | ||
<td><%= salary_history.current_salary %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<h4>Salary History</h4> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Date</th> | ||
<th>Title</th> | ||
<th>Salary</th> | ||
<th>Change Reason</th> | ||
<th>Current Salary</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @user.salary_histories.order(change_date: :desc).each do |salary_history| %> | ||
<tr> | ||
<td><%= salary_history.change_date %></td> | ||
<td><%= salary_history.job_title %></td> | ||
<td> | ||
<details> | ||
<summary>Salary</summary> | ||
<%= number_to_currency(salary_history.salary) %> | ||
</details> | ||
</td> | ||
<td><%= salary_history.change_reason %></td> | ||
<td><%= salary_history.current_salary %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,65 @@ | ||
# Create a seeded Rob User with Superadmin role | ||
superadmin_email = '[email protected]' | ||
# This file should contain all the record creation | ||
# needed to seed the database with its default values. | ||
|
||
# Create a seeded Rob User with Superadmin role | ||
superadmin_salary_history = SalaryHistory.create( | ||
job_title: 'Superadmin Role Example Title', | ||
salary: 200000, | ||
change_date: Date.new(2015, 1, 1), | ||
change_reason: 'Annual Raise', | ||
current_salary: true, | ||
change_reason: 'New Hire', | ||
current_salary: true | ||
) | ||
|
||
User.create!( | ||
email: superadmin_email, | ||
password: 'testing123', | ||
roles: [:employee, :superadmin], | ||
name: 'Super Admin User', | ||
github_handle: 'superadmin', | ||
salary_histories: [superadmin_salary_history], | ||
) | ||
if ENV['INITIAL_SUPER_ADMIN_EMAIL'] && ENV['INITIAL_SUPER_ADMIN_PASSWORD'] | ||
superadmin = User.find_or_create_by(email: ENV['INITIAL_SUPER_ADMIN_EMAIL']) do |u| | ||
u.password = ENV['INITIAL_SUPER_ADMIN_PASSWORD'] | ||
u.role = 'superadmin' | ||
u.name = 'Super Admin User' | ||
u.github_handle = 'superadmin' | ||
u.review_document = 'https://example.com' | ||
end | ||
superadmin.salary_histories << superadmin_salary_history unless superadmin.salary_histories.include?(superadmin_salary_history) | ||
superadmin.save | ||
end | ||
|
||
# Create a seeded User with default Employee role | ||
employee_email = '[email protected]' | ||
# Create a seeded User with Admin role | ||
|
||
employee_salary_history = SalaryHistory.create( | ||
job_title: 'Employee Example Title', | ||
admin_salary_history = SalaryHistory.create( | ||
job_title: 'Admin Role Example Title', | ||
salary: 200000, | ||
change_date: Date.new(2015, 1, 1), | ||
change_reason: 'New Hire', | ||
current_salary: true, | ||
current_salary: true | ||
) | ||
|
||
User.create!( | ||
email: employee_email, | ||
password: 'testing123', | ||
name: 'Employee', | ||
github_handle: 'employee', | ||
salary_histories: [employee_salary_history], | ||
) | ||
if ENV['INITIAL_ADMIN_EMAIL'] && ENV['INITIAL_ADMIN_PASSWORD'] | ||
admin = User.find_or_create_by(email: ENV['INITIAL_ADMIN_EMAIL']) do |u| | ||
u.password = ENV['INITIAL_ADMIN_PASSWORD'] | ||
u.role = 'admin' | ||
u.name = 'Admin User' | ||
u.github_handle = 'admin' | ||
u.review_document = 'https://example.com' | ||
end | ||
admin.salary_histories << admin_salary_history unless admin.salary_histories.include?(admin_salary_history) | ||
admin.save | ||
end | ||
|
||
# # Admin is not a role in the application yet | ||
# # Create a seeded User with Admin role | ||
admin_email = '[email protected]' | ||
|
||
admin_salary_history = SalaryHistory.create( | ||
# Create a seeded User with default Employee role | ||
employee_salary_history = SalaryHistory.create( | ||
job_title: 'Employee Example Title', | ||
salary: 200000, | ||
change_date: Date.new(2015, 1, 1), | ||
change_reason: 'New Hire', | ||
current_salary: true, | ||
current_salary: true | ||
) | ||
|
||
User.create!( | ||
email: admin_email, | ||
password: 'testing123', | ||
name: 'Employee', | ||
github_handle: 'employee', | ||
roles: [:employee, :admin], | ||
salary_histories: [admin_salary_history], | ||
) | ||
|
||
# # Mentor is not a role in the application yet | ||
# # Create a seeded User with Mentor role | ||
# mentor_email = '[email protected]' | ||
|
||
# mentor_salary_history = SalaryHistory.create( | ||
# job_title: 'Employee with Mentor Role Example Title', | ||
# salary: 200000, | ||
# change_date: Date.new(2015, 1, 1), | ||
# change_reason: 'Annual Increase', | ||
# current_salary: true, | ||
# ) | ||
|
||
# User.create!( | ||
# email: mentor_email, | ||
# password: 'testing123', | ||
# name: 'Mentor User', | ||
# github_handle: 'mentor', | ||
# roles: [:employee, :mentor], | ||
# salary_histories: [mentor_salary_history], | ||
# ) | ||
if ENV['INITIAL_USER_EMAIL'] && ENV['INITIAL_USER_PASSWORD'] | ||
employee = User.find_or_create_by(email: ENV['INITIAL_USER_EMAIL']) do |u| | ||
u.password = ENV['INITIAL_USER_PASSWORD'] | ||
u.name = 'Default Employee User' | ||
u.github_handle = 'employee' | ||
u.review_document = 'https://example.com' | ||
end | ||
employee.salary_histories << employee_salary_history unless employee.salary_histories.include?(employee_salary_history) | ||
employee.save | ||
end |