<div class="wide form">

    <?php
    $form = $this->beginWidget('GxActiveForm', array('action' => Yii::app()->createUrl($this->route),'method' => 'get'));
    if(empty($model->TOKEN)) {
        $model->TOKEN = Util::uid();
    }
    echo $form->hiddenField($model, 'TOKEN');
    ?>
    
    <?php if (!User::isRevenda()) { ?>
        <div class="row">
            <?php echo $form->label($model, 'ATD_IDREVENDA'); ?>
            <?php echo $form->dropDownList($model, 'ATD_IDREVENDA', GxHtml::listDataEx(Revendas::model()->findAll('REV_SITUACAO="A" order by REV_NOME')), array('prompt' => 'Todas')); ?>
        </div>
    <?php } ?>
    <div class="row">
        <?php echo $form->labelEx($model, 'ATD_ATENDENTE'); ?>
        <?php  echo $form->dropDownList($model, 'ATD_IDFUNCIONARIO', User::getFuncionariosRevendas(), array('prompt' => 'Todos'));?>
    </div><!-- row --> 

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

    <div class="row">
        <?php echo $form->label($model, 'ATD_IDCLIENTE'); ?>
        <?php
        $this->widget('ext.Utils.widgets.CrmAutoComplete', array(
            'model' => $model,
            'attribute' => 'ATD_IDCLIENTE',
            'url' => 'autocomplete/clientes',
            'params' => array(
                'field: "CLI_NOME"',
                'todos: "true"',
                )
            )
        );
        ?>
    </div>

    <div class="row buttons">
        <input type="hidden" name="busca" value="1" />

        <?php echo FaHtml::searchButton(); ?>
    </div>

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

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