/home/hdwebsolution/www/sareenn/application/views/admin/categories.php
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Categories</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="<?php echo base_url(); ?>admin">Home</a></li>
<li class="breadcrumb-item active">Categories</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title">Create New Category</h3>
</div>
<div class="card-body">
<form class="form-inline" method="post" action="<?php echo base_url(); ?>admin/category_add_request" enctype="multipart/form-data">
<div class="col-12">
<label class="mr-2 sr-only">Category Name<span class="text-danger">*</span></label>
<input type="text" name="category_name" class="form-control mr-2" placeholder="Enter Category Name" required>
</div>
<div class="col-12">
<label class="mr-2 sr-only">Category Description</label>
<!-- <input type="text" name="category_description" class="form-control mr-2" placeholder="Enter Category Description"> -->
<textarea class="form-control textarea" id="lc_category_description" name="category_description" rows="2"></textarea>
</div>
<div class="col-12">
<input type="file" class="form-control mr-2" name="category_image" id="category_image" required>
</div>
<input type="submit" class="btn btn-primary" value="Add New">
</form>
</div>
<!-- /.card-body -->
</div>
<!-- Default box -->
<div class="card">
<div class="card-header">
<h3 class="card-title">All Categories</h3>
</div>
<div class="card-body">
<?php if ($categories) : ?>
<table id="lc_default_dt" class="table table-bordered table-striped table-sm">
<thead>
<tr>
<th>Category ID</th>
<th>Category Image</th>
<th>Category Name</th>
<th>Featured</th>
<th>Active</th>
<th>Options</th>
</tr>
</thead>
<tbody>
<?php foreach ($categories as $category) : ?>
<tr>
<td><?php echo $category['id']; ?></td>
<td><img src="<?php echo base_url(); ?>assets/images/categories/<?php echo $category['category_image']; ?>" class="img-thumbnail" width="63px"></td>
<td><?php echo $category['category_name']; ?></td>
<td>
<div class="form-group">
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
<input type="hidden" id="category_is_featured_<?php echo $category['id']; ?>" value="<?php echo $category['category_is_featured']; ?>">
<input type="hidden" id="category_id" value="<?php echo $category['id']; ?>">
<input <?php if ($category['category_is_featured'] == 1) echo "checked";
else ""; ?> type="checkbox" class="custom-control-input" id="lc_category_is_featured_switch_<?php echo $category['id']; ?>" onclick="lc_switch_activation('categories', '<?php echo $category['id']; ?>', 'category_is_featured', document.getElementById('category_is_featured_<?php echo $category['id']; ?>').value, 'category_is_featured_label_<?php echo $category['id']; ?>', 'category_is_featured_<?php echo $category['id']; ?>')">
<label class="custom-control-label" for="lc_category_is_featured_switch_<?php echo $category['id']; ?>" id="category_is_featured_label_<?php echo $category['id']; ?>">
<?php if ($category['category_is_featured'] == 1) echo "Yes";
if ($category['category_is_featured'] == 0) echo "No"; ?></label>
</div>
</td>
<td>
<div class="form-group">
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
<input type="hidden" id="category_is_active_<?php echo $category['id']; ?>" value="<?php echo $category['category_is_active']; ?>">
<input type="hidden" id="category_id" value="<?php echo $category['id']; ?>">
<input <?php if ($category['category_is_active'] == 1) echo "checked";
else ""; ?> type="checkbox" class="custom-control-input" id="lc_category_is_active_switch_<?php echo $category['id']; ?>" onclick="lc_switch_activation('categories', '<?php echo $category['id']; ?>', 'category_is_active', document.getElementById('category_is_active_<?php echo $category['id']; ?>').value, 'category_is_active_label_<?php echo $category['id']; ?>', 'category_is_active_<?php echo $category['id']; ?>')">
<label class="custom-control-label" for="lc_category_is_active_switch_<?php echo $category['id']; ?>" id="category_is_active_label_<?php echo $category['id']; ?>">
<?php if ($category['category_is_active'] == 1) echo "Yes";
if ($category['category_is_active'] == 0) echo "No"; ?></label>
</div>
</td>
<td>
<a class="btn btn-primary btn-sm" href="<?php echo base_url(); ?>admin/category/edit/<?php echo $category['id']; ?>">Edit</a>
</td>
</tr>
<?php endforeach; ?>
</tfoot>
</table>
<?php else : ?>
No Categories Yet
<?php endif; ?>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->