<commit_before><% content_for :additional_javascripts do %>
  <%= javascript_include_tag 'dashboard' %>
<% end %>
<% content_for :right_column do %>
  <%= render :partial => "common/user_info" %>

  <% if can?(:manage, EnrollmentSemester) %>
    <div class="section">
      <div class="section-header ">
        <h4 class="pull-left">
          <%=t :label_deadline_plural %>
        </h4>
        <%= link_to t(:label_manage), edit_enrollment_semester_path(current_semester), :class => 'pull-right inline-icon inline-icon-red inline-icon-manage' %>
        <div class="clearfix"></div>
        <hr>
      </div>
      <div class="subsection">
        <div class="subsection-header ">
          <h5><%=t :label_thesis_plural %></h5>
          <hr>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_enrollment_begin %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%= current_semester.thesis_enrollments_begin.present? ? l( current_semester.thesis_enrollments_begin) : "-" %>
            </h6>
          </div>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_enrollment_end %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%= current_semester.thesis_enrollments_end.present? ? l( current_semester.thesis_enrollments_end) : "-" %>
            </h6>
          </div>
        </div>
      </div>
      <div class="subsection">
        <div class="subsection-header">
          <h5><%=t :label_elective_block_plural%></h5>
          <hr>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_enrollment_begin %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%= current_semester.elective_enrollments_begin.present? ? l( current_semester.elective_enrollments_begin) : "-" %>
            </h6>
          </div>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_enrollment_end %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%= current_semester.elective_enrollments_end.present? ? l( current_semester.elective_enrollments_end) : "-" %>
            </h6>
          </div>
        </div>
        <div class="section-header">
          <hr>
        </div>
      </div>
    </div>
  <% end %>

  <% if current_user.employee? && cannot?(:manage, Diamond::Thesis) %>
    <div class="section">
      <div class="section-header">
        <h4>
          <%=t :label_statistics %>
        </h4>
        <hr>
      </div>
      <div class="subsection">
        <div class="subsection-header ">
          <% if can?(:manage_own, Diamond::Thesis) %>
            <h5><%=t :label_thesis_plural%></h5>
          <% elsif can?(:manage_department, Diamond::Thesis) %>
            <h5><%=t :label_thesis_plural_department%></h5>
          <% end %>
          <hr>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_thesis_proposed_count%>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%=t 'misc.thesis_proposed', :count => @proposed_theses %>
            </h6>
          </div>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_status_accepted%>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%=t 'misc.thesis_accepted', :count => @accepted_theses %>
            </h6>
          </div>
        </div>
        <% if @unaccepted_theses %>
          <div class="row">
            <div class="col-md-8">
              <h6 class="text-muted">
                <%=t :label_filter_unaccepted%>
              </h6>
            </div>
            <div class="col-md-8">
              <h6>
                <%=t 'misc.thesis_not_accepted', :count => @unaccepted_theses %>
              </h6>
            </div>
          </div>
        <% end %>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_thesis_enrolled_count%>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%=t 'misc.thesis_chosen', :count => @chosen_theses %>
            </h6>
          </div>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_thesis_not_enrolled_count %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%=t 'misc.thesis_not_chosen', :count => @not_chosen_theses %>
            </h6>
          </div>
        </div>
      </div>
      <div class="section-footer">
        <hr>
      </div>
    </div>
  <% end %>
  <% if can?(:read, :theses_reports) %>
    <div class="section">
      <div class="section-header">
        <h4>
          <%=t :label_report_plural %>
        </h4>
        <hr>
      </div>
      <div class="subsection">
        <div class="subsection-header extra-margin">
          <h5><%=t :label_thesis_plural_official%></h5>
          <hr>
        </div>
        <div class="subsection-content">
          <% if can?(:manage, :theses_reports) %>
            <div class="row">
              <div class="col-md-16">
                <p>
                  <%= link_to t(:label_report_export_unassigned_students), diamond.unassigned_students_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-user' %>
                </p>
              </div>
            </div>
          <% end %>
          <div class="row">
            <div class="col-md-16">
              <p>
                <% if can?(:manage, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_supervisors_theses_of_faculty), diamond.supervisors_theses_of_faculty_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-statistics' %>
                <% elsif can?(:manage_department, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_supervisors_theses_of_department), diamond.supervisors_theses_of_department_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-statistics' %>
                <% end %>
              </p>
            </div>
          </div>
          <div class="row">
            <div class="col-md-16">
              <p>
                <% if can?(:manage, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_faculty_theses), diamond.faculty_theses_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-export' %>
                <% elsif can?(:manage_department, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_department_theses), diamond.department_theses_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-export' %>
                <% elsif can?(:manage_own, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_theses_mine), diamond.supervisor_theses_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-export' %>
                <% end %>
              </p>
            </div>
          </div>
        </div>
        <div class="section-footer">
          <hr>
        </div>
      </div>
    </div>
  <% end %>
