<?php 
include ('../ro_head.php'); ?>

<!-- BEGIN PAGE LEVEL STYLES -->

<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">

<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="../assets/global/plugins/select2/select2.css"/>



<link rel="stylesheet" type="text/css" href="../assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="../assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css"/>
<link rel="stylesheet" type="text/css" href="../assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css"/>


<!-- END PAGE LEVEL STYLES -->

<!-- BEGIN THEME STYLES -->

<link href="../assets/global/css/components.css" id="style_components" rel="stylesheet" type="text/css"/>
<link href="../assets/global/css/plugins.css" rel="stylesheet" type="text/css"/>
<link href="../assets/admin/layout/css/layout.css" rel="stylesheet" type="text/css"/>
<link id="style_color" href="../assets/admin/layout/css/themes/darkblue.css" rel="stylesheet" type="text/css"/>
<link href="../assets/admin/layout/css/custom.css" rel="stylesheet" type="text/css"/>


<script>

$(function () {

    var counter=0;

    $("#btndependent").bind("click", function () {

    counter++;

    $.ajax({
	   url:'dependant.php?cn='+counter,
	   type:'GET',
	   success: function(data){
	      
	           var div = $("<tr />");
	          div.html(data);
	         //alert(data);
	          $("#dependentBoxContainer").append(div);
	   
	   		}
		});
   
	});


	$("body").on("click", ".dependantremove", function () {
        $(this).closest("tr").remove();
        counter--;

    });

	$('body').on('click','#qty,.dobb', function () {    	
    	
		var names = [];		
		var age = [];		

		$("input[id='visatype']").each(function() {

		    if($(this).val()!=''){

		    	age.push($(this).val());
		    }
		});

	    $.ajax({
		   url:'val.php',

		   data: { name: names, ages: age},

		   type:'POST',
		   success: function(data){

		           $("#box").html(data);
		   
		   }
		});
    });
    
});

</script>
<script type="text/javascript">
function myFunction(parent,str) {
            
            if (confirm("Do you want to delete this Dependent?") == true) {
                window.location = 'dependent_del.php?parent='+parent+'&id='+str;
            }
            
        }

$(document).ready(function(){ 

	$("button#posupdatesubmit").click(function(){

		
		$.ajax({
			type: "POST",
			url: "docposmodalupdate.php",
			data: $('form.feedback3').serialize(),
			success: function(message){
				$("#feedback3").html(message)
				$("#myModal_autocomplete3").modal('hide'); 

				location.reload();
			},
			error: function(){
				alert("Error");
			}
		});
	});

	$("button#notessubmit").click(function(){
				
		var x = $('#notedesc').val();
		if(x!=''){

		$.ajax({
			type: "POST",

			url: "notesuploadfile.php",
			data: $('form.notesfeedback').serialize(),
			success: function(message){
				$("#feedback3").html(message);
				$("#myModal_autocomplete3").modal('hide'); 
				//alert(message);
				location.reload();
			},
			error: function(){
				alert("Error");
			}
		});
		}
		else{
			alert("please add some text.");
		}
	});

	$("#docposModal").on("show.bs.modal", function(e) {
    var link = $(e.relatedTarget);
    $(this).find(".modal-body").load(link.attr("href"));
	});

	$("#notesModal").on("show.bs.modal", function(e) {
    var link = $(e.relatedTarget);
    $(this).find(".modal-body").load(link.attr("href"));
	});

});

$(function() {

	$('body').on('click', '#agstatus', function() {

       
       var i= $("input[name=agstatus]:checked").val();

        if(i==2) // equal to a selection option
         {
             $('#agentshow').show();
              $('#companyshow').hide();
         }
         if(i==3) // equal to a selection option
         {
             $('#agentshow').hide();
             $('#companyshow').show();
         }
         if(i==1 || i=="") // equal to a selection option
         {
             $('#agentshow').hide();
             $('#companyshow').hide();
         }
    });
});

</script>

