[% USE KohaDates %] [% USE To %] { "sEcho": [% sEcho %], "iTotalRecords": [% iTotalRecords %], "iTotalDisplayRecords": [% iTotalDisplayRecords %], "aaData": [ [% FOREACH data IN aaData %] { "dt_type": "[% data.type %]", "dt_shelfname": "[% data.shelfname | html%]", "dt_count": "[% data.count %] item(s)", "dt_owner": "[% data.firstname %] [% data.surname %]", "dt_sortby": [% IF data.sortby == "author" %]"Author"[% ELSIF data.sortby == "copyrightdate" %]"Year"[% ELSIF data.sortby == "itemcallnumber" %]"Call number"[% ELSE %]"Title"[% END %], "dt_created_on": "[% data.created_on | $KohaDates %]", "dt_modification_time": "[% data.modification_time | $KohaDates %]", "dt_action": "[% PROCESS action_form shelfnumber=data.shelfnumber can_manage_shelf=data.can_manage_shelf can_delete_shelf=data.can_delete_shelf type=data.type %]" }[% UNLESS loop.last %],[% END %] [% END %] ] } [% BLOCK action_form -%] [%~ SET action_block = '' ~%] [%~ IF can_manage_shelf OR can_delete_shelf ~%] [%~ IF can_manage_shelf ~%] [%~ action_block = '
' ~%] [%~ END ~%] [%~ IF can_manage_shelf OR can_delete_shelf ~%] [%~ action_block = action_block _ '' ~%] [%~ END ~%] [%~ ELSE ~%] [%~ SET action_block = 'None' ~%] [%~ END ~%] [%~ To.json(action_block) ~%] [%~ END ~%]