[% BLOCK attachments %]

[% text('Attached and Linked Files') %]
[% IF attachments.files && attachments.files.size > 0 -%]
[% text('File name') %] | [% text('File type') %] | [% text('Attached at') %] | [% text('Attached by') %]
--- | --- | --- | ---
[% FOREACH file IN attachments.files %]
[% file.file_name %] | [% file.mime_type %] | [% file.uploaded_at %] | [% file.uploaded_by_name %]
[% END # FOREACH %] [% END # IF attachments.files.size > 0 %]

[% IF attachments.file_links && attachments.file_links.size > 0 -%]

[% text('File name') %] | [% text('File type') %] | [% text('Attached To Type') %] | [% text('Attached To') %] | [% text('Attached at') %] | [% text('Attached by') %]
--- | --- | --- | --- | --- | ---
[% FOREACH link IN attachments.file_links; aclass=" "; IF link.src_class() == 1; aclass="Transaction"; ELSIF link.src_class() == 2; aclass="Order"; END; %]
[% file.file_name %] | [% file.mime_type %] | [% aclass %] | [% file.reference() %] | [% file.attached_at() %] | [% file.attached_by() %]
[% END # FOREACH %]

[% END # IF attachments.file_links.size > 0 -%] [[% text('Attach') %]] [% END; # block attachments %]