<style type="text/css">
	h4{
		font-size: 15px;
    font-weight: 500;
    border: 1px solid rgb(198, 222, 239);
    padding: 7px 20px;
    margin-bottom: 20px;
    margin-top: 20px;
    background-color: aliceblue;
    }
    #pricebox{
		/*border: 1px solid #C6DEEF;*/
		background-color: #C6DEEF;
		padding: 15px 30px;
    	border-radius: 5px !important;
	}

	.theme-panel{
		display: none;
	}
	.page-title {
 
    font-size: 18px;
 
    font-weight: 500;
    padding: 10px 20px;
}
	.modal-title {
 
    font-size: 18px;
 
    font-weight: 500;
    padding: 10px 20px;
}

h3{
	background-color: #c6deef;
	padding: 10px 0px 10px 20px;
	font-size: 18px;
}

</style>


<!-- END THEME STYLES -->

<link rel="shortcut icon" href="favicon.ico"/>

</head>

<!-- END HEAD -->

<!-- BEGIN CONTAINER -->

<div class="page-container">

<?php include_once("../ro_sidebar.php"); ?>

	<!-- BEGIN CONTENT -->

	<div class="page-content-wrapper">

		<div class="page-content">
<?php 
//	include("methodlist.php");
	$rs = mysqli_query($con,"select * from applicant_table where app_id='$_GET[appid]'");
    $row=mysqli_fetch_array($rs);
