{% extends "layout/baseadmin.html.twig" %}
{% block content %}
    <div class="widget">
        <div class="widget-body">
            <table id="product-list" class="table table-hover dt-responsive nowrap">
                    <thead>
                    <tr>
                        <th>Email</th>
                        <th>FullName</th>
                        <th>Action</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for participant in participants %}
                        <tr>
                            <td>{{ participant.user.email }}</td>
                            <td>{{ participant.fullName }}</td>
                            <td>
                                <a href="#" data-toggle="modal" data-target=".bs-view{{participant.id  }}" class="btn btn-outline btn-success"><i class="ti-eye"></i></a>
                                <form method="post" action="{{ path('participant_delete', {'id': participant.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
                                    <input type="hidden" name="_method" value="DELETE">
                                    <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ participant.id) }}">
                                    <button class="btn btn-outline btn-danger"><i class="ti-trash"></i></button>
                                </form>

                            </td>
                            <div tabindex="-1" role="dialog" aria-labelledby="modalWithForm01" class="modal fade bs-view{{participant.id  }}">
                                <div role="document" class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <div class="text-left">
                                                <button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true">×</span></button>
                                                <h4 id="modalWithForm01" class="modal-title">Participant details</h4>
                                            </div>
                                        </div>
                                        <div class="modal-body">
                                            <div class="form-group">
                                                <label for="phoneNumber1">Email</label>
                                                <input id="phoneNumber1" type="text"  value="{{  participant.user.email }}" disabled class="form-control focus">
                                            </div>
                                            <div class="form-group">
                                                <label for="phoneNumber1">FullName</label>
                                                <input id="phoneNumber1" type="text"  value="{{  participant.fullName }}" disabled class="form-control focus">
                                            </div>
                                            <div class="form-group">
                                                <label for="phoneNumber1">Phone Number</label>
                                                <input id="phoneNumber1" type="text"  value="{{  participant.user.phoneNumber }}" disabled class="form-control focus">
                                            </div>
                                            <div class="form-group">
                                                <label for="phoneNumber1">Country </label>
                                                <input id="phoneNumber1" type="text"  value="{{  participant.country }}" disabled class="form-control focus">
                                            </div>
                                            <div class="form-group">
                                                <label for="phoneNumber1">Birth Date </label>
                                                <input id="phoneNumber1" type="text"  value="{{ participant.birthDate ? participant.birthDate|date('Y-m-d') : '' }}" disabled class="form-control focus">
                                            </div>
                                            <div class="form-group">
                                                <label for="phoneNumber1">Adresse</label>
                                                <input id="phoneNumber1" type="text"  value="{{ participant.user.fullAdress }}" disabled class="form-control focus">
                                            </div>

                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" data-dismiss="modal" class="btn btn-raised btn-black">Cancel</button>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </tr>
                    {% else %}
                        <tr>
                            <td colspan="5">no records found</td>
                        </tr>
                    {% endfor %}
                    </tbody>
        </table>

        </div>
    </div>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script>
        $(document).ready(function() {
            $('#product-list').DataTable();
        } );
    </script>
{% endblock %}
