<?php 
	$header_file=APPPATH.'views/include/header.php';
	require($header_file);
?>
<style>
form .form-actions {
    border-top: 0px!important
    padding: 6px 0;
    margin-top: 20px;
}
</style>
   
    <!-- BEGIN: Content-->
    <div class="app-content content">
      <div class="content-overlay"></div>
      <div class="content-wrapper">
        <div class="content-header row">
          <div class="content-header-left col-md-12 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-inline-block">Category </h3>
            <div class="row breadcrumbs-top d-inline-block">
              <div class="breadcrumb-wrapper col-12">
                <ol class="breadcrumb">
                  <li class="breadcrumb-item"><a href="#">Home</a>
                  </li>
                  <li class="breadcrumb-item"><a href="#">Category</a>
                  </li>
                  <li class="breadcrumb-item active">Category Creation
                  </li>
                </ol>
              </div>
            </div>
          </div>
          
        </div>
        <div class="content-body"><!-- Basic form layout section start -->
<section id="basic-form-layouts">
	<div class="row justify-content-md-center">
		<div class="col-md-12">
			<div class="card">
				<div class="card-header">
					<h4 class="card-title" id="basic-layout-form-center">Category Creation</h4>
					<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
					<div class="heading-elements">
						<ul class="list-inline mb-0">
							<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
							<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
							<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
							<li><a data-action="close"><i class="ft-x"></i></a></li>
						</ul>
					</div>
				</div>
				<div class="card-content collapse show">
					<div class="card-body">
						<form class="form" autocomplete="off" action="<?php echo site_url('Master/categoryInsert');?>" method="post">
							<div class="row justify-content-md-center">
								<div class="col-md-6">
									<div class="form-body">
										<div class="form-group">
											<label for="eventInput1">Category Name</label>
											<input type="text" class="form-control" id="cname" name="cname" value="" required placeholder="Category Name">
											<input type="hidden" class="form-control" id="sub_modid" name="sub_modid" value="<?php echo $submod_id; ?>" >
										</div>
									</div>
								</div>
								
								<div class="col-md-6 ">
								    <button type="submit" class="btn btn-primary btn-min-width mr-1 mb-1" style="margin-top: 23px;">
									<i class="la la-check-square-o"></i> Submit
								    </button>
								    <input type="reset" name="reset" class="btn btn-secondary btn-min-width mr-1 mb-1" value="Cancel" style="margin-top: 23px;">
							    </div>
								
							</div>

							
						</form>	
					</div>
				</div>
			</div>
			<div class="card">
				<div class="card-content collapse show">
					<div class="card-body">
						<div class="table-responsive">
                            <table id="myTable" class="table table-bordered">
                                <thead>
                                    <tr>
                                        <th>Sl No</th>
                                        <th>Category</th>
									    <th>Edit</th>
									    <th>Delete</th>
										<th>Status</th>
                                    </tr>
                                </thead>
                                <tbody>
								 <?php
									$count =1;
									foreach($rawCategory as $record)
								{
								?>
                                    <tr>
                                        <td><?php echo $count;?></td>
                                        <td><?php echo $record->category_name ?></td>
                                        
										<td>
											<a href="<?php echo site_url('Master/categoryEdit/'. $submod_id . '/' . $record->category_id); ?>" ><i class="ft-eye"></i></a>
									    </td>
										
										<td>
											<a href="<?php echo site_url('Master/categoryDelete/'. $submod_id . '/' . $record->category_id); ?>"  onClick="return confirm('Are you sure want to delete?');" ><i class="ft-trash-2"></i></a>
											</td>
										
										<td>
											<?php if($record->status == 'Enabled') { ?>
												<a href="#" cat-status="Disabled" cat-id="<?php echo $record->category_id; ?>" class="btn btn-sm btn-info cat_status ">Disable</a>
											<?php } else { ?>
												<a href="#" cat-status="Enabled" cat-id="<?php echo $record->category_id; ?>" class="btn btn-sm btn-info cat_status">Enable</a>
											<?php } ?>
										</td>
                                    </tr>
                                    
                                   <?php
								  $count++;
								}
							  
							?>
                                </tbody>
                               
                            </table>
                        </div>
					</div>
				</div>
			</div>
		</div>
	</div>

</section>
<!-- // Basic form layout section end -->
        </div>
      </div>
    </div>
    <?php //require('include/theme_customizer.php');?>

<?php 
	$footer_file=APPPATH.'views/include/footer.php';
	require($footer_file);
?>
<script>
	$(document).on("click",".cat_status",function(){
		var cat_id=$(this).attr('cat-id');
		var cat_status=$(this).attr('cat-status');
			$.ajax({
			type: "POST",
			dataType:'json',
			data : { cat_id : cat_id, cat_status : cat_status},
			url: "<?php echo base_url();?>index.php/Master/change_cat_status",
			success: function(dataz) { 
				var data = $.trim(dataz);
				
				setInterval(function(){
						window.location.reload(true);
					}, 400);
			}
		});
	});
</script>
<script>
	$('.param_check').each(function() { $(this).on( {'click contextmenu': function() {
		//contextmenu
		var i = $(this).data('value');
		var anchor = $("a");
		var anchorTarget = $(this).parent().find('.parmetre').val();
		var submodid = $(this).parent().find('.submod_id').val();
		var link = $(this).attr('href');
		$(this).attr("href", link + submodid +'/'+anchorTarget);

		location.reload();
	}
	})
	})
</script>  
<script type='text/javascript'>
    $(document).ready(function() {
        $("#myTable").DataTable({
           dom: "Bfrtip",
             displayLength: 200,
            buttons: ["copyHtml5", "excelHtml5", "csvHtml5", "pdfHtml5"]
    }) 
   });
</script>
  </body>
  <!-- END: Body-->

<!-- Mirrored from pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-modern-menu-template/form-layout-basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Apr 2020 09:38:02 GMT -->
</html>