?>					

			<!-- BEGIN PAGE HEADER-->

			<h3 class="page-title">

			Update Application Information

			</h3>
			<!-- END PAGE HEADER-->

			<!-- BEGIN PAGE CONTENT-->

			<div class="row">

				<div class="col-md-12">	


				<form name="updateapplication" class="form-horizontal form-row-seperated" action="application_crud.php" method="post">

					<input type="hidden" class="form-control" name="parent" value="<?php echo $row["app_id"];?>" >
					<input type="hidden" name="total" value="<?php echo $row["total_fee"];?>">
                	<input type='hidden' name='actionid' value='update'>
					
					<div class="form-group">

                                <label class="col-md-2 control-label">
                                    Select Type: <span class="required">* </span>
                                </label>

                                <div class="col-md-3">
                                   <!--  <select name="biostatus" id="biostatus" class="form-control" required>
									  	<option value=""> - Select -</option>
									  	<option value="1"> Yes </option>
									  	<option value="0"> No </option>
									  </select>	 -->
									   <label class="radio-inline">
									      <input type="radio" name="agstatus" id="agstatus" value="1" <?php if($row["agent"]==1) echo "checked";?>>General 
									    </label>
									    <label class="radio-inline">
									      <input type="radio" name="agstatus" id="agstatus" value="2" <?php if($row["agent"]==2) echo "checked";?>>Agent
									    </label>
									    <label class="radio-inline">
									      <input type="radio" name="agstatus" id="agstatus" value="3" <?php if($row["agent"]==3) echo "checked";?>>Company
									    </label>
                                </div>
                                <div id="agentshow" style="display:<?php if($row["agent"]==2) echo "block"; else echo "none"; ?>;">
	                                <label class="col-md-2 control-label">
	                                    Agent Name: 
	                                </label>

	                                <div class="col-md-3">
	                                     <input type="text" class="form-control" name="agentname" placeholder="Agent name" value="<?php if($row["agent"]==2) echo $row["agent_name"]; ?>">
	                                </div>
                            	</div>
                            	<div id="companyshow" style="display:<?php if($row["agent"]==3) echo "block"; else echo "none"; ?>;">
	                                <label class="col-md-2 control-label">
	                                    Company Name: 
	                                </label>

	                                <div class="col-md-3">
	                                     <input type="text" class="form-control" name="companyname" placeholder="Company name" value="<?php if($row["agent"]==3) echo $row["agent_name"]; ?>">
	                                </div>
                            	</div>

                            </div>
                            
                         <div class="form-group">
							  	
							<label class="col-md-2 control-label">
								 Category: 
							</label>

							<div class="col-md-3">
								<input type="text" class="form-control" readonly="yes" value="<?php echo get_parent_mainvisatype_name($row["visa_type"],$con); ?>">							
	                        
							</div>

							<label class="col-md-2 control-label">
								 Type:
							</label>

							<div class="col-md-3">
								<input type="text" class="form-control" readonly="yes" value="<?php echo get_visatype_name($row["visa_type"],$con); ?>">
								<input type="hidden" id="visatype" value="<?php echo $row["visa_type"]; ?>">
	                        
							</div>

						</div>	

                            <h4>Personal Details</h4>
                            <div class="form-group">

								<label class="col-md-2 control-label">
									Salutation: <!-- <span class="required">* </span> -->
								</label>
                                    
								<div class="col-md-3">
									<select name="salut" class="form-control" required>									  	
									  	<option value="MR." <?php if($row["salu"]=="MR.") echo "selected";?>> Mr. </option>
									  	<option value="MRS." <?php if($row["salu"]=="MRS.") echo "selected";?>> Mrs. </option>
									  	<option value="MS." <?php if($row["salu"]=="MS.") echo "selected";?>> Ms. </option>
									  		<option value="MSTR" <?php if($row["salu"]=="MSTR") echo "selected";?>> Mstr </option>
									  </select>
								</div>

							</div>	
							
							<div class="form-group">


								<label class="col-md-2 control-label">
									Surname: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="surname" 
									value="<?php echo $row["surname"];?>" required>
								</div>

								<label class="col-md-2 control-label">
									Given Name: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="gname" value="<?php echo $row["givenname"];?>" required>
								</div>

							</div> 

					<!--		<div class="form-group">

								<label class="col-md-2 control-label">
									Date of Birth: <span class="required">* </span>
								</label>

								<div class="col-md-3">
								    	<input type="text" class="form-control date" style="text-transform: lowercase;" name="dob" id="dob" value="<?php echo date("d/m/Y", strtotime($row["birth_date"]));?>" required data-inputmask="'alias': 'date'" />
								
										
								</div>

								<label class="col-md-2 control-label">
									Place of Birth: 
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="pob" value="<?php 
									echo $row["placeofbirth"];?>" >
								</div>

							</div> 

							<div class="form-group">

								<label class="col-md-2 control-label">
									Gender: <span class="required">* </span>
								</label>

								<div class="col-md-3">									
									  <select name="gender" class="form-control" required>
									  	<option value=""> - Select -</option>
									  	<option value="Male" <?php if($row["gender"]=="Male") echo "selected";?>> Male </option>
									  	<option value="Female" <?php if($row["gender"]=="Female") echo "selected";?>> Female </option>
									  </select>	
								
								</div>	

								<label class="col-md-2 control-label">
									Nationality: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="nation" value="<?php echo $row["nationality"];?>" required>
								</div>

							</div> 

							<div class="form-group">

								<label class="col-md-2 control-label">
									Passport Type: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									 <select name="passtype" class="form-control" required>
									  	<option value=""> - Select -</option>									  	
									  	<option value="1" <?php if($row["passporttype"]=="1") echo "selected='yes'";?>> Normal Passport </option>
									  	<option value="2" <?php if($row["passporttype"]=="2") echo "selected='yes'";?>> Govt Passport </option>
									  </select>	
								</div>

								<label class="col-md-2 control-label">
									Passport No.: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="passport" value="<?php echo $row["passport_no"];?>" required>
								</div>

							</div>


							<div class="form-group">

								<label class="col-md-2 control-label">
									Passport Issue Date: 
								</label>

								<div class="col-md-3">
										<input type="text" class="form-control date" style="text-transform: lowercase;" name="pissue_date" id="pissue_date" value="<?php 
										 if($row["passissuedate"]!='0000-00-00'){
										 echo date("d/m/Y", strtotime($row["passissuedate"]));
										 }?>"  data-inputmask="'alias': 'date'" />
										
									<!--	<div class="input-group date date-picker" data-date-format="dd-mm-yyyy" data-date-end-date="0d">-->
									<!--	<input type="text" class="form-control" name="pissue_date" value="<?php //echo date("d/m/Y", strtotime($row["passissuedate"]));?>" required>-->
									<!--	<span class="input-group-btn">-->
									<!--	<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>-->
									<!--	</span>-->
									<!--</div>											
									
								</div>

								<label class="col-md-2 control-label">
									Passport Expire Date: <span class="required">* </span>
								</label>

								<div class="col-md-3">
										<input type="text" class="form-control date" style="text-transform: lowercase;" name="pexp_date" id="pexp_date" value="<?php echo date("d/m/Y", strtotime($row["passexpdate"]));?>" required data-inputmask="'alias': 'date'" />
										
									<!--	<div class="input-group date date-picker" data-date-format="dd-mm-yyyy" data-date-start-date="+165d" >-->
									<!--	<input type="text" class="form-control" name="pexp_date" value="<?php //echo date("d/m/Y", strtotime($row["passexpdate"]));?>" required>-->
									<!--	<span class="input-group-btn">-->
									<!--	<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>-->
									<!--	</span>-->
									<!--</div>											
									
								</div>

							</div>-->

						
							<h4>Contact Information</h4>

							<div class="form-group">

								<label class="col-md-2 control-label">
									Email Id: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="email" class="form-control" name="email" value="<?php echo $row["email"];?>" required>
								</div>

								<label class="col-md-2 control-label">
									Phone No.: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="phone" value="<?php echo $row["phone_no"];?>" required>
								</div>

							</div>
							

							<!--<div class="form-group">

								<label class="col-md-2 control-label">
									Home Address: 
								</label>

								<div class="col-md-3">
									<textarea class="form-control" name="haddress" ><?php echo $row["homeaddress"];?></textarea>
								</div>

								<label class="col-md-2 control-label">
									Payment Mode: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<select name="paymode" class="form-control" required>
									  	<option value=""> - Select -</option>
									  	<option value="1" <?php if($row["paymode"]==1) echo "selected";?>> Cash </option>
									  	<option value="2" <?php if($row["paymode"]==2) echo "selected";?>> Card </option>
									  </select>
								</div>

							</div>-->
							
							<div class="form-group">

								<label class="col-md-2 control-label">
									Delivery Type: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<select name="deliverymode" class="form-control" required>
									  	<option value=""> - Select -</option>
								
								<?php    
		                            $delrs = mysqli_query($con,"select * from deli_type_table where delitype_status=1 order by delitype_name ASC");
                            		while($delrow=mysqli_fetch_array($delrs)){ 
                                
                                 	  	echo "<option value='".$delrow["deli_typeid"]."'";
                                 	  	if($delrow["deli_typeid"]==$row["delitypeid"]) echo "selected";
                                 	  	echo "> ".$delrow["delitype_name"]." </option>";
									  	
									} 
								?>	
									</select>	
								</div>


							</div>
							
							

                        <?php    
                //////////////////// Child information starts here ///////////////
                
                        $drs = mysqli_query($con,"select * from applicant_table where parent='$row[app_id]' order by app_id ASC");
                        $i=1;

                        while($drow=mysqli_fetch_array($drs)){ 
                        $cn=$drow["app_id"];	
                        ?>
                        
                        <h3 class="page-title">	Dependent<?php echo "-".$i; ?> Information 
                        	
                        	<?php if($row["paystatus"]=="0"){ ?>
                        	<a href='#' class='btn btn-danger btn-xs' style="float: right;" onclick='myFunction(<?php echo $drow["parent"].",".$drow["app_id"]; ?>)' title='Delete'><i class='fa fa-list-alt'></i></a>
                        	<?php } ?></h3>
                        	
                        <input type="hidden" name="child[]" value='<?php echo $cn ;?>'>	
				
					<div class="form-group">
							  	
							<label class="col-md-2 control-label">
								Visa Category: 
							</label>

							<div class="col-md-3">
								<input type="text" class="form-control" readonly="yes" value="<?php echo get_parent_mainvisatype_name($drow["visa_type"],$con); ?>">							
	                        
							</div>

							<label class="col-md-2 control-label">
								Visa Type:
							</label>

							<div class="col-md-3">
								<input type="text" class="form-control" readonly="yes" value="<?php echo get_visatype_name($drow["visa_type"],$con); ?>">
								<input type="hidden" id="visatype" value="<?php echo $drow["visa_type"]; ?>">	
	                        
							</div>

					</div>

						<h4>Personal Details </h4>
						              <div class="form-group">

								<label class="col-md-2 control-label">
									Salutation: <!-- <span class="required">* </span> -->
								</label>
                                    
								<div class="col-md-3">
									<select name="salut<?php echo "ch".$cn ;?>" class="form-control" required>									  	
									  	<option value="MR." <?php if($drow["salu"]=="MR.") echo "selected";?>> Mr. </option>
									  	<option value="MRS." <?php if($drow["salu"]=="MRS.") echo "selected";?>> Mrs. </option>
									  	<option value="MS." <?php if($drow["salu"]=="MS.") echo "selected";?>> Ms. </option>
									  	<option value="MSTR" <?php if($drow["salu"]=="MSTR") echo "selected";?>> Mstr </option>
									  </select>
								</div>
								

							</div>
                            <div class="form-group">

								<label class="col-md-2 control-label">
									Surname: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="surname<?php echo "ch".$cn ;?>" 
									value="<?php echo $drow["surname"];?>" required>
								</div>

								<label class="col-md-2 control-label">
									Given Name: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="gname<?php echo "ch".$cn ;?>" value="<?php echo $drow["givenname"];?>" required>
								</div>

							</div> 
							<?php //echo $_REQUEST["cn"];?>
							<div class="form-group">


								<label class="col-md-2 control-label">
									Date of Birth: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									 <input type="text" class="form-control date" style="text-transform: lowercase;" name="dob<?php echo "ch".$cn ;?>" id="dob" value="<?php echo date("d/m/Y", strtotime($drow["birth_date"]));?>" required data-inputmask="'alias': 'date'" />
									<!-- <div class="input-group date date-picker" data-date-format="dd-mm-yyyy" data-date-end-date="0d">-->
									<!--	<input type="text" class="form-control " name="dob<?php //echo "ch".$cn ;?>" value="<?php //echo date("d/m/Y", strtotime($drow["birth_date"]));?>" required>-->
									<!--	<span class="input-group-btn">-->
									<!--	<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>-->
									<!--	</span>-->
									<!--</div>	-->
								</div>

								<label class="col-md-2 control-label">
									Place of Birth: 
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="pob<?php echo "ch".$cn ;?>" value="<?php echo $drow["placeofbirth"];?>" >
								</div>

							</div> 

							<div class="form-group">


								<label class="col-md-2 control-label">
									Gender: <span class="required">* </span>
								</label>

								<div class="col-md-3">									
									  <select name="gender<?php echo "ch".$cn ;?>" class="form-control" required>
									  	<option value=""> - Select -</option>
									  <option value="Male" <?php if($drow["gender"]=="Male") echo "selected";?>> Male </option>
									  	<option value="Female" <?php if($drow["gender"]=="Female") echo "selected";?>> Female </option>
									  </select>	
								
								</div>	

								<label class="col-md-2 control-label">
									Nationality: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="nation<?php echo "ch".$cn ;?>" value="<?php echo $drow["nationality"];?>" required>
								</div>

							</div> 

							<div class="form-group">

								<label class="col-md-2 control-label">
									Passport Type: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									 <select name="passtype<?php echo "ch".$cn ;?>" class="form-control" required>
									  	<option value=""> - Select -</option>
									  	<option value="1" <?php if($drow["passporttype"]=="1") echo "selected='yes'";?>> Normal Passport </option>
									  	<option value="2" <?php if($drow["passporttype"]=="2") echo "selected='yes'";?>> Govt Passport </option>
									  </select>	
								</div>

								<label class="col-md-2 control-label">
									Passport No.: <span class="required">* </span>
								</label>

								<div class="col-md-3">
									<input type="text" class="form-control" name="passport<?php echo "ch".$cn ;?>" value="<?php echo $drow["passport_no"];?>" required>
								</div>

							</div>


							<div class="form-group">

								<label class="col-md-2 control-label">
									Passport Issue Date: 
								</label>

								<div class="col-md-3">
								    <input type="text" class="form-control date" style="text-transform: lowercase;" name="pissue_date<?php echo "ch".$cn ;?>" id="pissue_date" value="<?php 
								    if($drow["passissuedate"]!='0000-00-00'){
								    echo date("d/m/Y", strtotime($drow["passissuedate"]));
								    }?>"  data-inputmask="'alias': 'date'" />
									<!--<div class="input-group date date-picker" data-date-format="dd-mm-yyyy" data-date-end-date="0d">-->
									<!--	<input type="text" class="form-control" name="pissue_date<?php //echo "ch".$cn ;?>" value="<?php //echo date("d/m/Y", strtotime($drow["passissuedate"]));?>" required>-->
									<!--	<span class="input-group-btn">-->
									<!--	<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>-->
									<!--	</span>-->
									<!--</div>											-->
									
								</div>

								<label class="col-md-2 control-label">
									Passport Expire Date: <span class="required">* </span>
								</label>

								<div class="col-md-3">
								    	<input type="text" class="form-control date" style="text-transform: lowercase;" name="pexp_date<?php echo "ch".$cn ;?>" id="pexp_date" value="<?php echo date("d/m/Y", strtotime($drow["passexpdate"]));?>" required data-inputmask="'alias': 'date'" />
									<!--<div class="input-group date date-picker" data-date-format="dd-mm-yyyy" data-date-start-date="+165d">-->
									<!--	<input type="text" class="form-control" name="pexp_date<?php //echo "ch".$cn ;?>" value="<?php //echo date("d/m/Y", strtotime($drow["passexpdate"]));?>" required>-->
									<!--	<span class="input-group-btn">-->
									<!--	<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>-->
									<!--	</span>-->
									<!--</div>											-->
									
								</div>

							</div>
							

                        <?php 
                        $i++;

                    	} 
                    	?>    
                        <!--- dependant information ends here -->        
                            
                  
		                	
		                	<div class="form-group">

		                		<?php 
									$date1 = new DateTime(substr($row["created_date"], 0, 10));
									$date2 = new DateTime();
									$difference = $date2->diff($date1)->format("%a");
									//echo $difference;
									if($difference==0){
									//if($row["paystatus"]=="0"){ ?>

		                		<label class="col-sm-2 control-label" ></label>

			                	<div class="col-sm-5" style="margin-top:20px;"><button class="btn green"><i class="fa fa-check"></i> Save</button></div>

			                	<?php } ?>
			                	
			                </div>	

			                <div class="form-group">         		
		                	
			                	<div class="col-sm-5">
			                		<div class="btn green" id="qty">Show Fee Details</div>
			                  		<div id="box">	</div>
								</div>
			                </div>	


