<%@ page import="org.agnitas.dao.FollowUpType" %>

<c:set var="TYPE_FOLLOWUP_NON_OPENER" value="<%= FollowUpType.TYPE_FOLLOWUP_NON_OPENER.getKey() %>"/>
<c:set var="TYPE_FOLLOWUP_NON_CLICKER" value="<%= FollowUpType.TYPE_FOLLOWUP_NON_CLICKER.getKey() %>"/>
<c:set var="TYPE_FOLLOWUP_OPENER" value="<%= FollowUpType.TYPE_FOLLOWUP_OPENER.getKey() %>"/>
<c:set var="TYPE_FOLLOWUP_CLICKER" value="<%= FollowUpType.TYPE_FOLLOWUP_CLICKER.getKey() %>"/>

<%--@elvariable id="followupFor" type="java.lang.String"--%>
<%--@elvariable id="followUpType" type="java.lang.String"--%>

<c:if test="${isNormalMailing or (isFollowUpMailing and not empty followupFor)}">
    <div class="${isFollowUpMailing ? 'col-12' : 'col'}">
        <label class="form-label"><mvc:message code="Recipients" /></label>

        <c:choose>
            <c:when test="${isFollowUpMailing}">
                <div class="notification-simple notification-simple--lg">
                    <span>
                        <mvc:message code="RecipientsFollowupXplain1" />
                        <strong>${form.totalSentCount}</strong>
                        <mvc:message code="RecipientsFollowupXplain2" />
                        <br/>
                       <mvc:message code="mailing.RecipientsRecieved" />
                        <strong>
                            <c:if test="${followUpType eq TYPE_FOLLOWUP_NON_OPENER}">
                                <mvc:message code="noneOpeners" />.
                            </c:if>
                            <c:if test="${followUpType eq TYPE_FOLLOWUP_NON_CLICKER}">
                                <mvc:message code="noneClickers" />.
                            </c:if>
                            <c:if test="${followUpType eq TYPE_FOLLOWUP_OPENER}">
                                <mvc:message code="openers" />.
                            </c:if>
                            <c:if test="${followUpType eq TYPE_FOLLOWUP_CLICKER}">
                                <mvc:message code="clickers" />.
                            </c:if>
                        </strong>
                    </span>
                </div>
            </c:when>
            <c:otherwise>
                <div class="input-groups">
                    <div class="input-group">
                        <span class="input-group-text input-group-text--disabled"><mvc:message code="Text"/></span>
                        <input type="text" class="form-control commaSplitInput" value="${form.textEmailsCount}" disabled>
                    </div>

                    <div class="input-group">
                        <span class="input-group-text input-group-text--disabled"><mvc:message code="HTML"/></span>
                        <input type="text" class="form-control commaSplitInput" value="${form.htmlEmailsCount}" disabled>
                    </div>

                    <div class="input-group">
                        <span class="input-group-text input-group-text--disabled"><mvc:message code="OfflineHTML"/></span>
                        <input type="text" class="form-control commaSplitInput" value="${form.offlineHtmlEmailsCount}" disabled>
                    </div>

                    <c:forEach var="sendStatKey" items="${form.sentStatistics.keySet()}">
                        <c:if test="${sendStatKey gt 0}">
                            <c:set var="sendStat" value="${form.getSendStatisticsItem(sendStatKey)}" />
                            <c:if test="${sendStat gt 0}">
                                <div class="input-group">
                                    <span class="input-group-text input-group-text--disabled"><mvc:message code="mailing.MediaType.${sendStatKey}" /></span>
                                    <input type="text" class="form-control commaSplitInput" value="${sendStat}" disabled>
                                </div>
                            </c:if>
                        </c:if>
                    </c:forEach>

                    <div class="input-group">
                        <span class="input-group-text input-group-text--disabled fw-semibold"><mvc:message code="report.total"/></span>
                        <input type="text" class="form-control commaSplitInput fw-semibold" value="${form.totalSentCount}" disabled>
                    </div>
                </div>
            </c:otherwise>
        </c:choose>
    </div>
</c:if>
