<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <?php
        include '../../session.php';
        require '../../conexion.php';
        require '../../menu/css_lte.ctp';
        ?>
    </head>
    <body class="hold-transition skin-blue sidebar-mini">
        <div class="wrapper">
            <?php require '../../menu/cabecera.ctp'; ?><!--BARRA DE HERRAMIENTAS-->
            <?php require '../../menu/izquierda.ctp'; ?><!--BARRA DE HERRAMIENTAS-->
            <div class="content-wrapper">
                <div class="content">
                    <div class="row">
                        <div class="col-lg-12 col-sm-12 col-md-12 col-xs-12">
                            <div class="box box-primary">
                                <div class="box-header">
                                    <i class="fa fa-plus"></i>
                                    <h3 class="box-title">Agregar Diagnostico</h3>
                                    <div class="box-tools">
                                        <a href="diagnostico_index.php" class="btn btn-primary btn-md" data-title="Volver" rel="tooltip">
                                            <i class="fa fa-arrow-left"></i> VOLVER</a>
                                    </div>
                                </div>                               
                                <form action="diagnostico_control.php" method="post" accept-charset="utf-8" class="form-horizontal">
                                        <input type="hidden" name="accion" value="1">
                                        <input type="hidden" name="vcod" value="0">                                    
                                    <div class="box-body">
                                        <?php $fecha = consultas::get_datos("select current_date as fecha");?>
                                        <div class="row">
                                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
                                                <label>Fecha:</label>
                                                <input type="date" class="form-control" value="<?php echo $fecha[0]['fecha'];?>" disabled="">
                                            </div>
                                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">
                                                <label>Cliente:</label>                                                
                                                <?php $clientes = consultas::get_datos("select * from v_clientes where id_cliente > 0 order by cliente");?>
                                                <select class="form-control select2" name="vcliente" required="" onchange="recepciones()" id="cliente">
                                                        <option value="">Seleccione un cliente</option>
                                                        <?php foreach ($clientes as $cliente) { ?>
                                                        <option value="<?php echo $cliente['id_cliente'];?>"><?php echo $cliente['cliente'];?></option>
                                                        <?php } ?>
                                                    </select>                                                
                                            </div>
                                        </div>                                        
                                        <div class="row">
                                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
                                                <label>Sucursal:</label>
                                                <input type="text" name="vsucursal" 
                                                       class="form-control" value="<?php echo $_SESSION['suc_nombre'];?>" disabled="">
                                            </div> 
                                            
                                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">
                                                <label>Recepción:</label>
                                                <div id="recepciones">
                                                    <select class = "form-control select2" name = "vrecepcion">
                                                       <option value = "">No se encontraron recepciones</option>
                                                   </select>                                                                                                       
                                                </div>                                                
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                                <label>Observaciones:</label>
                                                <textarea name="vdescripcion" class="form-control" placeholder="Aqui puede realizar comentarios adicionales"></textarea>
                                            </div>                                             
                                        </div>
                                    </div>
                                    <div class="box-footer">
                                        <button type="submit" class="btn btn-primary pull-right" data-title="Presione para guardar" rel="tooltip">
                                            <i class="fa fa-floppy-o"></i> Registrar
                                        </button>
                                    </div>
                                </form>                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <?php require '../../menu/pie.ctp'; ?><!--ARCHIVOS JS-->  
            <!-- Inicio Modal Registrar-->
            <div class="modal fade" id="registrar" role="dialog">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">x</button>
                            <h4 class="modal-title"><i class="fa fa-plus"></i> <strong>Registrar Marcas</strong></h4>
                        </div>
                        <form action="articulo_control.php" method="post" accept-charset="UTF-8" class="form-horizontal">
                            <input type="hidden" name="accion" value="4"/>
                            <input type="hidden" name="vart_cod" value="0"/>
                            <div class="modal-body">
                                <div class="form-group">
                                    <label class="control-label col-lg-2 col-md-2 col-sm-2">Descripción:</label>
                                    <div class="col-lg-8 col-md-8 col-sm-10">
                                        <input type="text" name="vart_descri" class="form-control" required="" autofocus="" placeholder="Ingrese la descripción de la marca"/>                                                
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="reset" data-dismiss="modal" class="btn btn-default" 
                                        data-title="Cerrar ventana" rel="tooltip">
                                    <i class="fa fa-close"></i> Cerrar
                                </button>
                                <button type="submit" class="btn btn-success" data-title="Guardar Marca" rel="tooltip">
                                    <i class="fa fa-floppy-o"></i> Registrar
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <!-- Fin Modal -->        
        </div>                  
<?php require '../../menu/js_lte.ctp'; ?>
        <script>
            $(".modal").on("shown.bs.modal", function () {
                $(this).find("input:text:visible:first").focus();
            });
        function recepciones(){
            //alert($("#cliente").val())
            $.ajax({
               type     : "GET",
               url      : "/farmmedi/servicios/diagnostico/recepciones.php?vid_cliente="+$("#cliente").val(),
               cache    : false,
               beforeSend:function(){
                 $("#recepciones").html('<img src="img/ajax-loader.gif"/><strong>Cargando...</strong>');  
               },
               success:function(data){
                   $("#recepciones").html(data);  
               }
            });
        }            
        </script>  
    </body>
</html>