<!--- Document tracker starts here -->

	<h3 class="page-title">

			Document Tracker

			</h3>
	<table class="table table-striped table-bordered table-hover" id="sample_2">
							<thead>
							<tr>
								<!--<th class="table-checkbox">
									<input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes"/>
								</th>-->
								 			<th style="width:10%">Seq No</th>
								 			<th style="width:10%">Barcode</th>
                                            <th style="width:15%">Application Date</th>
                                            <th style="width:15%">Document Status</th>
<!--                                             <th style="width:10%">Payment</th> -->

                                          <?php if($newarr[6]=="Update Position status") {?>		
                                             <th style="width:10%">Update</th> 
                                            <?php } ?>

                                            
							</tr>

							
							
							</thead>
							<tbody>

								<?php


								$sql = "";
								$result = mysqli_query($con,"select * from applicant_table where app_id='$_GET[appid]'");
						        $row = mysqli_fetch_array($result);
							?>

									
								<tr  class='odd gradeX'>
								<td><?php echo $row['v_uid'];?></td>
								<td><?php echo $row['refer_no'];?></td>
								
								<td><?php echo $row['created_date'];?></td>
								<td><?php 

								$vresult = mysqli_query($con,"SELECT docp_name FROM doc_position_table WHERE docp_id='".$row['doc_position']."'");
								$vrow=mysqli_fetch_array($vresult);
								echo $vrow['docp_name'];
								?></td>
								
								
								
						<?php  if($newarr[6]=="Update Position status") {?>	
							<td>

							<a href="doc_position_modal.php?id=<?php echo $row['app_id'];  ?>" class="btn btn-sm btn-default" data-toggle="modal" data-target="#docposModal" data-remote="false">Update Status	</a> 
							
								

									 </td> 

										 <?php } ?>
								
							</tr>




							<?php


								//return $row['v_uid'];


