<?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['ventas']==1 or $_SESSION['averia']==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> Apertura Caja
                                            </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 Aperturas
                                        </h3>
                                    </div>
                                    <div class="card-body" style="display: block;">
                                        <div class="container-fluid">
                                            <br>
                                            <table style="width:100%;" class="table table-bordered" id="caja">
                                                <thead>
                                                <tr>
                                                    <th>Fecha Apertura</th>
                                                    <th>Nombre Caja</th>
                                                    <th>Monto Apertura</th>                                                  
                                                    <th>Usuario Responsable</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="card-footer">
                                        <button id="btncaja" type="button" class="btn btn-danger btn-flat" data-toggle="modal" data-target="#myModalCaja">
                                                <i class="fas fa-box"></i> Abrir Caja
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>                
            </div>

            <div class="modal fade" id="myModalCaja" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="modalLabel">Abrir Caja</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Cerrar">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <form id="form_abricaja">
                            <div class="modal-body">
                                <!-- Campo para mostrar el dato -->
                                <div class="form-group">
                                    <label >Monto Apertura:</label>
                                    <input type="hidden"  name="idmovimientocaja" id="idmovimientocaja" > 
                                    <input type="number" step="0.01" class="form-control" name="monto_apertura" id="monto_apertura" placeholder="Monto Apertura" required>                                        
                                </div>
                                <div class="form-group">
                                    <label >Fecha:</label>
                                    <input type="datetime-local" class="form-control" name="fecha_apertura" id="fecha_apertura" required="" readonly>                                   
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-danger btn-flat" data-dismiss="modal" id="btnGuardar"> <i class="fas fa-times"></i> Cancelar</button>
                                <button type="submit" id="btnGuardar" class="btn btn-primary btn-flat"> <i class="fas fa-save"></i> Guardar registro </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>


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