- if defined?(Foundation)
  = page_title :index, TargetFile
  table.target_files
    thead
      = search_form_for @q do |f|
        tr
          th= at :sti_type
          th= at :state
          th= at :size
          th= at :number_of_records
          th= sort_link @q, :created_at
          th= at :duration
          th.actions
            i.icon-search
            = search_result_info @target_files
        = search_row do
          th= f.select :sti_type_eq, tarray(TargetFile.classes.select{|klass| can? :read, klass}), {include_blank: ' - '}, class: 'smart-select', data: {select2_width: '400px'}
          th= f.select :state_eq, TargetFile.distinct.pluck(:state), {include_blank: ' - '}, {class: 'input-small'}
          th &nbsp;
          th &nbsp;
          th
            = f.text_field "created_at_gteq", placeholder: 'min', class: 'datepicker input-small'
            = f.text_field "created_at_lteq", placeholder: 'max', class: 'datepicker input-small'
          th &nbsp;
          th.actions
            = f.submit t('dunlop.filter.apply').html_safe, class: 'submit-filters-button'
            = link_to dunlop.target_files_path(reset_q: true), class: 'clear-filters-button' do
              span== t('dunlop.filter.reset')
    tbody
      - @target_files.each do |target_file|
        - if can? :read, target_file
          tr
            td= link_to target_file.class.model_name.human, dunlop.target_file_path(target_file)
            td= target_file.state
            td data-size=target_file.size
            td= target_file.number_of_records
            td data-time=target_file.created_at.iso8601
            td= target_file.duration.to_f.round
            td.actions
              = table_show_link target_file, dunlop.target_file_path(target_file)
              = table_download_link target_file, dunlop.download_target_file_path(target_file)
              = table_destroy_link target_file, dunlop.target_file_path(target_file)
  = paginate @target_files
- else
  .ui.container
    = page_title :index, TargetFile
    = search_form_for(@q, html: {class: 'ui form'}) do |f|
      table.target_files.ui.compact.striped.table
        thead
            tr
              th= at :sti_type
              th= at :state
              th= at :size
              th= at :number_of_records
              th= sort_link @q, :created_at
              th= at :duration
              th.actions
                i.icon-search
                = search_result_info @target_files
            = search_row do
              th= f.select :sti_type_eq, tarray(TargetFile.classes.select{|klass| can? :read, klass}), {include_blank: ' - '}, class: 'smart-select', data: {select2_width: '400px'}
              th= f.select :state_eq, TargetFile.distinct.pluck(:state), {include_blank: ' - '}, {class: 'input-small'}
              th &nbsp;
              th &nbsp;
              th
                .ui.mini.input= f.text_field "created_at_gteq", placeholder: 'min', class: 'datepicker input-small'
                .ui.mini.input= f.text_field "created_at_lteq", placeholder: 'max', class: 'datepicker input-small'
              th &nbsp;
              th.column-filter.actions
                button.ui.small.primary.icon.button.submit-filters-button
                  i.filter.icon
                = link_to dunlop.source_files_path(reset_q: true), class: 'clear-filters-button ui basic yellow small icon button'
                  i.undo.icon
        tbody
          - @target_files.each do |target_file|
            - if can? :read, target_file
              tr
                td= link_to target_file.class.model_name.human, dunlop.target_file_path(target_file)
                td= target_file.state
                td data-size=target_file.size
                td= target_file.number_of_records
                td data-time=target_file.created_at.iso8601
                td= target_file.duration.to_f.round
                td.actions
                  = table_show_link target_file, dunlop.target_file_path(target_file)
                  = table_download_link target_file, dunlop.download_target_file_path(target_file)
                  = table_destroy_link target_file, dunlop.target_file_path(target_file)
    = paginate @target_files
