[% IF results.count == 0 %]
<div class="span2 alert alert-info">The user activity log is empty.</div>
[% ELSE %]
<table id="aul-data-table" class="table table-bordered table-condensed table-hover" width="100%" cellspacing="0">
  <thead>
    <tr>
      <th class="nd_center-cell">Creation</th>
      <th class="nd_center-cell">User</th>
      <th class="nd_center-cell">User IP</th>
      <th class="nd_center-cell">Event</th>
    </tr>
  </thead>
</table>
[% END %]

<script>
$(document).ready(function() {
  $('#aul-data-table').dataTable( {
    "serverSide": true,
    "order": [[ 0, "desc" ]],
    "ajax": "[% uri_for('/ajax/control/admin/userlog/data') | none %]",
    "columns": [{
      "data": 'creation',
      "className": "nd_center-cell",
      "render": function(data, type, row, meta) {
        return moment(data).format('YYYY-MM-DD HH:mm');
      }
    }, {
      "data": 'username',
      "className": "nd_center-cell",
      "render": function(data, type, row, meta) {
        return he.encode(data || '');
      }
    }, {
      "data": 'userip',
      "className": "nd_center-cell",
      "render": function(data, type, row, meta) {
        return he.encode(data || '');
      }
    }, {
      "data": 'event',
      "className": "nd_center-cell",
      "render": function(data, type, row, meta) {
        return he.encode(data || '');
      }
    }
  ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
  } );
} );
</script>
