<!DOCTYPE html>
<html lang="en">
<?php include('fixed/top.php');  ?>
<body>
  <div class="loader"></div>
  <div id="app">
    <div class="main-wrapper main-wrapper-1">
      <div class="navbar-bg"></div>

       <?php include('fixed/navigation.php');  ?>
      <!-- Main Content -->
      <div class="main-content">
         <section class="section">
          <div class="section-body">
            <div class="row clearfix">
              <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 col-12">
                <?php echo $this->session->flashdata('msg'); ?>  
                  
                  <!----banner--->
                   <div class="card">
                  <div class="card-header">
                    <h4>Media</h4>
                      <button data-target="#add_banner" data-toggle="modal" class="btn btn-outline-primary" style="float:right;">Update Banner</button>
                  </div>
                  <div class="card-body">
                      <?php  $banner_image = $this->db->get_where('gallery', array('type'=>'1'))->row();  ?>
                       <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
                           <a href="<?php echo base_url(); ?>uploads/front/gallery/<?=$banner_image->photo?>" data-sub-html="<?=$banner_image->name?>">
                          <img style="height:160px;width:290px;" src="<?php echo base_url(); ?>uploads/front/gallery/<?=$banner_image->photo?>" alt="">
                            
                        </a>
                      </div>
                      
                  </div>
                </div>
                  <!----banner--->
                <div class="card">
                  <div class="card-header">
                    <h4>Photos</h4>
                      <button data-target="#add_photo" data-toggle="modal" class="btn btn-outline-primary" style="float:right;">Add Photo</button>
                  </div>
                  <div class="card-body">
                    <div id="aniimated-thumbnials" class="list-unstyled row clearfix">
                        <?php 
                       $gallery_images = $this->db->get('gallery')->result();
                      foreach($gallery_images as $gallery) { if($gallery->type =='0') {
                        ?>
                      <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
                        <a href="<?php echo base_url(); ?>uploads/front/gallery/<?=$gallery->photo?>" data-sub-html="<?=$gallery->name?>">
                          <img class="img-responsive thumbnail" src="<?php echo base_url(); ?>uploads/front/gallery/<?=$gallery->photo?>" alt="">
                            
                        </a>
                      </div><i data-target="#delete_modal<?=$gallery->id?>" data-toggle="modal" class="fa fa-times"></i>
                      <?php } } ?>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </section>
      </div>
         <!---delete modal--->
          <?php 
          $gallery_data = $this->db->get('gallery')->result();
          foreach($gallery_data as $gallery) {
          ?>
          <div class="modal fade" id="delete_modal<?=$gallery->id?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
          aria-hidden="false">
          <div class="modal-dialog" role="document">
         <form id="" method="post" action="<?php echo base_url(); ?>admin/delete_gallery_photo/<?=$gallery->id?>" enctype="multipart/form-data">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel" style="color:red;">Delete Picture</h5>
              </div>
              <div class="modal-body">
                <div class="row clearfix">
                     <div class="col-md-12 col-sm-12 col-xs-12">
                               <div class="form-group">
                               <p>Are you sure you want to delete this picture ?</p>
                                   </div>
                      </div>   

                            </div>   
              </div>
               
              <div class="modal-footer bg-whitesmoke br">
                <button type="submit" class="btn btn-primary" id="send">Continue</button>
                <!--button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button-->
              </div>
            </div>
              </form>
          </div>
        </div>
          <?php } ?>
         <!---add photo modal--->
        
          <div class="modal fade" id="add_photo" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
          aria-hidden="false">
          <div class="modal-dialog" role="document">
         <form id="" method="post" action="<?php echo base_url(); ?>admin/add_gallery_photo" enctype="multipart/form-data">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel" style="color:green;">Upload Photo</h5>
              </div>
              <div class="modal-body">
                <div class="row clearfix">
                    <div class="col-md-12 col-sm-12 col-xs-12">
                      <div class="form-group">
                        <label>Name</label>
                       <input name="name" type="text" class="form-control" required>
                      </div>
                    </div>
                    <input type="hidden" value="0" name="type">
                   <div class="col-md-12 col-sm-12 col-xs-12">
                      <div class="form-group">
                        <label>Upload Photo</label>
                       <input name="photo" type="file" class="form-control" required>
                      </div>
                    </div>   
               </div>   
              </div>
               
              <div class="modal-footer bg-whitesmoke br">
                <button type="submit" class="btn btn-primary" id="send">Continue</button>
                <!--button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button-->
              </div>
            </div>
              </form>
          </div>
        </div>
        
         
          <div class="modal fade" id="add_banner" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
          aria-hidden="false">
          <div class="modal-dialog" role="document">
         <form id="" method="post" action="<?php echo base_url(); ?>admin/add_gallery_photo" enctype="multipart/form-data">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel" style="color:green;">Update Banner Image</h5>
              </div>
              <div class="modal-body">
                <div class="row clearfix">
                    <div class="col-md-12 col-sm-12 col-xs-12">
                      <div class="form-group">
                        <label>Name</label>
                       <input name="name" type="text" class="form-control" required>
                      </div>
                    </div>
                    <input type="hidden" value="1" name="type">
                   <div class="col-md-12 col-sm-12 col-xs-12">
                      <div class="form-group">
                        <label>Upload Photo</label>
                       <input name="photo" type="file" class="form-control" required>
                      </div>
                    </div>   
               </div>   
              </div>
               
              <div class="modal-footer bg-whitesmoke br">
                <button type="submit" class="btn btn-primary" id="send">Continue</button>
                <!--button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button-->
              </div>
            </div>
              </form>
          </div>
        </div>
      <?php include('fixed/footer.php');  ?>
    </div>
  </div>
   <?php include('fixed/bottom.php');  ?>
</body>
    <link href="<?php echo base_url(); ?>assets/back/bundles/lightgallery/dist/css/lightgallery.css" rel="stylesheet">
    <script src="<?php echo base_url(); ?>assets/back/bundles/lightgallery/dist/js/lightgallery-all.js"></script>
  <!-- Page Specific JS File -->
  <script src="<?php echo base_url(); ?>assets/back/js/page/light-gallery.js"></script>
</html>