<?php if(isset($_SESSION['successMsg'])){?>
	<div class="alert alert-success" role="alert"><?php echo $_SESSION['successMsg']; unset($_SESSION['successMsg']);?></div>
<?php }?>

<?php if(isset($_SESSION['errorMsg'])){?>
    <div class="alert alert-danger" role="alert"><?php echo $_SESSION['errorMsg']; unset($_SESSION['errorMsg']);?></div>
<?php }?>
<style>
.btn-sm, .btn-group-sm > .btn {
    padding: 0px 5px;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.1875rem;
}
.table td, .table th {
    padding:1px 1px;
	vertical-align: middle;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}
.btn i {
    margin-right: 0px;
}
.content-wrapper {
    background: #f2f8f9;
    padding: 0px;
    width: 100%;
    -webkit-flex-grow: 1;
    flex-grow: 1;
}
.page-body-wrapper:not(.auth-page) {
    padding-top: 50px;
}
</style>
<div class="col-lg-12 grid-margin stretch-card">	                
    <div class="card">    
        <div class="card-body">        	            		    		    	        
            <h4 class="card-title">PRODUCT LIST</h4>                   
            <div class="table-responsive">
                <table class="table datatable-sorting" id="myTable">
                    <thead>
                        <tr>                            
                            <th>S.NO</th>
                            <th>PRODUCT NAME</th>
                            <th>SKU</th>
                            <th>CASE SIZE</th>
                            <th>SMALL UNIT</th>
                            <th>LARGE UNIT</th>
                            <th>PRICE</th>
                            <th>PCS/SET PRICE</th>                     
                            <th style="text-align:center;">Action</th>                                           
                        </tr>
                    </thead>
                    <tbody>
                    <?php 
					$i=1;                                       
                    $sqlQuestion = mysqli_query($cn,"select * from `tbl_product` where `status`=1");			
                    while($sqlQuestionData = mysqli_fetch_array($sqlQuestion))
                    {								
                        ?>
                        <tr>                            
                            <td><?php echo $i++;?></td>
                            <td><?php echo $sqlQuestionData['product_name'];?></td>
                            <td><?php echo $sqlQuestionData['sku'];?></td>
                            <td><?php echo $sqlQuestionData['case_size'];?></td>
                            <td><?php echo $sqlQuestionData['unit1'];?></td>
                            <td><?php echo $sqlQuestionData['unit2'];?></td>
                            <td><?php echo $sqlQuestionData['price'];?></td>
                            <td><?php echo $sqlQuestionData['set_price'];?></td>                        
                            <td style="text-align:center;"><a href="home.php?pages=addProduct&edit_id=<?php echo $sqlQuestionData['id'];?>" class="btn btn-outline-success btn-sm"><i class="mdi mdi-pencil"></i></a></td> 
                        </tr>
                    <?php }?>    
                    </tbody>
                </table>                
                </div>
        </div>
    </div>
</div>    
