
<table class="table discourse-patrons-table">
  <thead>
    <tr>
      <th>{{i18n 'discourse_subscriptions.admin.subscriptions.subscription.user'}}</th>
      <th>{{i18n 'discourse_subscriptions.admin.subscriptions.subscription.subscription_id'}}</th>
      <th>{{i18n 'discourse_subscriptions.admin.subscriptions.subscription.customer'}}</th>
      <th>{{i18n 'discourse_subscriptions.admin.subscriptions.subscription.product'}}</th>
      <th>{{i18n 'discourse_subscriptions.admin.subscriptions.subscription.plan'}}</th>
      <th>{{i18n 'discourse_subscriptions.admin.subscriptions.subscription.status'}}</th>
      <th class="td-right">{{i18n 'discourse_subscriptions.admin.subscriptions.subscription.created_at'}}</th>
      <th></th>
    </tr>
  </thead>
  {{#each model as |subscription|}}
    <tr>
      <td>
        {{#if subscription.metadataUserExists}}
          <a href="{{unbound subscription.subscriptionUserPath}}">
            {{subscription.metadata.username}}
          </a>
        {{/if}}
      </td>
      <td>{{subscription.id}}</td>
      <td>{{subscription.customer}}</td>
      <td>{{subscription.plan.product.name}}</td>
      <td>{{subscription.plan.nickname}}</td>
      <td>{{subscription.status}}</td>
      <td class="td-right">{{format-unix-date subscription.created}}</td>
      <td class="td-right">
        {{#if subscription.loading}}
          {{loading-spinner size="small"}}
        {{else}}
          {{d-button disabled=subscription.canceled label="cancel" action=(route-action "cancelSubscription" subscription) icon="times"}}
        {{/if}}
      </td>
    </tr>
  {{/each}}
</table>
