- if @provider.errors.any?
  .validation-summary
    %h2.heading-small= "#{t('.prohibited_save')} #{pluralize(@provider.errors.count, t('.error'))}"
    %ul
      - @provider.errors.full_messages.each do |message|
        %li
          = message
    %span.form-hint
      = t('.form_error_hint')

%h1.page-title
  = "Edit #{@provider.provider_type} details"

= form_for [:advocates, :admin, @provider], html: { novalidate: true } do |f|

  %fieldset.user-form
    = f.label t('.provider_name'), class: "form-label"
    = f.text_field :name
    = validation_error_message(@provider, :name)

    - if @provider.firm?
      = f.label t('.supplier_number'), class: "form-label"
      = f.text_field :supplier_number
      = validation_error_message(@provider, :supplier_number)

      %label
        = f.check_box :vat_registered
        = t('.vat_registered')

    = f.label :api_key, t('.api_key'), class: "form-label"
    = @provider.api_key

  %p
    = f.submit 'Save', class: "button"

- if @provider.errors.any?
  .validation-summary
    %h2.heading-small= "#{t('.prohibited_save')} #{pluralize(@provider.errors.count, t('.error'))}"
    %ul
      - @provider.errors.full_messages.each do |message|
        %li
          = message
    %span.form-hint
      = t('.form_error_hint')

%h1.page-title
  = "Edit #{@provider.provider_type} details"

= form_for [:advocates, :admin, @provider], html: { novalidate: true } do |f|

  %fieldset.user-form
    = f.label :name, t('.provider_name'), class: "form-label"
    = f.text_field :name
    = validation_error_message(@provider, :name)

    - if @provider.firm?
      = f.label t('.supplier_number'), class: "form-label"
      = f.text_field :supplier_number
      = validation_error_message(@provider, :supplier_number)

    - if @provider.firm?
      %label
        = f.check_box :vat_registered
        = t('.vat_registered')

    = f.label :api_key, t('.api_key'), class: "form-label"
    = @provider.api_key

  %p
    = f.submit 'Save', class: "button"

Improve accessibility by linking the label to the text field
Improve accessibility by linking the label to the text field
