<?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> Garantia
                                            </a>
                                        </li>
                                    </ol>
                                </nav>
                            </div>
                          
                            <div class="col-sm-12" style="margin-top: 20px;">
                                <div class="card  ">
                                    <div class="card-header bg-primary">
                                        <h3 class="card-title">
                                            <i class="fas fa-search"></i>
                                            Listado de Garantia
                                        </h3>
                                    </div>
                                    <div class="card-body" style="display: block;">
                                        <div class="container-fluid">
                                            <br>
                                            <table style="width:100%;" class="table table-bordered" id="garantia">
                                                <thead>
                                                <tr>
                                                    <th>Fecha Envio</th>
                                                    <th>Fecha Retorno</th>
                                                    <th>Proveedor</th>
                                                    <th>Producto</th>
                                                    <th>Nro Factura</th>
                                                    <th>Mac</th>
                                                    <th>Codigo</th>
                                                    <th>Garantia</th>
                                                    <th>Estado</th>
                                                    <th>Opciones</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="card-footer">
                                        <!-- Footer buttons -->
                                        <a href="create.php" class="btn btn-primary btn-flat">
                                            <i class="fas fa-plus"></i> Nuevo Registro
                                        </a>
                                        <a href="list.php" class="btn btn-success btn-flat">
                                            <i class="fas fa-sync-alt"></i> Actualizar
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>                
            </div>

            <div class="modal fade" id="modal_proceso" tabindex="-1" role="dialog"  >
                <div class="modal-dialog modal-lg " role="document">
                    <div class="modal-content">
                        <div class="modal-header"  style="background:#8e0f06; color:white">
                            <h5 class="modal-title" id="Label">Registro Ticket</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span>&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <form id="ticketForm">
                                <div class="row">
                                <input type="hidden"  class="form-control" name="idgarantia" id="idgarantia"  >
                                        <div class="col-12">
                                            <div class="form-group"> 
                                                <label>Nombre Ticket:</label>
                                                <input type="text" class="form-control" name="nombre_envio" id="nombre_envio"  placeholder="Nombre Ticket" required="" >
                                            </div>
                                        </div>
                                        <div class="form-group col-lg-6 col-md-12 col-sm-12 col-xs-12">
                                            <label>Imagen Ticket:</label>
                                            <input type="file" class="form-control" name="nombre_imagen" id="nombre_imagen" required>
                                            <input type="hidden" name="imagenactual" id="imagenactual">
                                        <img src="../../files/averia/no_disponible.jpg" width="250px" height="200px" id="imagenmuestra">
                                    </div>
                                    <div class="form-group col-lg-6 col-md-6 col-sm-6 col-xs-6">                
                                        <label>Fecha Envio:</label>                           
                                        <input type="datetime-local"  class="form-control" name="fechaenvio" id="fechaenvio"  >
                                    </div>
                                    </div>
                                 </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary  btn-flat" data-dismiss="modal">Cerrar</button>
                                    <button type="submit" id="btnProceso" class="btn btn-flat" style='background-color:#8e0f06;color: #FFFFFF'> <i class="fas fa-save"></i> Registrar Ticket</button>
                                </div>
                         </form>
                    </div>
                </div>
            </div>

            <div class="modal fade" id="modal_retorno" tabindex="-1" role="dialog"  >
                <div class="modal-dialog modal-lg " role="document">
                    <div class="modal-content">
                        <div class="modal-header"  style="background:#8e0f06; color:white">
                            <h5 class="modal-title" id="Label">Registro Retorno Garantia</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span>&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <form id="retornoForm">
                                <div class="row">
                                <input type="hidden"  class="form-control" name="idgarantia" id="idgarantiaa">
                                    <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                            <label for="descripcion_retorno" >Descripcion Garantia Retorno:</label>
                                            <p><textarea name="descripcion_retorno" cols="100" rows="3" id="descripcion_retorno" required=""></textarea></p>
                                    </div>
                                    <div class="form-group col-lg-6 col-md-12 col-sm-12 col-xs-12">
                                        <label>Estado Retorno:</label>
                                        <select  name="estado_garantia" id="estado_garantia" class="form-control"  data-live-search="true" data-style="btn-default" required>
                                            <option value="">Seleccione Estado</option>
                                            <option value="3">Procedio Garantia</option>
                                            <option value="4">No Procedio Garantia</option>      
                                        </select>
                                    </div>
                                    <div class="form-group col-lg-6 col-md-6 col-sm-6 col-xs-6">                
                                        <label>Fecha Retorno:</label>                           
                                        <input type="datetime-local"  class="form-control" name="fecharetorno" id="fecharetorno"  >
                                    </div>
                                    <div class="form-group col-lg-6 col-md-12 col-sm-12 col-xs-12">
                                        <label>Imagen Constancia:</label>
                                        <input type="file" class="form-control" name="nombre_imagen" id="nombre_imagen" required>
                                        <input type="hidden" name="imagenactual" id="imagenactual">
                                        <img src="../../files/averia/no_disponible.jpg" width="250px" height="200px" id="imagenmuestra">
                                    </div>
                                    </div>
                                 </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary  btn-flat" data-dismiss="modal">Cerrar</button>
                                    <button type="submit" id="btnRetorno" class="btn btn-flat" style='background-color:#8e0f06;color: #FFFFFF'> <i class="fas fa-save"></i> Registrar Retorno</button>
                                </div>
                         </form>
                    </div>
                </div>
            </div>


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