{{#if list.length}}
<table class="full-width service-list" width="100%">
{{#each list as |service|}}
{{#if (or (is_not service.enabled null) (and service.paid_by_license (or (is ../Layout.org.organization_type "partner_organization") (is ../Layout.org.organization_type "cloud_partner"))))}}
<tbody data-id="{{service.slug}}" data-enabled="{{service.enabled}}" data-ready="{{service.ready}}">
<tr>
    {{!--
    <td data-id="icon">
        <span style="background-image: url({{service.icon}});"></span>
    </td>
    --}}
    <th data-id="name">
        <span class="badge" title="enabled: {{stringify service.enabled}}, ready: {{stringify service.ready}}"></span><span title="slug: {{service.slug}}">{{service_name service.slug}}</span>
    </th>
    {{#is service.enabled null}}
    <td data-id="actions">
        <div data-element="popup-container">
            <label class="link" for="open_{{join "." service.slug "enable_service"}}">{{i18n "service_details.action.enable_service"}}</label>
            <div data-element="popup_form">
                <input type="radio" name="action" id="cancel_{{join "." service.slug "enable_service"}}">
                <input type="radio" name="action" id="open_{{join "." service.slug "enable_service"}}">
                {{> forms.service.activation org=../Layout.org service=service name=(join "." service.slug "enable_service") position="middle left"}}
            </div>
        </div>
    </td>
    {{else}}
    <td data-id="details">
        <table>
        {{#if service.timeline.length}}
        <tbody data-id="timeline">
        {{#each service.timeline as |record|}}
        {{#if (or (is_not record.key "expires_at") (or (is ../../Layout.org.organization_type "partner_organization") (is ../../Layout.org.organization_type "cloud_partner")))}}
        <tr data-id="{{record.key}}" data-status="{{record.flag.value}}" data-future="{{record.future}}">
            <td data-id="date">
                <span title="{{record.key}}" data-date="{{record.date}}">{{{html_date record.date}}}</span>
            </td>
            <td data-id="description">
                <span class="description">{{i18n "service_details.timeline." record.key}}</span>
                {{#if record.icon}}
                <span class="icon">{{record.icon}}</span>
                {{/if}}
                {{#if record.tag}}
                <span class="badge" title="{{record.tag}}">{{record.tag}}</span>
                {{/if}}
            </td>
            <td data-id="actions">
                {{#if (and (is record.key "enabled_at") (is record.flag.value true) service.paid_by_license)}}
                <label class="link" for="open_{{join "." service.slug "disable_service"}}">{{i18n "service_details.action.disable_service"}}</label>
                <div data-element="popup_form">
                    <input type="radio" name="action" id="cancel_{{join "." service.slug "disable_service"}}">
                    <input type="radio" name="action" id="open_{{join "." service.slug "disable_service"}}">
                    {{> forms.service.disactivation org=../../Layout.org service=service name=(join "." service.slug "disable_service")}}
                </div>
                {{/if}}
                {{#if (and (is record.key "disabled_at") (is record.flag.value false) service.paid_by_license)}}
                <label class="link" for="open_{{join "." service.slug "enable_service"}}">{{i18n "service_details.action.enable_service"}}</label>
                <div data-element="popup_form">
                    <input type="radio" name="action" id="cancel_{{join "." service.slug "enable_service"}}">
                    <input type="radio" name="action" id="open_{{join "." service.slug "enable_service"}}">
                    {{> forms.service.activation org=../../Layout.org service=service name=(join "." service.slug "enable_service")}}
                </div>
                {{/if}}
                {{#is record.key "expires_at"}}
                <label class="link" for="open_{{join "." service.slug "expiration"}}">{{i18n "service_details.action.change_expiration_date"}}</label>
                <div data-element="popup_form">
                    <input type="radio" name="action" id="cancel_{{join "." service.slug "expiration"}}">
                    <input type="radio" name="action" id="open_{{join "." service.slug "expiration"}}">
                    {{> forms.service org=../../Layout.org service=service name=(join "." service.slug "expiration") mode="expiration"}}
                </div>
                {{/is}}
                {{#if (and (is service.slug "search") (is record.key "enabled_at") (is record.flag.value true))}}
                <label class="link" for="open_synchronize_search">{{i18n "service_details.action.synchronize_search"}}</label>
                <div data-element="popup_form">
                    <input type="radio" name="action" id="cancel_synchronize_search">
                    <input type="radio" name="action" id="open_synchronize_search">
                    {{> forms.search.sync org=../../Layout.org}}
                </div>
                {{/if}}
            </td>
        </tr>
        {{/if}}
        {{/each}}
        </tbody>
        {{/if}}
        {{#if service.paid_by_license}}
        <tbody data-id="props">
            <tr>
                <th>{{i18n "service_details.prop.subscribers"}}</th>
                <td {{#if (is_not service.slug "tracker")}} colspan="2" {{/if}}>
                    {{#if service.user_count}}
                    <a href="/organizations/{{../Layout.org.id}}/subscribers/{{service.slug}}">{{service.user_count}}</a>
                    {{else}}
                    &mdash;
                    {{/if}}
                </td>
                {{#if (is service.slug "tracker")}}
                    <td data-id="actions">
                        <a href="/organizations/{{../Layout.org.id}}/services/{{service.slug}}/licenses">{{i18n "service_details.action.licenses_history"}}</a>
                    </td>
                {{/if}}
            </tr>
            {{#if (or (is ../Layout.org.organization_type "partner_organization") (is ../Layout.org.organization_type "cloud_partner"))}}
            <tr>
                <th>{{i18n "service_details.prop.subscription_limit"}}</th>
                <td>{{dash_empty service.user_limit}}</a></td>
                <td data-id="actions">
                    <label class="link" for="open_{{join "." service.slug "user_limit"}}">{{i18n "service_details.action.change_user_limit"}}</label>
                    <div data-element="popup_form">
                        <input type="radio" name="action" id="cancel_{{join "." service.slug "user_limit"}}">
                        <input type="radio" name="action" id="open_{{join "." service.slug "user_limit"}}">
                        {{> forms.service org=../Layout.org service=service name=(join "." service.slug "user_limit") mode="user_limit"}}
                    </div>
                </td>
            </tr>
            {{/if}}
        </tbody>
        {{/if}}
        {{#unless (and (is service.resources_count 0) (empty service.responsible))}}
        <tbody data-id="props">
            <tr>
                <th>{{fallback (i18n "service_details.prop.resources." service.slug) (i18n "service_details.prop.resources.default")}}</th>
                <td colspan="2">
                    {{dash_empty service.resources_count}}
                </td>
            </tr>
            <tr>
                <th>{{i18n "service_details.prop.responsible"}}</th>
                <td colspan="2">
                    {{> user data=service.responsible}}
                </td>
            </tr>
        </tbody>
        {{/unless}}
        </table>
    </td>
    {{/is}}
</tr>
{{#unless @last}}
<tr class="spacer"><td colspan="2"></td></tr>
{{/unless}}
</tbody>
{{/if}}
{{/each}}
</table>
{{else}}
<div class="blank-list">{{i18n "common.no_data"}}</div>
{{/if}}
