<?php
/* @var $this ComisionController */
/* @var $model Comision */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'planilla-form',
        'htmlOptions'=>array('class'=>'form-horizontal'),
        'enableClientValidation'=>true,
        'clientOptions'=>array(
        'validateOnSubmit'=>true,
    ),
      
    )); 
?>

    
	<div class="row">
            <div class="col-12">
                <p class="note">Los campos con <span class="required">*</span> son obligatorios.</p>
            </div> 
        </div>
    
	
    
    
	<div class="row">
            
            <div class="col-12 col-sm-12 col-md-4">
                    <div class="form-group">
                       <?php echo $form->labelEx($model,'gestor', array('class' => 'col-12 mdi mdi-mail mdi-18px text-uppercase')); ?>
                       <div class="col-12">
                        <?php echo $form->textField($model,'gestor',array('size'=>60,'maxlength'=>100,
                               'class' => 'form-control form-control-line text-uppercase',
                               'placeholder'=>"")); ?>
                        <?php echo $form->error($model,'gestor'); ?>
                      </div>
                    </div>
         </div>
            
           <div class="col-12 col-sm-12 col-md-4 ">
                 <div class="form-group">
                    <?php echo $form->labelEx($model,'fecha',array('class' => 'col-12 text-uppercase')); ?>
                    <div class="col-12">
                    <?php
                            $this->widget('ext.YiiDateTimePicker.jqueryDateTime', array(
                                'model' => $model,
                                'attribute' => 'fecha',
                                'options' => array(
                                    'lang'=>'es',
                                    'timepicker'=>false,
                                    'format'=>'d-m-Y',
                                    ),
                                    'htmlOptions' => array(
                                    'class' => 'form-control form-control-line',
                                    'placeholder'=>"dd-mm-aaaa",
                                    'autocomplete'=>"off"
                                    ),
                            ));
                            ?>
                     <?php echo $form->error($model,'fecha'); ?>
                   </div>
                 </div>
            </div>
            
             <div class="col-12 col-sm-12 col-md-4">
                    <div class="form-group">
                       <?php echo $form->labelEx($model,'cliente', array('class' => 'col-12 mdi mdi-mail mdi-18px text-uppercase')); ?>
                       <div class="col-12">
                        <?php echo $form->textField($model,'cliente',array('size'=>60,'maxlength'=>100,
                               'class' => 'form-control form-control-line text-uppercase',
                               'placeholder'=>"")); ?>
                        <?php echo $form->error($model,'cliente'); ?>
                      </div>
                    </div>
         </div>
            
        <div class="col-12 col-sm-12 col-md-4">
                    <div class="form-group">
                       <?php echo $form->labelEx($model,'monto', array('class' => 'col-12 mdi mdi-mail mdi-18px text-uppercase')); ?>
                       <div class="col-12">
                        <?php echo $form->textField($model,'monto',array('size'=>60,'maxlength'=>100,
                               'class' => 'form-control form-control-line text-uppercase',
                               'placeholder'=>"",'onChange'=>"calcular()")); ?>
                        <?php echo $form->error($model,'monto'); ?>
                      </div>
                    </div>
         </div>
            
            <div class="col-12 col-sm-12 col-md-4">
                    <div class="form-group">
                       <?php echo $form->labelEx($model,'comision', array('class' => 'col-12 mdi mdi-mail mdi-18px text-uppercase')); ?>
                       <div class="col-12">
                        <?php echo $form->textField($model,'comision',array('size'=>60,'maxlength'=>100,
                               'class' => 'form-control form-control-line text-uppercase',
                               'placeholder'=>"",'readonly'=>'true')); ?>
                        <?php echo $form->error($model,'comision'); ?>
                      </div>
                    </div>
         </div>
	</div>

    
	<div class="row" >
            <div class="col-12 col-sm-12 col-md-4 m-t-20">
                <div class="form-group">
                    <div class="col-12">
                        <button type="submit" class="btn btn-large btn-block btn-primary  ">
                           <i class="fas fa-save fa-lg   "></i>    <?php echo $model->isNewRecord ? "REGISTRAR" : "EDITAR"; ?></button>
                    </div>
                </div>
            </div> 
        </div>
        <div class="row">
                <div class="col-12 col-sm-12 col-md-4">
                <?php echo $form->errorSummary($model); ?>
                </div>
        </div>
    
<?php $this->endWidget(); ?>

</div><!-- form -->




<script type="application/javascript">
  

$(document).ready(function() {

    $('#Comision_monto').mask('999999999999999', {translation: { 'A':{pattern: /[1-9]/}}, clearIfNotMatch: true});
    
}); 



function calcular() {
     var comision=0;
     var monto=$('#Comision_monto').val();
    
 
     if((monto == "" || monto.length == 0)){
         alert('DEBE INGRESAR UN MONTO VALIDO.');
     }else{

         comision= monto*0.05;
     
         
         $('#Comision_comision').val(comision);
     }
 }
 
 
</script> 
