From 89757cf53178d9d9210621a68ca57fe8d27412c1 Mon Sep 17 00:00:00 2001 From: matheusbsilva Date: Tue, 20 Jun 2017 19:34:46 +0000 Subject: [PATCH] Changes employees index. --- app/views/employees/index.html.erb | 76 +++++++++++++++++++++--------- db/seeds.rb | 6 +-- 2 files changed, 56 insertions(+), 26 deletions(-) diff --git a/app/views/employees/index.html.erb b/app/views/employees/index.html.erb index 3ea131f..94061a9 100644 --- a/app/views/employees/index.html.erb +++ b/app/views/employees/index.html.erb @@ -1,27 +1,61 @@ + <%= render "layouts/navbar" %> -

Lista de Funcionários

-
-
- <% @employees.each do |employee| %> -
-
-
- <%= image_tag("avatar_250x300.png", alt: "", class: "img-responsive" ) %> -
-
-

<%= employee.name %>

-

<%= employee.address %>

-

<%= employee.birth_date.day %>/<%= employee.birth_date.month %>/<%= employee.birth_date.year %>

-

<%= employee.gender %>

-

<%= employee.phone %>

-

<%= employee.registry %>

- <%= link_to ' Visualizar'.html_safe, employee_path(employee), class:'btn btn-info' %> - <%if is_principal? %> - <%= link_to ' Resetar senha'.html_safe, edit_password_employee_path(employee), class:'btn btn-default' %> +<% if flash[:alert]%> +
+
+ +<% end %> +<% if flash[:success]%> + +<% end %> + <% @employees.each do |employee|%> +
+
+ <% if (employee.is_a?(Principal)) %> +
+ <%= image_tag("avatar_250x300.png", alt: "", class: "img-responsive" ) %> +
+
+

<%= employee.name %>

+
Diretor
+

Endereço: <%= employee.address %>

+

Data de Aniversário: <%= employee.birth_date.day %>/<%= employee.birth_date.month %>/<%= employee.birth_date.year %>

+

Sexo: <%= employee.gender %>

+

Telefone: <%= employee.phone %>

+

Matrícula: <%= employee.registry %>

+ <%= link_to ' Visualizar'.html_safe, principal_path(employee), class:'btn btn-suspension-show' %> + <%= link_to ' Resetar senha'.html_safe, edit_password_employee_path(employee), class:'btn btn-default' %> +
+ <% else %> +
+ <%= image_tag("avatar_250x300.png", alt: "", class: "img-responsive" ) %> +
+
+

<%= employee.name %>

+ <% if employee.is_a?(Teacher) %> +
Professor
+ <% elsif employee.is_a?(Secretary) %> +
Secretário
+ <% elsif is_principal? %> +
Diretor
+ <%end%> +

Endereço: <%= employee.address %>

+

Data de Aniversário: <%= employee.birth_date.day %>/<%= employee.birth_date.month %>/<%= employee.birth_date.year %>

+

Sexo: <%= employee.gender %>

+

Telefone: <%= employee.phone %>

+

Matrícula: <%= employee.registry %>

+ <% if employee.is_a?(Teacher) %> + <%= link_to ' Visualizar'.html_safe, teacher_path(employee), class:'btn btn-info' %> + <% elsif employee.is_a?(Secretary) %> + <%= link_to ' Visualizar'.html_safe, secretary_path(employee), class:'btn btn-info' %> + <%end%> + <% if is_principal? %> + <%= link_to ' Resetar senha'.html_safe, edit_password_employee_path(employee), class:'btn btn-default' %> + <%end%> +
<% end %>
+
-
-
<% end %>
diff --git a/db/seeds.rb b/db/seeds.rb index 6188158..a9376eb 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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', @@ -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',