<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<!------ Include the above in your HEAD tag ---------->


<!--BEGIN HEAD-->
<!--<small>-->
<div id="container" style="width:95%; margin-left:2vw">
    <div class="card border-info mb-3 text-center">
        <div class="card-header">
            <h5 class="card-title text-dark">RELATÓRIO DE PEÇAS</h5>
        </div>

        <div class="card-header" style="background-color: #9e9e9e">
            <h5 class="card-title">Peças Utilizadas</h5>
        </div>
        <div class="card-body">
            <table class="table table-hover group table-striped">
                <table class="table table-hover group table-striped">
                    <thead>
                    <tr style="font-size: x-small">
                        <th width="10">N.&ordm; OS</th>
                        <th width="5">Data Abertura</th>
                        <th>Peça Utilizada</th>
                        <th>QTDE</th>
                        <th>Unid</th>
                        <th>Veículo</th>
                        <th>Fabricante</th>
                        <th>Garantia</th>
                        <th>Tipo Manutenção</th>
                        <th>Garagem</th>
                        <th>Técnico</th>
                        <th>Status OS</th>
<!--                        <th>Próxima</th>-->
                    </tr>
                    </thead>
                    <tbody>

                    <?php foreach ($pecasPorPreventiva as $r) { ?>

                        <?php

                        $statusPreventiva = 'green';
//                        if ($r->DT_PROXIMA_PREVENTIVA < date('Y-m-d')) {
//
//                            $statusPreventiva = 'red';
//                        }

                        ?>

                        <tr>
                            <td><?php echo $r->ID_PREVENTIVA ?></td>
                            <td style="font-size:x-small"><?php echo date('d/m/Y', strtotime($r->DT_PREVENTIVA)) ?></td>
                            <td style="color: <?php echo $statusPreventiva ?>"><?php echo $r->DS_DESCRICAO_PECA ?></td>
                            <td><?php echo $r->NU_QUANTIDADE ?></td>
                            <td><?php echo $r->DS_UNIDADE_MEDIDA ?></td>
                            <td><?php echo $r->PREFIXO ?></td>
                            <td style="font-size:x-small"><?php echo $r->DS_FABRICANTE ?></td>
                            <td style="font-size:x-small"><?php echo $r->NU_MESES_GARANTIA.' Meses' ?></td>
<!--                            <td style="font-size:x-small">--><?php //echo $r->DT_FINALIZACAO==null?"":date('d/m/Y', strtotime($r->DT_FINALIZACAO)) ?><!--</td>-->
                            <td><?php echo $r->DS_TIPO_MANUTENCAO=='C'?'Corretiva':'Preventiva' ?></td>
                            <!--                    <td>-->
                            <?php //echo $r->DS_TIPO_MANUTENCAO=="P"?"Preventiva":"Corretiva" ?><!--</td>-->
                            <td style="font-size:x-small"><?php echo $r->GARAGEM ?></td>
                            <td style="font-size:x-small"><?php echo $r->nomeFuncionario ?></td>

                            <td>
                                <span class="label label-table label-<?php echo !$r->DT_FINALIZACAO ? 'warning' : 'success' ?>"><?php echo !$r->DT_FINALIZACAO ? 'Pedente' : 'Realizada' ?></span>
                            </td>

                        </tr>
                    <?php } ?>
                    <tr>

                        <td colspan="4" align="center"><strong>Total de Registros </strong></td>
                        <td colspan="8" align="center"><strong><?php echo count($pecasPorPreventiva); ?></strong></td>

                    </tr>

                    </tbody>
                </table>

                <div class="card-footer text-muted">

                </div>
        </div>


    </div>
</div>


