<?php
Yii::app()->clientScript->registerScript('submit', '
$(document).ready( function() {
   $("#submit_button").click(function() {
      $(this).prop("disabled",true)
         .parents("form").submit();
      });
})
');
?>

<div class="form">

    <?php
    $form = $this->beginWidget('GxActiveForm', array(
        'id' => 'versoes-form',
        'enableAjaxValidation' => false,
        'focus' => array($model, 'VER_DESCRICAO'),
    ));

    $this->widget('application.extensions.EChosen.EChosen', array(
        'target' => '.echosen',
        'useJQuery' => true,)
    );

    if (!empty($model->VER_IDVERSAO)) {
        $ProjetosVersoes = VersoesProjetos::model()->findAll("VRP_IDVERSAO = " . $model->VER_IDVERSAO);
        foreach ($ProjetosVersoes as $ProjetosVersoes) {
            $model->VER_IDPROJETO[] = $ProjetosVersoes->VRP_IDPROJETO;
        }
    }
    ?>
    <?php echo FaHtml::getFormInfo($form, $model); ?>

    <div class="row">
        <?php echo $form->labelEx($model, 'VER_DESCRICAO'); ?>
        <?php echo $form->textField($model, 'VER_DESCRICAO', array('maxlength' => 50)); ?>
        <?php echo $form->error($model, 'VER_DESCRICAO'); ?>
    </div><!-- row -->
    <div class="row">
        <?php echo $form->labelEx($model, 'VER_DTPREVISAO'); ?>
        <?php $form->widget('ext.Utils.widgets.CrmDatePicker', array('model' => $model, 'attribute' => 'VER_DTPREVISAO')); ?>
        <?php echo $form->error($model, 'VER_DTPREVISAO'); ?>
    </div><!-- row -->
    <div class="row">
        <?php echo $form->labelEx($model, 'VER_DTLIBERACAO'); ?>
        <?php $form->widget('ext.Utils.widgets.CrmDatePicker', array('model' => $model, 'attribute' => 'VER_DTLIBERACAO')); ?>
        <?php echo $form->error($model, 'VER_DTLIBERACAO'); ?>
    </div><!-- row -->
    <div class="row">
        <?php echo $form->labelEx($model, 'VER_HORALIBERACAO'); ?>
        <?= $form->textField($model, 'VER_HORALIBERACAO', array('maxlength' => 5, 'class' => 'format_hora hora_inicio')); ?>
        <?php echo $form->error($model, 'VER_HORALIBERACAO'); ?>
    </div><!-- row -->
    <div class="row">
        <?php echo $form->label($model, 'VER_IDPROJETO'); ?>
        <?php $data = GxHtml::listDataEx(Projetos::model()->findAll('PRO_STATUS = "1" order by PRO_PROJETO'), 'PRO_IDPROJETO', 'PRO_PROJETO'); ?>
        <?php echo $form->dropDownList($model, 'VER_IDPROJETO', $data, array('multiple' => 'multiple', 'class' => 'echosen', 'data-placeholder' => 'Selecione'));?>
        <?php echo $form->error($model, 'VER_IDPROJETO'); ?>
    </div>

    <div class="row">
        <?php echo $form->label($model, 'VER_SITUACAO'); ?>
        <?php $data = array('A' => 'Ativa', 'I' => 'Inativa'); ?>
        <?php echo $form->dropDownList($model, 'VER_SITUACAO', $data); ?>
        <div class="errorMessage pendencias-vinculadas"><?php echo $model->getPendenciasVinculadas(); ?></div>
    </div>

    <?php
    echo FaHtml::saveButton();
    $this->endWidget();
    ?>
</div><!-- form -->
<style type="text/css">
    .pendencias-vinculadas {
        font-weight: bold;
        font-size: 12px;
        margin-top:  10px;
    }
    .pendencias-vinculadas ul {
        margin-bottom: 10px;
        margin-top: 5px;
        padding-left: 10px;
    }
    .pendencias-vinculadas ul li {
        font-weight: normal;
        color: red;
    }
</style>