<div class="label-wrapper">
  <span class="strong">{{i18n 'Upload Badge Images'}}</span>
</div>

<form class="cl-input-container">
  <p class="sub-text">
    {{i18n 'Please provide all three badge sizes to ensure optimal display.'}}
  </p>

  <p class="sub-text">
    {{i18n 'All badge images must be transparent PNG files.'}} {{styled-i18n 'Max file size is %{number} KB.' (hash number=fileSizeLimitKilobytes)}}
  </p>

  <div style="margin: 20px 0;">
    {{dashboards/subscription-dash/badges/badge-image-picker
      fileSizeLimitBytes=fileSizeLimitBytes
      imageHeightRequirement=18
      imageWidthRequirement=18
      inputName='image_1x'
      file=image1xFile
      updateFile=(action (mut image1xFile))}}

    {{dashboards/subscription-dash/badges/badge-image-picker
      fileSizeLimitBytes=fileSizeLimitBytes
      imageHeightRequirement=36
      imageWidthRequirement=36
      inputName='image_2x'
      file=image2xFile
      updateFile=(action (mut image2xFile))}}

    {{dashboards/subscription-dash/badges/badge-image-picker
      fileSizeLimitBytes=fileSizeLimitBytes
      imageHeightRequirement=72
      imageWidthRequirement=72
      inputName='image_4x'
      file=image4xFile
      updateFile=(action (mut image4xFile))}}
  </div>

  <button type="submit"
    class="button {{if (or isConfirmationModalOpen isSaving (not isFormComplete)) 'button--disabled'}}"
    disabled={{or isConfirmationModalOpen isSaving (not isFormComplete)}}
    {{action 'openConfirmationModal'}}>

    {{#if isSaving}}
      {{i18n 'Saving Images...'}}
    {{else}}
      {{i18n 'Save Images'}}
    {{/if}}
  </button>
</form>

{{#if isConfirmationModalOpen}}
  {{#ember-wormhole to='wormhole-overlays'}}
    {{! ember-wormhole@0.5.0 must have a stable root element in 2.10.0-beta's }}
    <div>
      {{#modal-dialog action=(action 'closeConfirmationModal')}}
        <div class="card">
          <div class="text-content">
            <div class="content-header">
              <h4>{{i18n 'Save Badge Images'}}</h4>
            </div>

            <div class="item">
              <p>
                {{i18n 'By uploading and saving these images, you are confirming that you own all rights to the images.'}}
              </p>
            </div>

            <div class="buttons">
              <button type="button"
                      class="button button--text"
                      disabled={{isSaving}}
                      {{action 'closeConfirmationModal'}}>

                {{t 'general.forms.cancel'}}
              </button>

              <button type="button"
                      class="button {{if (or isSaving (not isFormComplete)) 'button--disabled'}}"
                      disabled={{or isSaving (not isFormComplete)}}
                      {{action 'confirm'}}>

                {{#if isSaving}}
                  {{i18n 'Saving...'}}
                {{else}}
                  {{t 'general.forms.save'}}
                {{/if}}
              </button>
            </div>
          </div>
        </div>
      {{/modal-dialog}}
    </div>
  {{/ember-wormhole}}
{{/if}}
