<div id="adicionarPreventiva" class="modal-demo modal-lg">
    <button type="button" class="close" onclick="Custombox.close();">
        <span>&times;</span><span class="sr-only">Close</span>
    </button>
    <h4 class="custom-modal-title">Cadastrar Ordem Serviço</h4>
    <div class="custom-modal-text">

        <form action="<?php echo base_url(); ?>manutencao/adicionar" method="post" name="formAddPreventiva"
              id="formAddPreventiva"
              class="floating-labels m-t-40">
            <div class="form-body">
                <input type="hidden" id="idVeiculo" name="idVeiculo">
                <div class="row p-t-20 ">

                    <div class="form-group col-lg-4">
                        <input type="text" class="form-control" id="prefixo" name="prefixo"
                               required>
                        <span class="bar"></span>
                        <label for="input1">Prefixo Veículo <i class="fa fa-search"></i></label>
                    </div>

                    <div class="form-group col-lg-3">
                        <input type="text" class="form-control text-center" id="placa" name="placa"
                               required readonly>
                        <span class="bar"></span>
                        <!--                        <label for="input1">Placa</label>-->
                    </div>
                    <div class="form-group col-lg-4 ">
                        <input type="text" class="form-control text-center" id="garagem" name="garagem"
                               required readonly>
                        <span class="bar"></span>
                        <!--                        <label for="input1">Garagem</label>-->
                    </div>
                </div>

                <div class="row p-t-20 ">
                    <div class="form-group col-lg-6">
                        <select name="garantia" id="garantia" class="form-control" required >
                            <option value="1" selected>Mensal</option>
                            <option value="3">Trimestral</option>
                            <option value="6">Semestral</option>
                            <option value="12">Anual</option>
                        </select>
                        <span class="bar"></span>
                        <label for="input1">Frequência</label>
                    </div>

                    <div class="form-group col-lg-6">
                        <input type="date" class="form-control text-center" id="dataPreventiva"
                               name="dataPreventiva"
                               required value="<?php echo date('Y-m-d') ?>">
                        <span class="bar"></span>
                        <label for="input1">Data da Preventiva</label>
                    </div>
                </div>

            </div>
            <div class="modal-footer">
                <a onclick="Custombox.close();" class="btn btn-default"><i
                            class="icon-arrow-left"></i> Voltar</a>

                <button type="submit" id="btnCadastarManutencao" class="btn btn-success" disabled><i class="fa fa-save"></i> Save</button>
            </div>
        </form>
    </div>
</div>





<script>
    $("#prefixo").autocomplete({
        source: "<?php echo base_url(); ?>veiculos/autoCompleteVeiculo",
        minLength: 3,
        select: function (event, ui) {
            $("#proprietario_id").val(ui.item.id);

            $("#placa").val(ui.item.placa);
            $("#garagem").val(ui.item.garagem);
            $("#idVeiculo").val(ui.item.idVeiculo);
            $("#teste").html(ui.item.idVeiculo);

            if(ui.item.idVeiculo){
                $("#btnCadastarManutencao").prop("disabled", false);
            }
        }
    });


    //function busca_manutencoes_por_tipo(tipoManutencao) {
    //    $.ajax({
    //        type: "POST",
    //        url: "<?php //echo base_url();?>//manutencao/busca_manutencao_by_tipo",
    //        data: {tipoManutencao: tipoManutencao},
    //        dataType: 'json',
    //        success: function (data) {
    //            console.log(data);
    //        }
    //            $('select[name="sel_carteira"]').empty();
    //            $.each(data, function (key, valor) {
    //                // $('select[name="sel_carteira"]').append('<option></option>');
    //                // console.log(data);
    //            }
    //        });
    //}

</script>