
<?php
include("common/connection.php");
login_check();

$Lead_Va_Id=base64_decode($_REQUEST['Lid']);
$user_type_sql="select User_Type from user_master where User_Name='".$_SESSION['user']."'";
$user_type_query=mysqli_query($con,$user_type_sql);
$user_type=mysqli_fetch_array($user_type_query);
?>

<!doctype html>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>View Service | Buurtzorg</title>
    <?php include("headerlink.php"); ?> 
    
    
   
    
    
    
    <link rel="stylesheet" href="css/data-table/bootstrap-table.css">
    	<link rel="stylesheet" href="css/data-table/bootstrap-editable.css">
        
        
        <style>
		table {overflow:inherit !important}
		table thead {overflow:inherit !important}
		table thead tr {overflow:inherit !important; }
		
		table tbody {overflow:inherit !important}
		table tbody tr {overflow:inherit !important; }
		table tbody tr td {overflow:inherit !important}
		
		
		.fixed-table-body {overflow:inherit !important}
		.action_dropdown {padding:0 !important; min-width:460px !important;  left:-258px; background-color:rgba(0,0,0,0) !important;
		 box-shadow:none !important; border:none !important; margin-top:-70px}
										
		 .action_dropdown:after {
			  content:'';
			  width: 0;
			  height: 0;
			  border-left: 7px solid transparent;
			  border-right: 7px solid transparent;
			  border-top: 12px solid #337ab7;
			  margin-top:40px;
			  position:absolute;
			  top:-10px;
			  margin-left:-190px;
		}
		
		
		
		
		</style>
    
    
    
    
    
     <link rel="stylesheet" href="css/form/all-type-forms.css">
    <!-- x-editor CSS
		============================================ -->
    <link rel="stylesheet" href="css/editor/select2.css">
    <link rel="stylesheet" href="css/editor/datetimepicker.css">
    <link rel="stylesheet" href="css/editor/bootstrap-editable.css">
    <link rel="stylesheet" href="css/editor/x-editor-style.css">

</head>

<body onLoad="showbutton('<?php echo $Lead_Va_Id; ?>')">
 <?php 
  if (isset($_REQUEST['upld_agreement']))
  	{ 
	$flag=0;
$fileName1 = $_FILES["agreement"]["name"]; // The file name
$fileTmpLoc1 = $_FILES["agreement"]["tmp_name"]; // File in the PHP tmp folder
$fileType1 = $_FILES["agreement"]["type"]; // The type of file it is
$fileSize1 = $_FILES["agreement"]["size"]; // File size in bytes
$fileErrorMsg1 = $_FILES["agreement"]["error"]; // 0 for false... and 1 for true

$name1=time() . '_' .$fileName1;
$target1=$target1.basename($name1);
$type1=pathinfo($target1,PATHINFO_EXTENSION);
	$mimeArray1 = array('image/jpeg','image/png','application/pdf');
		
			if (!in_array($fileType1, $mimeArray1)) 
			
			{
            $msg='Only jpg,jpeg,pdf files format are allowed to Upload';
			$flag=1;
			}
			else if ($fileSize1 > 10240000) 
  			{
				
       		$msg='File is too large. File must be less than 1 MB';
           	$flag=1;
 			}
			
			if($flag==0)
			{
			move_uploaded_file($fileTmpLoc1, "uploadfile/$name1");

  		$upload="update `patient_agreement` set `Signed_Agreement`='".$name1."' where Lead_ID='".$Lead_Va_Id."'";
		$upload_query=mysqli_query($con,$upload);
		?>
        <script>
     			alert('Agreement uploaded Successsfully');
						setTimeout( function() {
			
						window.parent.location.href="Pending_Agreement.php";
						},500);
     		</script>
        <?php
		}
		}
		?>
        <br />
        <br />
	<div style="text-align:center;">
    <h4>Upload Scan Copy of Physically Signed Agreement</h4>
    </div>
    <br />
    <form action="#" name="Product" method="post"  enctype="multipart/form-data" onSubmit="return ValidateProduct()" style="text-align:center;">
    <div id="prnt_btn">
   <center> <input type="file" autocomplete="off" name="agreement" id="agreement" class="txtbox" placeholder="Upload Agreement" style="margin-bottom:5px; padding-top:3px; padding-bottom:3px; background-color:#CCCCCC; margin:20px 0px;" onClick="ActiveColour('agreement')"></center> 
    <input name="upld_agreement" id="upld_agreement" type="submit" value="Upload Agreement" class="btn btn-success" style="margin-bottom:20px;" />
    </form>
    <span style="color:#FF0000;  font-size:12px; text-align:center; display:block"><?php echo $msg;?></span>
   	 
    </div>   
       
       
       </body>

</html>