<%= javascript_include_tag 'wkpayroll', :plugin => "redmine_wktime" %>
<script type="text/javascript">
	var prevTab = "tab-<%= "#{controller_name}" %>";
	var runperiodUrl="<%= "#{url_for(:controller => controller_name, :action => 'runPeriodEndProcess', :tab => controller.controller_name)}" %>";
</script>

<% wktime_helper = Object.new.extend(WktimeHelper) %>


<% if (wktime_helper.validateERPPermission('A_ATTEND')) %>
	<%= form_tag({}, :method => :get) do %>
		<fieldset>
			<legend><%= l(:label_filter_plural) %></legend>
			<div style='float:right'>
				<%= link_to l(:"label_title_end_process"), "javascript:runperiodDatePicker()" %>&nbsp;
				<%= render :partial => "wkattendance/sidebar" %>
			</div>
			<label for='status'><%= l(:field_status) %></label>
			<%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;"  %>
			<label for='group_id'><%= l(:label_group) %></label>
				<%= select_tag 'group_id', content_tag('option') + options_from_collection_for_select(@groups, :id, :name, controller.getSession(:group_id).to_i),
					:onchange => "this.form.submit(); return false;" if @groups.present? %>
			<label for='name'><%= l(:label_user) %></label>
			<%= text_field_tag 'name', controller.getSession(:name), :size => 30 %>
			<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
			<%= link_to l(:button_clear), {:tab => controller_name, clear: true},
				:class => 'icon icon-reload' %>
		</fieldset>
		<%= hidden_field_tag("tab", controller_name) %>
		<%= hidden_field_tag("searchlist", controller_name) %>
		<%= hidden_field_tag "back_url", url_for(:controller => controller_name, :action => action_name) %>
	<% end %>&nbsp;
<% end %>

<% if @leave_entries.present? %>
	<%= render :partial => "wkattendance/list"%>
	<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>
	<% other_formats_links do |f| %>
		<%= f.link_to_with_query_parameters "CSV", {} %>
	<% end %>
<% else %>
	<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>