<!-- 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>Products</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">New Products</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<!-- Default box -->
<div class="card">
<div class="card-header">
<h3 class="card-title">All Products</h3>
<div class="card-tools">
<a href="<?php echo base_url(); ?>admin/product/add" class="btn btn-sm btn-primary"><i class="fas fa-plus"></i> Add Product</a>
</div>
</div>
<div class="card-body">
<?php if ($products) : ?>
<table id="lc-default-dt" class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>Image</th>
<th>Name</th>
<th>Category</th>
<th>New Product</th>
<th>Options</th>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product) : ?>
<tr>
<td><?php echo $product['id']; ?></td>
<td><img src="<?php echo base_url(); ?>assets/images/products/<?php echo $product['product_image']; ?>" class="img-thumbnail" width="63px"></td>
<td><?php echo $product['product_name']; ?></td>
<td><?php echo $product['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="product_is_new_<?php echo $product['id']; ?>" value="<?php echo $product['product_is_new']; ?>">
<input type="hidden" id="product_id" value="<?php echo $product['id']; ?>">
<input <?php if ($product['product_is_new'] == 1) echo "checked";
else ""; ?> type="checkbox" class="custom-control-input" id="lc-product-active-switch_<?php echo $product['id']; ?>" onclick="lc_switch_activation('products', '<?php echo $product['id']; ?>', 'product_is_new', document.getElementById('product_is_new_<?php echo $product['id']; ?>').value, 'product_is_new_label_<?php echo $product['id']; ?>', 'product_is_new_<?php echo $product['id']; ?>')">
<label class="custom-control-label" for="lc-product-active-switch_<?php echo $product['id']; ?>" id="product_is_new_label_<?php echo $product['id']; ?>"><?php if ($product['product_is_new'] == 1) echo "Yes";
if ($product['product_is_new'] == 0) echo "No"; ?></label>
</div>
</div>
</td>
<td>
<a class="btn btn-success btn-sm" href="<?php echo base_url(); ?>admin/product/<?php echo $product['id']; ?>"><i class="fas fa-eye" aria-hidden="true"></i></a>
<a class="btn btn-primary btn-sm" href="<?php echo base_url(); ?>admin/product/edit/<?php echo $product['id']; ?>"><i class="fas fa-pen-square" aria-hidden="true"></i></a>
<a class="btn btn-danger btn-sm" href="<?php echo base_url(); ?>admin/product/delete/<?php echo $product['id']; ?>" onclick="return confirm('Are You Sure You Want to Delete Product')"><i class="fas fa-trash" aria-hidden="true"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tfoot>
</table>
<?php else : ?>
No Products Yet
<?php endif; ?>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->