<?php 
	$form = $this->beginWidget('GxActiveForm', array(
        'id' => 'bloqueio-form',
        'enableAjaxValidation' => false,
        // 'focus' => array($model, 'INT_IDVENDEDOR'),
        'htmlOptions' => array('class'=>'col-xs-12 form-cadastro inline-addon')
    ));
?>
<div class="form">
	<?php if($bloqueio = $model_bloqueio->verificaBloqueio()){ ?>
		<?php echo $form->hiddenField($model_bloqueio, 'SITUACAO', array('value' => "B")); ?>
		<div class="form-group col-xs-12 col-sm-6 col-md-4 checkbox_acao">
			<?php 
				$data = explode(" ", $bloqueio->FUQ_DATAFIM);
				echo "<h2>Esse usuário está bloqueado até ".$data[0]." ŕs ".$data[1]."</h2>";
			?>
			<?php echo $form->checkBox($model_bloqueio, "FUQ_DESBLOQUEIO", array('value' => 1, 'class' => 'acao-bloqueio')); ?>
			<?php echo $form->labelEx($model_bloqueio,'FUQ_DESBLOQUEIO'); ?>
			
		</div>
		<div id="acoes" style="display:none">
			<?php echo FaHtml::saveButton(); ?>
		</div>
	<?php } else{ ?>
		<div class="form-group col-xs-12 col-sm-6 col-md-4 checkbox_acao">
			<?php echo $form->hiddenField($model_bloqueio, 'SITUACAO', array('value' => "D", 'disabled' => true)); ?>
			<?php echo $form->checkBox($model_bloqueio, "FUQ_BLOQUEIO", array('value' => 1, 'class' => 'acao-bloqueio')); ?>
			<?php echo $form->labelEx($model_bloqueio,'FUQ_BLOQUEIO'); ?>
			
		</div>
		<div class="clearfix"></div>
		
		<fieldset class="dark radius border-box col-xs-12 col-sm-12 col-md-12" id="acoes" <?php if(!$model_bloqueio->FUQ_BLOQUEIO) { echo 'style="display:none;'; } ?>">
			<div class="form-group col-xs-6 col-sm-3 col-md-3 col-lg-2">
		        <?php echo $form->labelEx($model_bloqueio, 'DATAINICIO', array('required' => true)); ?>
		        <?php
		        	
		        	$form->widget('ext.Utils.widgets.CrmDatePicker', array(
		        		'model' => $model_bloqueio, 
		        		'attribute' => 'DATAINICIO')); 
		        	?>
		        <?php echo $form->error($model_bloqueio, 'DATAINICIO'); ?>
		    </div>

		    <div class="form-group col-xs-6 col-sm-3 col-md-3 col-lg-2">
		        <?php echo $form->labelEx($model_bloqueio, 'HORAINICIO', array('required' => true)); ?>
		        <?php 
			        echo $form->textField($model_bloqueio, 'HORAINICIO', array('maxlength' => 5, 'class' => 'format_hora')); 
			    ?>
		        <?php echo $form->error($model_bloqueio, 'HORAINICIO'); ?>
		    </div>
			<div class="clearfix"></div>
			<div class="form-group col-xs-6 col-sm-3 col-md-3 col-lg-2">
		        <?php echo $form->labelEx($model_bloqueio, 'DATAFIM', array('required' => true)); ?>
		        <?php 
		        	$form->widget('ext.Utils.widgets.CrmDatePicker', array(
		        		'model' => $model_bloqueio, 
		        		'attribute' => 'DATAFIM')
		        	); 
		        ?>
		        <?php echo $form->error($model_bloqueio, 'DATAFIM'); ?>
		    </div>

		    <div class="form-group col-xs-6 col-sm-3 col-md-3 col-lg-2">
		        <?php echo $form->labelEx($model_bloqueio, 'HORAFIM', array('required' => true)); ?>
		        <?php 
		        	echo $form->textField($model_bloqueio, 'HORAFIM', array('maxlength' => 5, 'class' => 'format_hora')); 
		        ?>
		        <?php echo $form->error($model_bloqueio, 'HORAFIM'); ?>
		    </div>
			<div class="clearfix"></div>
		    <div class="form-group col-xs-12 col-sm-6 col-md-4">
			    <?php echo $form->labelEx($model_bloqueio, 'FUQ_MENSAGEM', array('required' => true)); ?>
			    <?php
			    	echo $form->textArea($model_bloqueio, 'FUQ_MENSAGEM', array('class' => 'col-xs-12 col-sm-6 col-md-4'))
			    ?>
			    <?php echo $form->error($model_bloqueio, 'FUQ_MENSAGEM');?>
			</div>

			<?php echo FaHtml::saveButton(); ?>
	    </fieldset>
	<?php } ?>
</div>
<?php
	$this->endWidget();
?>

<script type="text/javascript">
	jQuery(document).ready(function($) {
		$(document).on('change', '.checkbox_acao input', function(event) {
			if($(this).is(":checked")){
				$("#bloqueio-form").find('#acoes').show();
			}
			else{
				$("#bloqueio-form").find('#acoes').hide();
			}
		});
	});
</script>

<style type="text/css" media="screen">
    .checkbox_acao label,
    .checkbox_acao input{
    	display: inline!important;
    }
    .checkbox_acao input{
    	margin-bottom:  3px!important;
    	margin-right: 5px!important;
    }
</style>