<div class="card">
    <div class="card-block">
        <h2 class="card-title">Listagem de Peças</h2>
        <div align="right">
            <a href="#adicionarPecas" class="btn btn-s-md btn-success" data-animation="swell" data-plugin="custommodal"
               data-overlaySpeed="100" data-overlayColor="#36404a"><i class="fa fa-user-plus fa-2x"></i> Adicionar</a>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <label class="form-inline">Show
                    <select id="demo-show-entries" class="form-control input-sm">
                        <option value="5">5</option>
                        <option value="10">10</option>
                        <option value="15">15</option>
                        <option value="20">20</option>
                    </select> entries </label>
            </div>
            <div class="col-sm-6">
                <div class="m-t-40">
                    <div class="d-flex">
                        <div class="ml-auto">
                            <div class="form-group">
                                <input id="demo-input-search1" type="text" placeholder="Procurar" class="form-control"
                                       autocomplete="off">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <table id="demo-foo-pagination" class="table toggle-circle table-hover" data-page-size="6">
            <thead>


            <tr>
                <th data-toggle="true">#</th>
                <th> Descrição</th>
                <th data-hide="phone">Grupo</th>
                <th data-hide="phone">Vida Útil</th>
                <th data-hide="phone">Referência</th>
                <th></th>
                <th data-hide="all"></th>
                <!--                <th data-hide="all"> Status</th>-->
            </tr>
            </thead>
            <tbody>
            <?php foreach ($pecas as $r) {?>

                <tr>
                    <td><?php echo $r->ID_PECA ?></td>
                    <td><?php echo $r->DS_DESCRICAO_PECA ?></td>
                    <td><?php echo $r->DS_GRUPO ?></td>
                    <td><?php echo $r->NU_MESES_VIDA_UTIL." Meses" ?></td>
                    <td><span class="label label-table label-success"><?php echo $r->DS_REFERENCIA?></span></td>
                    <td>
                        <button class="btn btn-default waves-effect waves-light" type="button" onclick="location.href='<?php echo base_url()?>pecas/editar/<?php echo $r->ID_PECA?>';">
                            <i class="fa fa-pencil-square-o"></i>
                        </button>
                        <a href="#" class="btn btn-default waves-effect waves-light"
                           servicoItem="<?php echo $r->ID_PECA ?>"
                           data-toggle="modal" data-target="#modalExluirItem"
                        > <i
                                    class="fa fa-trash-o text-danger"></i>
                        </a>
                    </td>
<!--                    <td>-->
<!--                        <div class="row">-->
<!--                            <div class="col-12">-->
<!--                                <div class="card">-->
<!--                                    <div class="card-block">-->
<!--                                        <div class="table-responsive">-->
<!--                                            <table class="table table-bordered">-->
<!--                                                <tbody>-->
<!--                                                <tr>-->
<!--                                                    <td>Lunar probe project</td>-->
<!--                                                    <td>-->
<!--                                                        <div class="progress progress-xs margin-vertical-10 ">-->
<!--                                                            <div class="progress-bar bg-danger" style="width: 35%; height:6px;"></div>-->
<!--                                                        </div>-->
<!--                                                    </td>-->
<!--                                                    <td>May 15, 2015</td>-->
<!--                                                    <td class="text-nowrap">-->
<!--                                                        <a href="#" data-toggle="tooltip" data-original-title="Edit"> <i class="fa fa-pencil text-inverse m-r-10"></i> </a>-->
<!--                                                        <a href="#" data-toggle="tooltip" data-original-title="Close"> <i class="fa fa-close text-danger"></i> </a>-->
<!--                                                    </td>-->
<!--                                                </tr>-->
<!---->
<!--                                                </tbody>-->
<!--                                            </table>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
<!---->
<!---->
<!--                        </div>-->
<!--                    </td>-->


                </tr>
            <?php }?>

            </tbody>
            <tfoot>
            <tr>
                <td colspan="5">
                    <div class="text-right">
                        <ul class="pagination pagination-split m-t-30"></ul>
                    </div>
                </td>
            </tr>
            </tfoot>
        </table>
    </div>
</div>
<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() ?>pecas/excluir");
        }
    });

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

