{{#if list.length}}
<div class="domain-list" data-element="expandable">
{{#each list}}
<div class="domain" id="/{{this.name}}">
    <h2>
        <span data-id="master" data-value="{{this.master}}" title="{{i18n "domains.master." this.master}}">{{#if this.master}}★{{else}}☆{{/if}}</span>
        <span data-id="name">{{this.name}}</span>
        <a class="ref" href="{{link_url this.name}}">#</a>
    </h2>
    <table data-id="props">
    <tbody>
        <tr>
            <th>{{i18n "domains.prop.added"}}</th>
            <td data-id="status"></td>
            <td data-date="{{this.created_at}}">{{{html_date this.created_at}}}</td>
            <td data-id="actions">
                <a href="/services/domains/resources/{{this.name}}/history">{{i18n "domains.action.all_history"}}</a>
            </td>
        </tr>
        {{#if this.blocked_at}}
        <tr>
            <th>{{i18n "domains.prop.blocked"}}</th>
            <td data-id="status"></td>
            <td data-date="{{this.blocked_at}}">{{{html_date this.blocked_at}}}</td>
            <td data-id="actions"></td>
        </tr>
        {{/if}}
        <tr data-id="verified" data-owned="{{this.owned}}">
            <th>{{i18n "domains.prop.verified"}}</th>
            <td data-id="status">{{on_off this.owned}}</td>
            <td{{#if this.owned}} colspan="2"{{/if}} data-id="verification_date">
                {{#if this.validated_at}}<span class="main-value" data-date="{{this.validated_at}}">{{{html_date this.validated_at}}}</span> {{/if}}
                <span class="note">{{i18n "domains.verification." (ternary this.via_webmaster "via_webmaster" "via_pdd")}}</span>
            </td>
            {{#unless this.owned}}
            <td data-id="actions">
                <label class="link" for="verification_open_{{this.id}}">{{i18n "domains.action.verify"}}</label>
                <div data-element="popup_form">
                    <input type="radio" name="action" id="verification_canceled_{{this.id}}">
                    <input type="radio" name="action" id="verification_open_{{this.id}}">
                    {{> forms.domain.verify org=../Layout.org domain=this key=this.id}}
                </div>
            </td>
            {{/unless}}
        </tr>
        {{#if this.ownership.methods.length}}
        <tr data-id="verification" class="followup">
            <th>{{i18n "domains.prop.verification_methods"}}</th>
            <td data-id="status"></td>
            <td data-id="value">
                <div class="main-value">
                    {{#each this.ownership.methods}}
                    {{i18n "domains.verification." this.method}}{{#unless @last}}, {{/unless}}
                    {{/each}}
                </div>
            </td>
            <td data-id="actions">
                <a href="#/{{this.name}}/verification" data-action="expand">{{i18n "domains.action.details"}}</a>
            </td>
        </tr>
        <tr data-id="verification_methods" id="/{{this.name}}/verification">
            <th></th>
            <td data-id="status"></td>
            <td data-id="value">
                <pre>{{{code this.ownership.methods}}}</pre>
            </td>
            <td data-id="actions">
                <a href="#/{{this.name}}" data-action="collapse">{{i18n "common.action.hide_nested_pane"}}</a>
            </td>
        </tr>
        {{/if}}
        {{#if this.ownership.last_check}}
        <tr data-id="last_check">
            <th>{{i18n "domains.prop.last_check"}}</th>
            <td data-id="status">
                <div data-role="hover_tip_container">
                    <div data-element="hover_tip">
                        <div class="content">
                            <table>
                                <tr>
                                    <th>{{i18n "domains.prop.verification.method"}}</th>
                                    <td>{{this.ownership.last_check.method}}</td>
                                </tr>
                                <tr>
                                    <th>{{i18n "domains.prop.verification.failure_type"}}</th>
                                    <td>{{this.ownership.last_check.fail_type}}</td>
                                </tr>
                                <tr>
                                    <th>{{i18n "domains.prop.verification.failure_reason"}}</th>
                                    <td>{{this.ownership.last_check.fail_reason}}</td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </td>
            <td>
                <span class="main-value" data-date="{{this.ownership.last_check.date}}">{{{html_date this.ownership.last_check.date}}}</span>
            </td>
            <td data-id="actions"></td>
        </tr>
        {{/if}}
        <tr data-id="delegated">
            <th>{{i18n "domains.prop.delegated"}}</th>
            <td data-id="status">{{on_off this.delegated}}</td>
            <td></td>
            <td></td>
        </tr>
        <tr data-id="mx">
            <th>{{i18n "domains.prop.mx"}}</th>
            <td data-id="status">{{on_off this.mx}}</td>
            <td></td>
            <td data-id="actions">
                <label class="link" for="recheck_open_mx_{{this.id}}">{{i18n "domains.action.check_mx"}}</label>
                <div data-element="popup_form">
                    <input type="radio" name="action" id="recheck_canceled_mx_{{this.id}}">
                    <input type="radio" name="action" id="recheck_open_mx_{{this.id}}">
                    {{> forms.domain.recheck domain=this key=(join "_" "mx" this.id)}}
                </div>
            </td>
        </tr>
        <tr data-id="dns">
            <th>{{i18n "domains.prop.dns_records"}}</th>
            <td data-id="status">
                {{#unless this.dns._description}}&mdash;{{/unless}}
            </td>
            <td>
                <div data-id="dns_description">{{this.dns._description}}</div>
            </td>
            <td data-id="actions">
                <a href="/organizations/{{../Layout.org.id}}/dns/{{this.name}}">{{i18n "domains.action.show_dns_records"}}</a>
            </td>
        </tr>
    </tbody>
    </table>
    <table data-id="dkim-props">
    <thead>
        <tr>
            <td colspan="2">{{i18n "domains.dkim.title"}}</td>
            <td data-id="actions">
                <label class="link" for="recheck_open_dkim_{{this.id}}">{{i18n "domains.action.check_dkim"}}</label>
                <div data-element="popup_form">
                    <input type="radio" name="action" id="recheck_canceled_dkim_{{this.id}}">
                    <input type="radio" name="action" id="recheck_open_dkim_{{this.id}}">
                    {{> forms.domain.recheck domain=this key=(join "_" "dkim" this.id)}}
                </div>
            </td>
        </tr>
    </thead>
    {{#if this.dkim}}
    <tbody>
        <tr>
            <th title="{{i18n "domains.dkim.tip.domain"}}">
                {{i18n "domains.prop.dkim.domain"}}
            </th>
            <td data-id="status"></td>
            <td>{{this.dkim.selector}}._domainkey.{{this.name}}</td>
        </tr>
        <tr>
            <th title="{{i18n "domains.dkim.tip.value"}}">
                {{i18n "domains.prop.dkim.value"}}
            </th>
            <td data-id="status"></td>
            <td class="long-string">
                {{dash_empty this.dkim.public_key}}
            </td>
        </tr>
        <tr>
            <th>{{i18n "domains.prop.dkim.actual_value"}}</th>
            <td data-id="status"></td>
            <td class="long-string">
                {{dash_empty this.dkim.actual_value}}
            </td>
        </tr>
        <tr>
            <th>{{i18n "domains.prop.dkim.changed"}}</th>
            <td data-id="status">{{on_off this.dkim.changed}}</td>
            <td></td>
        </tr>
        <tr>
            <th>{{i18n "domains.prop.dkim.enabled"}}</th>
            <td data-id="status">{{on_off this.dkim.enabled}}</td>
            <td></td>
        </tr>
    </tbody>
    {{else}}
    <tbody class="empty">
        <tr>
            <td colspan="3">{{i18n "domains.dkim.no_data"}}</td>
        </tr>
    </tbody>
    {{/if}}
    </table>
</div>
{{/each}}
{{else}}
<div class="blank-list">{{i18n "domains.no_domains"}}</div>
{{/if}}
