{% extends 'base.html.twig' %}

{% block title %}Broadcast{% endblock %}

{% block content %}

<!-- az-header -->
<div class="az-content">
    <div class="container">
        <div class="az-content-body d-flex flex-column">


            <div class="az-content-breadcrumb">
                <span>Broadcast</span>
                <span>Liste</span>
            </div>
            <h2 class="az-content-title"><span>Broadcast</span></h2>
            <div class="az-content-label mg-b-5"></div>
            


            <div class="az-content-label mg-b-5">Près a divuser</div>
            <p class="mg-b-20">Liste des enquêtes près a divuser</p>
            <div class="table-responsive">
                <table class="table table-striped mg-b-0">
                    <thead>
                        <tr>
                            <th>Id</th>
                            <th>Name</th>
                            <th>Créer les paramètres du divisions</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for investigation in investigations %}
                            <tr>
                                <td>{{ investigation.getId() }}</td>
                                <td>{{ investigation.getNameEn() }}</td>
                                <td>
                                    <a href="{{ path('app_broadcast_add', {id:investigation.getId()}) }}" class="btn mb-3 btn-success">
                                        <i class="ri-bill-fill"></i>Créer
                                    </a>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>

            <hr class="mg-y-30">

            <div class="az-content-label mg-t-15">en cours de divusion</div>
            <p class="mg-b-20">Liste des enquêtes en cours de divusion</p>
            <div class="table-responsive">
                <table class="table table-striped mg-b-0">
                    <thead>
                        <tr>
                            <th>Id</th>
                            <th>Name</th>
                            <th>Date début</th>
                            <th>Date fin</th>
                            <th>E-mail</th>
                            <th>SMS</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for broadcast in broadcasts %}
                            <tr>
                                <td>{{ broadcast.getInvestigation().getId() }}</td>
                                <td>{{ broadcast.getInvestigation().getNameEn() }}</td>
                                <td>{{ broadcast.getDateCreate()|date("d/m/Y") }}</td>
                                <td>{{ broadcast.getDateEnd()|date("d/m/Y") }}</td>
                                <td>{% if broadcast.isNotificationEmail() %} <i class="fa fa-chevron-circle-down" aria-hidden="true"></i> {% else %} <i class="fa fa-times fa-1x" aria-hidden="true"></i> {% endif %}</td>
                                <td> {% if broadcast.isNotificationSms() %} <i class="fa fa-chevron-circle-down" aria-hidden="true"></i> {% else %} <i class="fa fa-times fa-1x" aria-hidden="true"></i> {% endif %}</td>
                                <td>
                                    {% if broadcast.getLastState() == 30 %} 
                                        <span class="badge badge-pill badge-primary">Terminer</span>
                                    {% elseif broadcast.getLastState() == 31 %} 
                                        <span class="badge badge-pill badge-success">En attente</span>
                                    {% elseif broadcast.getLastState() == 32 %}
                                        <span class="badge badge-pill badge-warning">En cours</span>
                                    {% else %} 
                                        <span class="badge badge-pill badge-danger">Erreur</span>
                                    {% endif %}
                                </td>
                                <td>
                                    <div class="flex align-items-center list-user-action">
                                        <a class="btn btn-info btn-icon" title="" href=""><i class="ion ion-md-eye"></i></a>
                                    </div>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>


        </div>
    </div>
</div>

{% endblock %}