<label><%= l(:label_document_plural) %></label>
<% getDocuments() %>
<div>
    <div class="contextual">
        <%= link_to(l(:label_document_new), url_for(getDocumentType), :class => 'icon icon-add') %>
    </div>

    <table class="list files">
        <thead><tr>
        <th><%= l(:field_filename) %></th>
        <th><%= l(:field_description) %></th>
        <th><%= l(:label_date) %></th>
        <th><%= l(:field_filesize) %></th>
        <th><%= l(:label_downloads_abbr) %></th>
        <th></th>
        </tr></thead>
        <tbody>
            <% @attachments.each do |file| %>
            <tr class="file">
                <td class="filename">
                    <%= link_to file.filename, url_for(controller: "wkdocument", action: "download", id: file.id),
                        class: 'icon icon-download', title: file.description %>
                </td>
                <td class="description"><%= file.description %></td>
                <td class="created_on"><%= format_time(file.created_on) %></td>
                <td class="filesize"><%= number_to_human_size(file.filesize) %></td>
                <td class="downloads"><%= file.downloads %></td>
                <td>
                <%= link_to l(:button_download), url_for(controller: "wkdocument", action: "download", id: file.id),
                        class: 'icon-only icon-download', title: l(:button_download) %>
                <%= link_to(l(:button_delete), url_for(controller: "wkdocument", action: "destroy", id: file.id),
                        class: 'icon-only icon-del', title: l(:button_delete), method: :delete,
                        data: {:confirm => l(:text_are_you_sure)}) if validateERPPermission("A_CRM_PRVLG") %>
                </td>
            </tr>
            <% end %>
        </tbody>
    </table>
</div>