<!-- Modal -->
<div id="modalEditarProducto" class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
        <div class="modal-header">
            <h3 id="myModalLabel"><?php echo $_translator->_getTranslation('Editar producto');?></h3>
            <div id="infoProducto"></div>
        </div> 
        <div id="flashmessenger-editarProducto"></div>
        <div class="modal-body">  
                <div style="display: none">
                    <?php echo $form->showElement('idDetalleTemp');?>
                    <?php echo $form->showElement('idProducto');?>
                     <?php echo $form->showElement('cantidadOrigen');?>
                </div>   
            <div class="col-lg-12 col-md-12 col-sm-12 p-t-1">

                
                <div style='padding:0px;' class='col-lg-4 col-md-4 col-sm-4 item-wrap'>
                    <h4 class="m-t-0" style="text-align: center;"><?php echo $_translator->_getTranslation('Cantidad');?></h4>
                    <!-- <h4 class="m-t-0" style="text-align: center;"><input type="text" id="cantidad" name="cantidad" class="form-control" style="text-align: center;"></h4> -->
                    <div class="form-group  has-feedback">         
                        <div class="input-group col-lg-12 col-md-12 col-sm-12">
                            <input style="font-size:24px;border-with: 2px;padding:10px;text-align: center;" type="text" id="cantidad" name="cantidad" value="" class="form-control " placeholder="Cantidad" data-bv-field="monto">                             
                        </div>            
                    </div>

                    
                    <div><h4 id="lblDescripcion" class="m-t-0" style="text-align: center;"></h4></div>
                   
                    <div id="divProduct"></div>
                    <div ><?php echo $form->showElement('precio');?></div>

                </div> 

                <div id="" class='col-lg-8 col-md-8 col-sm-8'>

                <table class="w-100 sparko_numPadQTY" style="float:left">
                        <tr>
                            <td class="btn_numPadQTY" data-value="7">7</td>
                            <td class="btn_numPadQTY" data-value="8">8</td>
                            <td class="btn_numPadQTY" data-value="9">9</td>
                            <td class="btn_numPadQTY" data-value="backspace"><?php echo $_translator->_getTranslation('Borrar')?></td>
                        </tr>
                        <tr>
                            <td class="btn_numPadQTY" data-value="4">4</td>
                            <td class="btn_numPadQTY" data-value="5">5</td>
                            <td class="btn_numPadQTY" data-value="6">6</td>
                            <td class="btn_numPadQTY" data-value="clear"><?php echo $_translator->_getTranslation('Limpiar')?></td>
                        </tr>
                        <tr>
                            <td class="btn_numPadQTY" data-value="3">3</td>
                            <td class="btn_numPadQTY" data-value="2">2</td>
                            <td class="btn_numPadQTY" data-value="1">1</td>
                            <!-- <td class="btn_numPadQTY" data-value="cancel"><?php echo $_translator->_getTranslation('Cancelar')?></td> -->
                        </tr>
                        <tr>
                            <td class="btn_numPadQTY" colspan="2" data-value="0">0</td>
                            <td class="btn_numPadQTY" data-value=".">.</td>
                            <!-- <td class="btn_numPadQTY" rowspan="2" data-value="done"><?php echo $_translator->_getTranslation('Ir')?></td> -->
                        </tr>
                    
                    </table>
                    <div class="clear"></div>
                    <br/>
                        <?php            
                        /*$_allowDisccounts se declara en POS.php (VIEW) */
                        if($_allowDisccounts == '0'){
                            $form->addProperties('descuento_item_valor',array('class'=>''));
                            $form->addOptionals('descuento_item_valor',array('readOnly'=>'true'));?>
                            <div class='hide' style="display:none"><?php echo $form->showElement('descuento_item_valor');?></div><?php                
                        }else{?>
                            <div class='hide'><?php  echo $form->showElement('descuento_item_valor');?></div><?php                
                        }?>              
                        
                        <!--<div><?php echo $form->showElement('impuestos')?></div>-->
                            <!--
                            <div>
                                <div class="form-group">
                                    <label class="control-label col-lg-3 col-md-3 col-sm-3"></label>
                                    <a class="btn btn-default" onclick="$('#descuento_item_valor').val(30)">30%</a>
                                    <a class="btn btn-default" onclick="$('#descuento_item_valor').val(0)">0%</a>
                                </div>
                            </div>-->
                </div> 
                    
            </div>
                <div class="clear"></div>        
        </div>
        <div class="modal-footer">
            <div class="col-lg-12 col-md-12 col-sm-12">
                <?php $element = $form->getElement('guardar');echo $form->createOnlyElement($element); /* Save cobroTemp */?>
                <input type="button" class='btn btn-default setCursor _closeEditarProducto' onclick="$('#idDetalleTemp').val('');" value="<?php echo $_translator->_getTranslation('Cerrar');?>" />                      
            </div>
        </div>
    </div>           
    </div>
    <style>
                      
                        table.sparko_numPadQTY td.btn_numPadQTY{
                            width: 25%;
                            height: 50px;
                            text-align: center;
                            vertical-align: middle;  
                            border: 1px solid #e5e5e5;  
                            border-radius: 5px;
                            font-weight: bold;
                        }
                        
                        table.sparko_numPadQTY td.btn_numPadQTY:hover{
                            position: relative;  
                            top: 1px;  
                            left: 1px;  
                            border-color: #979797;  
                            cursor: pointer;                            
                        }
                        
                        table.sparko_numPadQTY td.btn_numPadQTY_quickPayment{
                            width: 14.285%;
                            height: 50px;
                            text-align: center;
                            vertical-align: middle;  
                            border: 1px solid #e5e5e5;  
                            font-weight: bold;
                        }
                        
                        table.sparko_numPadQTY td.btn_numPadQTY_quickPayment:hover{
                            position: relative;  
                            border-color: #979797;  
                            cursor: pointer;                            
                        }
                        table.sparko_numPadQTY {
                            background-color: #ceeefd; /* Celeste claro*/
                        }
                        
                        .bg-success-strong{
                            background-color: #28a745;
                        }
                        
                        .bg-info-strong{
                            background-color: #17a2b8;
                        }
                    </style>

        <script>
        $('#modalEditarProducto').on('shown.bs.modal', function (e) {              
            $('#cantidad').attr('readonly',false);
            $('#cantidad').focus().select();                          
         });
         
        $('._closeEditarProducto').on('click',function(){
            $('#idDetalleTemp').val('');
            $('#cantidad').val('1');
            $('#precio').val('');
            $("#impuestos").val('');
            $("#descuento_item_valor").val('');
            $('#modalEditarProducto').modal('hide');
            stopReadScale();
        });
        /*
        $('#cantidad').on('click',function(){
            var numpad_precio = $(this).attr("data-numpad");
            $('#'+numpad_precio).remove(); //Se eliminar instacia creada para #precio
            $(this).removeAttr("data-numpad"); //Se eliminar attr asignado a #precio por instancia numpad            
            $(this).attr('readonly',false);
            $(this).select();
        });
         
        $('._addClassCalculator').on('click',function(){
            $('#cantidad').removeClass('numPad').addClass('numPad');
            $("#cantidad").numpad({decimalSeparator: '.',hidePlusMinusButton: true});
            $("#cantidad").numpad('open');
        });*/
        
        $('#cantidad').on('keydown',function(e){
            var keycode = e.keyCode || e.which;
            if(keycode === 13) {
               setVentaPos(true);
            }
        });
        $('table.sparko_numPadQTY td.btn_numPadQTY').on('click',function(){setQtyProduct(this);});

    </script>
</div>