<!-- Begin Page Content -->
<div class="container-fluid">

    <!-- Page Heading -->
    <div class="row column_title">
        <div class="col-md-12">
            <div class="page_title">
                <h2>Products List</h2>
            </div>
        </div>
    </div>

            <button type="button" style="float: right" onclick="location.href='<?= base_url() . 'dashboard/addpoduct' ?>'" class="btn btn-primary" >Add Product</button>
    <!-- DataTales Example -->
   <br><br><br>
    <div class="card shadow mb-4">

        <div class="card-header py-3 ml-auto">

        </div>

        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" id="songTable" width="100%" cellspacing="0">
                    <thead class="thead-dark">
                        <tr>
                            <th>Title</th>
                            <th>Image</th>
                            <th>Description</th>
                            <th>Price</th>
                            <th>Rating</th>
                            <th>Actions</th>
                        </tr>
                    </thead>

                    <tbody>

                    Array

                        <?php
            if (!empty($products)) {
              $count = 1;
              foreach ($products as $id => $product) {
                echo "<pre>";
                print_r($product);
                echo "</pre>";
            ?>
                        <tr>
                            <td><?php echo $product['productName']; ?></td>
                            <td>
                                <?php if ($product['productUrl'][0] != "") { ?>
                                <img class="img-thumbnail" width="100" height="100" src="<?php echo $product['productUrl'][0]; ?>">
                                <?php } else { ?>
                                <img class="img-thumbnail" src="http://placehold.jp/100x100.png">
                                <?php } ?>
                            </td>
                            <td>
                                <?php echo $product['productDetail']; ?>
                            </td>
                            <td>
                                <?php echo $product['productPrice']; ?>
                            </td>
                            <td>
                                <?php echo $product['averageRating']; ?>
                            </td>
                            <td>
                            <a class="icon" style="text-decoration: none;" href="<?php echo base_url(); ?>dashboard/viewProduct/<?php echo $id; ?>">
                                    <button class="btn btn-info btn-block mt-2">View</button>
                                </a>
                                <a class="icon" style="text-decoration: none;" href="<?php echo base_url(); ?>dashboard/editProduct/<?php echo $id; ?>">
                                    <button class="btn btn-info btn-block mt-2">Edit</button>
                                </a>
                                <a class="icon" style="text-decoration: none;" href="<?php echo base_url(); ?>dashboard/deleteProduct/<?php echo $id; ?>">
                                    <button class="btn btn-danger btn-block mt-2">Delete</button>
                                </a>

                            </td>

                        </tr>
                        <?php }
            } ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</div>
<!-- /.container-fluid -->