<% end %>

<% if current_user.employee? %>
  <% if cannot?(:manage, Diamond::Thesis) %>
    <div class="section-header">
      <h4>
        <%=t :label_message_plural %>
      </h4>
      <hr>
    </div>

    <ul class="nav nav-tabs">
      <li class="active"><a href="#enrollments" data-toggle="tab"><%= "#{t :label_enrollment_plural} (#{@enrollment_messages.count})" %></a></li>
      <% if @thesis_state_messages.present? %>
        <li><a href="#states" data-toggle="tab"><%= "#{t :label_thesis_plural_short} (#{@thesis_state_messages.count})" %></a></li>
      <% end %>
    </ul>

    <div class="tab-content">
      <div class="tab-pane active" id="enrollments">
        <table class="table">
          <tbody>
            <% if @enrollment_messages.present? %>
              <% @enrollment_messages.each do |em| %>
                <tr id="msg-<%=em.id%>" style="<%="opacity: 0.5" if em.visited? %>">
                  <td>
                    <%= em.thesis_enrollment.thesis.supervisor.surname_name %>
                  </td>
                  <td>
                    <%= link_to truncate(em.thesis_enrollment.thesis.title, :omission => '...', :separator => ' ', :length => 47), diamond.thesis_path(em.thesis_enrollment.thesis_id) %>
                  </td>
                  <td>
                    <% if can?(:manage_department, em.thesis_enrollment.thesis) || em.thesis_enrollment.accepted? %>
                      <%=  format_status(em.thesis_enrollment.current_state)  %>
                    <% else %>
                      <%=raw t :label_thesis_accept, :days => content_tag(:span, t('misc.days', :count => em.thesis_enrollment.days_for_acceptance), :class => 'text-danger')  %>
                    <% end %>
                  </td>
                  <td>
                    <%=l em.thesis_enrollment.created_at, :format => :short %>
                  </td>
                  <td>
                    <div class="text-right" style="width: 100px;">
                      <% if em.visited? %>
                        <i class="icon-email"></i>
                      <% else %>
                        <%= button_to '', diamond.thesis_message_path(em), :method => :patch, :class => 'icon icon-email mark-as-read has-tooltip', 'data-toggle'=>"tooltip", 'data-placement'=>"top", :title => t(:label_mark_as_read) %>
                      <% end %>
                    </div>
                  </td>
                </tr>
              <% end %>
            <% else %>
              <tr>
                <td class="text-center">
                  <%=t :label_enrollment_empty %>
                </td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>
      <% if @thesis_state_messages.present? %>
        <div class="tab-pane" id="states">
          <table class="table">
            <tbody>
              <% if @thesis_state_messages.present? %>
                <% @thesis_state_messages.each do |ts| %>
                  <tr id="msg-<%=ts.id%>" style="<%="opacity: 0.5" if ts.visited? %>">
                    <td>
                      <%= ts.thesis_state_audit.creator.surname_name %>
                    </td>
                    <td>
                      <%= link_to truncate(ts.thesis_state_audit.thesis.title, :omission => '...', :separator => ' ', :length => 40), diamond.thesis_path(ts.thesis_state_audit.thesis_id) %>
                    </td>
                    <td>
                      <%=t "label_status_#{ts.thesis_state_audit.state}" %>
                    </td>
                    <td>
                      <%=l ts.thesis_state_audit.created_at, :format => :short %>
                    </td>
                    <td>
                      <div class="text-right" style="width: 100px;">
                        <% if ts.visited? %>
                          <i class="icon-email"></i>
                        <% else %>
                          <%= button_to '', diamond.thesis_message_path(ts), :method => :patch, :class => 'icon icon-email mark-as-read has-tooltip', 'data-toggle'=>"tooltip", 'data-placement'=>"top", :title => t(:label_mark_as_read) %>
                        <% end %>
                      </div>
                    </td>
                  </tr>
                <% end %>
              <% else %>
                <tr>
                  <td>
                  </td>
                </tr>
              <% end %>
            </tbody>
          </table>
        </div>
      <% end %>
    </div>
    <div class="section-footer extra-margin">
      <hr>
    </div>
  <% end %>
  <div class="section-header">
    <h4 style="margin-top: 40px;">
      <%= theses_header_title %>
    </h4>
    <hr>
  </div>
  <div class="section-menu">
    <h4 class="pull-left">
      <span><%=t :label_display%></span>
      <div class="dropdown">
        <%= link_to t("label_filter_#{DashboardHelper::CONTEXT_FILTERS.first}").downcase, '', 'data-toggle' => 'dropdown', :class => 'context-filter-dropdown context-filter-theses' %>
        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
          <% DashboardHelper::CONTEXT_FILTERS.each do |filter| %>
            <li>
              <%= form_tag dashboard_index_path do  %>
                <%= hidden_field_tag :context, 'theses' %>
                <%= hidden_field_tag :filter, filter %>
                <%= link_to t("label_filter_#{filter}"), '', :class => 'context-filter' %>
              <% end %>
            </li>
          <% end %>
        </ul>
      </div>
    </h4>
    <div class="pull-right ">
      <%= button_to diamond.theses_path, :method => :get,  :class => 'inline-btn accept-selected', :type => :button do %>
        <% if cannot?(:manage, Diamond::Thesis) %>
          <%= hidden_field_tag :supervisor_id, current_user.verifable_id %>
        <% end %>
        <%= content_tag :i, nil, :class => 'icon icon-red icon-thesis-list' %>
        <%=t :label_list_move%>
      <% end %>
    </div>
  </div>
  <div class="clearfix"></div>
  <div class="theses-list">
    <table class="table">
      <tbody>
        <% if @theses.present? %>
          <%= render :partial => "diamond/common/thesis_record", :collection => @theses %>
        <% else %>
          <tr>
            <td>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
  <div class="section-menu">
    <div class="pull-right ">
      <%= button_to diamond.theses_path, :method => :get,  :class => 'inline-btn accept-selected', :type => :button do %>
        <% if cannot?(:manage, Diamond::Thesis) %>
          <%= hidden_field_tag :supervisor_id, current_user.verifable_id %>
        <% end %>
        <%= content_tag :i, nil, :class => 'icon icon-red icon-thesis-list' %>
        <%=t :label_list_move%>
      <% end %>
    </div>
  </div>
  <div class="clearfix"></div>
  <div class="section-footer extra-margin">
    <hr>
  </div>
