app/views/estimation_statuses/_statuses_management.html.erb
<div>
<h5 class="blue"><%= I18n.t(:estimations_statuses) %></h5>
<table class="table tablesorterPager table-striped table-bordered table-condensed">
<thead>
<tr>
<th><%= I18n.t(:status_number) %></th>
<th><%= I18n.t(:alias) %></th>
<th><%= I18n.t(:name) %></th>
<th><%= I18n.t(:status_color) %></th>
<th><%= I18n.t(:description) %></th>
<th class="action"><%= I18n.t(:actions) %></th>
</tr>
</thead>
<tbody>
<% @organization.estimation_statuses.each do |estimation_status| %>
<tr>
<td style='width: 10px;'><%= estimation_status.status_number %></td>
<td><%= estimation_status.status_alias %></td>
<td><%= estimation_status.name %></td>
<td style='width: 10%; background-color: <%= "##{estimation_status.status_color}" %>'></td>
<td><%= estimation_status.description %></td>
<td class="center">
<%= link_to '', edit_estimation_status_path(estimation_status), :class => 'icon icon-pencil', :title => I18n.t('edit') %>
<% if can? :manage, EstimationStatus %>
<%= link_to '', estimation_status, confirm: I18n.t('are_you_sure'), method: :delete, :class => 'icon-trash', :style => 'color:red', :title => I18n.t('delete') %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
<%= render :partial => 'layouts/footer_table' %>
</table>
</div><br>
<% if @organization.estimation_statuses.length > 0 %>
<div>
<h5 class="blue"><%= I18n.t(:manage_estimations_statuses_workflow) %></h5>
<h5><%= I18n.t(:text_explain_estimation_status_workflow) %></h5>
<%= form_tag '/set_estimation_status_workflow', :method => 'POST', :class => 'simple_form' do %>
<%= hidden_field_tag "organization_id", @organization.id %>
<table class="table table-striped table-bordered table-condensed permissions">
<tr>
<th><%= I18n.t(:estimations_statuses) %></th>
<% @organization.estimation_statuses.each do |status| %>
<th><%= status.libelle %></th>
<% end %>
</tr>
<% @organization.estimation_statuses.each do |estimation_status| %>
<tr>
<td><%= estimation_status.libelle %></td>
<% @organization.estimation_statuses.each do |status| %>
<% if estimation_status == status %>
<td class="center">
<%= check_box_tag("status_workflow[#{status.id}][]", estimation_status.id, true, :disabled => true ) %>
</td>
<% else %>
<td class="center"><%= check_box_tag("status_workflow[#{status.id}][]", estimation_status.id, (status.to_transition_statuses.map(&:id).include? estimation_status.id)) %></td>
<% end %>
<% end %>
</tr>
<% end %>
</table>
<% if can? :manage, EstimationStatus %>
<%= submit_tag I18n.t('apply'), :class => 'btn' %>
<%= submit_tag I18n.t('cancel'), :class => 'btn' %>
<% end %>
<% end %>
</div><br>
<div>
<h5 class="blue"><%= I18n.t(:manage_estimations_statuses_roles) %></h5>
<h5><%= I18n.t(:text_explain_estimation_status_group_roles) %></h5>
<%= form_tag '/set_estimation_status_group_roles', :method => 'POST', :class => 'simple_form' do %>
<%= hidden_field_tag "organization_id", @organization.id %>
<table class="table table-striped table-bordered table-condensed permissions">
<tr>
<th></th>
<th colspan="<%= Group.all.length %>"> <%= I18n.t(:groups_and_roles) %> </th>
</tr>
<% if @organization_group.length >= 1 %>
<tr>
<th></th>
<% @organization_group.each do |group| %>
<th scope='colgroup'><%= group.name %></th>
<% end %>
</tr>
<tr>
<th colspan="<%= @organization_group.size + 1 %>" style="text-align: left"><%= I18n.t(:estimations_statuses) %></th>
</tr>
<% else %>
<tr>
<th></th>
<th><%= I18n.t(:no_group_in_organization, value: @organization.name) %></th>
</tr>
<tr>
<th style="text-align: left"><%= I18n.t(:estimations_statuses) %></th>
<th></th>
</tr>
<% end %>
<% @organization.estimation_statuses.each do |estimation_status| %>
<tr>
<td class="span2"><%= estimation_status.libelle %></td>
<% if @organization_group.length >= 1 %>
<% @organization_group.each do |group| %>
<td class="center span1">
<% esgr = EstimationStatusGroupRole.where(group_id: group.id,
estimation_status_id: estimation_status.id,
organization_id: @organization.id ).first %>
<%= select_tag("status_group_role[#{estimation_status.id}][#{group.id}]", options_for_select(@organization.project_security_levels.map{|i| [i.name, i.id]},
selected: esgr.nil? ? '' : esgr.project_security_level_id),
prompt: "Aucune permission",
class: "input-small") %>
</td>
<% end %>
<% else %>
<td></td>
<% end %>
</tr>
<% end %>
</table>
<% if can? :manage, EstimationStatus %>
<%= submit_tag I18n.t('apply'), :class => 'btn' %>
<%= submit_tag I18n.t('cancel'), :class => 'btn' %>
<% end %>
<% end %>
</div>
<% end %>