<?php
require '../../conexion.php';
include '../../session.php';
?>

<div class="modal-header " >
    <button type="button" class="close"     
            data-dismiss="modal" arial-label="Close">x</button>
    <h4 class="modal-title"><i class="fa fa-plus"></i> <strong>Registrar Promociones</strong></h4>
</div>
<form action="promo_control.php" method="post" accept-charset="utf-8" class="form-horizontal" >
    <div class="modal-body">
        <input type="hidden" name="accion"  value="1">
        <input type="hidden" name="vusu" value="<?php echo $_SESSION['usu_cod']; ?>">
        <input type="hidden" name="vsuc" value="<?php echo $_SESSION['cod_suc']; ?>">
        <input type="hidden" name="pagina" value="promo_index.php" id="vcod">
        <input type="hidden" name="vcod" value="0"/>
        <div class="form-group">
            <label class="col-md-2 control-label">Inicio:</label>
            <div class="col-md-4 col-sm-4 col-lg-4">
                <input type="date" required="" class="form-control" value="<?php echo date("Y-m-d") ?>" name="vfechainicio"  min="<?php echo date('Y-m-d'); ?>">
            </div>
            <label class="col-md-2 control-label">Fin:</label>
            <div class="col-md-4 col-sm-4 col-lg-4">
                <input type="date" required="" class="form-control" value="<?php echo date("Y-m-d") ?>" name="vfechafin"  min="<?php echo date('Y-m-d'); ?>">
            </div>
        </div> 
        <div class="form-group">
            <label class="col-md-2 control-label">Tipo:</label>
            <div class="col-md-8 col-sm-8 col-lg-8">
                <?php $tpromocion = consultas::get_datos("SELECT * from tipo_promo"); ?>                                 
                <select name="vtpromo" class="select2 form-control" required="" style="width: 100%">
                    <option value="">Seleccione un tipo</option>
                    <?php if(!empty($tpromocion)) {
                        foreach ($tpromocion as $tpromo) { ?>
                            <option value="<?php echo $tpromo['id_tpromo']; ?>">
                                <?php echo $tpromo['descripcion']; ?></option>
                            <?php
                        }
                    } else {
                        ?>
                        <option value="">Debe insertar un registro</option>
                    <?php } ?>
                </select>
            </div>
        </div>  
        <div class="form-group">
            <label class="col-lg-2 col-md-2 col-sm-2 control-label">Descripcion:</label>
            <div class="col-md-8 col-sm-8 col-lg-8">
                <textarea class="form-control" name="vdescripcion" id="vdescripcion" placeholder="Ingrese una breve descripción de la promoción"></textarea>
            </div>
        </div>         
        <div class="modal-footer">
            <button type="reset" data-dismiss="modal" class="btn btn-default pull-left">
                <i class="fa fa-close"></i> Cerrar</button>
            <button type="submit" class="btn btn-primary pull-right">
                <i class="fa fa-floppy-o"></i> Registrar</button>
        </div>
    </div> 
</form>

<script type="text/javascript">
    $(".select2").select2();
</script>