Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Signup.vue
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | <div class="container"> | ||||
<label for="signup_voucher" class="sr-only">Voucher code</label> | <label for="signup_voucher" class="sr-only">Voucher code</label> | ||||
<input type="text" class="form-control" id="signup_voucher" placeholder="Voucher code" v-model="voucher"> | <input type="text" class="form-control" id="signup_voucher" placeholder="Voucher code" v-model="voucher"> | ||||
</div> | </div> | ||||
<button class="btn btn-secondary" type="button" @click="stepBack">Back</button> | <button class="btn btn-secondary" type="button" @click="stepBack">Back</button> | ||||
<button class="btn btn-primary" type="submit"><svg-icon icon="check"></svg-icon> Submit</button> | <button class="btn btn-primary" type="submit"><svg-icon icon="check"></svg-icon> Submit</button> | ||||
</form> | </form> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="card d-none" id="step4"> | |||||
<div class="card-body"> | |||||
<h4 class="card-title">Sign Up - Wait for approval</h4> | |||||
<p class="card-text"> | |||||
Thank you for signing up for a {{ appName }} account. Your request now would have to be approved by us. | |||||
We'll send you an email notification when that happens. Stay tuned. | |||||
</p> | |||||
</div> | |||||
</div> | |||||
</div> | </div> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
export default { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
appName: window.config['app.name'], | |||||
email: '', | email: '', | ||||
first_name: '', | first_name: '', | ||||
last_name: '', | last_name: '', | ||||
code: '', | code: '', | ||||
short_code: '', | short_code: '', | ||||
login: '', | login: '', | ||||
password: '', | password: '', | ||||
password_confirmation: '', | password_confirmation: '', | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | export default { | ||||
code: this.code, | code: this.code, | ||||
short_code: this.short_code, | short_code: this.short_code, | ||||
login: this.login, | login: this.login, | ||||
domain: this.domain, | domain: this.domain, | ||||
password: this.password, | password: this.password, | ||||
password_confirmation: this.password_confirmation, | password_confirmation: this.password_confirmation, | ||||
voucher: this.voucher | voucher: this.voucher | ||||
}).then(response => { | }).then(response => { | ||||
if (response.data.access_token) { | |||||
// auto-login and goto dashboard | // auto-login and goto dashboard | ||||
this.$root.loginUser(response.data) | this.$root.loginUser(response.data) | ||||
} else { | |||||
// display confirmation (step 4 - waiting for approval) | |||||
this.displayForm(4) | |||||
} | |||||
}) | }) | ||||
}, | }, | ||||
// Moves the user a step back in registration form | // Moves the user a step back in registration form | ||||
stepBack(e) { | stepBack(e) { | ||||
var card = $(e.target).closest('.card') | var card = $(e.target).closest('.card') | ||||
card.prev().removeClass('d-none').find('input').first().focus() | card.prev().removeClass('d-none').find('input').first().focus() | ||||
card.addClass('d-none').find('form')[0].reset() | card.addClass('d-none').find('form')[0].reset() | ||||
if (card.attr('id') == 'step1') { | if (card.attr('id') == 'step1') { | ||||
this.step0() | this.step0() | ||||
this.$router.replace({path: '/signup'}) | this.$router.replace({path: '/signup'}) | ||||
} | } | ||||
}, | }, | ||||
displayForm(step, focus) { | displayForm(step, focus) { | ||||
[0, 1, 2, 3].filter(value => value != step).forEach(value => { | [0, 1, 2, 3, 4].filter(value => value != step).forEach(value => { | ||||
$('#step' + value).addClass('d-none') | $('#step' + value).addClass('d-none') | ||||
}) | }) | ||||
if (!step) { | if (!step) { | ||||
return this.step0() | return this.step0() | ||||
} | } | ||||
$('#step' + step).removeClass('d-none') | $('#step' + step).removeClass('d-none') | ||||
if (focus) { | if (focus) { | ||||
$('#step' + step).find('input').first().focus() | $('#step' + step).find('input').first().focus() | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
</script> | </script> |