<% elsif current_user.student? %>
  <div class="section-header">
    <h4 class="pull-left">
      <%=t :label_thesis_chosen_yours %>
    </h4>
    <%= link_to t(:label_thesis_list_move), diamond.theses_path, :class => 'pull-right inline-icon inline-icon-red inline-icon-thesis-list' %>
    <div class="clearfix"></div>
    <hr>
  </div>

  <% if @enrollments.present? %>
    <table class="table">
      <tbody>
        <%= render :partial => "enrollment_record", :collection => @enrollments %>
      </tbody>
    </table>
  <% else %>
    <p class="text-center">
      <%=t :label_thesis_enroll_first %>
    </p>
  <% end %>
<% else %>
  <div class="section-header">
    <h4>
      <%=t :label_thesis_yours %>
    </h4>
    <hr>
  </div>
  <div class="panel panel-default">
    <div class="panel-heading"> <%= t("panel.header.theses") %> </div>
    <div class="panel-body">
      <p><%= link_to t("diamond.link.new_thesis"), diamond.new_thesis_path %></p>
      <%= t("panel.body.theses") %>
    </div>
  </div>

  <div class="panel panel-default">
    <div class="panel-heading"> <%= t("panel.header.elective_subject") %> </div>
    <div class="panel-body">
      <%= t("panel.body.elective_subject") %>
    </div>
  </div>

<% end %>
<commit_msg>Introduce supervisor theses statistics report<commit_after><% content_for :additional_javascripts do %>
  <%= javascript_include_tag 'dashboard' %>
