- provide(:page_name, 'amazon_lessons_promo_2')
- provide(:description, @description)
- provide(:title, @title)

form#root method='POST' action='/account/activate/signup'
  .logo-holder.create-account
    = image_tag("content/amazon_logo.jpg")

  .steps
    = image_tag("content/1-2-with-2-Bold.png")

  .success-msg
    | Success!&nbsp;
    wbr
    | Your code has been validated!

  -if @current_user
    .instructions.create-account
      input type='hidden' name='code' value=@code
      - if @error
        .error = @error
      = 'Click the button below to credit your account with your 2 free lessons.'
    .submit-row.create-account
      .submit.create-account
        .amazon-button-stack
          span.amazon-button
            span.amazon-button-inner
              a.amazon-a-button-text
                = 'Apply Credits'
  -else
    .instructions.create-account
      = 'Please let us know what kind of instrument you bought from Amazon, and enter your email address and a password so we can create a JamKazam account for you and credit your account with 2 free lessons.'

    .code-form.create-account
      .text-input
        label.code-prompt.first
          = 'First Name:'
        - if @error
          .error = @error
        input autofocus='autofocus' type='text' name='first' value=@first
    .email-row
      .text-input
        label.code-prompt.email
          = 'Email:'
        input type='hidden' name='code' value=@code
        input type='text' name='email' value=@email
    .password-row
      .text-input
        label.code-prompt.password
          = 'Password:'
        input type='password' name='password' value=@password
    .instrument-row
      .select-input
        label.code-prompt.instrument-select
          = 'Instrument:'
        select name='instrument' value=''
          option value='' Please Select One
          option value='acoustic guitar' Acoustic Guitar
          option value='electric guitar' Electric Guitar
          option value='other' Other
    .terms-row
      label.code-prompt
      .checkbox-input
        input type='checkbox' name='terms' checked=@terms
        label
          | I have read and agree to the JamKazam&nbsp;
          = link_to 'terms of service', '/corp/terms', target: '_blank'
    .submit-row.create-account
      .submit.create-account
        .amazon-button-stack
          span.amazon-button
            span.amazon-button-inner
              a.amazon-a-button-text
                = 'Create Account'
  .powered-by.create-account
    .code-prompt
    p
      = 'powered by '
      = image_tag("web/logo_inverted.png")


javascript:
  var submitted = false
  $('a.amazon-a-button-text').on('click', function(e) {

    if(!submitted) {
      submitted = true
      console.log("submit button clicked")
      $('form#root').submit()
    }

  })