//								}
							?>
							 
							</tbody>
							</table>
						<!--- Document tracker ends here -->	
		                <!--- Acoount history starts here -->

	<h3 class="page-title">

			Application History

			</h3>

			<ul style="line-height: 30px;">
			<?php
			   $hisrs = mysqli_query($con,"select * from app_his_table where app_id='$_GET[appid]' order by vh_datetime DESC");

                                 while($hisrow=mysqli_fetch_array($hisrs)){ 
                                 		
                                  		$name=get_session_user_name($hisrow["user_id"],$con);
                                        echo "<li>".$hisrow["vh_datetime"]." : ".$hisrow["vh_notes"]." ".$name."</li>";

                                          }

                                          ?>
                                      </ul>

                                    <!--- Acoount history ends here -->  
                <h3 class="page-title">

			Notes

	</h3>
	<ul style="line-height: 30px;">
			<?php
			   $notesrs = mysqli_query($con,"select * from app_notes_table where app_id='$_GET[appid]' order by vnotes_datetime DESC");

                                 while($notesrow=mysqli_fetch_array($notesrs)){ 
                                 		
                                  		$name=get_session_user_name($notesrow["user_id"],$con);
                                        echo "<li>".$notesrow["vnotes_datetime"]." : <b>".$notesrow["notes_desc"]."</b> by ".$name."</li>";

                                          }

                                          ?>
                                      </ul>
			<a href="addnotes.php?id=<?php echo $row['app_id'];  ?>" class="btn btn-sm btn-default" data-toggle="modal" data-target="#notesModal" data-remote="false">Add Notes	</a>                          

											</div>

										</div>

								</div>

							</div>

							</div>



						</div>



					</form>



				</div>



			</div>



			<!-- END PAGE CONTENT-->



		</div>



	</div>

	<!-- END CONTENT -->
	</div>

	<!-- Modal for Update document position -->

