<div ng-app="myApp" ng-controller="myCtrl">

    <span ng-init="setValue('marca','<?= $field_marca ?>')"></span>
    <span ng-init="setValue('filial','<?= $field_filial ?>')"></span>
    <span ng-init="setValue('ano','<?= $field_ano ?>')"></span>
    <span ng-init="setValue('modelo','<?= $field_modelo ?>')"></span>
    <span ng-init="setValue('max_price','<?= $field_max_price ?>')"></span>
    <span ng-init="setValue('min_price','<?= $field_min_price ?>')"></span>

    <?php foreach ($arrFiliais as $id => $filial): ?>
        <span ng-init="arrFiliais.push({slug:'<?= $id; ?>',name: '<?= $filial; ?>'})"></span>
    <?php endforeach; ?>

    <?php foreach ($arrModelos as $id => $modelo): ?>
        <span ng-init="arrModelos.push({slug:'<?= $modelo['slug']; ?>',name: '<?= $modelo['name']; ?>'})"></span>
    <?php endforeach; ?>

    <?php foreach ($arrMarcas as $id => $marca): ?>
        <span ng-init="arrMarcas.push({slug:'<?= $marca['slug']; ?>',name: '<?= $marca['name']; ?>'})"></span>
    <?php endforeach; ?>

    <?php foreach ($arrAnoModelo as $id => $ano): ?>
        <span ng-init="arrAnos.push({slug:'<?= $ano; ?>',name: '<?= $ano; ?>'})"></span>
    <?php endforeach; ?>


    <div id="filtro_home">
        <h3>Seu carro novo está aqui!</h3>
        <h4>Faça sua busca e encontre seu próximo veículo</h4>
        <form action="#" method="get">


            <div class="row">


                <div class="form-group col-md-12 col-sm-12 col-xs-12 black_input">
                    <input type="text" class="form-control" name="s" ng-model="objForm.s" placeholder="Pesquisar ..."
                           my-enter="filtrarVeiculosHome()"/>
                </div>
            </div>

            <div class="row">


                <div class="form-group col-md-3 col-sm-6 col-xs-12 black_input">
                    <div class="select">
                        <select name="marca" ng-model="objForm.marca" class="form-control"
                                ng-change="carregarFiltroModelos()"
                                ng-options="item.slug as item.name for item in arrMarcas| orderBy:'slug'">
                            <option value="">Marca</option>
                        </select>
                    </div>
                </div>
                <div class="form-group col-md-3 col-sm-6 col-xs-12 black_input">
                    <div class="select">
                        <select name="modelo" ng-model="objForm.modelo" class="form-control"
                                ng-disabled="carregando_modelos"
                                ng-options="item.slug as item.name for item in arrModelos| orderBy:'slug'">
                            <option value="">Modelo</option>
                        </select>
                    </div>
                </div>
                <div class="form-group col-md-3 col-sm-6 col-xs-12 black_input">
                    <div class="select">
                        <select name="ano" ng-model="objForm.ano" class="form-control"
                                ng-options="item.slug as item.name for item in arrAnos| orderBy:'slug'">
                            <option value="">Ano Modelo</option>
                        </select>
                    </div>
                </div>

                <div class="form-group col-md-3 col-sm-6 col-xs-12">


                    <button class="btn btn-block btn-skew-r btn-skew-r_mod-a btn-effect" type="button"
                            ng-click="filtrarVeiculosHome()">
                        <span class="btn-skew-r__inner">Buscar</span>
                    </button>


                </div>

                <div class="form-group col-md-9 col-sm-6 col-xs-12 black_input">

                    <span style="float: left;">R$<?= number_format($arrPrecos['minimo'], '2', ',', '.'); ?></span>

                    <span style="float: right;">R$<?= number_format($arrPrecos['maximo'], '2', ',', '.'); ?></span>
                    <input id="price_range"
                           type="text"
                           class="span2"
                           value=""
                           name="preco"
                           data-slider-min="<?= $arrPrecos['minimo']; ?>"
                           data-slider-max="<?= $arrPrecos['maximo']; ?>"
                           data-slider-step="10"
                           data-slider-value="[<?= $field_min_price; ?>,<?= $field_max_price; ?>]"/>


                </div>


            </div>
        </form>
    </div>
</div>
<!-- /Filter-Form -->
