<!-- BEGIN history/categories.tt -->

    <h3 class="header">Request history:</h3>
    [% IF categorical.request_data.size %]
        <div class="indent">
            <table class="history">
                <tr>
                    <th>Day</th>
                    <th>Date</th>
                    <th>Time</th>
                    <th>UserID</th>
                    <th>Action</th>
                </tr>
                [% FOREACH event IN categorical.request_data %]
                    <tr class="[% loop.count % 2 ? 'normal' : 'bkgd_grey' %]">
                        <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 | html %]
                            [% IF is_lab_user # must be lab-user to see this:
                                AND (
                                    event.action.match('amended comment') OR
                                    event.action.match('modified Comment')
                                )
                            %]
                                [<a href="[% url_with_path.replace('=', 'comment') %]">
                                    view
                                </a>]
                            [% END %]
                        </td>
                    </tr>
                [% END %]
            </table>
        </div>
    [% ELSE %]
        <p class="indent">[ NONE ]</p>
    [% END %]

    [% IF is_lab_user %]
        <h3 class="header">Lab test history:</h3>
        [% IF categorical.lab_test_data.size;
            # PROCESS dumper.tt dump = categorical.lab_test_data %]
    
            <div class="indent">
                <table class="history">
                    <tr>
                        <th>Day</th>
                        <th>Date</th>
                        <th>Time</th>
                        <th>UserID</th>
                        <th>Action</th>
                    </tr>
                    [% FOREACH event IN categorical.lab_test_data %]
                        <tr class="[% loop.count % 2 ? 'normal' : 'bkgd_grey' %]">
                            <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 %]
                            </td>
                        </tr>
                    [% END %]
                </table>
            </div>
        [% ELSE %]
            <p class="indent">[ NONE ]</p>
        [% END %]
    [% END %]
<!-- END history/categories.tt -->
