<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>

<%--@elvariable id="dependents" type="java.util.List<Dependent<MailingDependentType>>"--%>

<mvc:form id="used-in-tile" cssClass="tile" servletRelativeAction="/mailing/send/${tmpMailingID}/view.action" modelAttribute="form" data-editable-tile="">
    <mvc:hidden path="mailingID"/>

    <script type="application/json" data-initializer="web-storage-persist">
        {
            "mailing-send-dependents-overview": {
                "rows-count": ${form.numberOfRows}
            }
        }
    </script>

    <div class="tile-header">
        <h1 class="tile-title">
            <mvc:message code="default.usedIn"/>
            <a href="#" class="icon icon-question-circle" data-help="help_${helplanguage}/mailing/MailingDependentsList.xml"></a>
        </h1>
    </div>

    <div class="tile-body">
        <div class="table-box">
            <div class="table-scrollable">
                <display:table class="table table-hover table-rounded js-table" id="item" list="${dependents}"
                               pagesize="${form.numberOfRows}" sort="list" excludedParams="*" requestURI="/mailing/send/${tmpMailingID}/view.action"
                               partialList="false">

                    <%@ include file="../../../../displaytag/displaytag-properties.jspf" %>

                    <display:setProperty name="basic.msg.empty_list_row">
                        <tr class="empty">
                            <td colspan="{0}">
                                <div class="notification-simple">
                                    <i class="icon icon-info-circle"></i>
                                    <span><mvc:message code="warning.mailing.action.sending.non" /></span>
                                </div>
                            </td>
                        </tr>
                    </display:setProperty>

                    <display:column headerClass="js-table-sort js-filter-type" sortProperty="type" sortable="true" titleKey="default.Type">
                        <c:choose>
                            <c:when test="${item.type == 'ACTION'}">
                                <emm:ShowByPermission token="actions.show">
                                    <c:url var="actionViewLink" value="/action/${item.id}/view.action" />
                                    <a href="${actionViewLink}" class="hidden" data-view-row="page"></a>
                                </emm:ShowByPermission>
                                <mvc:message code="action.Action"/>
                            </c:when>
                            <c:when test="${item.type == 'WORKFLOW'}">
                                <emm:ShowByPermission token="workflow.show">
                                    <c:url var="workflowViewLink" value="/workflow/${item.id}/view.action" />
                                    <a href="${workflowViewLink}" class="hidden" data-view-row="page"></a>
                                </emm:ShowByPermission>
                                <mvc:message code="workflow.single"/>
                            </c:when>

                            <c:when test="${item.type == 'BOUNCE_FILTER'}">
                                <emm:ShowByPermission token="mailloop.show">
                                    <c:url var="bounceViewLink" value="/administration/bounce/${item.id}/view.action" />
                                    <a href="${bounceViewLink}" class="hidden" data-view-row="page"></a>
                                </emm:ShowByPermission>
                                <mvc:message code="settings.Mailloop"/>
                            </c:when>
                        </c:choose>
                    </display:column>
                    <display:column headerClass="js-table-sort" property="shortname" sortProperty="name" sortable="true" titleKey="Name" escapeXml="true"/>
                </display:table>
            </div>
        </div>
    </div>
</mvc:form>

