memberlog/app/views/plugin/memberlog/_profile.html.erb

128 lines
5.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/list-check" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/list-check" %>
<% end %>
<%
if has_access?
@memberlogs = MemberLog.where(member_profile_id: @member.id).desc(:created_at).page(params[:page]).per(10)
@dayoffs = Dayoff.where(member_profile_id: @member.id).desc(:created_at).page(params[:page]).per(10)
else
@memberlogs = MemberLog.where(is_hidden: false, member_profile_id: @member.id).desc(:created_at).page(params[:page]).per(10)
@dayoffs = Dayoff.where(is_hidden: false, member_profile_id: @member.id).desc(:created_at).page(params[:page]).per(10)
end
%>
<div class="alert alert-error">
<% @dayoffs.each do |b| %>
<% if Time.now <= b.end_dayoff.to_date+40 %>
<ul>
【<%= b.dayoff_description %>】
<%= b.start_dayoff.strftime('%Y-%m-%d') %>~
<%= b.end_dayoff.strftime('%Y-%m-%d') %>
<%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('edit'),'/admin/members/'+@member.to_param+'/dayoffs/'+b.id+'/edit', :class => "btn btn-danger btn-mini"%>
<%= link_to content_tag(:i, nil, :class => 'icons-trash') +' '+ t(:delete_), admin_dayoff_path(id: b.id, member_profile_id: @member.id), :class => "btn btn-danger btn-mini", method: :delete, remote: true, data: { confirm: t('sure?') } %>
</ul>
<% end %>
<% end %>
</div>
<table class="table table-condensed table-striped main-list">
<thead>
<tr>
<!-- <% if has_access? %> -->
<!-- <th><input type="checkbox" /></th> -->
<!-- <% end -%> -->
<th class="span2"><%= t('memberlog.checkin') %></th>
<th class="span3"><%= t('memberlog.checkout') %></th>
<th class="span3"><%= t('memberlog.excuse') %></th>
</tr>
</thead>
<tbody>
<% @memberlogs.each do |memberlog| %>
<tr id="<%= dom_id memberlog %>">
<td>
<%= link_to memberlog.created_at.strftime('%Y-%m-%d (%a) %R'), admin_memberlog_path(memberlog.id), :data => {"target" => "#logModal", "toggle" => "modal"} %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<% if memberlog.finish == false %>
<li><%= link_to t('edit'), '/admin/members/'+@member.to_param+'/memberlogs/'+memberlog.id+'/edit' %></li>
<li><%= link_to t(:delete_), admin_memberlog_path(id: memberlog.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
<% end %>
</ul>
</div>
</td>
<td>
<% if memberlog.finish == true %>
<%= memberlog.checkout.strftime('%m-%d %R') %></td>
<% else %>
<span class="label label-warning">Working....</span>
<% end %>
</td>
<td>
<% if !memberlog.excuse.nil? %>
<span class="label label-important"><%= memberlog.excuse %></span>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<!-- Modal -->
<div id="logModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="logModalLabel" aria-hidden="true" style="width:800px ;left:40%">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="logModalLabel"><%= t("module_name.memberlog") %></h3>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
<script type="text/javascript">
var logModal = $("#logModal");
$("a.modal-opener").on("click",function(){
var el = $(this);
$.ajax({
url : el.attr("href"),
dataType : "html",
type : "get"
}).done(function(html){
logModal.find(".modal-body").html(html);
logModal.modal("show");
})
return false;
})
</script>
<div class="bottomnav clearfix">
<% if has_access? %>
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('memberlog.take_dayoff'),'/admin/members/'+@member.to_param+'/dayoffs/new', :class => 'btn btn-primary' %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'),
'/admin/members/'+@member.to_param+'/memberlogs/new', :class => 'btn btn-primary' %>
</div>
<% end %>
<div class="pagination pagination-centered">
<%= paginate @memberlogs, :params => {:direction => params[:direction], :sort => params[:sort] } %>
</div>
</div>
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><%= t(:sure?) %></h3>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
</div>
</div>