RSS Git Download  Clone
Raw Blame History
[%# META title = 'Summary' %]
[% # PROCESS dumper.tt dump = records %]
  <div class="container">
  [% IF records;
	IF NOT records.size %]
     <div class="row">
	   <div class="container alert alert-info my-3" role="alert">
		 No records found matching "[% params.search || params.category %]"
         [% 'category' IF params.category %]
       </div>
	</div>
    [% ELSE # have records %]
     <div class="row">
		<div class="container alert alert-info my-3" role="alert">
			Total records: <strong>[% records.size %]</strong>
		</div>

	    [% SET needs_filter = ( records.size >= 100 AND NOT params.category );
			filter_title = needs_filter ? 'Filter selected' : 'SELECT FILTER' %]
        [% IF records.size > 1 # no need for filter if less %]
		<div class="input-group flex-nowrap">
			<span class="input-group-text col-md-2" id="title">[% filter_title %]</span>
            <form>
              <select name="category" id="category_select" class="form-control"
                  hx-post="[% uri_for_section.dpw.summary %]"
                  hx-target="#hx-container" hx-trigger="change">
                <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>
        [% END %]
    
		[% 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='#' hx-get="[% uri_for_section.dpw.document %]/[% entry.id %]"
						  hx-target="#hx-container">[% 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; END %]
        </div>
		[% END %]
    </div>
  </div>