<% if (data.meta.user !== "") { %>
<% if (_.size(data.paid_tasks) > 0) { %>
  <h2><%= gettext('Registered Tasks') %></h2>
  <table class="stats">
    <thead>
    <tr>
      <th><%= gettext('Datetime') %> (UTC<%= data.meta.utc_offset %>)</th>
      <th><%= gettext('Comment') %></th>
      <th><%= gettext('Action') %></th>
      <th class="number"><%= gettext('Amount') %></th>
      <th class="number">&times; <%= gettext('Rate') %></th>
      <th class="number"><%= gettext('Subtotal') %></th>
      <th class="remove"></th>
    </tr>
    </thead>
    <tbody>
    <% _.each(data.paid_tasks, function (row) { %>
      <%
        var amount;
        if (row.type === paidTaskTypes.hourlyWork) {
          amount = interpolate(ngettext("%s hour", "%s hours", Math.round(row.amount)), [Math.round(row.amount)]);
        } else if (row.type === paidTaskTypes.translation ||
                   row.type === paidTaskTypes.review) {
          amount = interpolate(ngettext("%s word", "%s words", Math.round(row.amount)), [Math.round(row.amount)]);
        } else {
          amount = row.amount;
        }
      %>
      <tr class="item is-visible task<%= row.id %>">
        <td><%- row.datetime %></td>
        <td><%- row.description %></td>
        <td><%- row.action %></td>
        <td class="number"><%= amount %></td>
        <td class="number"><%= row.rate %> <%= data.meta.user.currency %></td>
        <td class="number"><%= (row.rate * row.amount).toFixed(2) %> <%= data.meta.user.currency %></td>
        <td class="remove">
          <% if (PTL.reports.adminReport) { %>
            <% var removeTask = gettext('Remove task'); %>
            <i class="icon-reject js-remove-task" data-id="<%= row.id %>" original-title="<%= removeTask %>"></i>
          <% } else { %>
            <a data-action="contact" data-subject-prefix="Task"
               data-subject="<%= _.escape(row.description) + ' (' + amount + ')' %>"
               data-body="Task permalink (for administrators):&#010;<%= data.meta.admin_permalink + row.id %>&#010;&#010;"><%= gettext('Comment on it') %></a>
          <% } %>
          </a>
        </td>
      </tr>
    <% }); %>
    </tbody>
  </table>
<% } %>
<% } %>
