
<!-- 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>
			<div class="widget-content">
				<form id="frmmain" name="frmmain" data-parsley-validate novalidate>
					<input type="hidden" name="_token" value="<?php echo e(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="text-input1">Date.*</label>
								<input type="date" name="batchDate" id="batchDate" class="form-control" >
								<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" >
								<small class="text-danger" id="errcustomername"></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">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" >
								<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" >
								<small class="text-danger" id="errbankacct" ></small>
							</div>
							
						</div>
						<!-- END ADVANCED VALIDATION -->
					</div>
					
					<div class="col-md-6">
						<!-- ADVANCED VALIDATION -->
						<div class="widget-content">
							
							<div class="form-group">
								<label for="text-input1">No. of chicks</label>
								<input type="text" name="Noofchicks" id="Noofchicks" class="form-control"  >
								<small class="text-danger" id="erremailid"></small>
							</div>
							<div class="form-group">
								<label>Free chicks</label>
								<input type="text" name="Freechicks" id="Freechicks" class="form-control" onkeyup="Noofchickss()" >
								<small class="text-danger" id="errbankacct" ></small>
							</div>
							<div class="form-group">
								<label>Total Chicks</label>
								<input type="text" name="TotalChicks" id="TotalChicks" class="form-control" >
								<small class="text-danger" id="errbankacct" ></small>
							</div>
							<div class="form-group">
								<label>Rate Per chick</label>
								<input type="text" name="RatePerchick" id="RatePerchick" class="form-control" >
								<small class="text-danger" id="errbankacct" ></small>
							</div>
							<div class="form-group">
								<label>Amount</label>
								<input type="text" name="Amount" id="Amount" class="form-control"onkeyup="Amountchickss()" >
								<small class="text-danger" id="errdescription" ></small>
							</div>
							
							<div class="form-group">
								<label>Cost Per chick</label>
								<input type="text" name="CostPerchick" id="CostPerchick" class="form-control" >
								<small class="text-danger" id="errdescription" ></small>
							</div>
							<div class="form-group">
								<label>Remarks</label>
								<input type="text" name="Remarks" id="Remarks" class="form-control" >
								<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: 'AddBatchrecords',
			type: 'POST',
			data:$('#frmmain').serialize(),
			success: function(data) 
			{
				
			}
			
		});
	});
	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;
	}
</script>