_samples.html.erb 3.6 KB
Newer Older
Sara Kuqi's avatar
Sara Kuqi committed
1
2
3
4
<script type="text/javascript">
$(document).ready(function(){
 $('#tab_logic tr.selekt .status').each(function(){
   console.log($(this).parent(".selekt"))
5
6
7
8
9
10
11
12
13
   if ($(this).text() =="in preparation") {
      $(this).parents(".selekt").css('background-color','#feffea');
   }
   else if ($(this).text() =="submitted") {
      $(this).parents(".selekt").css('background-color','#e2f7e7')
   }
   else {
    $(this).parents(".selekt").css('background-color','#f9e5ef')
   }
Sara Kuqi's avatar
Sara Kuqi committed
14
15
16
17
18
19
 });
});

</script>

<% if (current_page?('/samples, /index') || current_page?('/'))%>
20
<div class="panel panel-default">
Sara Kuqi's avatar
Sara Kuqi committed
21
22
  <%=render 'shared/sample_form'%><br>
<%end%>
Sara Kuqi's avatar
fc  
Sara Kuqi committed
23
<div class="container">
Sara Kuqi's avatar
Sara Kuqi committed
24
25
  <div class="row clearfix">
    <div class="col-md-12 column">
26
			<table  id="tab_logic" class="table table-hover table table-bordered " style="width:75%" >
Sara Kuqi's avatar
Sara Kuqi committed
27
28
29
30
31
32
33
34
35
36
37
38
39
  				<thead>
  					<tr>
  						<th class="text-center">
  							ID
  						</th>
  						<th class="text-center">
  							Name
  						</th>
  						<th class="text-center">
  							Formula
  						</th>
  						<th class="text-center">
  							Status
40
41
42
43
44
                <%if operator? && (current_page?('/samples, /index') || current_page?('/')) %>
                 <%= link_to '<i class="fa fa-hourglass-half" aria-hidden="true"></i>'.html_safe,samples_path(status: "in preparation"),{:style=>'color:#000;', class: "btn btn-default" }%>
                 <%= link_to '<i class="fa fa-line-chart" aria-hidden="true"></i>'.html_safe,samples_path(status: "submitted"),{:style=>'color:#000;', class: "btn btn-default" }  %>
                 <%= link_to '<i class="fa fa-check-square-o" aria-hidden="true"></i>'.html_safe,samples_path(status: "measured"),{:style=>'color:#000;', class: "btn btn-default" }%>
                <%end%>
Sara Kuqi's avatar
Sara Kuqi committed
45
46
47
48
49
  						</th>
              <%if operator?%>
              <th class="text-center">
                Email
              </th>
Sara Kuqi's avatar
Sara Kuqi committed
50
              <%end%>
Sara Kuqi's avatar
Sara Kuqi committed
51
52
53
54
55
56
57
58
59
60
              <th class="text-center">
                Action
              </th>
  					</tr>
  				</thead>
  				<tbody>
            <%@samples.each do |sample|%>
  					<tr class="selekt">
  						<td>
               <%="#{sample.id}"%>
61
62
63
               <%=link_to '<i class="fa fa-caret-square-o-left" aria-hidden="true"></i>'.html_safe, sample, remote: true%>

              </td>
Sara Kuqi's avatar
Sara Kuqi committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
  						<td>
  					    <span class="name"><%= sample.name %></span>
  						</td>
  						<td>
  						  <span class="formula"><%= add_subscript(sample.formula) %></span>
  						</td>
  						<td>
                 <span class="status"><%= sample.status %></span>
  						</td>
              <%if operator?%>
              <td>
                 <span class="email"><%= sample.try(:user).try(:email) %></span>
              </td>
              <%end%>
              <td>
79
80
81
                <%if (operator? && (sample.status=="in preparation" || sample.status=="submitted")) || (!operator? && sample.status=='in preparation') %>
                <%=link_to '<i class="fa fa-pencil-square-o" aria-hidden="true"></i>'.html_safe, edit_sample_path(sample), remote: true %>
                <%end%>
Sara Kuqi's avatar
Sara Kuqi committed
82
                <% if current_user?(sample.user) && sample.status == "in preparation" %>
83
84
                <%= link_to '<i class="fa fa-trash" aria-hidden="true"></i>'.html_safe, sample, method: :delete,
                                               data: { confirm: "You sure?"}%>
Sara Kuqi's avatar
Sara Kuqi committed
85
86
87
88
89
90
                <%end%>
  				   </tr>
             <%end%>
  				</tbody>
  			</table>
    </div>
91
   </div>
Sara Kuqi's avatar
Sara Kuqi committed
92
  </div>
93
 </div>
94
95
96
97
98
99
100
 <%if @sample.persisted?%>
   <div class="panel panel-default" id="show">
   <%= render 'samples/show'%>
 </div>
 <%else%>
 <div class="panel panel-default" id="show" style="display:none;"></div>
 <%end%>