extends layout
block content
  .dashhead
    .dashhead-titles
      h6.dashhead-subtitle File
      h2.dashhead-title Listings
    .btn-toolbar.dashhead-toolbar
      .btn-group
        a.btn.btn-primary-outline(href='/admin/file', type='button')
          | New File
          span.icon.icon-plus
  hr.m-t
  .flextable.table-actions
    .flextable-item.flextable-primary
      .btn-toolbar-item.input-with-icon
        input.form-control.input-block.model_search(type='text', value="#{search}",placeholder='Search files')
        span.icon.icon-magnifying-glass
    .flextable-item
  .table-full
    .table-responsive
      table.table(data-sort='table')
        thead
          tr
            th Original name
            th Encoding
            th Mimetype
            th Destination
            th Filename
            th Path
            th Size
            th Created
            th Actions
        tbody
          if files.length
            each file in files
              tr
                td
                  =file.originalname
                td
                  =file.encoding
                td
                  =file.mimetype
                td
                  =file.destination
                td
                  =file.filename
                td
                  =file.path
                td
                  =file.size
                td
                  =file.created
                td
                  a.btn.btn-primary-outline.btn-sm(href='/admin/file/#{file._id}')
                    | View/Edit
                    span.icon.icon-pencil
                  | &nbsp;
                  a.btn.btn-primary-outline.btn-sm(href='/admin/file/delete/#{file._id}', data-remote='true', data-confirm='Are You Sure?')
                    | Delete
                    span.icon.icon-erase
                  | &nbsp;
          else
            tr
              td(colspan=8, class="text-center")
                | No files found
  .text-center
