- page_title _("Upload License")
- eula_url = 'https://about.gitlab.com/terms/#subscription'
- eula_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: eula_url }
%h3.page-title= _('Upload License')

%p.light
  To #{License.current ? "continue" : "start"} using GitLab Enterprise Edition, upload the <code>.gitlab-license</code> file or enter the license key you have received from GitLab Inc.

%hr
= form_for @license, url: admin_license_path, html: { multipart: true, class: 'fieldset-form' } do |f|
  - if @license.errors.any?
    #error_explanation
      .gl-alert.gl-alert-danger.gl-mb-5
        = sprite_icon('warning', size: 16, css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
        .gl-alert-body
          %p= _('The form contains the following errors:')
          %details
            %summary= n_('%d error found:', '%d errors found:', @license.errors.full_messages.length) % @license.errors.full_messages.length
            %ul
              - @license.errors.full_messages.each do |msg|
                %li= msg



  .form-group.row
    .col-sm-2
    .col-sm-10
      .form-check
        = radio_button_tag :license_type, :file, @license.data.blank?, class: 'form-check-input'
        = label_tag :license_type_file, class: 'form-check-label' do
          .option-title
            Upload <code>.gitlab-license</code> file
      .form-check
        = radio_button_tag :license_type, :key, @license.data.present?, class: 'form-check-input', data: { qa_selector: 'license_type_key_radio' }
        = label_tag :license_type_key, class: 'form-check-label' do
          .option-title
            Enter license key

  .form-group.row.license-file
    .col-sm-2.col-form-label
      = f.label :data_file, "License file"
    .col-sm-10
      = f.file_field :data_file, accept: ".gitlab-license,.gitlab_license,.txt", class: "form-control"

  .form-group.row.license-key.hidden
    .col-sm-2.col-form-label
      = f.label :data, "License key"
    .col-sm-10
      = f.text_area :data, class: "form-control license-key-field", data: { qa_selector: 'license_key_field' }, rows: 20

  .form-group.row
    .col-sm-2
    .col-sm-10
      = label_tag :accept_eula, nil, class: 'form-check-label' do
        = check_box_tag :accept_eula, nil, false, data: { qa_selector: 'accept_eula_checkbox' }
        = _('Unless otherwise agreed to in writing with GitLab, by clicking "Upload License" you agree that your use of GitLab Software is subject to the %{eula_link_start}Terms of Service%{eula_link_end}.').html_safe % { eula_link_start: eula_link_start, eula_url: eula_url, eula_link_end: '</a>'.html_safe }

  .form-actions
    = f.submit 'Upload License', class: 'gl-button btn btn-confirm', data: { qa_selector: 'license_upload_button' }, disabled: true, id: 'js-upload-license'