<% end %>
<% content_for :right_column do %>
  <%= render :partial => "common/user_info" %>

  <% if can?(:manage, EnrollmentSemester) %>
    <div class="section">
      <div class="section-header ">
        <h4 class="pull-left">
          <%=t :label_deadline_plural %>
        </h4>
        <%= link_to t(:label_manage), edit_enrollment_semester_path(current_semester), :class => 'pull-right inline-icon inline-icon-red inline-icon-manage' %>
        <div class="clearfix"></div>
        <hr>
      </div>
      <div class="subsection">
        <div class="subsection-header ">
          <h5><%=t :label_thesis_plural %></h5>
          <hr>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_enrollment_begin %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%= current_semester.thesis_enrollments_begin.present? ? l( current_semester.thesis_enrollments_begin) : "-" %>
            </h6>
          </div>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_enrollment_end %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%= current_semester.thesis_enrollments_end.present? ? l( current_semester.thesis_enrollments_end) : "-" %>
            </h6>
          </div>
        </div>
      </div>
      <div class="subsection">
        <div class="subsection-header">
          <h5><%=t :label_elective_block_plural%></h5>
          <hr>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_enrollment_begin %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%= current_semester.elective_enrollments_begin.present? ? l( current_semester.elective_enrollments_begin) : "-" %>
            </h6>
          </div>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_enrollment_end %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%= current_semester.elective_enrollments_end.present? ? l( current_semester.elective_enrollments_end) : "-" %>
            </h6>
          </div>
        </div>
        <div class="section-header">
          <hr>
        </div>
      </div>
    </div>
  <% end %>

  <% if current_user.employee? && cannot?(:manage, Diamond::Thesis) %>
    <div class="section">
      <div class="section-header">
        <h4>
          <%=t :label_statistics %>
        </h4>
        <hr>
      </div>
      <div class="subsection">
        <div class="subsection-header ">
          <% if can?(:manage_own, Diamond::Thesis) %>
            <h5><%=t :label_thesis_plural%></h5>
          <% elsif can?(:manage_department, Diamond::Thesis) %>
            <h5><%=t :label_thesis_plural_department%></h5>
          <% end %>
          <hr>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_thesis_proposed_count%>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%=t 'misc.thesis_proposed', :count => @proposed_theses %>
            </h6>
          </div>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_status_accepted%>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%=t 'misc.thesis_accepted', :count => @accepted_theses %>
            </h6>
          </div>
        </div>
        <% if @unaccepted_theses %>
          <div class="row">
            <div class="col-md-8">
              <h6 class="text-muted">
                <%=t :label_filter_unaccepted%>
              </h6>
            </div>
            <div class="col-md-8">
              <h6>
                <%=t 'misc.thesis_not_accepted', :count => @unaccepted_theses %>
              </h6>
            </div>
          </div>
        <% end %>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_thesis_enrolled_count%>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%=t 'misc.thesis_chosen', :count => @chosen_theses %>
            </h6>
          </div>
        </div>
        <div class="row">
          <div class="col-md-8">
            <h6 class="text-muted">
              <%=t :label_thesis_not_enrolled_count %>
            </h6>
          </div>
          <div class="col-md-8">
            <h6>
              <%=t 'misc.thesis_not_chosen', :count => @not_chosen_theses %>
            </h6>
          </div>
        </div>
      </div>
      <div class="section-footer">
        <hr>
      </div>
    </div>
  <% end %>
  <% if can?(:read, :theses_reports) %>
    <div class="section">
      <div class="section-header">
        <h4>
          <%=t :label_report_plural %>
        </h4>
        <hr>
      </div>
      <div class="subsection">
        <div class="subsection-header extra-margin">
          <h5><%=t :label_thesis_plural_official%></h5>
          <hr>
        </div>
        <div class="subsection-content">
          <% if can?(:manage, :theses_reports) %>
            <div class="row">
              <div class="col-md-16">
                <p>
                  <%= link_to t(:label_report_export_unassigned_students), diamond.unassigned_students_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-user' %>
                </p>
              </div>
            </div>
          <% end %>
          <div class="row">
            <div class="col-md-16">
              <p>
                <% if can?(:manage, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_supervisors_theses_of_faculty), diamond.supervisors_theses_of_faculty_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-statistics' %>
                <% elsif can?(:manage_department, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_supervisors_theses_of_department), diamond.supervisors_theses_of_department_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-statistics' %>
                <% end %>
              </p>
            </div>
          </div>
          <div class="row">
            <div class="col-md-16">
              <p>
                <% if can?(:manage, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_faculty_theses), diamond.faculty_theses_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-export' %>
                <% elsif can?(:manage_department, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_department_theses), diamond.department_theses_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-export' %>
                <% elsif can?(:manage_own, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_theses_mine), diamond.supervisor_theses_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-export' %>
                <% end %>
              </p>
            </div>
          </div>
          <div class="row">
            <div class="col-md-16">
              <p>
                <% if can?(:manage, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_faculty_theses_stats), diamond.faculty_theses_stats_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-statistics' %>
                <% elsif can?(:manage_department, Diamond::Thesis) %>
                  <%= link_to t(:label_report_export_department_theses_stats), diamond.department_theses_stats_reports_theses_path(:format => :xlsx), :class => 'inline-icon inline-icon-red inline-icon-statistics' %>
                <% end %>
              </p>
            </div>
          </div>
        </div>
        <div class="section-footer">
          <hr>
        </div>
      </div>
    </div>
  <% end %>
