<%=raw app.core.View.getTemplate( 'appointment-detail-nav', { a : a, activeTab : 'attendee' } ) %>
<% mStart = a.getMomentStart(); %>
<% mEnd = a.getMomentEnd(); %>
<% mDeadline = a.getMomentDeadline(); %>
<% var prfl; %>
<div class="row">
    <div class="col-sm-12">
        <div class="card">
            <div class="card-body">
                <% if ( a.hasStarted() ) {  %>

                    <% var attendeesAttended = a.getAttendeesAttended(); %>
                    <div class="row">
                        <div class="col">
                            <div class="appointment-detail-header">
                                <i class="far fa-thumbs-up"></i> <%= _lc( 'ATTENDED' ) %> (<%= attendeesAttended.length %>)
                            </div>
                            <div class="appointment-detail-content">
                                <% if ( attendeesAttended.length > 0 ) {    %>
                                <table class="table table-profiles">
                                    <tbody>
                                    <% for ( var aai = 0; aai < attendeesAttended.length; aai++ ) {  %>
                                        <% prfl = a.getProfileById( attendeesAttended[ aai ].profile_id ); %>
                                        <%=raw app.core.View.getTemplate( 'appointment-detail-attendee-row', { a: a, at :prfl, g : g, childProfile : prfl.getChildProfileById( attendeesAttended[ aai ].profile_child_id ) } ) %>
                                    <% }    %>
                                    </tbody>
                                </table>
                                <% } else {   %>
                                    <%= _lc( 'NONE' ) %>
                                <% }    %>
                            </div>
                        </div>
                    </div>

                <% } else { %>

                    <% var attendeesAccepted = a.getAttendeesAccepted(); %>

                    <div class="row">
                        <div class="col">
                            <div class="appointment-detail-header">
                                <i class="far fa-thumbs-up"></i> <%= _lc( 'ACCEPTANCE' ) %> (<%= attendeesAccepted.length %>)
                            </div>
                            <div class="appointment-detail-content">
                                <% if ( attendeesAccepted.length > 0 ) {    %>
                                    <table class="table table-profiles">
                                        <tbody>
                                            <% for ( var aai = 0; aai < attendeesAccepted.length; aai++ ) {  %>
                                                <% prfl = a.getProfileById( attendeesAccepted[ aai ].profile_id ); %>
                                                <%=raw app.core.View.getTemplate( 'appointment-detail-attendee-row', { a: a, at : prfl, g : g, childProfile : prfl.getChildProfileById( attendeesAccepted[ aai ].profile_child_id ) } ) %>
                                            <% }    %>
                                        </tbody>
                                    </table>
                                <% } else {   %>

                                    <%= _lc( 'NONE' ) %>

                                <% }    %>
                            </div>
                        </div>
                    </div>
                    <% if ( 0 < a.getMaxAttendees() ) { %>

                        <% var attendeesWaiting = a.getWaitingList();   %>
                        <div class="row">
                            <div class="col">
                                <div class="appointment-detail-header">
                                    <i class="fas fa-hourglass-half"></i></i> <%= _lc( 'WAITINGLIST' ) %> (<%= attendeesWaiting.length %>)
                                </div>
                                <div class="appointment-detail-content">
                                    <% if ( attendeesWaiting.length > 0 ) {    %>
                                    <table class="table table-profiles">
                                        <tbody>
                                        <% for ( var awi = 0; awi < attendeesWaiting.length; awi++ ) {  %>
                                            <% prfl = a.getProfileById( attendeesWaiting[ awi ].profile_id ); %>
                                            <%=raw app.core.View.getTemplate( 'appointment-detail-attendee-waiting-row', { a: a, at : prfl, g : g, waitingPos : (awi + 1), childProfile :  prfl.getChildProfileById( attendeesWaiting[ awi ].profile_child_id ) } ) %>
                                        <% }    %>
                                        </tbody>
                                    </table>
                                    <% } else {    %>
                                        <%= _lc( 'NONE' ) %>
                                    <% }    %>
                                </div>
                            </div>
                        </div>
                    <% }    %>
                    <div class="row">
                        <div class="col">
                            <div class="appointment-detail-header">
                                <i class="far fa-thumbs-down"></i></i> Absagen (<%= a.getProfileIdsDeclined().length %>)
                            </div>
                            <% let attendeesDeclined = a.getAttendeesDeclined(); %>
                            <div class="appointment-detail-content">
                                <% if ( attendeesDeclined.length > 0 ) {    %>
                                <table class="table table-profiles">
                                    <tbody>
                                    <% for ( var adi = 0; adi < attendeesDeclined.length; adi++ ) {  %>
                                        <% prfl = a.getProfileById( attendeesDeclined[ adi ].profile_id ); %>
                                        <%=raw app.core.View.getTemplate( 'appointment-detail-attendee-row', { a: a, at : prfl, g : g, childProfile :  prfl.getChildProfileById( attendeesDeclined[ adi ].profile_child_id ) } ) %>
                                    <% }    %>
                                    </tbody>
                                </table>
                                <% } else {    %>
                                    <%= _lc( 'NONE' ) %>
                                <% }    %>
                            </div>
                        </div>
                    </div>
                <% } %>
            </div>
            <div class="card-footer">
                <div class="row">
                    <div class="col">
                        <% if ( app.model.SessionUser.canAdministrateTeam( a.getTeamId() )  ) {    %>
                            <a href="#/appointment/edit/<%= a.getId() %>/attendee"
                               class="btn btn-primary">
                                <i class="fas fa-user-edit"></i>
                            </a>
                        <% }    %>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>