
<!-- 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> Weight entry</h3> <em> - Weight records</em>
			</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 Weight 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="multiselect1">Shed Name*</label>
                                <select name="ShedName" id="ShedName" class="form-control" required>
									<option value="0">-- Select --</option>
								</select>
								<small class="text-danger" id="errcompname"></small>
							</div>
							<div class="form-group">
								<label for="multiselect1">Batch Number*</label>
                                <select name="BatchNumber" id="BatchNumber" class="form-control" required>
									<option value="0">-- Select --</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">Day.*</label>
								<input type="text" name="batchDay" id="batchDay" class="form-control" >
								<small class="text-danger" id="errcustomername"></small>
							</div>
							
						</div>
						<!-- END ADVANCED VALIDATION -->
					</div>
					
					<div class="col-md-6">
						<!-- ADVANCED VALIDATION -->
						<div class="widget-content">
							
							<table id="tab_logic" class="table table-sorting table-striped table-hover datatable">
								<thead>
									<tr>
										<th>SL. No.</th>
										<th>No. of Birds</th>
										<th>Total Weight in GM</th>
										<th>Add</th>
										<th>Remove</th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td> <input type="text" name="batchSlno1" id="batchSlno1" class="form-control" value='1'></td>
										<td> <input type="text" name="noOfBird1" id="noOfBird1" class="form-control" ></td>
										<td> <input type="text" name="ToatlWeight1" id="ToatlWeight1" class="form-control" ></td>
										<td><button type="button"  value="Add" class="form-control" id="add_row" >+</button></td>
										<td><button type="button"  value="Add" class="form-control" id="delete_row" >-</button></td>
									</tr>
									<tr id='addr2'></tr>
								</tbody>
								
								
								<tfoot>
									<tr>
										<th>Total <input readonly style="border:0px; width:25px; font-size:30; color:red;" id="num" name="num" value="1"/></th>
										<th>0</th>
										<th>0</th>
									</tr>
									<tr>
										<th></th>
										<th>Total bird in Gm</th>
										<th>4400</th>
									</tr>
								</tfoot>
							</table>
						</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 WeightEntry">Add record</button></center>
						</div>
					</div>                        
				</form>
				
			</div>
		</div>
		<!-- END DATA EXPORT -->
		
	</div>
</div>
<!-- /main -->	
<script>
	
	$(document).ready(function(){
		var i=2;
		$("#add_row").click(function(){
			$('#addr'+i).html("<td><input name='batchSlno"+i+"' id='batchSlno"+i+"' type='text'  class='form-control input-md' value='"+i+"' /> </td><td><input  name='noOfBird"+i+"'id='noOfBird"+i+"' type='text'   class='form-control input-md'></td><td><input  name='ToatlWeight"+i+"' id='ToatlWeight"+i+"' type='text'  class='form-control input-md'></td>");
			
			$('#tab_logic').append('<tr id="addr'+(i+1)+'"></tr>');
			
			$('#num').val(i);
			i++; 
		});
		$("#delete_row").click(function(){
			if(i>1){
				$("#addr"+(i-1)).html('');
				i--;
				$('#num').val(i);
			}
		});
		
	});
	
	$('.WeightEntry').click(function(e)
	{
		e.preventDefault();
		$.ajax({
			url: 'AddWeightEntry',
			type: 'POST',
			data:$('#frmmain').serialize(),
			success: function(data) 
			{
				
			}
			
		});
	});
</script>