<section role="main" class="content-body">
					<header class="page-header">
						<h2>Manage Credit Plans</h2>
						<div class="right-wrapper pull-right">
							<ol class="breadcrumbs">
								<li>
									<a href="<?php echo base_url();?>admin">
										<i class="fa fa-home"></i>
									</a>
								</li>
								<li><span>Manage Credit Plans</span></li>
							</ol>
					
						</div>
					</header>

					<div class="row">
						<div class="col-md-5">
                        <?php 
						 if($this->session->flashdata("msg")){echo $this->session->flashdata("msg"); }?>
							<section class="panel panel-featured">
								<div class="panel-heading">Add New Plan
                                </div>
								<div class="panel-body">
      
      <?php  if($this->uri->segment(3)){?>
      	<form  action="<?php echo base_url();?>admin/update_plan" method="post" enctype="multipart/form-data">
          <input type="hidden" name="plid" value="<?php echo $edit->plid;?>" />
          <div class="form-group ">
            <label for="email">Plan Title</label>
            <input type="text" required class="form-control" name="plname" value="<?php echo $edit->plname;?>">
          </div>
          
          <div class="row">
          <div class="form-group col-md-4">
            <label for="email">Featured Prods</label>
            <input type="number" required class="form-control" name="feat_pro" value="<?php echo $edit->feat_pro;?>">
          </div>
          <div class="form-group col-md-4">
            <label for="email">Deals</label>
            <input type="number" required class="form-control" name="deal" value="<?php echo $edit->deal;?>" >
          </div>
          <div class="form-group col-md-4">
            <label for="email text-warning">Price</label>
            <input type="number" required class="form-control" name="pl_price" value="<?php echo $edit->pl_price;?>">
          </div>
          </div>
          
          <div class="form-group ">
            <label for="email">Plan Short Description</label>
            <textarea class="form-control" rows="3" name="pl_desc"><?php echo $edit->pl_desc;?></textarea>
          </div>
          <div class="form-group ">
            <label for="email">Plan Featured Image</label>
            <input type="file" name="img" class="btn btn-default"/>
            <input type="hidden" name="oldimg" value="<?php echo $edit->pl_image;?>" />
            <img class="img img-responsive" src="<?php echo base_url();?>assets/images/category/<?php echo $edit->pl_image;?>" />
          </div><br/>
          <button type="submit" class="btn btn-success" name="submit">Update Plan</button>
        </form>
      <?php }else{?>
      	<form  action="<?php echo base_url();?>admin/add_plan" method="post" enctype="multipart/form-data">
         
          <div class="form-group ">
            <label for="email">Plan Title</label>
            <input type="text" required class="form-control" name="plname">
          </div>
          
          <div class="row">
          <div class="form-group col-md-4">
            <label for="email">Featured Prods</label>
            <input type="number" required class="form-control" name="feat_pro">
          </div>
          <div class="form-group col-md-4">
            <label for="email">Deals</label>
            <input type="number" required class="form-control" name="deal">
          </div>
          <div class="form-group col-md-4">
            <label for="email text-warning">Price</label>
            <input type="number" required class="form-control" name="pl_price">
          </div>
          </div>
          
          <div class="form-group ">
            <label for="email">Plan Short Description</label>
            <textarea class="form-control" rows="3" name="pl_desc"></textarea>
          </div>
          <div class="form-group ">
            <label for="email">Plan Featured Image</label>
            <input type="file" name="img" class="btn btn-default"/>
          </div><br/>
          <button type="submit" class="btn btn-success" name="submit">Add Plan</button>
        </form>
        <?php }?>
      </div>
							</section>
						</div>
                        <div class="col-md-7">
							<section class="panel panel-featured">
								<div class="panel-heading">Listing All Plans </div>
     							 <div class="panel-body">
                     <table class="table table-striped table-responsive table-bordered">
        	<thead><tr><th>Sort.</th><th>Image</th><th>Title</th><th>Offer</th><th>Price</th><th>Action</th></tr></thead>
            <tbody>
            	<?php $i=1;foreach($plans as $cat){?>
                <tr><td><?php echo $i;?></td>
                <td width="100px"><img src="<?php echo base_url();?>assets/images/category/<?php echo $cat->pl_image;?>" class="img img-responsive"></td>
                <td><?php echo $cat->plname;?></td>
                <td><label class="label label-info">Featured <?php echo $cat->feat_pro;?></label><br/>
                	<label class="label label-primary">Deals <?php echo $cat->deal;?></label></td>
                <td><?php echo $cat->pl_price;?></td>
                <td>
<a href="<?php echo base_url();?>admin/plans/<?php echo $cat->plid;?>" class="btn btn-xs btn-warning"><i class="fa fa-edit"></i></a>
<a href="<?php echo $cat->plid;?>" class="btn btn-xs btn-danger plandelete"><i class="fa fa-trash-o"></i></a>
				</td>
                <?php $i++;}?></tr>
                
            </tbody>
        </table>
        </div>
        						</div>
							</section>
						</div>
						
                    </div>
				</section>
			</div>

			
		</section>

		<!-- Vendor -->
        <script>
	$(document).ready(function(){ 
		$(".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);
							 }
							 });
		});
		$(".plandelete").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/plandelete',
							 data: {id:id},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
	});
</script>

		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/bootstrap/js/bootstrap.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/nanoscroller/nanoscroller.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-placeholder/jquery.placeholder.js"></script>
		
		<!-- Theme Base, Components and Settings -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.js"></script>
		
		<!-- Theme Custom -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.custom.js"></script>
		
		<!-- Theme Initialization Files -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.init.js"></script>

	</body>
</html>