<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js"></script>	
<div class="vd_content-wrapper">
      <div class="vd_container">
        <div class="vd_content clearfix">
          <div class="vd_head-section clearfix">
            <div class="vd_panel-header">
              <ul class="breadcrumb">
                <li><a href="<?php echo base_url();?>admin">Home</a> </li>
                <li class="active">Add Custom Product Types</li>
              </ul>
              
 
            </div>
          </div>
          <!-- vd_head-section -->
          
          <div class="vd_title-section clearfix">
            <div class="vd_panel-header">
              <h1>Manage Custom Product Types</h1>
              <small class="subtitle">Add, Edit Custom Product Types</small>
              
<!-- vd_panel-menu --> 
            </div>
            <!-- vd_panel-header --> 
          </div>
          <!-- vd_title-section -->
          
          <div class="vd_content-section clearfix">
            
         <div class="row">
                	
                    
                    <!-- User Activity -->
                    <div class="col-md-5"><?php if($this->session->flashdata("msg")!==""){echo $this->session->flashdata("msg"); }?>
                        <div class="panel panel-success">
							
      <div class="panel-heading">Add/Edit Custom Designs</div>
      <div class="panel-body">
      
      <?php if($this->uri->segment(3)){?>
      	<form  action="<?php echo base_url();?>admin/add_category/<?php echo $this->uri->segment(3);?>" method="post" enctype="multipart/form-data">
       
          <div class="form-group ">
            <label for="email">Category Title</label>
            <input type="text" required class="form-control" name="cat" value="<?php echo $editcat->cat_name;?>">
          </div>
          <div class="form-group ">
            <label for="email">Meta Title</label>
            <input type="text"  class="form-control" name="metatitle" value="<?php echo $editcat->metatitle;?>">
          </div>
          <div class="form-group ">
            <label for="email">Meta Keywords</label>
            <input type="text"  class="form-control" name="metakey" value="<?php echo $editcat->metakey;?>">
          </div>
          <div class="form-group ">
            <label for="email">Meta Description</label>
            <textarea class="form-control" rows="3" name="metadesc"><?php echo $editcat->metadesc;?></textarea>
          </div><div class="form-group ">
            <label for="email">Category Image</label>
          	<input type="hidden" value="<?php echo $editcat->cat_image;?>" name="oldimg">
            <input type="file"  class="btn btn-primary" name="img"/>
            <img width="30%" src="<?php echo base_url();?>assets/images/category/<?php echo $editcat->cat_image;?>" class="img img-responsive">
          </div><br/>
          <button type="submit" class="btn btn-success" name="submit">Update</button>
        </form>
      <?php }else{?>
      	<form  action="<?php echo base_url();?>admin/add_predesigns" method="post" enctype="multipart/form-data">
         <div class="row">
            <div class="form-group col-md-8">
              <label for="email">Design Title</label>
              <input type="text" required class="form-control" name="title">
            </div>
            <div class="form-group col-md-4">
              <label for="email">Design Price</label>
              <input type="number" required class="form-control" name="price">
            </div>
         </div>
         <div class="row">
            <div class="form-group col-md-6">
              <label for="email">Front Image</label>
              <input type="file" name="front" id="fileUpload1" class="btn btn-default"/>
              <div id="image-container1"><img class="center-block" src="<?php echo base_url();?>assets/images/front.jpg"></div>
            </div>
            <div class="form-group col-md-6">
              <label for="email">Back Image</label>
              <input type="file" name="back" id="fileUpload2" class="btn btn-default"/>
              <div id="image-container2"><img class="center-block" src="<?php echo base_url();?>assets/images/back.jpg"></div>
            </div>
            <div class="form-group col-md-6">
              <label for="email">Side 1 Image</label>
              <input type="file" name="side1" id="fileUpload3" class="btn btn-default"/>
              <div id="image-container3"><img class="center-block" src="<?php echo base_url();?>assets/images/side1.jpg"></div>
            </div>
            <div class="form-group col-md-6">
              <label for="email">Side 2 Image</label>
              <input type="file" name="side2" id="fileUpload4" class="btn btn-default"/>
              <div id="image-container4"><img class="center-block" src="<?php echo base_url();?>assets/images/side2.jpg"></div>
            </div>
          </div>
          <button type="submit" class="btn btn-success" name="submit">Add Category</button>
        </form>
        <?php }?>
      </div>
    </div>
                    </div>
                    
                    <div class="col-md-7">
                     <div class="panel panel-success">
							
      <div class="panel-heading">Listing All Designs</div>
      <div class="panel-body">
                    <table class="table table-striped table-responsive">
        	<thead><tr><th>S.No.</th><th>Images</th><th>Title/Price</th></tr></thead>
            <tbody>
            	<?php $i=1;foreach($cds as $cds){?>
                <tr><td><?php echo $i;?></td>
                    
          <td><img width="80px" src="<?php echo base_url();?>assets/images/<?php echo $cds->front;?>" class="img img-responsive pull-left">
              <img width="80px" src="<?php echo base_url();?>assets/images/<?php echo $cds->back;?>" class="img img-responsive pull-left">
              <img width="80px" src="<?php echo base_url();?>assets/images/<?php echo $cds->side1;?>" class="img img-responsive pull-left">
              <img width="80px" src="<?php echo base_url();?>assets/images/<?php echo $cds->side2;?>" class="img img-responsive pull-left">
                            </td>
                            <td><?php echo '<h4>'.$cds->dtitle.'</h4>'.$cds->dprice;?>
                      <a href="#" class="btn btn-danger btn-xs pull-right"><i class="fa fa-trash-o"></i></a>
                       <a href="#" class="btn btn-warning btn-xs pull-right"><i class="fa fa-edit"></i></a>
                    </td>
               <?php $i++;}?></tr>
            </tbody>
        </table>
        </div></div>
                    </div>
                    
                    
                    <!-- End Chat Room -->
                </div>
          </div>
          <!-- .vd_content-section --> 
          
        </div>
        <!-- .vd_content --> 
      </div>
      <!-- .vd_container --> 
    </div>
    <!-- .vd_content-wrapper --> 
    
    <!-- Middle Content End --> 
    
  </div>
  <!-- .container --> 
