{{> common_header}}

<div class="layout-body">

<h1>{{{fallback (i18n "resources.title." Layout.service_slug resource_id=Layout.resource_id) (i18n "resources.title.default" service_slug=Layout.service_slug resource_id=Layout.resource_id)}}}</h1>

{{#if Layout.history.result.length}}
<table class="ordinary full-width resource-history">
    <thead>
        <tr>
            <td data-id="id">{{i18n "resources.prop.id"}}</td>
            <td data-id="timestamp">{{i18n "resources.prop.timestamp"}}</td>
            <td data-id="action">{{i18n "resources.prop.action"}}</td>
            <td data-id="org">{{i18n "resources.prop.org"}}</td>
            <td data-id="author">{{i18n "resources.prop.author"}}</td>
            <td data-id="source">{{i18n "resources.prop.source"}}</td>
            <td data-id="note">
                {{#unless (is Layout.service_slug "dominator")}}
                {{i18n "resources.prop.name"}}&nbsp;/
                {{/unless}}
                {{i18n "resources.prop.comment"}}
            </td>
        </tr>
    </thead>
    {{#each Layout.history.result}}
    <tbody>
        <tr>
            <td data-id="id">{{this.id}}</td>
            <td data-id="timestamp">
                <span title="{{this.timestamp}}" data-date="{{this.timestamp}}">{{this.timestamp}}</span>
            </td>
            <td data-id="action">{{this.action}}</td>
            <td data-id="org">
                {{#if this.org_id}}
                <a href="/organizations/{{this.org_id}}">#{{this.org_id}}</a>
                {{else}}
                &mdash;
                {{/if}}
            </td>
            <td data-id="author">
                <div class="user-card">
                    {{#if this.author.nickname}}
                    <div class="name">
                        <span title="{{user_name this.author}}">{{this.author.nickname}}</span>
                    </div>
                    {{/if}}
                    <div class="uid">
                        <span>UID {{this.author_id}}</span>
                        <a href="/search?query={{this.author_id}}&type=owner_id" title="{{i18n "org_list.tip.search_by_owner"}}" class="symbol">🔍</a>
                    </div>
                </div>
            </td>
            <td data-id="source">{{this.source}}</td>
            <td data-id="note">
                {{#unless (is ../Layout.service_slug "dominator")}}
                <div data-id="name">{{this.name}}</div>
                {{/unless}}
                <div data-id="comment">{{this.comment}}</div>
            </td>
        </tr>
    </tbody>
    {{/each}}
</table>
{{else}}
<div class="blank-list">{{i18n "common.no_data"}}</div>
{{/if}}

{{#if (or Layout.history.links.prev Layout.history.links.next)}}
{{> page_navigation data=Layout.history}}
{{/if}}

</div>
