<div class="moe-field">
{{form-field-label
  label=label
  required=required
  error=error
  toolTipContent=toolTipContent
  showErrors=showErrors
  additionalInfo=additionalInfo
  additionalButton=additionalButton
  description=description  
}}
<table class="table currency-table" id="{{name}}">
  {{! Heading }}
  <thead>
  <tr>
    {{#each config.columns as |column|}}
      <th>{{column}}</th>
    {{/each}}

    {{! Action Columns }}
    {{#if hasDynamicRows }}
      <th></th>
    {{/if}}
  </tr>
  </thead>

  {{! Body }}
  <tbody>

  {{! Static Rows }}
  {{#each config.rows as |field|}}
    <tr>
      <td>
        <label class="label">
          {{field.label}}
        </label>
      </td>
      <td class="input-row">
        {{form-currency value=field.value}}
      </td>

      {{! Action Columns }}
      {{#if hasDynamicRows }}
        <td></td>
      {{/if}}
    </tr>
  {{/each}}

  {{! Dynamic Rows }}
  {{#if hasDynamicRows}}
    {{#each dynamicRows as |field index|}}
      <tr>
        <td class="input-row">
          {{form-text placeholder="Enter label here" value=field.label}}
        </td>
        <td class="input-row">
          {{form-currency value=field.value}}
        </td>

        {{! Action Columns }}
        <td>
          {{#if index}}
            <button class="button add-row-button" {{action 'removeRow' index}}>
              <span class="icon">
                <i class="fa fa-times-circle"></i>
              </span>
            </button>
          {{/if}}
        </td>
      </tr>
    {{/each}}
  {{/if}}

  {{! Total Row }}
  <tr>
    <td class="total-row">
      {{#if hasDynamicRows}}
        <button class="is-pulled-left button add-row-button" {{action 'addRow'}} id="{{addRowButtonName}}">
              <span class="icon">
                <i class="fa fa-plus-circle"></i>
              </span>
          <span>Add Row</span>
        </button>
      {{/if}}
      Total
    </td>
    <td class="input-row">
      {{form-currency disabled=true value=calculatedTotal}}
    </td>

    {{! Action Columns }}
    {{#if hasDynamicRows }}
      <td></td>
    {{/if}}
  </tr>
  </tbody>
</table>
</div>
