<?php 
	$header_file=APPPATH.'views/include/header.php';
	require($header_file);
	$sidenav_file=APPPATH.'views/include/sidenav.php';
	require($sidenav_file);	?>
<style>
.card {
    margin-bottom: 0.475rem!important;
    border: none!important;
    box-shadow: 0 2px 18px 1px rgb(49 53 72 / 10%)!important;
    border-radius: .45rem!important;
}
</style>  
    <!-- BEGIN: Content-->
    <div class="app-content content">
      <div class="content-overlay"></div>
      <div class="content-wrapper">
        <div class="content-header row">
          <div class="content-header-left col-md-12 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-inline-block">GRN </h3>
            <div class="row breadcrumbs-top d-inline-block">
              <div class="breadcrumb-wrapper col-12">
                <ol class="breadcrumb">
                  <li class="breadcrumb-item"><a href="#">Home</a>
                  </li>
                  <li class="breadcrumb-item"><a href="#">Purchase Order</a>
                  </li>
                  <li class="breadcrumb-item active">GRN 
                  </li>
                </ol>
              </div>
            </div>
          </div>
          
        </div>
        <div class="content-body"><!-- Basic form layout section start -->
<section id="basic-form-layouts">
	<div class="row justify-content-md-center">
		<div class="col-md-12">
		    	<form class="form" autocomplete="off" action="<?php echo site_url('Purchase/addGrn');?>" method="post" enctype="multipart/form-data">
			<div class="card">
				<div class="card-header">
					<h4 class="card-title" id="basic-layout-form-center">Purchase Order</h4>
					<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
					<div class="heading-elements">
						<ul class="list-inline mb-0">
							<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
							<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
							<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
							<li><a data-action="close"><i class="ft-x"></i></a></li>
						</ul>
					</div>
				</div>
					
					<?php 	foreach($purchase_order as $purchase) 
					
					?>
					<div class="row justify-content-md-center" style="margin-top: 7px!important;">
								<div class="col-md-2" style="margin-right:-23px!important;">
								<div class="form-group">
									<label>PO.NO</label>
									<input type="text" name="order_no" id="order_no" class="form-control" value="<?php echo $purchase->purchase_no; ?>" readonly tabindex="-1" />
								</div>
							</div>
							<div class="col-md-2">
								<div class="form-group">
									<label>PO DATE</label>
									<input type="text" name="order_date"  id="order_date" class="form-control" readonly="readonly" value="<?php echo $purchase->purchase_date; ?>" tabindex="-1" />
								</div>
							</div>
							<div class="col-md-2">
								<div class="form-group">
									<label>GRN DATE</label>
									<?php $cur_date = date("d-m-Y"); ?>
										<input class="form-control" type="text" name="grn_date"  id="uk_dp_1" value="<?php echo $cur_date; ?>" readonly tabindex="-1" >
									<!--<input class="form-control" type="text" name="grn_date"  id="uk_dp_1" placeholder="Date" data-uk-datepicker="{format:'DD-MM-YYYY'}" required >-->
								</div>
							</div>
							<div class="col-md-2">
								<div class="form-group">
									<label>INVOICE NO</label>
									<input class="form-control" type="text" name="grn_invoice" id="grn_invoice" required >
								</div>
							</div>
							<div class="col-md-2">
								<div class="form-group">
									<label>SUPPLIER NAME</label>
									<input type="text" name="supplier_name"  id="supplier_name" class="form-control" readonly="readonly" value="<?php echo $purchase->venders_name; ?>" tabindex="-1" />
								</div>
							</div>
							<div class="col-md-2">
								<div class="form-group">
									<label>INVOICE UPLOAD</label>
									<input type="file" name="in_upload[]" id="in_upload" class="form-control image_file" accept="image/*" multiple />
									<div id="errfn2" style="color:red;"></div>
									<input name="indent_id" id="indent_id" type="hidden" class="textbox" value="<?php echo $purchase->purchase_id ?>">
									<input type="hidden" name="purchase_id" id="purchase_id" class="form-control" value="<?php //echo $cur_auto_id ?>"/>
									<input type="hidden" name="branchname" id="branchname" class="form-control" value="<?php echo $_SESSION['branch_name']?>"/>
									<input type="hidden" name="uname" id="uname" class="form-control" value="<?php echo $_SESSION['username']?>"/>
									<input type="hidden" name="user_name" id="user_name" class="form-control" value="<?php echo $_SESSION['full_name']?>"/>
								</div>
							</div>
							</div>
							<div class="row justify-content-md-center" style="margin-top: 7px!important;">
							<div class="col-md-3" style="margin-right:-23px!important;">
								<div class="form-group">
									<label>INVOICE DATE</label>
									<input class="form-control pickadate datepicker picker__input picker__input--active" type="text" name="grn_inv_date" id="grn_inv_date" data-uk-datepicker="{format:'DD-MM-YYYY'}" required >
								</div>
							</div>
							</div>
							
						</div>
						</div>
				</div>	
				
				<div class="row">
				    <?php
					
					$count = 1;
					foreach($purchase_item as $pitem){
					?>
		    <div class="col-md-5">
    			<div class="card" style="height: 58px!important;">
    				<div class="card-content collapse show">
    					<div class="card-body">
    					    	<?php
										if($pitem->purchase_order_status == 'Closed') {
										?>
										
										<div class="row" style="margin-top: -12px!important;margin-left: -36px!important;">
											<div class="col-md-5">
												<div class="form-group">
													<input class="form-control product_details" style="width: 202px!important;" type="text" name="item_name[]" id="item_name <?php echo $count; ?>" value="<?php echo $pitem->item_name; ?>" disabled tabindex="-1" />
													<input class="form-control product_details" type="hidden" name="uom[]" id="uom <?php echo $count; ?>" value="<?php echo $pitem->unit_measurement; ?>" disabled tabindex="-1" />
												</div>
											</div>
											<div class="col-md-2">
												<div class="form-group">
													<input class="form-control product_details quantity" type="text" name="quantity[]" style="width: 80px!important;"  id="quantity<?php echo $count; ?>" value="<?php echo $pitem->required_qty; ?>" disabled tabindex="-1" />
												</div>
											</div>
											<div class="col-md-2">
												<div class="form-group">
													<input class="form-control product_details price" type="text" name="price[]" style="width: 80px!important;"   id="price <?php echo $count; ?>" value="<?php echo $pitem->item_price; ?>" disabled tabindex="-1" />
												</div>
											</div>
											<div class="col-md-3">
												<input class="form-control batch_no total_amount" type="text" name="total_amount[]" style="width: 91px!important;"  id="total_amount<?php echo $count; ?>" value="<?php echo $pitem->total_amount; ?>" disabled tabindex="-1" />
											</div>
											</div>
									
										<?php
											} else {
										?>	
										
										<div class="row" style="margin-top: -12px!important;margin-left: -32px!important;">
											<div class="col-md-5">
												<div class="form-group">
													<input class="form-control product_details" type="text" name="item_name[]" id="item_name <?php echo $count; ?>" value="<?php echo $pitem->item_name; ?>" style="width: 202px!important;"  readonly tabindex="-1" />
													<input class="form-control product_details" type="hidden" name="uom[]" id="uom <?php echo $count; ?>" value="<?php echo $pitem->unit_measurement; ?>" readonly tabindex="-1" />
												</div>
											</div>
											<div class="col-md-2">
												<div class="form-group">
													<input class="form-control product_details " type="text" name="quantity[]" style="width: 80px!important;"  id="quantity<?php echo $count; ?>" value="<?php echo $pitem->required_qty; ?>" readonly tabindex="-1" />
												</div>
											</div>
											<div class="col-md-2">
												<div class="form-group">
													<input class="form-control product_details" type="text" name="price[]" style="width: 80px!important;"   id="price <?php echo $count; ?>" value="<?php echo $pitem->item_price; ?>" readonly tabindex="-1" />
												</div>
											</div>
											<div class="col-md-3">
												<input class="form-control batch_no total_amount" type="text" name="total_amount[]" style="width: 91px!important;" id="total_amount<?php echo $count; ?>" value="<?php echo $pitem->total_amount; ?>" readonly tabindex="-1" />
											</div>
										</div>
										
										<?php
										}
									?>	
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-7">
    			<div class="card" style="height: 58px!important;">
    				<div class="card-content collapse show">
    					<div class="card-body">
    					    <?php
										if($pitem->purchase_order_status == 'Closed') {
										?>
										
										<div class="row" style="margin-top: -12px!important;">
											<div class="col-md-2 ">
												<div class="form-group">
													<input class="item_id" type="hidden" name="item_id[]" id="item_id" value="<?php echo $pitem->purchase_order_id;?>" disabled>
													<input class="qty form-control comm" type="text" name="inward_quantity[]"  id="inward_quantity[]" value="<?php echo $pitem->required_qty; ?>" placeholder ="Qty" disabled />
												</div>
											</div>
											<div class="col-md-2 ">
												<div class="form-group">
													<input class="grn_balance form-control " type="text" name="alredy_grn[]"   id="alredy_grn" value="<?php echo $pitem->grn_balance_qty; ?>" disabled />
												</div>
											</div>
											<div class="col-md-2">
												<div class="form-group">
													<input class="price form-control" type="text" name="inward_price[]"  id="inward_price[]" value="<?php echo $pitem->grn_last_price; ?>" placeholder ="price" disabled />
												</div>
											</div>
											<div class="col-md-1">
												<div class="form-group">
													<input class="tax form-control" type="text" name="grn_tax[]"   id="grn_tax[]" value="<?php echo $pitem->grn_last_tax; ?>%" placeholder="tax(%)" disabled />
												</div>
											</div>
											<div class="col-md-2">
												<div class="form-group">
													<input class="total form-control" type="text" name="inward_total_amount[]" value="<?php echo $pitem->grn_last_amount; ?>" id="inward_total_amount[]"  placeholder ="Amount" disabled />
												</div>
											</div>
											<div class="col-md-1">
												<div class="form-group">
													<input class="remarks form-control" type="text" name="remarks[]" id="remarks[]" value="<?php echo $pitem->grn_last_remarks; ?>" placeholder ="Remarks" disabled  />
												</div>
											</div>
											<div class="col-md-1">
												<div class="form-group">
													<img src="<?php echo base_url(); ?>app-assets/images/right.png" alt="" class="img_main"/>
													<input type="hidden" name="inward_status[]" id="inward_status" value="<?php echo $pitem->purchase_order_status;?>" >
												</div>
											</div>
										</div>
										
										<?php
											} else {
										?>
									
										
											<div class="row" style="margin-top: -12px!important;">
													<input class="item_id form-control " type="hidden" name="item_id[]" id="item_id" value="<?php echo $pitem->purchase_order_id;?>">	
													<input class="item_id form-control" type="hidden" name="item_sid[]" id="item_sid" value="<?php echo $pitem->item_id; ?>">
													<input type="hidden" name="stock_item[]"   id="stock_item <?php echo $count; ?>" value="<?php echo $pitem->stock_item; ?>" />
													<input class="qty form-control col-md-1 comm" type="text" name="inward_quantity[]"  id="inward_quantity"  placeholder="Qty"   data-uk-tooltip="{pos:'bottom'}" title=" Remaining Qty :  <?php echo $pitem->total_balance_qty; ?>"  />
													<input class="grn_balance form-control col-md-1 comm" type="text" name="alredy_grn[]"   id="alredy_grn" value="<?php echo $pitem->grn_balance_qty; ?>" disabled />
													<input class="grn_balance form-control" type="hidden" name="grn_updated[]"   id="grn_required" value="<?php echo $pitem->grn_balance_qty; ?>" />
													<input class="price form-control col-md-1 comm" type="text" name="inward_price[]"  id="inward_price[]"  placeholder="Price" />
												<!--	<input class="tax tax_auto form-control md-col" type="text" name="grn_tax[]"  id="grn_tax1"  placeholder="tax(%)"/>-->
													<select id="grn_tax1" name="grn_tax[]" class="tax tax_auto col-md-1 form-control" >
														<option value="0">TAX</option>
														<?php  foreach($tax as $row)
														{
															echo '<option value="'.$row->tax_percentage.'">'.$row->tax_percentage.'</option>';
														} 
													?>
													</select>
													<input class="taxamount form-control" type="hidden" name="tax_amount[]"  id="tax_amount" />
													<input class="total form-control" type="hidden" name="inward_total_amount[]" id="inward_total_amount[]"/>
													<input class="grand grn_grand form-control col-md-1" type="text" name="inward_grand_amount[]" id="inward_grand_amount[]"  placeholder="Amount" readonly tabindex="-1" />
													<input class="remarks form-control col-md-1 " style="margin-left: 10px!important;" type="text" name="remarks[]" id="remarks[]" placeholder="Remarks"/>
													<input class="qty_pending form-control" type="hidden" name="grn_balanace[]"   id="grn_balanace_qty" value="<?php echo $pitem->total_balance_qty; ?>"/>
													
													<?php if($pitem->expiry_date == 'Yes') { ?>
												<input type="text" class="form-control col-md-2 md-col pickadate datepicker picker__input picker__input--active" id="expiry_date" name="expiry_date[]" data-uk-datepicker="{format:'DD-MM-YYYY'}" placeholder="Expiry Date">	
										<?php } else { ?>
										<input type="text" class="form-control md-col col-md-2" id="expiry_date" name="expiry_date[]" placeholder="No Expiry Date" readonly>
														<?php } ?>
													
													<img src="<?php echo base_url(); ?>app-assets/images/wrong.png" alt="" class="img_main col-md-1" style="margin-left: 28px!important;padding-right: 24px!important;"/>
													<input type="hidden" name="inward_status[]" id="inward_status" value="<?php echo $pitem->purchase_order_status;?>" style="width: 50px;">
												
												</div>
											
											
										
										<?php
										}
									?>	
                        </div>
                    </div>
                </div>
            </div>
            <?php $count++; } ?>
		</div>			
			

				<br/>
				<div class="card">
    				<div class="card-content collapse show">
    					<div class="card-body">
							<div class="md-card-content">
								<div class="row">
									<div class="col-md-2">
										<div class="form-group">
											<label>Courier Charge</label>
											<input class="form-control product_details " type="text" name="courier" id="courier" value="0"  />
										</div>
									</div>
									<div class="col-md-2">
										<div class="form-group">
											<label>Transport Charge</label>
											<input class="form-control product_details " type="text" name="transport" id="transport" value="0"  />
										</div>
									</div>
									<div class="col-md-2">
										<div class="form-group">
											<label>Insurance</label>
											<input class="form-control product_details " type="text" name="insurance" id="insurance" value="0"  />
										</div>
									</div>
									<div class="col-md-2">
										<div class="form-group">
											<label>Total Amount</label>
											<input class="form-control product_details " type="text" name="tamt" id="tamt" value="0" readonly />
										</div>
									</div>
									<div class="col-md-1">
										<div class="form-group">
											<label>Round off</label>
											<input class="form-control product_details " type="text" name="roundoff" id="roundoff" value="0" />
										</div>
									</div>
									<div class="col-md-2">
										<div class="form-group">
											<label>Final Amount</label>
											<input class="form-control product_details " type="text" name="total_amt" id="total_amt" value="0" readonly />
										</div>
									</div>
									<div class="col-md-12 text-right">
										<div class="form-group">
											
											<button type="submit" class="btn btn-sm btn-primary" onclick="return confirm('Are you sure you want to submit this form?')">
												<i class="ft-save"></i>  Add GRN
											</button>
											<!--<input type="button" name="submit1" id="submit1"  class="md-btn md-btn-primary" value="Close GRN" onClick="return lBooked(); ">-->
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</form>
			<br/>
			
			<?php
				foreach($purchase_order as $purchase){
				?>
			 <div class="col-lg-4 col-sm-4 col-12">
				<div class="form-group text-center">
					<button class="btn btn-lg btn-success font-medium-1 grid-form-dialog-btn mt-1">Close Manual</button>
					<p class="font-small-3 mt-1"></p>
					<div class="grid-form-dialog" title="Manual Purchase Order Close">
						<div class="container">
							<form action="" id="invoice_form_validate" class="uk-form-stacked"  method="post" autocomplete="off">
								<div class="form-group row">
									<label for="inputEmail3" class="col-sm-2 col-form-label">Enter Remarks</label>
									<div class="col-sm-10">
									<input name="indent_id" id="indent_id" type="hidden" class="textbox" value="<?php echo $purchase->purchase_id ?>">
										<input type="text" class="form-control"name="po_manuval_remarks" id="po_manuval_remarks">
									</div>
								</div>
								
								<div class="form-group row">
									<div class="offset-sm-2 col-sm-10">
										<button type="button" class="md-btn md-btn-flat uk-modal-close">Close</button>
										<input type="button" class="md-btn md-btn-flat md-btn-flat-primary" value="Confirm" name="submit3" id="submit3">
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
			<?php  } ?>
			<div id="image_preview"></div>
			<div class="doc_viewer">
				<!--<iframe id="viewer" frameborder="0" scrolling="yes" width="950" height="500"></iframe>-->
				<img id="viewer" />
			</div>
							<div class="form-actions text-center">
								<div class="col-md-2 ">
								<div class="form-group">
									
									<input class="form-control batch_no" type="text" name="bbbb"  id="tot" readonly Placeholder="Total amount"/>
								</div>
							</div>
								
							</div>
						</form>	

					</div>
				</div>
			</div>
		</div>
	</div>

