<!-- main -->
<div class="content">
	<div class="main-content">
		<!-- DATA EXPORT -->
		<div class="widget widget-table">
			<div class="widget-header">
				<h3><i class="fa fa-user"></i> Batch</h3> <em> - Batch records</em>
				<div class="btn-group widget-header-toolbar">
					<a class="btn-borderless btn-focus clickme" href="batchView" title="Focus" ><i class="fa fa-eye"></i></a>
				</div>
			</div>
			<div class="widget-content">
				<form id="frmmain" name="frmmain" data-parsley-validate novalidate>
					<input type="hidden" name="_token" value="{{ csrf_token() }}">

					<div class="alert  alert-info " >
						<ul><li class="fa fa-cog  fa-1x fa-fw"></li>Kindly enter batch details..</ul>
					</div>
					<div class="alert alert-success print-success-msg" style="display:none">
						<ul></ul>
					</div>
					<div class="alert alert-danger print-error-msg" style="display:none">
						<ul></ul>
					</div>

					<div class="col-md-6">
						<!-- ADVANCED VALIDATION -->
						<div class="widget-content">

							<div class="form-group">
								<label for="text-input1">Batch No.*</label>
								<input type="text" name="batchno" id="batchno" class="form-control" >
								<small class="text-danger" id="errcustomername"></small>
							</div>
							<div class="form-group">
								<label for="multiselect1">Shed Name*</label>
                                <select name="compname" id="compname" class="form-control" required>
									<option value="0">-- Select --</option>
									<?php
									foreach($data['shed'] as $shed)
									{
								      	echo "<option value='".$shed->shd_id."' >".$shed->shd_name."";
									    echo "</option>";
									}
									?>
								</select>
								<small class="text-danger" id="errcompname"></small>
							</div>
							<div class="form-group">
								<label for="multiselect1">Farm Item Name*</label>
                                <select name="itemname" id="itemname" class="form-control" required>
									<option value="0">-- Select --</option>
									<?php
									foreach($data['farmitem'] as $farmitems)
									{
				echo "<option value='".$farmitems->itm_id."' >".$farmitems->itm_name. "(".$farmitems->itm_code.")</option>";
									}
									?>
								</select>
								<small class="text-danger" id="errcompname"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Strain of Chicks</label>
								<input type="text" name="StrainofChicks" id="StrainofChicks" class="form-control" >
								<small class="text-danger" id="errcontact1"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Date.*</label>
								<input type="date" name="batchDate" id="batchDate" class="form-control" value="<?php echo date("Y-m-d"); ?>" >
								<small class="text-danger" id="errcustomername"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Time.*</label>
								<input type="time" name="batchTime" id="batchTime" class="form-control"  value="<?php echo date("h:i:s"); ?>"  >
								<small class="text-danger" id="errcustomername"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Day.*</label>
								<input type="text" name="day" id="day" class="form-control" readonly  value="<?php echo date("l"); ?>" >
								<small class="text-danger" id="errcustomername"></small>
							</div>
						</div>
						<!-- END ADVANCED VALIDATION -->
					</div>

					<div class="col-md-6">
						<!-- ADVANCED VALIDATION -->
						<div class="widget-content">
							<div class="form-group">
								<label for="multiselect1">User*</label>
                                <select name="user" id="user" class="form-control" required>
									<option value="0">-- Select --</option>
									<?php
									foreach($data['user'] as $user)
									{
				echo "<option value='".$user->usr_id."' >".$user->usr_name. "(".$user->usr_loginid.")</option>";
									}
									?>
								</select>
								<small class="text-danger" id="errcompname"></small>
							</div>
							<div class="form-group">
								<label for="text-input1">Hatchery</label>
								<input type="text" name="Hatchery" id="Hatchery" class="form-control" >
								<small class="text-danger" id="errcontact2"></small>
							</div>
							<div class="form-group">
								<label>Date of Hatch</label>
								<input type="date" name="DateofHatch" id="DateofHatch" class="form-control"  value="<?php echo date("Y-m-d"); ?>">
								<small class="text-danger" id="errbankacct" ></small>
							</div>
							<div class="form-group">
								<label> Time of dispatch from Hatchery</label>
								<input type="time" name="dispatchfromHatchery" id="dispatchfromHatchery" class="form-control"   value="<?php echo date("h:i:s"); ?>" >
								<small class="text-danger" id="errbankacct" ></small>
							</div>
							<div class="form-group">
								<label>Remarks</label>
								<textarea name="Remarks" id="Remarks" class="form-control" ></textarea>
								<small class="text-danger" id="errdescription" ></small>
							</div>
							<div class="form-group">
								<label for="multiselect1">Status*</label>
								<br/>
                                <select name="status" id="status" class="form-control" required>
                                    <option value="Active">Active</option>
                                    <option value="Inactive">Inactive</option>
								</select>
								<small class="text-danger" id="errstatus"></small>
							</div>
						</div>
						<!-- END ADVANCED VALIDATION -->
					</div>
					<div class="col-md-12">
						<div class="form-group">
                            <center><button type="submit" id="submit" name="submit" class="btn btn-primary Batchrecords">Add record</button></center>
						</div>
					</div>
				</form>

			</div>
		</div>
		<!-- END DATA EXPORT -->
	</div>
</div>
<!-- /main -->
<script>
	$('.Batchrecords').click(function(e)
	{
		e.preventDefault();
		$.ajax({
			url: 'AddNewBatch',
			type: 'POST',
			data:$('#frmmain').serialize(),
			success: function(data)
			{
				$('#sideMenu').load('batchView');
			}
		});
	});
	totalChicks=0;
	function Noofchickss()
	{
		Noofchicks = document.getElementById("Noofchicks").value;
		Freechicks = document.getElementById("Freechicks").value;
		totalChicks=parseInt(Noofchicks)+parseInt(Freechicks);
		document.getElementById("TotalChicks").value=totalChicks;
	}
	Amountper=0;
	function Amountchickss()
	{
		Amount = document.getElementById("Amount").value;
		RatePerchick = document.getElementById("RatePerchick").value;
		Amountper=Amount/RatePerchick;
		//totalChicks=parseInt(Noofchicks)+parseInt(Freechicks);
		document.getElementById("CostPerchick").value=Amountper;
	}
	$('.clickme').click(function(e)
	{
		e.preventDefault();
		$('#sideMenu').load($(this).attr('href'));
	});
</script>
