<script>
$(function() 
{
 $( "#porter" ).autocomplete({
  source: 'porter.php'
 });
});


$(function() 
{
 $( "#truck" ).autocomplete({
  source: 'truck.php'
 });
});


$(function() 
{
 $( "#cust" ).autocomplete({
  source: 'cust.php'
 });
});
</script>
<?php
   echo"<div class='modal fade' id='Modaldis-$i' tabindex='-1' role='dialog' aria-labelledby='exampleModalLabel' aria-hidden='true'>
  <div class='modal-dialog' role='document'><div class='modal-content'><div class='modal-header text-left'>
        <h5 class='modal-title' id='exampleModalLabel'>CREATE NEW ASSET
        <span class='pull-right'>  </span></h5>

      </div><form action='' method='post'>
      <div class='modal-body text-left'><div class='row'>

        <div class='form-group'>
			<div class='col-md-5' align='right'> 
    <label class='control-label' style='padding-top:10px;'>Due Date</label>
        </div>
            <div class='col-md-6'>
        <div class='input-group date' data-provide='datepicker'>	
      <input class='form-control form-center' name='dati' type='text' value='$dati' onkeypress='return isNumberKey(event)' required><span class='input-group-addon'>
      <i class='lnr lnr-calendar-full'></i></span></div>
            </div></div>
		<div class='row'> </div>
		
		
		
		<div class='form-group'>
			<div class='col-md-5' align='right'> 
    <label class='control-label' style='padding-top:10px;'>Asset Name</label>
        </div>
            <div class='col-md-6'>
<input name='name' class='form-control' type='text' OnKeyup='return cUpper(this);' value='$name' style='margin-bottom:10px; margin-top:10px;'>
            </div></div>
		<div class='row'> </div>
		
		
		
		<div class='form-group'>
			<div class='col-md-5' align='right'> 
    <label class='control-label' style='margin-top:10px;'>Asset Number</label>
        </div>
            <div class='col-md-6'>
<input name='num' class='form-control text-center' OnKeyup='return cUpper(this);' type='text' value='$num' style='margin-bottom:10px;'>
            </div></div>
		<div class='row'> </div>
		
		
		
	<div class='form-group'>
			<div class='col-md-5' align='right'> 
    <label class='control-label' style='margin-top:10px;'>Asset Type</label>
        </div>	
		 <div class='col-md-6'>
<select class='form-control' name='classi' style='font-size:16px; height:34px; margin-bottom:10px;'><option value=''> </option>";

    $doi=mysqli_query($conn, "SELECT `Asset` FROM `assetype` GROUP BY `Asset` ORDER BY `Asset` ASC");
			while($roi=mysqli_fetch_assoc($doi)){
				$fna=$roi['Asset'];
				if($type==$fna)
				    $s="selected";
			    else
			        $s="";
	    echo"<option value='$fna' $s> $fna </option>";
			}
			
			
            echo"</select>
            </div></div>
		<div class='row'> </div>
		
		
		
		<div class='form-group'>	 
			  <div class='col-md-5' align='right'>
			  <label class='control-label' style='padding-top:10px;'> Value&nbsp; / &nbsp;Rate </label></div>	

	 <div class='col-xs-4'>
          <input name='amo' class='form-control text-center' type='text' onkeyup='format(this);' value='$amoo' onkeypress='return isNumberKey(event)' required style='margin-bottom:10px;'>
    </div><div class='col-xs-2' style='padding-left:0px; margin-left:0px;'>
	    
	   <input name='rate' class='form-control text-center' type='text' onkeyup='format(this);' value='$rateo' onkeypress='return isNumberKey(event)' style='margin-bottom:10px;' placeholder='%'></div>
		</div>
	
		<div class='row'> </div>
		
		
		<div class='form-group'>	 
			  <div class='col-md-5' align='right'>
			  <label class='control-label' style='padding-top:10px;'>Asset Location </label></div>	

	 <div class='col-md-6'>
	    <select class='form-control' name='loco' title='Location' data-toggle='tooltip' data-placement='top' style='margin-left:0px; margin-bottom:10px;' required><option value='' selected='selected'>Select Location</option>";
		
			$doi=mysqli_query($conn, "SELECT `Store` FROM `expenses` WHERE `Status`='0' GROUP BY `Store` ORDER BY `Store` ASC");
			while($roi=mysqli_fetch_assoc($doi)){
				$stor=$roi['Store'];
				if($loco==$stor)
				    $s="selected";
				else
				    $s='';
			echo"<option value='$stor' $s> $stor </option>";
			}
		
		   echo"</select></div>
		</div>
	
		<div class='row'> </div>
		
		
			<div class='form-group'>
			<div class='col-md-5' align='right'> 
    <label class='control-label' style='margin-top:10px;'>Serial/Chassis No</label>
        </div>
            <div class='col-md-6'>
<input name='serio' class='form-control text-center' OnKeyup='return cUpper(this);' type='text' value='$serio' style='margin-bottom:10px;'>
            </div></div>
		<div class='row'> </div>
		
			 	
		 <div class='form-group'>
			<div class='col-md-5' align='right'> 
    <label class='control-label' style='padding-top:10px;'>Purchase Date</label>
        </div>
            <div class='col-md-6'>
        <div class='input-group date' data-provide='datepicker'>	
      <input class='form-control form-center' name='purc' type='text' value='$purc' onkeypress='return isNumberKey(event)' required><span class='input-group-addon'>
      <i class='lnr lnr-calendar-full'></i></span></div>
            </div></div>
		<div class='row'> </div>
		
		
		
		 <div class='form-group'>
			<div class='col-md-5' align='right'> 
    <label class='control-label' style='padding-top:20px;'>Keeper`s Name</label>
        </div>
            <div class='col-md-6'>	
      <input class='form-control' name='sup' type='text' value='$sup' style='margin-top:10px;' required>
            </div></div>
		<div class='row'> </div>
		
			

		
	</div></div>";
	
	if($i=='0')
	    echo"<div class='modal-header text-right' style='height:50px; padding-top:15px;'>
	<input type='hidden' name='dato' value='$dato'><input type='hidden' name='datos' value='$datos'>
	<input type='hidden' name='p' value='$p'><input type='hidden' name='custo' value='$custo'>
		<button type='button' class='btn btn-xs btn-danger' data-dismiss='modal' style='width:80px;'> CANCEL </button>
        <button type='submit' name='addo' class='btn btn-xs btn-success' style='width:80px;'> SAVE </button></div>";
    else
	    echo"<div class='modal-header text-right' style='height:50px; padding-top:15px;'>
	<input type='hidden' name='dato' value='$dato'><input type='hidden' name='datos' value='$datos'>
	<input type='hidden' name='p' value='$p'><input type='hidden' name='custo' value='$custo'><input type='hidden' name='code' value='$code'>
		<button type='button' class='btn btn-xs btn-danger' data-dismiss='modal' style='width:80px;'> CANCEL </button>
        <button type='submit' name='updo' class='btn btn-xs btn-success' style='width:80px;'> UPDATE </button></div>";
        
      echo"</form>
  </div></div>
</div>";
?>