
<div class="clearfix"></div>
	
  <div class="content-wrapper">
    <div class="container-fluid">
    <!-- Breadcrumb-->
     <div class="row pt-2 pb-2">
        <div class="col-sm-9">
		    <h5 class="page-title">Add Rooms to <b class="text-warning"><?php echo $hotel->hotel_name;?></b></h5>
	   </div>
	   
     </div>
    <!-- End Breadcrumb-->
      <div class="row">
			<div class="col-lg-4">
			   <?php if($this->session->flashdata("msg")){echo $this->session->flashdata("msg"); }?>
               <div class="card">
                    <div class="card-body">
                       <form method="post" enctype="multipart/form-data" action="<?php echo base_url();?>admin/add_room">
                       <input type="hidden" name="hid" value="<?php echo $hotel->hid;?>" />
                        <div class="form-group">
                            <label>Room Type</label>
                            <input type="text" class="form-control" required  name="room_type" />   
                        </div>
                        <div class="row">
                        	<div class="form-group col-md-6">
                                <label>Price Per Night</label>
                                <input type="text" class="form-control" required  name="rprice" />   
                            </div>
                            <div class="form-group  col-md-6">
                                <label>Max Person Allowed</label>
                                <input type="number" class="form-control" required  name="max_persons" />   
                            </div>
                        </div>
                        <div class="form-group">
                <label for="price">Room Images(Multiple with CTRL)</label>
                <input type="file" class="form-control" id="tg-photogallery"  onchange="preview_images();" name="test11[]"  multiple />
                        </div>
                        <button type="submit" class="btn btn-block btn-primary">Add Room</button>
                       </form>
                    </div>
               </div>                  
            </div>
            <div class="col-lg-8">
               <div class="card">
                    <div class="card-body">
                       <div class="card-header text-uppercase"><strong>Listing All </strong>Rooms</div>
						<table id="example" class="table table-striped table-bordered" style="width:100%">
    <thead><tr><th>S.No.</th><th>Image</th><th>Room Type</th><th>Per Night Price</th><th>Action</th></tr></thead>
    <tbody>
    <?php $i=1;foreach($rooms as $cat){$rimg=explode(",",$cat->room_images);?>
    <tr><td><?php echo $i;?></td>
    <td width="100px"><img width="100%" src="<?php echo base_url();?>assets/images/hotels/<?php echo $rimg[0];?>" class="img img-responsive"></td>
    <td><h6 class="text-success"><?php echo $cat->room_type;?></h6></td>
    <td>
    <i class="fa fa-inr"></i> <?php echo $cat->rprice;?></td>
    <td>
    <?php if($cat->room_status==""){$st="Disable";}else{$st="Enable";}?>
    <a href="<?php echo $cat->hid;?>" class="btn btn-sm btn-default enable"><?php echo $st;?></a>
    <a href="<?php echo base_url();?>admin/rooms/<?php echo $cat->hid.'/'.$cat->rid;?>" class="btn btn-sm btn-warning"><i class="fa fa-edit"></i></a>
    <a href="<?php echo $cat->rid;?>" class="btn btn-sm btn-danger catdelete"><i class="fa fa-trash-o"></i></a></td>
    <?php $i++;}?></tr>
    </tbody>
</table>
                    </div>
               </div>                  
            </div>
        </div>
    </div>
    
	</div>

    <a href="javaScript:void();" class="back-to-top"><i class="fa fa-angle-double-up"></i> </a>
    <!--End Back To Top Button-->
	
	<!--Start footer-->
	<footer class="footer">
      <div class="container">
        <div class="text-center">
          Copyright © 2019
        </div>
      </div>
    </footer>
	<!--End footer-->
	
  </div><!--End wrapper-->
  

  <!-- Bootstrap core JavaScript-->
  <script src="<?php echo base_url();?>assets/js/jquery.min.js"></script>
  <script>//CKEDITOR.replace( 'editor1' );
	$(document).ready(function(){
		//alert("Asdf");
		$("#fileUpload").on('change', function() {

  if (typeof(FileReader) == "undefined") {
    alert("Your browser doesn't support HTML5, Please upgrade your browser");
  } else {

    var container = $("#image-container");

    //remove all previous selected files
    container.empty();

    //create instance of FileReader
    var reader = new FileReader();
    reader.onload = function(e) {
      $("<img />", {
        "src": e.target.result,"style": 'width:100%;'
      }).appendTo(container);
    }
    
    reader.readAsDataURL($(this)[0].files[0]);
  }});
  		$(".removeimg").click(function(e){e.preventDefault();
				var img=$(this).attr("href");
				var aid=$(this).attr("id");
				var oldimgs=$("#oldimgs").val();
				$(this).closest("div.text-center").remove();
				$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>manufacture/ajax_remove_imgs',
				 data: {aid:aid,img:img,oldimgs:oldimgs},
				 success: function(res){
				 $("#oldimgs").val(res);
				}
				 }); 
			});	
	});
</script>
<script type="text/javascript">
function preview_images() 
{
	$('#image_preview').html('');
 var total_file=document.getElementById("tg-photogallery").files.length;
 for(var i=0;i<total_file;i++)
 {
  $('#image_preview').append("<div class='col-md-4'><img width='100%' class='img-responsive' src='"+URL.createObjectURL(event.target.files[i])+"'></div>");
 }
}

</script>
  <script src="<?php echo base_url();?>assets/js/popper.min.js"></script>
  <script src="<?php echo base_url();?>assets/js/bootstrap.min.js"></script>
	
  <!-- simplebar js -->
  <script src="<?php echo base_url();?>assets/plugins/simplebar/js/simplebar.js"></script>
  <!-- sidebar-menu js -->
  <script src="<?php echo base_url();?>assets/js/sidebar-menu.js"></script>
  
  <!-- Custom scripts -->
  <script src="<?php echo base_url();?>assets/js/app-script.js"></script>

</body>
</html>
