<div id="signup" v-cloak>
  <div class="container-fluid pt-5 pb-5" v-if="!cloudSuccess">
    <h1 class="text-center"><%=__('Create an account')%></h1>
    <div style="max-width: 450px;" class="mx-auto" >
      <p class="text-center"><%=__('Lets get started')%>.</p>
      <hr/>
      <ajax-form action="signup" :syncing.sync="syncing" :cloud-error.sync="cloudError" :form-errors.sync="formErrors" :form-data="formData" :form-rules="formRules" @submitted="submittedForm()">
        <div class="form-group">
          <label for="full-name"><%=__('Full name')%></label>
          <input class="form-control" id="full-name" type="text"  :class="[formErrors.fullName ? 'is-invalid' : '']" v-model.trim="formData.fullName" placeholder="Sturgis P. Sturgeon" autocomplete="name" focus-first>
          <div class="invalid-feedback" v-if="formErrors.fullName"><%=__('Please enter your full name')%>.</div>
        </div>
        <div class="form-group">
          <label for="email-address"><%=__('Email address')%></label>
          <input class="form-control" id="email-address" type="email"  :class="[formErrors.emailAddress ? 'is-invalid' : '']" v-model.trim="formData.emailAddress" placeholder="sturgeon@example.com" autocomplete="email">
          <div class="invalid-feedback" v-if="formErrors.emailAddress"><%=__('Please enter a valid email address')%>.</div>
        </div>
        <div class="form-group">
          <label for="password"><%=__('Chose')%>&nbsp;<%=__('New password') %></label>
          <input class="form-control" id="password" type="password"  :class="[formErrors.password ? 'is-invalid' : '']" v-model.trim="formData.password" placeholder="••••••••" autocomplete="new-password">
          <div class="invalid-feedback" v-if="formErrors.password"><%=__('Please enter a password')%>.</div>
        </div>
        <div class="form-group">
          <label for="confirm-password"><%=__('Confirm password')%></label>
          <input class="form-control" id="confirm-password" type="password"  :class="[formErrors.confirmPassword ? 'is-invalid' : '']" v-model.trim="formData.confirmPassword" placeholder="••••••••" autocomplete="new-password">
          <div class="invalid-feedback" v-if="formErrors.confirmPassword"><%=__('Your new password and confirmation')%>.</div>
        </div>
        <div class="form-group form-check">
          <input class="form-check-input" id="terms-agreement" type="checkbox" v-model="formData.agreed">
          <label for="terms-agreement" class="form-check-label" :class="[formErrors.agreed ? 'text-danger' : '']"><%=__('I have read and agree to the')%> <a target="_blank" href="/terms"><%=__('Terms of service')%></a>.</label>
        </div>
        <cloud-error v-if="cloudError==='emailAlreadyInUse'"><%=__('There is already an account')%> <a href="password/forgot"> <%=__('Here')%> </a>.</cloud-error>
        <cloud-error v-else-if="cloudError"></cloud-error>
        <div class="form-group">
          <ajax-button type="submit" :syncing="syncing" class="btn-dark btn-lg btn-block"><%=__('Create an account')%></ajax-button>
        </div>
      </ajax-form>
      <p class="text-center"><%=__('Have an account')%>? <a href="/login"><%=__('Sign in')%></a></p>
    </div>
  </div>
  <div class="container-fluid pt-5 pb-5" v-if="cloudSuccess">
    <h1 class="text-center"><%=__('Check your email')%>!</h1>
    <div class="text-center">
      <hr/>
      <p><%=__('Your account is nearly ready')%>.</p>
      <p>(<%=__('You can still access your dashboard now')%>)</p>
      <p><a class="btn btn-outline-info" href="/"><%=__('Go to dashboard')%></a></p>
    </div>
  </div>
</div>
<%- /* Expose locals as `window.SAILS_LOCALS` :: */ exposeLocalsToBrowser() %>
