<%= javascript_include_tag 'index', plugin: "redmine_wktime" %>
<%= stylesheet_link_tag 'wk-time', plugin: "redmine_wktime" %>

<%= hidden_field_tag 'back_url', url_for(:controller => params[:controller], :action => params[:action]) %>
<%= form_tag({:controller => controller_name, :action => 'index', :tab => controller_name}, :method => :get, :id => 'query_form') do %>
	<fieldset>
		<legend><%= l(:label_filter_plural) %></legend>
		<div style="float:right">
			<%= link_to l(:label_new_shipment), url_for(:controller => controller_name, :action => 'edit'), :class => 'icon icon-add' %>
		</div>
		<%= hidden_field_tag "searchlist", controller_name %>
		<%=h hidden_field_tag('tab', controller_name) %>
		<%= hidden_field_tag "preview_billing", false %>
		<script type="text/javascript">
			accountUrl="<%= "#{url_for(:controller => "wkinvoice", :action => 'getAccountProjIds')}" %>";
		</script>

		<%	contactId =session[controller_name].try(:[], :contact_id)
			accountId =session[controller_name].try(:[], :account_id)
			rfqId = session[controller_name].try(:[], :rfq_id)
			filterSession =session[controller_name].try(:[], :polymorphic_filter)
			projid =session[controller_name].try(:[], :project_id) %>

			<%= render partial: "wkbilling/index_filters", locals: { :contact_id => contactId, :account_id => accountId, :rfq_id => rfqId, :filter_session => filterSession, :project_id => projid, :pjtChanged => false, :isapply => false, :isproject => true, :isAll => true, :blankOptionForPjt => false, :blankForActDD => true, :blankForContactDD => true, :needQuotePoDD => false, :isFilter => true, :loadSIDD => false} %>

			<p style="float:left;"><%= render :partial => 'wkshipment/date_range' %></p>
		<div>
			<%= link_to_function l(:button_apply), '$("#query_form").submit(); return false;', :class => 'icon icon-checked' %>
			<%#= link_to l(:button_apply), {:controller => controller_name, :action => action_name}, :class => 'icon icon-checked' %>
			<%= link_to l(:button_clear), {:tab => 'wkshipment', clear: true}, :class => 'icon icon-reload' %>
		</div>
	</fieldset>
<% end %>
<div class="total-hours">
	<p><%= l(:label_total) %>: &nbsp;
		<%= @shipmentEntries[0].inventory_items[0].currency unless @shipmentEntries[0].blank? || @shipmentEntries[0].inventory_items[0].blank?%>
	<%= html_hours("%.2f" % @totalShipAmt) %></p>
</div>

<% if @shipmentEntries.present? %>
	<%= render :partial => 'wkshipment/shipment_list'%>
	<% other_formats_links do |f| %>
		<%= f.link_to_with_query_parameters 'CSV', {} %>
	<% end %>
<% else %>
	<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
