require_relative 'page'

class Features::Pages::AdminPage < Features::Pages::Page
  def submit_with(first_name, last_name, email, password = nil)
    fill_in 'admin[first_name]', with: first_name, match: :first
    fill_in 'admin[last_name]', with: last_name, match: :first
    fill_in 'admin[email]', with: email, match: :first

    if password
      fill_in 'admin[password]', with: password, match: :first
      fill_in 'admin[password_confirmation]', with: password, match: :first
    end

    submit
  end

  def submit
    click_button 'Opslaan'
  end

  def visit
    super '/backend/admins'
  end
end

require_relative 'page'

class Features::Pages::AdminPage < Features::Pages::Page
  def submit_with(first_name, last_name, email, password = nil)
    select 'nl', from: 'Taal'
    fill_in 'Voornaam', with: first_name
    fill_in 'Achternaam', with: last_name
    fill_in 'E-mail', with: email

    if password
      fill_in 'Wachtwoord', with: password, match: :first
      fill_in 'Wachtwoord bevestiging', with: password
    end

    submit
  end

  def submit
    click_button 'Opslaan'
  end

  def visit
    super '/backend/admins'
  end
end

Simplify the admin feature page object.
Simplify the admin feature page object.
