[%# META title = 'Summary' %]
[% # PROCESS dumper.tt dump = records %]
<div class="container">
<div class="row">
<legend class="form-file-upload-heading">
Summary
</legend>
</div>
<div class="row">
<div class="container span12">
<span class="pull-right">
<a href="[% uri_for_section.dpw.home %]">« return</a>
</span>
<script type="text/javascript">
jQuery(function() {
jQuery('#category_select').change(function() {
this.form.submit();
});
});
</script>
[% SET needs_filter = ( records.size >= 100 AND NOT params.category );
filter_title = needs_filter ? 'SELECT FILTER' : 'Filter selected' %]
<div class="input-group flex-nowrap mt-2 mb-2">
<span class="input-group-text col-md-2" id="title">[% filter_title %]</span>
<form action="[% uri_for_section.dpw.summary %]" id="filter" method="post">
<select name="category" class="form-control" id="category_select">
<option value="">--- select ---</option>
[% FOREACH opt in dpw_categories.sort %]
<option value="[% opt %]" [% 'selected' IF params.category.match(opt) %]>
[% opt.ucfirst %]</option>
[% END %]
</select>
</form>
</div>
<p class="bg-info p-2"><span class="">Total records: <strong>[% records.size %]</strong>
[% ' [select a filter]' IF needs_filter %]</span></p>
[% IF records.size < 100 OR params.category # need category if > 100 %]
<table class="table table-bordered table-striped table-condensed">
<tr>
<th>Date</th>
<th>Category</th>
<th>Detail</th>
<th>Retained</th>
<th>Uploaded</th>
</tr>
[% USE date(format = '%d/%m/%Y');
FOREACH entry IN records %]
<tr>
<td>[% date.format(entry.date _ " 00:00:00") # add time to satisfy requirement %]</td>
<td>[% entry.category.ucfirst %]</td>
<td>
<a href="[% uri_for_section.dpw.document %]/[% entry.id %]">
[% entry.description %]</a> [[%-
IF entry.comment.match('^http') %]<a href="[% entry.comment %]"
target="_blank">[% entry.comment %]</a>[%- ELSE %][% entry.comment %][% END %]]
[% IF entry.filename %]
<a href="[% uri_for_section.dpw.download %]/[% entry.category %]/[% entry.filename %]"
target="_blank"><i class="bi bi-file-pdf"></i>
</a>
[% END %]
</td>
<td>[% entry.retained.upper %]</td>
<td>[% date.format(entry.time) %]</td>
</tr>
[% END %]
</table>
[% END %]
</div>
</div>
</div>