<?php $this->load->view("main/drs/header"); ?>
<div class="col-lg-12">
	<style>
		.folder{
	   width: 130px;
	   height: 130px;
	   padding: 10px;
	   border: 1px solid #ddd;
	   float: right;
	   margin-left:15px;
	   cursor: pointer;
	   border-radius: 5px;
	   margin-bottom:10px;
	   position: relative;
}
.folder:hover{
	   border: 1px solid rgb(112,146,190);
	   color: rgb(112,146,190) !important;
}
.add:hover,.back:hover{
	 border: 1px solid green;
	   color: green !important;   
}
.folder i {
	   font-size: 85px;
	   text-align: center;
	   margin-right:5px;
}
.add i
{
	   margin-right:20px !important;
}
.folder span{
	   width: 100%;
	   display: block;
	   text-align: center;
	   font-size: 12px;
}
.folder img{
	   width: 100%;
	   height: 90px;
}
.add_folder,.display_images,.change_name{
	   width: 100%;
	   height: 100%;
	   position: fixed;
	   top: 0;
	   left: 0;
	   z-index: 3000;
	   background: rgba(0,0,0,0.5);
}
#delete_sl{
	width: 100%;
	height: 100%;
	position: absolute;
	background: rgba(0,0,0,0.7);
	top: 0;
	left: 0;
	border-radius: 5px;
}
#delete_sl button{
	margin:67px 19px;
}
	</style>
<section class="panel">
	<div class="add_folder" style="display: none;">
	   <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">ذخیره ی تصویر</h4>
                                            </div>
                                            <div class="modal-body">

                                                <form role="form" action="./set_galery_control" method="post" enctype="multipart/form-data" >
												 <input type="hidden" id="hidden_path" name="path" value="" />
												
												 
												
										  
										   <div id="piture" >
                                                    <div class="form-group">
                                                        <label for="exampleInputFile">تصویر مورد نظر خود را بارگذاری کنید.</label>
                                                        <input type="file" name="uploadfile" id="exampleInputFile3">
                                                    </div>
                                            </div>       
                                                    <button type="submit" class="btn btn-default">ایجاد</button>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
</div>
        <header class="panel-heading">گالری تصاویر</header>
		<div class="panel-body">
			<?php foreach($directory as $value){ ?>
			<div class="folder"  data_name="<?php echo $value; ?>">
			<div id="delete_sl" style="display: none;">
				<button class="btn btn-danger">حذف کردن</button>
			</div>
			<img src="<?php echo base_url(); ?>/assets/data_images/drs/dr_galery/<?php echo $this->session->userdata("id") ?>/<?php echo $value; ?>"><span></span></div>
			<?php } ?>
		<div class="folder add"><i class="icon-plus"></i><span>اضافه کردن</span></div>
		</div>
</section>
</div>
<?php $this->load->view("main/drs/footer"); ?>
<script>
	 $(".add").click(function(){
			  $(".add_folder").css({"display":"block"});
			  });
	 $(".close").click(function(){
		  $(".add_folder").css({"display":"none"});
		});
	 $(".folder").mouseenter(function(){
		$(this).find("#delete_sl").css({"display":"block"});
		});
	 $(".folder").mouseleave(function(){
		$(this).find("#delete_sl").css({"display":"none"});
		
		});
	 $(".btn-danger").click(function(){
		$filename = $(this).parent().parent().attr("data_name");
		$value = $(this).parent().parent();
	
	 $.post("<?php echo base_url(); ?>panel/delete_galery_control",{filename:$filename},function(e){
		if (e == "done") {
			$value.remove();
		}
		});
	 	});
	 
</script>