2021-07-21 07:37:06 +00:00
|
|
|
<style type="text/css">
|
|
|
|
.span20-percent{
|
|
|
|
width: 20%;
|
|
|
|
float: left;
|
|
|
|
text-align: center;
|
|
|
|
font-size: 1.5em;
|
|
|
|
margin: 0;
|
|
|
|
border: 2px solid #333333;
|
|
|
|
-moz-box-sizing: border-box;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
.span20-percent img{
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.status-tags > *{
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
.task_name{
|
|
|
|
font-size: 1.5em;
|
|
|
|
}
|
|
|
|
.working_label{
|
|
|
|
color: #5a5a5a;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
.finish_label{
|
|
|
|
color: #3ec700;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
.stop_label{
|
|
|
|
color: #cd1643;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
2022-04-18 01:01:57 +00:00
|
|
|
.black_hr{
|
|
|
|
border-color: #333333;
|
|
|
|
}
|
|
|
|
.types_link{
|
|
|
|
margin-bottom: 0.5em;
|
|
|
|
}
|
2021-07-21 07:37:06 +00:00
|
|
|
</style>
|
2022-04-18 01:01:57 +00:00
|
|
|
<h3><%= "#{@project.get_project_name} - " if @project%><%= t("ruling_timer.task") %></h3>
|
|
|
|
<div class="pull-right types_link">
|
|
|
|
<%if @is_manager
|
|
|
|
all_types = ["all_tasks","my_tasks","my_assisted_tasks","my_observed_tasks"]
|
|
|
|
else
|
|
|
|
all_types = ["my_tasks","my_assisted_tasks","my_observed_tasks"]
|
|
|
|
end
|
|
|
|
%>
|
|
|
|
<% all_types.each_with_index do |type,i| %>
|
|
|
|
<% active = false %>
|
|
|
|
<% if i == 0 && !(all_types.include?(params[:type]))
|
|
|
|
active = true
|
|
|
|
else
|
|
|
|
active = (type == params[:type])
|
|
|
|
end
|
|
|
|
%>
|
|
|
|
<a href="?type=<%=type%>" class="btn <%= 'active' if active %>"><%=t("ruling_timer.#{type}")%></a>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% if params[:id].present? %>
|
|
|
|
<% task_group = @tasks.group_by(&:ruling_timer_section_id) %>
|
|
|
|
<% task_group_count = task_group.count %>
|
|
|
|
<% task_group.each_with_index do |(ruling_timer_section_id, tasks), i| %>
|
|
|
|
<h4><%= tasks[0].ruling_timer_section.section_name rescue I18n.t("ruling_timer.none") %></h4>
|
|
|
|
<%= render :partial => "task_table", :locals =>{:tasks => tasks} %>
|
|
|
|
<%= '<hr class="black_hr">'.html_safe if i < task_group_count - 1 %>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<%= render :partial => "task_table", :locals =>{:tasks => @tasks} %>
|
|
|
|
<% end %>
|
2021-07-21 07:37:06 +00:00
|
|
|
<%=
|
|
|
|
content_tag :div, class: "bottomnav clearfix" do
|
|
|
|
content_tag(:div, paginate(@tasks), class: "pagination pagination-centered") +
|
2022-04-18 01:01:57 +00:00
|
|
|
content_tag(:div, link_to(t("ruling_timer.add_task"), add_task_admin_ruling_timers_path + (@project ? "?project_id=#{@project.id}" : ""), :class=>"btn btn-primary"), class: "pull-right")
|
2021-07-21 07:37:06 +00:00
|
|
|
end %>
|
|
|
|
<script>
|
|
|
|
<% ["working","stop","finish"].each do |status| %>
|
|
|
|
$(".<%=status%>_label").attr("title",'<%=t("ruling_timer.#{status}")%>');
|
|
|
|
<% end %>
|
|
|
|
$('.delete_task').click(function(){
|
|
|
|
var item = $(this);
|
|
|
|
var item_row = $(this).parents("tr").eq(0);
|
|
|
|
var task_id = $(item).data("task-id")
|
|
|
|
if(window.confirm("<%=t("ruling_timer.delete_task_hint")%>")){
|
|
|
|
if(window.confirm("<%=t("ruling_timer.delete_task_hint")%>")){
|
|
|
|
if($("#dialog-confirm").length == 0){
|
|
|
|
$("#main-wrap").before("<div id='dialog-confirm' title='<%=t("ruling_timer.delete_task")%>'>"+
|
|
|
|
"<div style='clear:both;'></div><div id='info_texts'>"+'<%=t("ruling_timer.delete_task_hint1")%>'.replace('{{task}}',item.data('task'))+"</div>"+"<input id=\"confirm_input\"/ placeholder=\"<%= t('ruling_timer.please_input_confirm_delete') %>\" style=\"width: 17em;\">"+"<div id='msg_end' style='height:0px; overflow:hidden'></div>"+
|
|
|
|
"</div>");
|
|
|
|
}else{
|
|
|
|
$("#info_texts").html('<%=t("ruling_timer.delete_task_hint1")%>'.replace('{{task}}',item.data('task')));
|
|
|
|
$('#confirm_input').css('display','block');
|
|
|
|
$('#confirm_input').val('');
|
|
|
|
}
|
|
|
|
$( "#dialog-confirm" ).dialog({
|
|
|
|
resizable: true,
|
|
|
|
minHeight: 200,
|
|
|
|
maxHeight: 400,
|
|
|
|
modal: true,
|
|
|
|
width: '80%',
|
|
|
|
open: function(){
|
|
|
|
$('#confirm_input').blur();
|
|
|
|
},
|
|
|
|
close: function(){
|
|
|
|
$('#confirm_input').css('display','none');
|
|
|
|
$( this ).dialog( "close" );
|
|
|
|
},
|
|
|
|
buttons: {
|
|
|
|
"<%= t('ruling_timer.confirm') %>": function(){
|
|
|
|
var _this = $(this);
|
|
|
|
if($('#confirm_input').val().match(/<%= t('ruling_timer.confirm_delete') %>/gi)){
|
|
|
|
$('#confirm_input').css('display','none');
|
|
|
|
$.post(decodeURIComponent("<%=delete_task_admin_ruling_timer_path(:id=>"{{task_id}}")%>").replace("{{task_id}}",task_id),{'confirm_delete': true}).done(function(data){
|
|
|
|
item_row.remove();
|
|
|
|
_this.dialog( "close" );
|
|
|
|
});
|
|
|
|
}else{
|
2022-04-18 01:01:57 +00:00
|
|
|
alert("<%= t('ruling_timer.please_input_confirm_delete').html_safe %>");
|
2021-07-21 07:37:06 +00:00
|
|
|
$('#confirm_input').focus();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"<%= t('ruling_timer.cancel') %>": function(){
|
|
|
|
$('#confirm_input').css('display','none');
|
|
|
|
$( this ).dialog( "close" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|