</div>
<!-- .content -->

<!-- Footer Start -->
  <footer class="footer-1"  id="footer">      
    <div class="vd_bottom ">
        <div class="container">
            <div class="row">
              <div class=" col-xs-12">
                <div class="copyright">
                  	Copyright &copy;2018 HadesIndia. All Rights Reserved 
                </div>
              </div>
            </div><!-- row -->
        </div><!-- container -->
    </div>
  </footer>
<!-- Footer END -->
  

</div>

<!-- .vd_body END  -->
<a id="back-top" href="#" data-action="backtop" class="vd_back-top visible"> <i class="fa  fa-angle-up"> </i> </a>

<!--
<a class="back-top" href="#" id="back-top"> <i class="icon-chevron-up icon-white"> </i> </a> -->

<!-- Javascript =============================================== --> 
<!-- Placed at the end of the document so the pages load faster --> 
<script>
	$(document).ready(function(){
    $("#fileUpload1").on('change', function() {

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

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

    //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:200px;'
      }).appendTo(container);
    }
    
    reader.readAsDataURL($(this)[0].files[0]);
  }});

     $("#fileUpload2").on('change', function() {

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

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

    //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:200px;'
      }).appendTo(container);
    }
    
    reader.readAsDataURL($(this)[0].files[0]);
  }});

 $("#fileUpload3").on('change', function() {

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

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

    //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:200px;'
      }).appendTo(container);
    }
    
    reader.readAsDataURL($(this)[0].files[0]);
  }});

  $("#fileUpload4").on('change', function() {

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

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

    //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:200px;'
      }).appendTo(container);
    }
    
    reader.readAsDataURL($(this)[0].files[0]);
  }});

		$(".enable").click(function(e){e.preventDefault();
			var st=$(this).text();
			var id=$(this).attr("href");
			if(st=="Enable"){
			$(this).text("Disable");
			}else{
			$(this).text("Enable");	
			}
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/catenable',
							 data: {id:id,st:st},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
		$(".catdelete").click(function(e){e.preventDefault();
		if (!confirm("Sure you want to delete?")){
				  return false;
				}
			var id=$(this).attr("href");$(this).closest("tr").remove();
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/catdelete',
							 data: {id:id},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
	});
</script>
<script type="text/javascript" src='<?php echo base_url();?>adminassets/plugins/jquery-ui/jquery-ui.custom.min.js'></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>

<script type="text/javascript" src="<?php echo base_url();?>adminassets/js/caroufredsel.js"></script> 
<script type="text/javascript" src="<?php echo base_url();?>adminassets/js/plugins.js"></script>

<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/breakpoints/breakpoints.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/prettyPhoto-plugin/js/jquery.prettyPhoto.js"></script> 

<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/tagsInput/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/bootstrap-switch/bootstrap-switch.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/blockUI/jquery.blockUI.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/pnotify/js/jquery.pnotify.min.js"></script>

<script type="text/javascript" src="<?php echo base_url();?>adminassets/js/theme.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/custom/custom.js"></script>


</body>
</html>