<nav class="navbar navbar-inverse clients-overview">
    <a href="create-freemium"><button type="button" class="btn btn-default navbar-btn pull-right"><span class="glyphicon glyphicon-plus"></span> Ajouter un freemium</button></a>
</nav>

<table class="clients-overview">
    <tr>
        <th>Inscription</th>
        <th>No comment après 2J</th>
        <th>Premier Comment reçu (D0)</th>
        <th>Mail widget</th>
        <th>Avis négatif</th>
        <th>Facebook</th>
        <th>Benchmark</th>
        <th>Enquête satis RA</th>
        <th>Avantages PREMIUM</th>
        <th>Fin free</th>
    </tr>


    <?php

        foreach ($this->freemiums as $f) {
            if ($f instanceof \Website\Model\Freemium) {

                echo '<tr>';

                $i = 0;
                while ($i < $f->getStep()) {
                    $getter = 'getStep_' . $i . '_time';
                    if (method_exists($f, $getter)) echo '<td>' . $f->$getter() . '</td>';
                    $i++;
                }

                echo '<td><button type="button" class="btn btn-primary btn-lg btn-sm" data-toggle="modal" data-target="#agency' . $f->getId() . '">' . $f->agency->getName() . '</button></td>';

                $i++;
                while ($i < 10) {
                    echo '<td>x</td>';
                    $i++;
                }

                echo '</tr>';
            }
        }

        foreach ($this->freemiums as $f){
            if ($f instanceof \Website\Model\Freemium) {

                echo '
                <div class="modal fade" id="agency' . $f->getId() . '" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="myModalLabel">' . $f->getAgency()->getName() . '</h4>
                            </div>
                            <div class="modal-body">
                                Dernier comment : 10/10/2016<br>
                                3 comments publiés sur 10<br>
                                NPS : 8
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>
                        </div>
                    </div>
                </div>';

             }
        }
    ?>

</table>

