<?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['pabellon']==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> Detalle Pabellon
                                            </a>
                                        </li>
                                    </ol>
                                </nav>
                            </div>
                          
                            <div class="col-sm-12" style="margin-top: 20px;">
                                <form class="form" method="post"  id="frmFormActualizar" autocomplete="off">
                                    <div class="card">
                                        <div class="card-header">
                                            <h3 class="card-title" id="idtitle" >
                                                <i class="fas fa-plus"></i> <!-- Icono para agregar -->
                                                Editar Nicho<!-- Título del formulario -->
                                            </h3>
                                        </div>
                                        <div class="card-body" style="display: block;">
                                            <div class="container-fluid">
                                                <input type="hidden" name="iddetalle_pabellon" id="iddetalle_pabellon">
                                                <div class="row">
                                                    <!-- Primera columna -->
                                                    <div class="col-12 col-sm-12 col-md-6">
                                                        <div class="form-group">
                                                            <label for="nombre">Nombre Propietario:</label>
                                                            <a href="#" class="text-secondary" data-toggle="modal" data-target="#nuevoClienteModal">[+ Nuevo]</a>
                                                            <select id="idpersona" name="idpersona" class="form-control select2" data-live-search="true" required="" >
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <!-- Segunda columna -->
                                                    <div class="col-12 col-sm-6 col-md-6">
                                                        <div class="form-group">
                                                            <label >Pabellon:</label>
                                                            <select id="idpabellon" name="idpabellon" class="form-control select2" data-live-search="true" required="" >
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="col-12 col-sm-6 col-md-6">
                                                        <div class="form-group">
                                                            <label >Numero Fila:</label>
                                                            <input type="number" class="form-control" name="fila" id="fila"  placeholder="Numero Fila" >
                                                        </div>
                                                    </div>
                                                    <div class="col-12 col-sm-6 col-md-6">
                                                        <div class="form-group">
                                                            <label >Columna:</label>
                                                            <input type="number" class="form-control" name="columna" id="columna"  placeholder="Numero Columna" >
                                                        </div>
                                                    </div>
                                                    <div class="col-12 col-sm-6 col-md-6">
                                                        <div class="form-group">
                                                            <label >Estado Nicho:</label>
                                                            <select  class="form-control" name="estado_nicho" id="estado_nicho" data-live-search="true" data-style="btn-default" required >
                                                                    <option value="">Selecciones Tipo Venta</option>
                                                                    <option value="1">Disponible</option>
                                                                    <option value="2">Vendido</option>
                                                                    <option value="3">Credito</option>
                                                                    <option value="4">Credito Futuro</option>
                                                                    <option value="5">Futuro</option>
                                                                    <option value="6">Enterrado</option>
                                                            </select>
                                                        </div>
                                                    </div>
                                            </div>
                                        </div>
                                        <div class="card-footer">
                                            <!-- Botones de acción -->
                                            <button type="submit" id="btnGuardar" class="btn btn-primary btn-flat">
                                                <i class="fas fa-save"></i> Actualizar registro
                                            </button>
                                            <a href="list_detalle.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="nuevoClienteModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-header bg-primary">
                            <h5 class="modal-title" id="modalLabel">Registro Cliente</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Cerrar">
                                <span>&times;</span>
                            </button>
                        </div>
                        <form id="clienteForm">
                            <div class="modal-body">
                                <div class="row">
                                    <div class="col-12 col-sm-12 col-md-6">
                                        <div class="form-group">
                                            <label >Nombre Cliente:</label>
                                            <input type="text" class="form-control" name="nombre" id="nombre"  placeholder="Nombre Cliente" required>                                       
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-12 col-md-6">
                                        <div class="form-group">
                                            <label >Nombre Nicho:</label>
                                            <input type="text" class="form-control" name="nombre_nicho" id="nombre_nicho"  placeholder="Nombre Nicho" required>                                       
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6 col-md-6">
                                        <div class="form-group">
                                            <label >Tipo Documento:</label>
                                            <select  name="idtipo_documento" id="idtipo_documento" class="form-control select2"  data-live-search="true" data-style="btn-default" >
                                            </select>                                      
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6 col-md-6">
                                        <div class="form-group">
                                            <label >Numero Documento:</label>
                                            <input type="number" class="form-control" name="num_documento" id="num_documento"  placeholder="Numero Documento" >
                                            <small id="num_documento_help" class="form-text text-muted"></small>                                      
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6 col-md-6">
                                        <div class="form-group">
                                            <label for="numero_celular" >Numero Celular:</label>
                                            <input type="number" class="form-control" name="numero_celular" id="numero_celular"  placeholder="Numero Celular" >                                       
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6 col-md-6">
                                        <div class="form-group">
                                            <label for="direccion" >Direccion:</label>
                                            <input type="number" class="form-control" name="direccion" id="direccion"  placeholder="Direccion" >                                       
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary  btn-flat" data-dismiss="modal"><i class="fas fa-times"></i> Cerrar</button>
                                    <button type="submit" id="btnCliente" class="btn btn-primary btn-flat"> <i class="fas fa-save"></i> Registrar Cliente</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>


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

<?php 
}
ob_end_flush();
?>