<?php
$page = 'category';
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Admin</title>

    <!-- Bootstrap Core CSS -->
    <link href="<?php echo base_url(); ?>assets/Backend/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="<?php echo base_url(); ?>assets/Backend/css/sb-admin.css" rel="stylesheet">

    <!-- Morris Charts CSS -->
    <link href="<?php echo base_url(); ?>assets/Backend/css/plugins/morris.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/Backend/font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <?php
		include "include/header.php";
		?>
        <?php
		//foreach($about as $row)
		//$p_id = $row->p_id;
		?>

        <div id="page-wrapper">

            <div class="container-fluid">

                <!-- Page Heading -->
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header">
                            <?php 
						     foreach($category as $cat)
							 $c_id=$cat->c_id;
						  ?>
                           Products <small><?php echo '['.$cat->c_name.']'; ?></small>
                          
                          <div style="float:right">
                            <a href="<?php echo base_url(); ?>app/new_chemical/<?php echo $c_id;?>" class="btn btn-primary">New Product</a>
                            <a href="<?php echo base_url(); ?>app/<?php echo $cat->c_type; ?>" class="btn btn-primary">Back</a>
                           </div>
                        </h1>
                       
                    </div>
                </div>
                
             <div class="row">
                    <div class="col-lg-12">
                        <div class="table-responsive">
                            <table class="table table-bordered table-hover">
							 <thead>
                             <th width="10%">P.Code</th>
                             <th width="">Product Name</th>
                             <th width="10%">CAS No</th>
                             <th width="10%">COAs</th>
                             <th width="10%">Action</th>
                             </thead>
                             <tbody>
                              <?php
					      		foreach($product as $row):
							  ?>			                             
                              <tr>
                                 <td><?php 
								   		foreach($p_code as $c_row)
										{
										   if($row->p_id == $c_row->p_id)
								   		   echo $c_row->pd_value;
										}
								     ?>
                                 </td>
                                 <td><?php echo $row->p_name;?>&nbsp;<label class="label-success"><?php if($row->p_status == 'New') echo $row->p_status;?></label></td>
                                 <td><?php 
								   		foreach($p_cas as $cas_row) 
										{
											if($row->p_id == $cas_row->p_id)
								   		    echo $cas_row->pd_value;
										}
								     ?>
                                 </td>
                                <td><a href="<?php echo base_url(); ?>app/view_coa/<?php echo $row->p_id;?>" class="btn btn-primary btn-sm">View COA / MSDS</a></td> 
                                 <td><a href="<?php echo base_url()?>app/edit_chemical/<?php echo $row->p_id;?>"><i class="fa fa-fw fa-pencil"></i></a></td>
                               </tr>   
							   <?php endforeach;?>  
                               </tbody>     
                                
                            </table>
                        </div>
                    </div>
                    </div>
				
            </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery Version 1.11.0 -->
    <script src="<?php echo base_url(); ?>assets/Backend/js/jquery-1.11.0.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="<?php echo base_url(); ?>assets/Backend/js/bootstrap.min.js"></script>

    <!-- Morris Charts JavaScript -->
    <script src="<?php echo base_url(); ?>assets/Backend/js/plugins/morris/raphael.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/Backend/js/plugins/morris/morris.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/Backend/js/plugins/morris/morris-data.js"></script>

</body>

</html>