<div class="modal fade" id="docposModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Update Document Position </h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" id="posupdatesubmit" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

<!-- Modal for add notes -->

<div class="modal fade" id="notesModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Add Notes </h4>
        <p id="msg"></p>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" id="notessubmit" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

<!-- END CONTAINER -->



<!-- BEGIN FOOTER -->


<?php include_once("../ro_footer.php"); ?>


<?php  include_once("../ro_js.php"); ?>

<script src="../assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="../assets/admin/layout/scripts/components-picker.js"></script>

<script>

jQuery(document).ready(function() {    
Metronic.init(); // init metronic core components
Layout.init(); // init current layout
QuickSidebar.init(); // init quick sidebar
Demo.init(); // init demo features
ComponentsPickers.init();
});

$(function() {
    
    $('body').on('click','#datepicker', function() {
    
        $(this).datepicker({Format: 'yyyy/mm/dd'}).focus();
    });
});

</script>
<script src="http://momentjs.com/downloads/moment.js"></script>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/jquery.inputmask.bundle.js"></script>
<script>
 //    $.validate({
	//   modules : 'date'
	// });
    $(".date").inputmask();
</script>
<script src="http://momentjs.com/downloads/moment.js"></script>
<script>
$(document).on('change',"#pexp_date", function() {

	var tt = $(this).val();
	//document.getElementById('pexp_date').value;
	var edd=moment(tt, 'DD-MM-YYYY');
	
	var myTime = moment();
	var newTime = moment(myTime).add('180', 'days');
	
	var ok=moment(edd).isSameOrAfter(newTime);
	
	if(ok){
		//alert('given date is ok ');
	}
	else{
		
		$(this).val('');
	   alert('Your passport Expire date must be greater than next 6 months.');
	 } 
 });	     
</script>  
<!-- END JAVASCRIPTS -->

</body>

<!-- END BODY -->

</html>