ruling_timer/app/views/admin/ruling_timers/_index_table.html.erb

78 lines
3.4 KiB
Plaintext
Raw Permalink Normal View History

2022-04-18 01:01:57 +00:00
<table class="table main-list">
<thead>
<tr>
<th><%=t("ruling_timer.date")%></th>
<th><%=t("ruling_timer.summary")%></th>
<th><%=t("ruling_timer.work_time")%></th>
<th><%=t("action")%></th>
</tr>
</thead>
<tbody>
<% if @ruling_timer_temp %>
<%= render :partial => "timer_work_row", :locals=>{:timer=>@ruling_timer_temp} %>
<% end %>
<% @ruling_timer_history.each do |timer_history| %>
<%= render :partial => "timer_work_row", :locals=>{:timer=>timer_history} %>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag(:div, paginate(@ruling_pager), class: "pagination pagination-centered") +
link_to(t("ruling_timer.add_history"),add_history_admin_ruling_timer_path(:id=>(params[:id].nil? ? "current_user" : params[:id])),:class=>"btn btn-primary pull-right")
end
%>
<script>
$('.delete_history').click(function(){
var item = $(this);
var item_row = $(this).parents("tr").eq(0);
var history_id = $(item).data("id");
var type = $(item).data("type");
if(window.confirm("<%=t("ruling_timer.delete_history_hint")%>")){
if(window.confirm("<%=t("ruling_timer.delete_history_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_history_hint1")%>'.replace('{{history}}',item.data('history-date'))+"</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_history_hint1")%>'.replace('{{history}}',item.data('history-date')));
$('#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_history_admin_ruling_timer_path(:id=>"{{history_id}}")%>").replace("{{history_id}}",history_id),{'confirm_delete': true,'type': type}).done(function(data){
item_row.remove();
_this.dialog( "close" );
});
}else{
alert("<%= t('client_management.please_input_confirm_delete').html_safe %>");
$('#confirm_input').focus();
}
},
"<%= t('ruling_timer.cancel') %>": function(){
$('#confirm_input').css('display','none');
$( this ).dialog( "close" );
}
}
});
}
}
});
</script>