Skip to content

Commit

Permalink
Changes employees index.
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusbsilva committed Jun 20, 2017
1 parent 4015eee commit 89757cf
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 26 deletions.
76 changes: 55 additions & 21 deletions app/views/employees/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,27 +1,61 @@

<%= render "layouts/navbar" %>
<h1 class="text-uppercase text-center" id="title-list"><span class="glyphicon glyphicon-list text-left"></span> Lista de Funcionários</h1>
<hr>
<section class="content-section" id="alumns-list">
<% @employees.each do |employee| %>
<div class="container">
<div class="row item">
<div class="col-sm-12 col-md-4">
<%= image_tag("avatar_250x300.png", alt: "", class: "img-responsive" ) %>
</div>
<div class="col-sm-12 col-md-8 text-capitalize descript">
<h2><%= employee.name %></h2>
<h4> <%= employee.address %> </h4>
<h4> <%= employee.birth_date.day %>/<%= employee.birth_date.month %>/<%= employee.birth_date.year %> </h4>
<h4> <%= employee.gender %> </h4>
<h4> <%= employee.phone %> </h4>
<h4><%= employee.registry %></h4>
<%= link_to '<span class="fa fa-search-plus"></span> Visualizar'.html_safe, employee_path(employee), class:'btn btn-info' %>
<%if is_principal? %>
<%= link_to '<span class="fa fa-unlock"></span> Resetar senha'.html_safe, edit_password_employee_path(employee), class:'btn btn-default' %>
<% if flash[:alert]%>
<br>
<br>
<div class="alert alert-danger" role = "alert"><%= flash[:alert]%></div>
<% end %>
<% if flash[:success]%>
<div class="alert alert-success" role = "alert"><%= flash[:success]%></div>
<% end %>
<% @employees.each do |employee|%>
<div class="container">
<div class="row item">
<% if (employee.is_a?(Principal)) %>
<div class="col-sm-12 col-md-4">
<%= image_tag("avatar_250x300.png", alt: "", class: "img-responsive" ) %>
</div>
<div class="col-sm-12 col-md-8 text-capitalize descript">
<h2><%= employee.name %></h2>
<h6 class="text-muted">Diretor</h6>
<h4>Endereço: <%= employee.address %> </h4>
<h4>Data de Aniversário: <%= employee.birth_date.day %>/<%= employee.birth_date.month %>/<%= employee.birth_date.year %> </h4>
<h4>Sexo: <%= employee.gender %> </h4>
<h4>Telefone: <%= employee.phone %> </h4>
<h4>Matrícula: <%= employee.registry %></h4>
<%= link_to '<span class="fa fa-search-plus"></span> Visualizar'.html_safe, principal_path(employee), class:'btn btn-suspension-show' %>
<%= link_to '<span class="fa fa-unlock"></span> Resetar senha'.html_safe, edit_password_employee_path(employee), class:'btn btn-default' %>
</div>
<% else %>
<div class="col-sm-12 col-md-4">
<%= image_tag("avatar_250x300.png", alt: "", class: "img-responsive" ) %>
</div>
<div class="col-sm-12 col-md-8 text-capitalize descript">
<h2><%= employee.name %></h2>
<% if employee.is_a?(Teacher) %>
<h6 class="text-danger">Professor</h6>
<% elsif employee.is_a?(Secretary) %>
<h6 class="text-warning">Secretário</h6>
<% elsif is_principal? %>
<h6 class="text-muted">Diretor</h6>
<%end%>
<h4>Endereço: <%= employee.address %> </h4>
<h4>Data de Aniversário: <%= employee.birth_date.day %>/<%= employee.birth_date.month %>/<%= employee.birth_date.year %> </h4>
<h4>Sexo: <%= employee.gender %> </h4>
<h4>Telefone: <%= employee.phone %> </h4>
<h4>Matrícula: <%= employee.registry %></h4>
<% if employee.is_a?(Teacher) %>
<%= link_to '<span class="fa fa-search-plus"></span> Visualizar'.html_safe, teacher_path(employee), class:'btn btn-info' %>
<% elsif employee.is_a?(Secretary) %>
<%= link_to '<span class="fa fa-search-plus"></span> Visualizar'.html_safe, secretary_path(employee), class:'btn btn-info' %>
<%end%>
<% if is_principal? %>
<%= link_to '<span class="fa fa-unlock"></span> Resetar senha'.html_safe, edit_password_employee_path(employee), class:'btn btn-default' %>
<%end%>
</div>
<% end %>
</div>
<hr>
</div>
<hr>
</div>
<% end %>
</section>
6 changes: 1 addition & 5 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
Shift.create(name_shift: "Noturno")
Shift.create(name_shift: "Diurno")

photofile = "app/assets/images/boletim.png"
fin = File.open(photofile, "rb")
teste = fin.read

Secretary.create(permission: 'Secretary', registry: '456456', employee_cpf: '44662111676',
name: "Tia Hillary", address: "Beco dos Desiludidos", gender: "Feminino",
shift: 'Matutino', password_digest: '12345678', birth_date: '03-03-2000',
Expand Down Expand Up @@ -68,7 +64,7 @@
phone: '6140028922', password: '12345678', birth_date: '10-10-1991',
registry: '654321', shift: "matutino", gender:"Masculino",
parent_id: Parent.last.id,classroom_id: Classroom.last.id,
photo: teste , bar_code: "123456")
bar_code: "123456")

Parent.create!(name: 'George-Michael Bluth', address: 'rua do iorgut batravo',
phone: '6155501234', password: '12345678', birth_date: '10-10-1990',
Expand Down

0 comments on commit 89757cf

Please sign in to comment.