<%= javascript_include_tag "ruling_timers/marked.min.js" %> <%= fields_for :task, @task do |f| %>

<%= @task.task_name%>

<%= t("ruling_timer.details") %>

<%= @task.details.html_safe %>

<%= t("ruling_timer.progress") %>: <%= @task.progress %> %

<%= t(:file_) %>

<% @task.ruling_timer_files.desc(:updated_at).each do |file| %> <% file_url = file.file.url rescue "" %> <% next if file_url.blank? %> <% file_name = File.basename(file_url) %> <% ext_name = File.extname(file_name).split(".").last %> <% ext_name = "File" if ext_name.blank? %>
<% if ext_name.match(/(png|jpg|gif)/i) %> <%= file_name %> <% else %>
<%=ext_name.upcase%>
<% end %>
<%= file_name %>
<%=file.description%>
<%=file.display_updated_at%>( <%=file.uploader.name%> )
<% end %>

<%= t("ruling_timer.comments_text") %>

<%= hidden_field_tag 'ruling_timer_comment_field_count', f.object.ruling_timer_comments.count %> <%= t(:add) %>

<% if f.object && !f.object.ruling_timer_comments.blank? %>
<% f.object.ruling_timer_comments.desc(:created_at).each_with_index do |ruling_timer_comment, i| %> <%= f.fields_for :ruling_timer_comments, ruling_timer_comment do |f| %> <%= render :partial => 'form_comment', :object => ruling_timer_comment, :locals => {:f => f, :i => i} %> <% end %> <% end %>
<% end %>

<% if @task.user_ids %> <% user_ids = @task.user_ids user_bson_ids = user_ids.map{|id| BSON::ObjectId(id)} %> <% users = User.find(user_ids).index_by(&:id).slice(*user_bson_ids).values %> <% users.each do |user| %> <% sub_task = @task.ruling_timer_sub_tasks.where(:user=>user).first %> <% klass = (sub_task.status == 'working' ? 'fa-play' : (sub_task.status == 'finish' ? 'fa-flag-checkered' : 'fa-pause') rescue 'fa-pause') %>
<% end %> <% end %>
<%= t("ruling_timer.task_performer") %> <%= t("ruling_timer.task_execution_time") %>
<%=user.name%> <% work_times = sub_task.get_work_times %> <% work_times.each_with_index do |work_time,i| %> <% next if i % 2 == 1 %> <% next_time = work_times[i+1] %> <% next_time = "Now" if next_time.nil? %> <%= "#{work_time} ~ #{next_time}" %>
<% end %>
<%=t("ruling_timer.#{sub_task.status}")%>( <%=t("ruling_timer.total")%>: <%=sub_task.get_infos["work"] rescue "00:00:00" %> )
<%= content_tag :div, class: "bottomnav clearfix" do referer = request.referer rescue nil referer = task_management_admin_ruling_timers_path if referer.blank? || request.host != URI.parse(URI.encode(referer)).host link_to(t('edit'), edit_task_admin_ruling_timer_path , :class=>"btn") + link_to(t('ruling_timer.back'), referer, :class=>"btn") end %> <% end %>