<div class="tab-pane p-20 active" id="profile8" role="tabpanel">

            <script type='text/javascript'>
                $(window).load(function(){
                    $('#chz-select').select2();
                });
            </script>

<!--    <div class="col-lg-12">-->
<!--        <div class="card-block">-->
<!--            -->
<!--        </div>-->
<!--    </div>-->

    <form action="<?php echo base_url(); ?>manutencao/adicionarServicoAManutencao" method="post"
          name="formAddPreventiva" id="formAddPreventiva"
          class="floating-labels m-t-40">

        <div class="form-body">
            <input type="hidden" id="preventiva_id" name="preventiva_id"
                   value="<?php echo $preventivaEditar->ID_PREVENTIVA ?>">

            <div class="row">

                <div class="col-lg-10">
                    <select id="chz-select" class="" name="servico_id"  style="width: 100%;" data-placeholder="Select...">

                        <?php
                        foreach ($servicos as $r) {
                            ?>
                            <option value="<?php echo $r->ID_SERVICO ?>"><?php echo $r->DS_DESCRICAO_SERVICO ?></option>
                        <?php } ?>

                    </select>

                </div>
                <div class="form-group col-lg-2 ">
                    <button type="submit" id="botaoServicoPreventiva" class="btn btn-info"><i
                                class="fa fa-save"></i> Adicionar
                    </button>
                </div>

            </div>
        </div>


    </form>
    <hr>
    <div class="card-block">
        <table id="demo-foo-row-toggler" class="table toggle-circle table-hover">
            <thead>
            <tr>
                <th data-toggle="true"> #</th>
                <th> Serviço</th>
                <th data-hide="phone"> Grupo</th>
                <th data-hide="phone"> Tempo Execução</th>
                <th></th>
                <th data-hide="all"></th>
                <!--                <th data-hide="all"> Status</th>-->
            </tr>

            </thead>
            <tbody>
            <?php foreach ($servicoPorPreventiva as $r) { ?>

                <tr>
                    <td><?php echo $r->ID_SEVICO_PREVENTIVA ?></td>
                    <td><?php echo $r->DS_DESCRICAO_SERVICO ?></td>
                    <td><?php echo $r->DS_GRUPO ?></td>
                    <td><?php echo $r->DS_DURACAO_SERVICO ?></td>
                    <td>
                        <a href="#"
                           servicoItem="<?php echo $r->ID_SEVICO_PREVENTIVA ?>"
                           preventivaEditar="<?php echo $preventivaEditar->ID_PREVENTIVA ?>"
                           data-toggle="modal" data-target="#modalExluirItem"
                        > <i
                                    class="fa fa-trash-o text-danger"></i>
                        </a>
                    </td>

                </tr>

            <?php } ?>
            </tbody>
        </table>
    </div>


</div>
<script>
    $("#servicodesc").autocomplete({
        source: "<?php echo base_url(); ?>servicos/autoCompleteServico",
        minLength: 3,
        select: function (event, ui) {
            $("#servico_id").val(ui.item.idServico);
            $("#garantia").val(ui.item.garantia);
            $("#grupo").val(ui.item.grupo);
        }
    });

    function habilitarBotaoPecaServico() {
        if ($("#servico_id").val() && $("#preventiva_id").val()) {
            $('#botaoServicoPreventiva').removeAttr('disabled');
        }
    }

</script>


<script type="text/javascript">

    $(document).on('click', 'a', function (event) {
        if ($(this).attr('servicoItem')) {
            $('#idItemExcluir').val($(this).attr('servicoItem'));
            $('#idItemAoEditar').val($(this).attr('preventivaEditar'));
            $("#excluirItem").attr("action", "<?php echo base_url() ?>manutencao/excluirServicoPreventiva");
        }
    });

</script>

<?php $this->load->view("sistema/modais/exluirItemGerericosModal"); ?>