</section>
<!-- // Basic form layout section end -->
        </div>
      </div>
    </div>
    <?php //require('include/theme_customizer.php');?>

   <?php 
  $footer_file=APPPATH.'views/include/footer.php';
	require($footer_file);
	?>
<script type='text/javascript'>//<![CDATA[
	/*	$(window).load(function(){
			$(".qty,.price,.tax,.closing")
			.each( function(){ $(this).on( {'keyup': function() { 
				var j0=$(this).nextAll(".total"); 
				j0.val( j0.prevAll(".qty").val() * j0.prevAll(".price").val() );
				//alert(j0.val());
				var j2=$(this).nextAll(".taxamount"); 
				j2.val(((j0.val() * parseFloat(j2.prevAll(".tax").val())) / 100).toFixed(2));
				//$('.tax').blur();
				var j3=$(this).nextAll(".grand"); 
				j3.val(((parseFloat(j0.val()) + parseFloat(j2.val()))).toFixed(2));
				var j1=$(this).nextAll(".final"); 
				j1.val( j1.prevAll(".qty").val() + j1.prevAll(".closing").val());
			}
			})});
		}); */
		
		$('.price').each(function() { $(this).on( {'keyup': function() {
			var qty = $(this).parent().find('.qty').val();
			var price = $(this).parent().find('.price').val();
			var tax = $(this).parent().find('.tax').val();
					
			var total = (parseFloat(qty) *  parseFloat(price));
			var tax_amt = ((parseFloat(total) * parseFloat(tax))/100);
			var total_price = (parseFloat(total) +  parseFloat(tax_amt)).toFixed(2);
			//alert(total);
			
			$(this).parent().find('.total').val(total);
			$(this).parent().find('.taxamount').val(tax_amt);
			$(this).parent().find('.grand').val(total_price);
		}
		})
		})
	
		$('.tax').each(function() { $(this).on( {'change': function() {
			var qty = $(this).parent().find('.qty').val();
			var price = $(this).parent().find('.price').val();
			var tax = $(this).parent().find('.tax').val();
			var total = $(this).parent().find('.total').val();
			
			var tax_amt = ((parseFloat(total) * parseFloat(tax))/100);
			var total_price = (parseFloat(total) +  parseFloat(tax_amt)).toFixed(2);
			
			$(this).parent().find('.total').val(total);
			$(this).parent().find('.taxamount').val(tax_amt);
			$(this).parent().find('.grand').val(total_price);
			}
			})
		})
	</script>
	<script>
		$(document).ready(function(){
			$(".qty").each( function(){ $(this).on( {'change keyup': function() {
				var q1 = $(this).parent().find('.qty').val();
				var q2 = $(this).parent().find('.qty_pending').val();
				//var grand = $(this).parent().find('.grand').val();
				//var tot = $("#total_amt").val();
				//var tot_amt = 0;
				//alert(tot);
				//alert(grand);
				//alert($(this).parent().find('.qty').val());
				if(parseFloat(q1) <= parseFloat(q2)){
					//alert("sucess");
				}
				else{
				    if(q1 != '')
				    {
    					alert("You cant enter more than PO balance quantity");
    					//tot_amt = parseFloat(tot) - parseFloat(grand);
    					//$('#inward_quantity').focus();
    					$(this).parent().find('.qty').val('');
    					$(this).parent().find('.grand').val('')
    					//$("#total_amt").val(tot_amt.toFixed(2));
				    }
				}
			}
			})
			});
		});
	</script>
	<script>
	
		
	$('#submit3').click(function() {
		var remarks = $('#po_manuval_remarks').val();
		var indent_id = $('#indent_id').val();
		if(remarks == '')
		{
			alert("Please Enter Remarks");
			return false;
		}
		else
		{
			$.ajax({
				type: "POST",
				dataType:'json',
				data : { indent_id : indent_id, remarks : remarks },
				url: "<?php echo base_url();?>index.php/Purchase/po_close_update",
				success: function(data) { 
					setTimeout(function() {
						window.location.href = '<?php echo site_url('Purchase/Closed_list');?>';
					}, 200);
				}
			});
		}
	});

		
	</script>
	<script type="text/javascript">
		/*jQuery(document).ready(function(){
			$('.tax_auto').autocomplete({
			source:'tax_amount_auto.php', 
			minLength:1,
			});
		});*/
	</script>
	<script type="text/javascript">
		$(function() {
			$('input.txtNum').blur(function() {
				var amt = parseFloat(this.value);
				//$(this).val('$' + amt.toFixed(2));
				$(this).val((Math.round(amt*100))/100).toFixed(2);
			});
		});
	</script>
	<!-- total amount calculation -->
	<script type="text/javascript">
		$('.tax').change(function () {
			var sum1 = 0;
			// we use jQuery each() to loop through all the textbox with 'price' class
			// and compute the sum for each loop
			$('.grn_grand').each(function() {
				sum1 += Number($(this).val());
			});
			var t_sum = (sum1).toFixed(2);
			// set the computed value to 'totalPrice' textbox
			$('#total_amt').val(t_sum);
			$('#tamt').val(t_sum);
		});
	</script>
	<script type="text/javascript">
		$('#courier').change(function() {
			var courier = $('#courier').val();
			var tamt = $('#total_amt').val();
			var sum = 0;
			var sum = parseFloat(parseFloat(tamt) + parseFloat(courier));
			if (!isNaN(sum)) {
				$('#total_amt').val(sum.toFixed(2));
				$('#tamt').val(sum.toFixed(2));
			}
		});
		$('#transport').change(function () {
			var transport = $('#transport').val();
			var tamt = $('#total_amt').val();
			var sum = 0;
			var sum = parseFloat(tamt) + parseFloat(transport);
		    $('#total_amt').val(sum.toFixed(2));
			$('#tamt').val(sum.toFixed(2));
		});
		$('#insurance').change(function () {
			var insurance = $('#insurance').val();
			var tamt = $('#total_amt').val();
			var sum = 0;
			var sum = parseFloat(tamt) + parseFloat(insurance);
			$('#total_amt').val(sum.toFixed(2));
			$('#tamt').val(sum.toFixed(2));
		});
	</script>
	<script type="text/javascript">
		$('.price').keyup(function () {
			var sum1 = 0;
			// we use jQuery each() to loop through all the textbox with 'price' class
			// and compute the sum for each loop
			$('.grn_grand').each(function() {
				sum1 += Number($(this).val());
			});
			var t_sum = (sum1).toFixed(2);
			// set the computed value to 'totalPrice' textbox
			$('#total_amt').val(t_sum);
			$('#tamt').val(t_sum);
		});
	</script>
	<script type="text/javascript">
		$('#roundoff').keyup(function () {
			var rnd = $('#roundoff').val();
			if(rnd == '')
			{
				rnd = 0;
			}
			var tamt = $('#tamt').val();
			var final_amt = (parseFloat(tamt) + parseFloat(rnd)).toFixed();
			$('#total_amt').val(final_amt);
		});
	</script>
	<script>
		$(document).ready(function () {
			$('.image_file').change(function () {
				var val = $(this).val().toLowerCase();
				var regex = new RegExp("(.*?)\.(jpg|png|jpeg|JPG)$");
				if(!(regex.test(val))) {
					$(this).val('');
					//alert('Please select correct file format');
					document.getElementById('errfn2').innerHTML="Please upload proper image format";
                    $('#image_preview').empty();
				}
				else
                {
                    preview_image();
                    document.getElementById('errfn2').innerHTML="";
                }
			    
			}); });
	</script> 
	 <script type="text/javascript">
		 $(document).ready(function () {
			 $('.image_file').change(function () {
		// function PreviewImage() {
                pdffile=document.getElementById("in_upload").files[0];
                pdffile_url=URL.createObjectURL(pdffile);
              //  $('#viewer').attr('src',pdffile_url);
           // }
			 });
		 });
      </script>
	  <script>
			function preview_image() 
			{
				var total_file=document.getElementById("in_upload").files.length;
				for(var i=0;i<total_file;i++)
				{
					$('#image_preview').append("<img style='width: 90%!important;' src='"+URL.createObjectURL(event.target.files[i])+"'><br>");
				}
			}
	  </script>
     <script>
	$(window).on('beforeunload', function () {
         //$("input[type=submit], input[type=button]").prop("disabled", "disabled");
		 $("input[type=submit]").prop("disabled", "disabled");
		 $("#submit").css("background-color","#dcdcdc");
    });
    
    $(document).ready(function() {
  $(window).keydown(function(event){
    if(event.keyCode == 13) {
      event.preventDefault();
      return false;
    }
  });
});
</script>
  </body>
  <!-- END: Body-->

<!-- Mirrored from pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-modern-menu-template/form-layout-basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Apr 2020 09:38:02 GMT -->
</html>