<?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">
<style>
.border {
	border-right:1px solid #CCC;
}
</style>
</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <?php
		include "include/header.php";
		?>
        <?php
		foreach($product as $p_row)
		//echo $p_id = $p_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;
						  ?>
                           COA <small><?php echo '['.$p_row->p_name.']';?></small>
                         
                          <div style="float:right">
                            <a href="<?php echo base_url(); ?>app/chemical_products/<?php echo $p_row->c_id; ?>" class="btn btn-primary">Back</a>
                           </div>
                        </h1>
                       
                    </div>
                </div>
             <div class="row">
             	<div class="col-lg-6 border">
                
             		<legend>Add COA</legend>
             		<form action="<?php echo base_url();?>insert/in_coa/<?php echo $p_row->p_id;?>" method="post" enctype="multipart/form-data">
             		<div class="form-group">
                		<label>Enter Batch No</label>
                        <input type="text" class="form-control" name="batch_no"/>
                    </div>
             		<div class="form-group">
                        <label>Select pdf for Uploading COA</label>
                        <input type="file" name="coa_pdf" class="form-control">
                    </div>
                    <input type="submit" class="btn btn-primary" value="Add COA" />
               		</form>
                    <br><br>
                    <legend></legend>
                    <?php if(count($coa) > 0)
					{
					?>
                    <table class="table table-bordered table-hover">
                    <thead>
                    <th>Batch No</th>
                    <th>COA</th>
                    <th width="10%">Action</th>
                    </thead>
                    <tbody>
                    <?php foreach($coa as $row):?>
                    <tr>
                    <td><?php echo $row->batch_no;?></td>
                    <td><a href="<?php echo base_url();?>assets/uploads/coa/<?php echo $row->batch_no.'_'.$row->coa_id.'.pdf'?>" target="_blank"><i class="fa fa-file-pdf-o"></i></a></td>
  					<td><a href="<?php echo base_url()?>delete/del_coa/<?php echo $row->coa_id.'/'.$p_row->p_id;?>"><i class="fa fa-fw fa-trash-o"></i></a></td>
                    </tr>
                    <?php endforeach;?>	
                    </tbody>
                    </table>
                    <?php }?>  
                </div>
                           
             	<div class="col-lg-6">
                <?php if(count($msds) == 0)
					{
					?>
             		<legend>Add MSDS</legend>
             		<form action="<?php echo base_url();?>insert/in_msds/<?php echo $p_row->p_id;?>" method="post" enctype="multipart/form-data">
             		<div class="form-group">
                		<label>Enter Name</label>
                        <input type="text" class="form-control" name="m_name" required/>
                    </div>
             		<div class="form-group">
                        <label>Select pdf for Uploading MSDS</label>
                        <input type="file" name="m_pdf" class="form-control" required>
                    </div>
                    <input type="submit" class="btn btn-primary" value="Add MSDS" />
               		</form>
                     <br><br>
                    <legend></legend>
                    <?php 
					} else
					{
					?>
                    <table class="table table-bordered table-hover">
                    <thead>
                    <th>Name</th>
                    <th>MSDS</th>
                    <th width="10%">Action</th>
                    </thead>
                    <tbody>
                    <?php foreach($msds as $m_row):?>
                    <tr>
                    <td><?php echo $m_row->m_pdf;?></td>
                    <td><a href="<?php echo base_url();?>assets/uploads/msds/<?php echo $m_row->m_pdf.'_'.$m_row->m_id.'.pdf'?>" target="_blank"><i class="fa fa-file-pdf-o"></i></a></td>
   					<td><a href="<?php echo base_url()?>delete/del_msds/<?php echo $m_row->m_id.'/'.$p_row->p_id;?>"><i class="fa fa-fw fa-trash-o"></i></a></td>
                    </tr>
                    <?php endforeach;?>	
                    </tbody>
                    </table>
                    <?php }?> 
                </div>
            </div> 
             <br><br><br>
             
             
             <!--<div class="row">
                    <div class="col-lg-6">
                    <table class="table table-bordered table-hover">
                    <thead>
                    <th>Batch No</th>
                    <th>COA</th>
                    </thead>
                    <tbody>
                    <?php foreach($coa as $row):?>
                    <tr>
                    <td><?php echo $row->batch_no;?></td>
                    <td><a href="<?php echo base_url();?>assets/uploads/coa/<?php echo $row->batch_no.'_'.$row->coa_id.'.pdf'?>" target="_blank"><i class="fa fa-file-pdf-o"></i></a></td>
  					</tr>
                    <?php endforeach;?>	
                    </tbody>
                    </table>  
                    </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>
