<div ng-controller="Umbraco.Overlays.UnpublishController as vm" class="umb-variant-selector-overlay">

    <!-- Single language -->
    <div ng-if="vm.variants.length === 1">
        <p><localize key="prompt_confirmUnpublish">Unpublishing will remove this page and all its descendants from the site.</localize></p>
    </div>

    <!-- Multiple languages -->
    <div ng-if="vm.variants.length > 1">
        <div style="margin-bottom: 15px;">
            <p><localize key="content_languagesToUnpublish">Select the languages to unpublish. Unpublishing a mandatory language will unpublish all languages.</localize></p>
        </div>

        <div class="umb-list umb-list--condensed">

            <div class="umb-list-item" ng-repeat="variant in vm.unpublishableVariants track by variant.compositeId">
                <ng-form name="unpublishVariantSelectorForm">
                    <div class="umb-variant-selector-entry" ng-class="{'umb-list-item--error': unpublishVariantSelectorForm.unpublishVariantSelector.$invalid}">

                        <umb-checkbox input-id="{{variant.htmlId}}"
                                      name="unpublishVariantSelector"
                                      model="variant.save"
                                      on-change="vm.changeSelection(variant)"
                                      disabled="variant.disabled"
                                      server-validation-field="{{variant.htmlId}}">

                            <span class="umb-variant-selector-entry__title" ng-if="!(variant.segment && variant.language)">
                                <span ng-bind="variant.displayName"></span>
                                <strong ng-if="variant.isMandatory" class="umb-control-required">*</strong>
                            </span>
                            <span class="umb-variant-selector-entry__title" ng-if="variant.segment && variant.language">
                                <span ng-bind="variant.segment"></span>
                                <span class="__secondarytitle"> — {{variant.language.name}}</span>
                                <strong ng-if="variant.isMandatory" class="umb-control-required">*</strong>
                            </span>
                            <span class="umb-variant-selector-entry__description" ng-if="!publishVariantSelectorForm.publishVariantSelector.$invalid && !(variant.notifications && variant.notifications.length > 0)">
                                <umb-variant-state variant="variant"></umb-variant-state>
                                <span ng-if="variant.isMandatory"> - </span>
                                <span ng-if="variant.isMandatory" ng-class="{'text-error': (variant.publish === false) }"><localize key="general_mandatory">Mandatory</localize></span>
                            </span>
                            <span class="umb-variant-selector-entry__description" ng-messages="publishVariantSelectorForm.publishVariantSelector.$error" show-validation-on-submit>
                                <span class="text-error" ng-message="valServerField">{{publishVariantSelectorForm.publishVariantSelector.errorMsg}}</span>
                            </span>

                        </umb-checkbox>

                        <umb-variant-notification-list notifications="variant.notifications"></umb-variant-notification-list>

                    </div>
                </ng-form>
            </div>
            <br />
        </div>
    </div>
</div>
