<style>
.dragandrophandler
{
	width:180px;
	border: 1px solid;
	margin: 10px; 
    float: left;

}
.progressBar {
    width: 100px;
    height: 22px;
    border: 1px solid #ddd;
    border-radius: 5px; 
    overflow: hidden;
    display:inline-block;
    margin:0px 10px 5px 5px;
    vertical-align:top;
}
 
.progressBar div {
    height: 100%;
    color: #fff;
    text-align: right;
    line-height: 22px; /* same as #progressBar height if we want text middle aligned */
    width: 0;
    background-color: #0ba1b5; border-radius: 3px; 
}
.statusbar
{
    border-top:1px solid #A9CCD1;
    min-height:25px;
    vertical-align:top;
}
.abort{
    background-color:#A8352F;
    -moz-border-radius:4px;
    -webkit-border-radius:4px;
    border-radius:4px;display:inline-block;
    color:#fff;
    font-family:arial;font-size:13px;font-weight:normal;
    padding:4px 15px;
    cursor:pointer;
    vertical-align:top
    }
    .large-folder-icon{
    	position: relative;
    	left: 7px;
    }
    .small-folder-icon{
    	position: relative;
    	left: 40px;
    }
    .medium-folder-icon{
    	position: relative;
    	left: 20px;
    }
    .folder-text{
    	margin: auto;
    }
</style>
<?php
include ('includes/db1config.php');
include ('../includes/mysql_connect.php');
if(isset($_POST["searchName"]) && $_POST["searchName"]!='')
{
	$value = mysql_real_escape_string(trim($_POST["searchField"]));
    $searchName    = $_POST["searchName"];
	if($searchName == "ALL")
	{ 
	$sql="select * from guestLogin";
	}else{
		if($value==''){
		 $sql="select * from guestLogin where firstName REGEXP '^[$searchName].*$' ";
		}else
		{
		$sql="select * from guestLogin WHERE (firstName REGEXP '^[$searchName].*$') or (`FirstName` LIKE '%$value%' OR `LastName` LIKE '%$value%' OR Email LIKE '%$value%') ";
		}
	}
}
/*
if(isset($_POST["searchField"]) && $_POST["searchField"]!='')
{
	$value = mysql_real_escape_string(trim($_POST["searchField"]));
    $sql="select * from guestLogin WHERE `FirstName` LIKE '%$value%' OR `LastName` LIKE '%$value%' OR Email LIKE '%$value%' ";
}*/
	$result=mysql_query($sql);
	$count=mysql_num_rows($result);
	?>
	<div class="row">
	<form action="upload_user_doc.php" method="post" enctype="multipart/form-data"> 
	<div id="upload-path" data-upload-path="upload_user_doc.php"></div>
	<?php
	while($row=mysql_fetch_assoc($result))
	{?>
		<div id="linked-id" data-linked-id="<?php echo $row['UserKey']; ?>"></div>
		<div class="col-sm-4 dragandrophandler" id="dragandrophandler-<?php echo $row['UserKey']; ?>" data-uid="<?php echo $row['UserKey']; ?>">
		  <input type="hidden" name='id[]' value="<?php echo $row['UserKey']; ?>">
		    <table>   
		        <tr>
		          <td><input id="upload-doc" type="file" name="my_file[]" multiple style="display:none;"></td>
		             <td><button class="btn btn-success" id="upload_btn" style="float:right;background-color:#26b99a;color:white;display:none;">Upload</button></td>
		        </tr>
		    </table>
	<?php
	   if($count<=10)
		{?>
	    <a href="view_folder_detail.php?userid=<?php echo $row['UserKey']; ?>&searchName= <?php echo $_POST['searchName']?>&searchField= <?php echo $_POST['searchField']?>"><img src="images/file-folder.jpg" height="100px" class="large-folder-icon"></a>
		<?php 
	    }
		
		if($count>10 && $count<=20)
		{?>
		
		<a href="view_folder_detail.php?userid=<?php echo $row['UserKey']; ?>&searchName= <?php echo $_POST['searchName']?>"><img src="images/file-folder.jpg" height="70px" class="medium-folder-icon"></a>
		<?php 
	    }
		
		if($count>20)
		{?>
	    <a href="view_folder_detail.php?userid=<?php echo $row['UserKey']; ?>&searchName= <?php echo $_POST['searchName']?>"><img src="images/file-folder.jpg" height="50px" class="small-folder-icon"></a>
		
		<?php 
	    }
	    ?>
	    <table class="folder-text">
		<tr><td><?php echo $row['FirstName'].' '.$row['LastName'].' ('. $row['UserKey'].')';?></td></tr>
		</table>
	  </div>
	<?php
    }
?>
</form>
</div>

<!-- upload doc Tab End -->
<script src="js/file-drop.js"></script>
  <script>
    $(document).ready(function() {

   function deleteAction() {
      if (confirm("Are you sure you want to delete Doc!") == true) {
          new PNotify({
                title: 'Success',
                text: 'Deleting Document!',
                type: 'success',
                styling: 'bootstrap3'
            });
          return true;
      } else {
         return false;
      }
  }

    $('#dragandrophandler').click(function(){
      $('#upload-doc').click();
      $('#upload-doc').show();
      $('#upload_btn').show();
    });
    //$( "#upload-form" ).submit();
});
</script>
