<!-- BEGIN resources/menu/chronological.tt -->

    [%
        colours = {
            request_data  = '#e6ffe6',
            lab_test_data = '#ffefdf',            
        }
    %]
    
    [% IF is_lab_user AND categorical.deletion_data.size %]
      <h3 class="header">Request deletion history</h3>
      <div class="indent">
        <table class="history">
          <tr>
            <td class="borderless"></td>
            <th>Day</th>
            <th>Date</th>
            <th>Time</th>
            <th>UserID</th>
            <th>Action</th>
          </tr>
          [% FOREACH event IN categorical.deletion_data;
              # INCLUDE dumper.tt dump = entry; %]
            <tr class="[% loop.count % 2 ? 'normal' : 'bkgd_grey' %]">
              <td style="text-align: right; background: #fff">
                [% loop.count %]</td>
              <td>
                [% event.time.strftime('%a') %]
              </td>
              <td>
                [% event.time.strftime('%d.%b.%Y') %]
              </td>
              <td>
                [% event.time.strftime('%T') %]
              </td>
              <td>
                [% event.user.username | upper %]
              </td>
              <td>
                [% event.action.replace('_', ' ') | html %]
              </td>
            </tr>
          [% END %]
        </table>
      </div>
    [% END %]
    
    <h3 class="header">
        Request [% IF is_lab_user %]&amp; lab test[% END %] history:
    </h3>
    <div class="indent">
        <table class="history">
            <tr>
                <td class="borderless"></td>
                <th>Day</th>
                <th>Date</th>
                <th>Time</th>
                <th>UserID</th>
                <th>Action</th>
            </tr>
            [% FOREACH event IN chronological; # PROCESS dumper.tt dump = event;
                # lab-test data filtered out in Controller if not lab user %]
                <tr style="background: [% colours.item(event.history_type) %]">
                    <td style="text-align: right; background: #fff">
                        [% loop.count %]</td>
                    <td>
                        [% event.time.strftime('%a') %]
                    </td>
                    <td>
                        [% event.time.strftime('%d.%b.%Y') %]
                    </td>
                    <td>
                        [% event.time.strftime('%T') %]
                    </td>
                    <td>
                        [% event.user.username | upper %]
                    </td>
                    <td>
                        [% event.action.replace('_', ' ') | html;
                            INCLUDE report_diff IF is_lab_user %]
                    </td>
                </tr>
            [% END %]
        </table>
    </div>
    
<!-- END resources/menu/chronological.tt -->

