1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| <p id="notice"><%= notice %></p>
<h1>Liste des incidents de <%= @user.name %> <%= @user.surname%></h1>
<% if !is_tech?%>
<table>
<thead>
<tr>
<th>Titre</th>
<th>Contenu</th>
<th>Utilisateur</th>
<th>Technicien</th>
<th>Categorie</th>
<th>Date de l'évènement</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @user.incidents.each do |user| %>
<% if !is_clotured?(user) %>
<tr>
<td><%= user.title %></td>
<td><%= user.content %></td>
<td><%= @user.name %></td>
<td><%= User.find_by_sql("SELECT `users`.* FROM `users` WHERE `id` = #{user.techuser_id}").collect{ |u| [u.surname, u.name]}.join(" ") %></td>
<td><%= user.category.name %></td>
<td><%= user.date_evenement %></td>
<td><%= link_to 'Voir le détail d\'incident', incident_path(user) %></td>
<td><%= link_to "cloturer", clotured_incident_path(user), method: :put%></td>
<% if is_tech? %>
<td><%= link_to 'Editer l\'incident', edit_incident_path(user) %></td>
<td><%= link_to 'Effacer l\'incident', incident_path(user), method: :delete, data: { confirm: 'Êtes vous sûr ?' } %></td>
<% end %>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<%end%>
<!--#FOR TECH BOTTOM !-->
<% if is_tech?%>
<table>
<thead>
<tr>
<th>Titre</th>
<th>Contenu</th>
<th>Date</th>
<th>Utilisateur</th>
<th>Technicien</th>
<th>Categorie</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<tr>
<% User.find_by_sql("SELECT `incidents`.* FROM `incidents` WHERE `techuser_id` = #{@user.id}").each do |incident|%>
<td><%= incident.title %></td>
<td><%= incident.content %></td>
<td><%= incident.created_at %></td>
<td><%= User.find_by_sql("SELECT `users`.* FROM `users` WHERE `id` = #{incident.user_id}").collect{|u| [u.name, u.surname]}.join(" ") %></td>
<td><%= current_user.name %><%= current_user.surname %></td>
<td><%= User.find_by_sql("SELECT `categories`.* FROM `categories` WHERE `id` = #{incident.category_id}").collect{|u| u.name}.join(" ") %></td>
<td><%= link_to 'Voir le détail d\'incident', incident_path(incident) %></td>
<td><%= link_to 'Editer l\'incident', edit_incident_path(incident) %></td>
<td><%= link_to 'Effacer l\'incident', incident_path(incident), method: :delete, data: { confirm: 'Êtes vous sûr ?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<%= link_to "Tous les incidents", incidents_path %>
<%= link_to 'Editer l\'utilisateur', edit_user_path(@user) %> |
<%= link_to 'Retour à la liste des utilisateurs', users_path %>
<% end %> |
Partager