
<script id="module-UnsubscribeCustomer" type="text/x-mustache-template">
    <div class="tile-body" data-module-content="{{- index}}">
        <input type="hidden" name="modules[].type" value="UnsubscribeCustomer"/>
        <input type="hidden" name="modules[].id" id="module_{{- index}}.id" value="{{- id}}"/>

        <c:if test="${isUnsubscribeExtended}">
            <div class="row g-3">
                <div class="col-12">
                    <div class="form-check form-switch">
                        {{var additionalListsCheckedAttr = mailinglistIds.length > 0 || allMailinglistsSelected ? 'checked' : '';}}
                        <input {{- additionalListsCheckedAttr}} name="modules[].additionalMailinglists" type="checkbox" id="additionalMailinglistsToggle" class="form-check-input" role="switch"/>
                        <label class="form-label form-check-label" for="additionalMailinglistsToggle">
                            <mvc:message code="action.unsubscribe.additionally"/>
                        </label>
                    </div>
                </div>

                <div class="col-12" data-show-by-checkbox="#additionalMailinglistsToggle">
                    <div class="row g-3">
                        <div class="col-12">
                            <div class="form-check form-switch">
                                {{var allMailinglistsChekcedAttr = allMailinglistsSelected ? 'checked' : '';}}
                                <input type="checkbox" {{- allMailinglistsChekcedAttr}} name="modules[].allMailinglistsSelected" id="allMailinglistsToggle" class="form-check-input" role="switch" />
                                <label class="form-label form-check-label" for="allMailinglistsToggle">
                                    <mvc:message code="recipient.AllMailinglists"/>
                                </label>
                            </div>
                        </div>

                        <div class="col-12" data-show-by-checkbox="#additionalMailinglistsToggle" data-hide-by-checkbox="#allMailinglistsToggle">
                            <label class="form-label" for="id{{- index}}"><mvc:message code="Mailinglists"/></label>
                            <select name="modules[].mailinglistIds" multiple id="id{{- index}}" class="form-control js-select">
                                <c:forEach var="mailinglist" items="${allowedMailinglists}">
                                    {{var selectedOptionAttr = mailinglistIds.includes(${mailinglist.id}) ? 'selected="selected"' : '';}}
                                    <option value="${mailinglist.id}" {{- selectedOptionAttr}} >${mailinglist.shortname}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
        </c:if>
    </div>
</script>
