<div id="{{fieldId}}"
     class="form-group {{#if error}}has-error has-feedback{{/if}}"
     data-multiple="{{#if field.formFieldMultiple}}true{{else}}false{{/if}}" >

  <label for="{{fieldId}}">{{{label}}} {{#ifCond field.allowNull false}}*{{/ifCond}}</label>

  <button id="{{fieldId}}FileBTNSelector"
      type="button"
      onclick="we.components.fileSelector.selectFileForField('#{{fieldId}}', '{{name}}');"
      class="btn btn-default"
      {{#unless field.formFieldMultiple}}
        {{#ifCond value 'null'}}{{else}}{{#if value}}style="display:none;"{{/if}}{{/ifCond}}
      {{/unless}} >
    {{t 'file.file.select.btn'}}
  </button>

  <input name="{{name}}" type="hidden" value="null">

  <table id="{{fieldId}}FileTable" class="table table-bordered"
    {{#ifCond value 'null'}}style="display:none;"{{/ifCond}}
    {{#unless value}}style="display:none;"{{/unless}} >
    <thead><tr>
      <th>{{t 'Name'}}</th>
      <th>{{t 'Actions'}}</th>
    </tr></thead>
    <tbody>
      {{#each value}}

        {{#if this.id}}
          <tr>
            <td><we-file-description data-id="{{id}}"></we-file-description></td>
            <td>
              <button onclick="we.components.fileSelector.removeFile(this, '#{{../fieldId}}')" type="button" class="btn btn-danger">{{t 'file.remove'}}</button>
              <input name="{{../name}}" type="hidden" value="{{id}}">
            </td>
          </tr>
        {{else}}
          <tr>
            <td>
               <we-file-description data-id="{{this}}"></we-file-description>
            </td>
            <td>
              <button onclick="we.components.fileSelector.removeFile(this, '#{{../fieldId}}')" type="button" class="btn btn-danger">{{t 'file.remove'}}</button>
              <input name="{{../name}}" type="hidden" value="{{this}}">
            </td>
          </tr>
        {{/if}}
      {{/each}}
    </tbody>
  </table>

  {{!-- each file template --}}
  <div id="{{fieldId}}FileFieldTemplates" style="display:none;">
    <table><tr>
      <td data-file-name></td>
      <td>
        <button onclick="we.components.fileSelector.removeFile(this, '#{{fieldId}}')" type="button" class="btn btn-danger">{{t 'file.remove'}}</button>
      </td>
    </tr></table>
  </div>

  <p class="help-block">{{{help}}}</p>

  {{{field-help-error error}}}
</div>