mirror of
https://github.com/oonyeje/Pearlception_Website_RoR.git
synced 2025-12-25 03:37:40 +00:00
Create implemented Company
- Create route and view implemented with minimal info - index implemented and shows number of registered companies
This commit is contained in:
parent
ace1290a76
commit
7c6cf0f38d
@ -1,4 +1,4 @@
|
||||
class Company < ApplicationRecord
|
||||
belongs_to :user
|
||||
has_many :users
|
||||
has_many :runs
|
||||
end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
class User < ApplicationRecord
|
||||
has_one :company
|
||||
belongs_to :company
|
||||
has_many :runs
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
|
||||
@ -59,15 +59,14 @@
|
||||
</div>
|
||||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
||||
<h1 class="page-header">Companies</h1>
|
||||
<h2 class="sub-header">Registered Companies</h2>
|
||||
<div class="table-responsive">
|
||||
<h2 class="sub-header">Registered Companies: <%= @companies.count %> </h2>
|
||||
<div class="panel panel-primary table-responsive">
|
||||
<%= link_to(new_company_path, :method => :get) do %>
|
||||
<i class="fa fa-external-link"></i> Register a Company
|
||||
<% end %>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Company ID</th>
|
||||
<th>Company Name</th>
|
||||
<th>Registration Serial Key</th>
|
||||
@ -80,6 +79,27 @@
|
||||
</div>
|
||||
<% else %>
|
||||
<tbody>
|
||||
<% @companies.each_slice(1) do |row| %>
|
||||
<tr>
|
||||
<% row.each do |company|%>
|
||||
|
||||
<!-- company id -->
|
||||
<td>
|
||||
<%= company.id %>
|
||||
</td>
|
||||
|
||||
<!-- company_name -->
|
||||
<td>
|
||||
<%= company.company_name %>
|
||||
</td>
|
||||
|
||||
<!-- company registration token -->
|
||||
<td>
|
||||
<%= company.company_token %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
@ -159,48 +159,48 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% @results.each_slice(1) do |row| %>
|
||||
<tr>
|
||||
<% row.each do |result|
|
||||
run = Run.find(result.id) %>
|
||||
<!-- run date -->
|
||||
<td>
|
||||
<%= run.runDate %>
|
||||
</td>
|
||||
<% @results.each_slice(1) do |row| %>
|
||||
<tr>
|
||||
<% row.each do |result|
|
||||
run = Run.find(result.id) %>
|
||||
<!-- run date -->
|
||||
<td>
|
||||
<%= run.runDate %>
|
||||
</td>
|
||||
|
||||
<!-- location -->
|
||||
<td>
|
||||
<%= run.location ? run.location : "" %>
|
||||
</td>
|
||||
<!-- location -->
|
||||
<td>
|
||||
<%= run.location ? run.location : "" %>
|
||||
</td>
|
||||
|
||||
<!-- harvest time -->
|
||||
<td>
|
||||
<%= "" %>
|
||||
</td>
|
||||
<!-- harvest time -->
|
||||
<td>
|
||||
<%= "" %>
|
||||
</td>
|
||||
|
||||
<!-- supplier -->
|
||||
<td>
|
||||
<!-- supplier -->
|
||||
<td>
|
||||
|
||||
<%= run.supplier ? run.supplier : "" %>
|
||||
</td>
|
||||
<%= run.supplier ? run.supplier : "" %>
|
||||
</td>
|
||||
|
||||
<!-- distributor -->
|
||||
<td>
|
||||
<%= run.distributor ? run.distributor : "" %>
|
||||
</td>
|
||||
<!-- distributor -->
|
||||
<td>
|
||||
<%= run.distributor ? run.distributor : "" %>
|
||||
</td>
|
||||
|
||||
<!-- total processed -->
|
||||
<td>
|
||||
<%= result.total %>
|
||||
</td>
|
||||
<!-- total processed -->
|
||||
<td>
|
||||
<%= result.total %>
|
||||
</td>
|
||||
|
||||
<!-- other -->
|
||||
<td>
|
||||
<%= run.other ? run.other : "" %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- other -->
|
||||
<td>
|
||||
<%= run.other ? run.other : "" %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user