<div class="p-l-15">
	<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
	<% if period_type != false %>
	<div class="row">
		<div class="col-lg-2 col-md-2 col-sm-2">
			<label class="font-14">Type</label>
			<select name="sale_type" id="sel_sale_type" class="form-control">
			    <%if @sale_type=="waste" %>		 
					<option value="waste" selected>Waste</option>
			   <% else %>
			    	<option value="waste">Waste</option>
			   <% end %>
			   <%if @sale_type=="spoile" %>		 
					<option value="spoile" selected>Spoilage</option>	
			   <% else %>
			    	<option value="spoile">Spoilage</option>	
			   <% end %>
			</select>		
		</div>
		<div class="col-lg-2 col-md-2 col-sm-2">
			<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label>
			<select name="period" id="sel_period" class="form-control">
				<option value=""><%= t("views.right_panel.detail.select_period") %></option>
				<option value="0">Today</option>
				<option value="1">Yesterday</option>
				<option value="2">This week</option>
				<option value="3">Last week</option>
				<option value="4">Last 7 days</option>
				<option value="5">This month</option>
				<option value="6">Last month</option>
				<option value="7">Last 30 days</option>
				<option value="8">This year</option>
				<option value="9">Last year</option>
			</select>
		</div>
		
		<div class="col-lg-3 col-md-3 col-sm-3">					
			<!-- <label class="">Select Shift Period</label> -->
			<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
			<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
		</div>
		<div class="col-lg-3 col-md-3 col-sm-3">
			<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
			<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
		</div>
	
		<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20">
			<br>
			<input type="submit" value="Generate Report" class='btn btn-primary'>
		</div>							
	</div>													
	<% end %>

	<% end %>	
</div>	

<script type="text/javascript">

	<% if params[:shift_name].to_i > 0%>
	shift_id = '<%= params[:shift_name] %>'
	local_date = '<%= @shift_from %> - <%= @shift_to %> '
	var shift = $('#shift_name');
	str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
	shift.append(str);
	<% end %>

	$("#from").val("<%=params[:from] rescue '-'%>");
	$("#to").val("<%=params[:to] rescue '-'%>");
	$("#sel_period").val(<%=params[:period] rescue '-'%>);
	$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);


</script>
