<div class="wide form">
<?php
Yii::app()->clientScript->registerScript('submit', '
$(document).ready( function() {
    $("#Downloads_DWN_ORIGEM").change(function(){
        var selected_origem = $(this).children("option:selected").val();
        if (selected_origem == 1) {
            $("#div_projeto").fadeIn("slow");
        } else {
            $("#div_projeto").fadeOut("slow");
        }
    });
})
');
?>

<?php $form = $this->beginWidget('GxActiveForm', array(
    'action' => Yii::app()->createUrl($this->route),
    'method' => 'get',
)); ?>

    <div class="row">
        <?php echo $form->label($model, 'DWN_ID'); ?>
        <?php echo $form->textField($model, 'DWN_ID', array('maxlength' => 100)); ?>
    </div>

    <div class="row">
        <?php echo $form->label($model, 'DWN_URL_ARQUIVO'); ?>
        <?php echo $form->textField($model, 'DWN_URL_ARQUIVO', array('maxlength' => 150)); ?>
    </div>

    <div class="row">
        <?php echo $form->label($model, 'DWN_ORIGEM'); ?>
        <?php
            $opcoes = $model->origens;
            echo $form->dropDownList($model, 'DWN_ORIGEM', $opcoes, array(
                'prompt'=>'Selecione'
            ));
        ?>
    </div><!-- row -->

    <?php
        $display = "none";
        if ($model->DWN_ORIGEM == "1" || $model->DWN_ORIGEM == "Projetos") {
            $display = "block";
        }
    ?>

    <div class="row" id="div_projeto" style="display: <?= $display; ?>">
        <?php echo $form->labelEx($model,'DWN_IDPROJETO'); ?>
        <?php
            $data = GxHtml::listDataEx(
                Projetos::model()->findAll(
                    array('order'=>'PRO_PROJETO')
                ),
                'PRO_IDPROJETO', 'PRO_PROJETO'
            );
        ?>
        <?php echo $form->dropDownList($model, 'DWN_IDPROJETO', $data, array('prompt'=>'Selecione')); ?>
    </div><!-- row -->

    <div class="row">
        <?php echo $form->labelEx($model,'DWN_DESCRICAO'); ?>
        <?php echo $form->textField($model, 'DWN_DESCRICAO', array('maxlength' => 200)); ?>
    </div><!-- row -->

    <div class="row">
        <?php echo $form->labelEx($model,'DWN_STATUS'); ?>
        <?php echo $form->textField($model, 'DWN_STATUS', array('maxlength' => 1)); ?>
    </div><!-- row -->

    <div class="row">
        <?php echo $form->label($model, 'DWN_DTCADASTRO'); ?>
        <?php $form->widget('ext.Utils.widgets.CrmDatePicker', array('model' => $model, 'attribute' => 'DWN_DTCADASTRO')); ?>
    </div>

    <div class="row">
        <?php echo $form->label($model, 'DWN_DTATUALIZACAO'); ?>
        <?php $form->widget('ext.Utils.widgets.CrmDatePicker', array('model' => $model, 'attribute' => 'DWN_DTATUALIZACAO')); ?>
    </div>

    <div class="row buttons">
        <?php echo FaHtml::searchButton(); ?>
    </div>

<?php $this->endWidget(); ?>

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