[%# admin/importer/history.tt

Admin page for a user's entire importer history

Authors:
    Afuna <coder.dw@afunamatata.com>

Copyright (c) 2015-2017 by Dreamwidth Studios, LLC.

This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself.  For a copy of the license, please reference
'perldoc perlartistic' or 'perldoc perlgpl'.
%]
[%- sections.title = '.title' | ml -%]
[%- dw.need_res( 'stc/simple-form.css') -%]
[%- USE date -%]

<form method="GET" class="simple-form">
<fieldset>
    [%- form.textbox(
        label = dw.ml( "Username" )
        id = "user"
        name = "user"
    ) -%]
</fieldset>
<fieldset class="submit">
    [% form.submit(
        value = dw.ml( ".form.submit" )
    ) -%]
</fieldset>
</form>

[%- IF import_items.defined && import_items.size > 0 -%]
<table class="table">
<thead><tr>
    <th>[% '.col.importnum' | ml %]</th>
    <th>[% '.col.item' | ml %]</th>
    <th>[% '.col.status' | ml %]</th>
    <th>[% '.col.created' | ml %]</th>
    <th>[% '.col.lasttouch' | ml %]</th>
    <th>[% '.col.source' | ml %]</th>
</tr></thead>
<tbody>
[%- FOREACH import_id = import_items.keys.nsort -%]
    [% SET parity = loop.count % 2 ? 'even' : 'odd' %]
    [%- FOREACH item = import_items.$import_id.pairs -%]
    <tr class='[% parity %]'>
        <td>[% import_id %]</td>
        <td>[% item.key %]</td>
        <td>[% item.value.status %]</td>
        <td>[% date.format( item.value.created ) %]</td>
        <td>[% item.value.last_touch ? date.format( item.value.last_touch ) : "-" %]</td>
        <td>[% item.value.source %]</td>
    </tr>
    [%- END -%]

[%- END %]
</tbody>
</table>
[%- ELSE -%]
    <p>[% '.empty' | ml %]</p>
[%- END -%]
