<?php

require('../functions/functions.php');
session_start();
$id_nota =$_SESSION['cveNota'];

$rol_usuario = $_SESSION['rolUsuario'];
$datos = get_productos_x_nota($id_nota, 2);
?>
<div class="table-responsive">
  <table class="table" id="pro_nta_tabla">
    <thead style="background: #D5D8DC;">
      <tr>
        <th class="align-middle text-center" scope="col">#</th>
        <th class="align-middle text-center" scope="col">Comensal</th>
        <th class="align-middle text-center" scope="col">Cantidad</th>
        <th class="align-middle text-center" scope="col">Nombre Producto</th>
        <th class="align-middle text-center" scope="col">Comentarios</th>
        <th class="align-middle text-center" scope="col">Precio</th>
        <th class="align-middle text-center" scope="col">Total</th>
        <th class="align-middle text-center" scope="col">Tiempo</th>
        <th class="align-middle text-center" scope="col">IMP</th> <!-- productos agregados -->
    </thead>
    
    <tbody id="pro_nta_tbody " class="tabla_prod_nta_body">
      <?php
          for($rr=0;$rr<count($datos);$rr++){
      ?>
      <tr class="<?php echo $datos[$rr]['BCOLOR']?>">
        <th class="align-middle text-center"><?php echo $datos[$rr]['CLAVE']?></th>
        <th class="align-middle text-center"><?php echo $datos[$rr]['COMENSAL']?></th>
        <td class="align-middle text-center"><!-- <input type="text" class="form-control input-cantidad" value="<?php echo $datos[$rr]['CANTIDAD']?>"> --><?php echo $datos[$rr]['CANTIDAD']?></td>
        <td class="align-middle text-center "><?php echo $datos[$rr]['NOMBRE']?></td>
        <td class="align-middle text-center "><!-- <input type="text" class="form-control input-comentario" value="<?php echo $datos[$rr]['COMENTARIO']?>" > --><?php echo $datos[$rr]['COMENTARIO']?></td>
        <td class="align-middle text-center ">
          <?php if ($rol_usuario=="ADMINISTRADOR") {?>
              <!-- <input type="text" class="form-control input-precio" value="<?php echo $datos[$rr]['PRECIO']?>" > --><?php echo $datos[$rr]['PRECIO']?>
            <?php  }else{
              echo $datos[$rr]['PRECIO'];
             }?>
        </td>
        <td class="align-middle text-center "><?php echo $datos[$rr]['CANTIDAD']*$datos[$rr]['PRECIO']?></td>
        <td class="align-middle text-center "><?php echo $datos[$rr]['TIEMPO']?></td>
        <td class="align-middle text-center "><?php echo $datos[$rr]['IMP']?></td>
      </tr>
      <?php }?>
    </tbody>
  </table>
</div>
    