<?php
ob_start();
ini_set('session.gc_maxlifetime', 14400);
session_set_cookie_params(14400);
session_start();

if (!isset($_SESSION["nombre"]))
{
    header("Location: ../../login/login.php");
}
else
{
    require '../header.php';

if($_SESSION['almacen']==1){

?>

            <div class="content-wrapper">
                <!-- Breadcrumb Section -->
                <section class="content-header">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <nav aria-label="breadcrumb">
                                    <ol class="breadcrumb">
                                        <li class="breadcrumb-item">
                                            <a href="#"><i class="fas fa-home"></i> Panel</a>
                                        </li>
                                        <li class="breadcrumb-item active" aria-current="page">
                                            <a href="list.php">
                                                <i class="module-icon"></i> Salida Productos
                                            </a>
                                        </li>
                                    </ol>
                                </nav>
                            </div>
                          
                            <div class="col-sm-12" style="margin-top: 20px;">
                                <form class="form" method="post"  id="frmForm" autocomplete="off">
                                    <div class="card">
                                        <div class="card-header">
                                            <h3 class="card-title" id="idtitle" >
                                                <i class="fas fa-plus"></i> <!-- Icono para agregar -->
                                                Registro Salida Productos<!-- Título del formulario -->
                                            </h3>
                                        </div>
                                        <div class="card-body" style="display: block;">
                                            <div class="container-fluid">
                                                <input type="hidden" name="idsalida" id="idsalida">
                                                <div class="row">
                                                    <!-- Primera columna -->
                                                    <div class="col-12 col-sm-12 col-md-8">
                                                        <div class="form-group">
                                                            <label for="idtecnico">Nombre Tecnico:</label>
                                                            <select  name="idtecnico" id="idtecnico" class="form-control"  data-live-search="true" data-style="btn-default" required>
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <!-- Segunda columna -->
                                                    <div class="col-12 col-sm-12 col-md-4">
                                                        <div class="form-group">
                                                        <label>Fecha y Hora:</label>
                                                            <input type="datetime-local" class="form-control" name="fecha_hora" id="fecha_hora" required="" readonly>
                                                        </div>
                                                    </div>

                                                    <div class="col-12 col-sm-12 col-md-3">
                                                        <div class="form-group">
                                                            <button id="btnAgregarArt" type="button" class="btn btn-danger btn-xs btn-flat" data-toggle="modal" data-target="#myModalIngreso">
                                                                <span class="fa fa-plus"></span>&nbsp;&nbsp;Agregar Productos
                                                            </button>
                                                        </div>
                                                    </div>
                                                    <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12 table-responsive">
                                                        <table id="detalles" class="table table-striped table-bordered table-condensed table-hover">
                                                            <thead>
                                                                <th style="background-color:#4564ff;color: white;">Opciones</th>
                                                                <th style="background-color:#4564ff;color: white;">Articulo</th>
                                                                <th style="background-color:#4564ff;color: white;">Codigo</th>
                                                                <th style="background-color:#4564ff;color: white;">Marca</th>
                                                                <th style="background-color:#4564ff;color: white;">Mac</th>
                                                                <th style="background-color:#4564ff;color: white;">Serie</th>
                                                                <th style="background-color:#4564ff;color: white;">Unidad Medida</th>
                                                                <th style="background-color:#4564ff;color: white;">Cantidad</th>
                                                                <th style="background-color:#4564ff;color: white;">Precio venta</th>
                                                                <th style="background-color:#4564ff;color: white;">Subtotal</th>

                                                            </thead>
                                                            <tfoot>
                                                                <th style="height:2px; text-align: right; font-size: 20px;" colspan="8" >TOTAL</th>
                                                                <th style="height:2px; text-align: right;" colspan="2">
                                                                <h4 id="total">S/&nbsp;&nbsp; 0.00</h4><input type="hidden" name="total_compra" id="total_compra"></th>
                                                            </tfoot>
                                                            <tbody>
                                                            </tbody>
                                                        </table>
                                                     </div>
                                                </div>  
                                            </div>
                                        </div>
                                        <div class="card-footer">
                                            <!-- Botones de acción -->
                                            <button  id="btnGuardar" class="btn btn-primary btn-flat">
                                                <i class="fas fa-save"></i> Guardar registro
                                            </button>
                                            <a href="list.php" class="btn btn-danger btn-flat">
                                                <i class="fas fa-times"></i> Cancelar
                                            </a>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </section>                
            </div>


            <div class="modal fade" id="myModalIngreso" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
                <div class="modal-dialog modal-xl" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="modalLabel"><i class="fa-solid fa-magnifying-glass"></i> Busqueda de producto</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Cerrar">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                            <div class="modal-body">
                                <!-- Campo para mostrar el dato -->
                                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                    <table style="width:100%;" class="table table-bordered" id="modalproducto">
                                        <thead>
                                            <th  style="width: 65% !important;">Nombre Producto</th>
                                            <th>Codigo</th>
                                            <th>Marca</th>                  
                                            <th>Mac</th>
                                            <th>Serie</th>
                                            <th>Precio</th>
                                            <th>Estado Material</th>
                                            <th>Stock</th>
                                            <th>Opciones</th>
                                        </thead>
                                        <tbody>

                                        </tbody>
                                        <tfoot>
                                            <th  style="width: 65% !important;">Nombre Producto</th>
                                            <th>Codigo</th>
                                            <th>Marca</th>                  
                                            <th>Mac</th>
                                            <th>Serie</th>
                                            <th>Precio</th>
                                            <th>Estado Material</th>
                                            <th>Stock</th>
                                            <th>Opciones</th>
                                        </tfoot>
                                    </table>
                                </div>
                            </div>
                    </div>
                </div>
            </div>


               
<?php
}
require '../footer.php';
?>
<script type="text/javascript" src="../../scripts/inventario.js"></script>
<?php 
}
ob_end_flush();
?>