<% end %>

<% if current_user.employee? %>
  <% if cannot?(:manage, Diamond::Thesis) %>
    <div class="section-header">
      <h4>
        <%=t :label_message_plural %>
      </h4>
      <hr>
    </div>

    <ul class="nav nav-tabs">
      <li class="active"><a href="#enrollments" data-toggle="tab"><%= "#{t :label_enrollment_plural} (#{@enrollment_messages.count})" %></a></li>
      <% if @thesis_state_messages.present? %>
        <li><a href="#states" data-toggle="tab"><%= "#{t :label_thesis_plural_short} (#{@thesis_state_messages.count})" %></a></li>
      <% end %>
    </ul>

    <div class="tab-content">
      <div class="tab-pane active" id="enrollments">
        <table class="table">
          <tbody>
            <% if @enrollment_messages.present? %>
              <% @enrollment_messages.each do |em| %>
                <tr id="msg-<%=em.id%>" style="<%="opacity: 0.5" if em.visited? %>">
                  <td>
                    <%= em.thesis_enrollment.thesis.supervisor.surname_name %>
                  </td>
                  <td>
                    <%= link_to truncate(em.thesis_enrollment.thesis.title, :omission => '...', :separator => ' ', :length => 47), diamond.thesis_path(em.thesis_enrollment.thesis_id) %>
                  </td>
                  <td>
                    <% if can?(:manage_department, em.thesis_enrollment.thesis) || em.thesis_enrollment.accepted? %>
                      <%=  format_status(em.thesis_enrollment.current_state)  %>
                    <% else %>
                      <%=raw t :label_thesis_accept, :days => content_tag(:span, t('misc.days', :count => em.thesis_enrollment.days_for_acceptance), :class => 'text-danger')  %>
                    <% end %>
                  </td>
                  <td>
                    <%=l em.thesis_enrollment.created_at, :format => :short %>
                  </td>
                  <td>
                    <div class="text-right" style="width: 100px;">
                      <% if em.visited? %>
                        <i class="icon-email"></i>
                      <% else %>
                        <%= button_to '', diamond.thesis_message_path(em), :method => :patch, :class => 'icon icon-email mark-as-read has-tooltip', 'data-toggle'=>"tooltip", 'data-placement'=>"top", :title => t(:label_mark_as_read) %>
                      <% end %>
                    </div>
                  </td>
                </tr>
              <% end %>
            <% else %>
              <tr>
                <td class="text-center">
                  <%=t :label_enrollment_empty %>
                </td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>
      <% if @thesis_state_messages.present? %>
        <div class="tab-pane" id="states">
          <table class="table">
            <tbody>
              <% if @thesis_state_messages.present? %>
                <% @thesis_state_messages.each do |ts| %>
                  <tr id="msg-<%=ts.id%>" style="<%="opacity: 0.5" if ts.visited? %>">
                    <td>
                      <%= ts.thesis_state_audit.creator.surname_name %>
                    </td>
                    <td>
                      <%= link_to truncate(ts.thesis_state_audit.thesis.title, :omission => '...', :separator => ' ', :length => 40), diamond.thesis_path(ts.thesis_state_audit.thesis_id) %>
                    </td>
                    <td>
                      <%=t "label_status_#{ts.thesis_state_audit.state}" %>
                    </td>
                    <td>
                      <%=l ts.thesis_state_audit.created_at, :format => :short %>
                    </td>
                    <td>
                      <div class="text-right" style="width: 100px;">
                        <% if ts.visited? %>
                          <i class="icon-email"></i>
                        <% else %>
                          <%= button_to '', diamond.thesis_message_path(ts), :method => :patch, :class => 'icon icon-email mark-as-read has-tooltip', 'data-toggle'=>"tooltip", 'data-placement'=>"top", :title => t(:label_mark_as_read) %>
                        <% end %>
                      </div>
                    </td>
                  </tr>
                <% end %>
              <% else %>
                <tr>
                  <td>
                  </td>
                </tr>
              <% end %>
            </tbody>
          </table>
        </div>
      <% end %>
    </div>
    <div class="section-footer extra-margin">
      <hr>
    </div>
  <% end %>
  <div class="section-header">
    <h4 style="margin-top: 40px;">
      <%= theses_header_title %>
    </h4>
    <hr>
  </div>
  <div class="section-menu">
    <h4 class="pull-left">
      <span><%=t :label_display%></span>
      <div class="dropdown">
        <%= link_to t("label_filter_#{DashboardHelper::CONTEXT_FILTERS.first}").downcase, '', 'data-toggle' => 'dropdown', :class => 'context-filter-dropdown context-filter-theses' %>
        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
          <% DashboardHelper::CONTEXT_FILTERS.each do |filter| %>
            <li>
              <%= form_tag dashboard_index_path do  %>
                <%= hidden_field_tag :context, 'theses' %>
                <%= hidden_field_tag :filter, filter %>
                <%= link_to t("label_filter_#{filter}"), '', :class => 'context-filter' %>
              <% end %>
            </li>
          <% end %>
        </ul>
      </div>
    </h4>
    <div class="pull-right ">
      <%= button_to diamond.theses_path, :method => :get,  :class => 'inline-btn accept-selected', :type => :button do %>
        <% if cannot?(:manage, Diamond::Thesis) %>
          <%= hidden_field_tag :supervisor_id, current_user.verifable_id %>
        <% end %>
        <%= content_tag :i, nil, :class => 'icon icon-red icon-thesis-list' %>
        <%=t :label_list_move%>
      <% end %>
    </div>
  </div>
  <div class="clearfix"></div>
  <div class="theses-list">
    <table class="table">
      <tbody>
        <% if @theses.present? %>
          <%= render :partial => "diamond/common/thesis_record", :collection => @theses %>
        <% else %>
          <tr>
            <td>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
  <div class="section-menu">
    <div class="pull-right ">
      <%= button_to diamond.theses_path, :method => :get,  :class => 'inline-btn accept-selected', :type => :button do %>
        <% if cannot?(:manage, Diamond::Thesis) %>
          <%= hidden_field_tag :supervisor_id, current_user.verifable_id %>
        <% end %>
        <%= content_tag :i, nil, :class => 'icon icon-red icon-thesis-list' %>
        <%=t :label_list_move%>
      <% end %>
    </div>
  </div>
  <div class="clearfix"></div>
  <div class="section-footer extra-margin">
    <hr>
  </div>
<% elsif current_user.student? %>
  <div class="section-header">
    <h4 class="pull-left">
      <%=t :label_thesis_chosen_yours %>
    </h4>
    <%= link_to t(:label_thesis_list_move), diamond.theses_path, :class => 'pull-right inline-icon inline-icon-red inline-icon-thesis-list' %>
    <div class="clearfix"></div>
    <hr>
  </div>

  <% if @enrollments.present? %>
    <table class="table">
      <tbody>
        <%= render :partial => "enrollment_record", :collection => @enrollments %>
      </tbody>
    </table>
  <% else %>
    <p class="text-center">
      <%=t :label_thesis_enroll_first %>
    </p>
  <% end %>
<% else %>
  <div class="section-header">
    <h4>
      <%=t :label_thesis_yours %>
    </h4>
    <hr>
  </div>
  <div class="panel panel-default">
    <div class="panel-heading"> <%= t("panel.header.theses") %> </div>
    <div class="panel-body">
      <p><%= link_to t("diamond.link.new_thesis"), diamond.new_thesis_path %></p>
      <%= t("panel.body.theses") %>
    </div>
  </div>

  <div class="panel panel-default">
    <div class="panel-heading"> <%= t("panel.header.elective_subject") %> </div>
    <div class="panel-body">
      <%= t("panel.body.elective_subject") %>
    </div>
  </div>

<% end %>

{'fraction_non_alphanumeric': 0.17327446110446754, 'fraction_numerical': 0.006316499555392021, 'mean_word_length': 1.696040340580309, 'pattern_counts': {'":': 0, '<': 942, '<?xml version=': 0, '>': 1058, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6181657', 'n_tokens_mistral': 11209, 'n_tokens_neox': 10357, 'n_words': 1729}