Bugfix order process/account update
This commit is contained in:
@@ -4,6 +4,8 @@ import { useBasketStore } from '@/stores/basket.store';
|
||||
import outlinedButton from '@/components/basics/outlinedButton.vue';
|
||||
import { ModelRef, ref } from 'vue';
|
||||
import { useAccountStore } from '@/stores/account.store';
|
||||
import { AddressModel } from '@/data/models/user/addressModel';
|
||||
import { PaymentModel } from '@/data/models/user/paymentModel';
|
||||
|
||||
const basketStore = useBasketStore()
|
||||
const accountStore = useAccountStore()
|
||||
@@ -32,6 +34,20 @@ async function doOrder() {
|
||||
|
||||
orderingInProgress.value = false
|
||||
}
|
||||
|
||||
function addressItemProps(item: AddressModel) {
|
||||
return {
|
||||
title: item.street + " " + item.houseNumber,
|
||||
subtitle: item.postalCode + " " + item.city
|
||||
}
|
||||
}
|
||||
|
||||
function paymentItemProps(item: PaymentModel) {
|
||||
return {
|
||||
title: item.bankName,
|
||||
subtitle: item.iban
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -42,64 +58,33 @@ async function doOrder() {
|
||||
max-width="800"
|
||||
persistent
|
||||
>
|
||||
<v-radio-group class="pa-0" v-model="basketStore.usedAddress">
|
||||
<v-list-subheader>
|
||||
{{ $t('account.userData.address', accountStore.userAccount.addresses.length) }}
|
||||
</v-list-subheader>
|
||||
|
||||
<v-list-item
|
||||
v-for="address in accountStore.userAccount.addresses"
|
||||
>
|
||||
|
||||
<v-list-item-title>
|
||||
<v-radio :label="address.street + '' + address.houseNumber" />
|
||||
</v-list-item-title>
|
||||
|
||||
<v-list-item-subtitle>
|
||||
{{ address.postalCode }} {{ address.city }}
|
||||
</v-list-item-subtitle>
|
||||
|
||||
<!-- <v-radio-group
|
||||
v-model="basketStore.usedAddress"
|
||||
:error="addressError"
|
||||
>
|
||||
<v-radio
|
||||
v-for="address in accountStore.userAccount.addresses"
|
||||
:value="address"
|
||||
:label="address.street + ' ' + address.houseNumber + ', ' + address.postalCode + ' ' + address.city"
|
||||
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-select
|
||||
v-model="basketStore.usedAddress"
|
||||
:items="accountStore.userAccount.addresses"
|
||||
:item-props="addressItemProps"
|
||||
:label="$t('account.userData.address')"
|
||||
variant="outlined"
|
||||
hide-details
|
||||
/>
|
||||
</v-radio-group> -->
|
||||
</v-list-item>
|
||||
</v-radio-group>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-list>
|
||||
<v-list-subheader>
|
||||
{{ $t('account.userData.payment', accountStore.userAccount.payments.length) }}
|
||||
</v-list-subheader>
|
||||
|
||||
<v-list-item v-for="payment in accountStore.userAccount.payments">
|
||||
<template #prepend="{ isActive }">
|
||||
<v-list-item-action start>
|
||||
<v-radio :model-value="isActive" />
|
||||
</v-list-item-action>
|
||||
</template>
|
||||
|
||||
<v-list-item-title>{{ payment.bankName }}</v-list-item-title>
|
||||
|
||||
<v-list-item-subtitle>{{ payment.iban }}</v-list-item-subtitle>
|
||||
<!-- <v-radio-group
|
||||
v-model="basketStore.usedPayment"
|
||||
>
|
||||
<v-radio
|
||||
|
||||
:value="payment"
|
||||
:label="payment.bankName + ': ' + payment.iban"
|
||||
:error="paymentError"
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-select
|
||||
v-model="basketStore.usedPayment"
|
||||
:items="accountStore.userAccount.payments"
|
||||
:item-props="paymentItemProps"
|
||||
:label="$t('account.userData.payment')"
|
||||
variant="outlined"
|
||||
hide-details
|
||||
/>
|
||||
</v-radio-group> -->
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<template #actions>
|
||||
<outlined-button
|
||||
|
||||
@@ -49,137 +49,135 @@ watch(() => currentStep.value, () => {
|
||||
max-width="800"
|
||||
persistent
|
||||
>
|
||||
<template #borderless>
|
||||
<v-stepper
|
||||
v-model="currentStep"
|
||||
alt-labels
|
||||
flat
|
||||
>
|
||||
<template #default="{ prev, next}">
|
||||
<!-- Header items -->
|
||||
<v-stepper-header>
|
||||
<template v-for="(step, n) in steps">
|
||||
<v-stepper-item
|
||||
:complete="currentStep > n + 1"
|
||||
:title="step"
|
||||
:value="n + 1"
|
||||
complete-icon="mdi-check"
|
||||
color="green"
|
||||
/>
|
||||
<v-stepper
|
||||
v-model="currentStep"
|
||||
alt-labels
|
||||
flat
|
||||
>
|
||||
<template #default="{ prev, next }">
|
||||
<!-- Header items -->
|
||||
<v-stepper-header>
|
||||
<template v-for="(step, n) in steps">
|
||||
<v-stepper-item
|
||||
:complete="currentStep > n + 1"
|
||||
:title="step"
|
||||
:value="n + 1"
|
||||
complete-icon="mdi-check"
|
||||
color="green"
|
||||
/>
|
||||
|
||||
<v-divider v-if="n < steps.length - 1" />
|
||||
</template>
|
||||
</v-stepper-header>
|
||||
<v-divider v-if="n < steps.length - 1" />
|
||||
</template>
|
||||
</v-stepper-header>
|
||||
|
||||
|
||||
<!-- Content -->
|
||||
<v-stepper-window>
|
||||
<v-stepper-window-item
|
||||
:value="1"
|
||||
class="text-h4 text-center"
|
||||
>
|
||||
<div>
|
||||
{{ $t('preferences.serverState') }}:
|
||||
</div>
|
||||
|
||||
<server-state-text />
|
||||
</v-stepper-window-item>
|
||||
|
||||
<v-stepper-window-item
|
||||
:value="2"
|
||||
>
|
||||
<div v-if="preferencesStore.fetchInProgress" class="text-center text-h4 pb-4">
|
||||
<div class="pb-4">
|
||||
{{ $t('misc.firstStartup.createDatabase') }}
|
||||
</div>
|
||||
|
||||
<v-progress-linear indeterminate />
|
||||
</div>
|
||||
|
||||
<div v-else class="text-center text-h4 pb-4 text-green">
|
||||
<v-icon icon="mdi-check" /> {{ $t('misc.firstStartup.finished') }}
|
||||
</div>
|
||||
</v-stepper-window-item>
|
||||
|
||||
|
||||
<v-stepper-window-item
|
||||
:value="3"
|
||||
>
|
||||
<div v-if="preferencesStore.fetchInProgress" class="text-center text-h4 pb-4">
|
||||
<div class="pb-4">
|
||||
{{ $t('misc.firstStartup.createExercises') }}
|
||||
</div>
|
||||
|
||||
<v-progress-linear indeterminate />
|
||||
</div>
|
||||
|
||||
<div v-else class="text-center text-h4 pb-4 text-green">
|
||||
<v-icon icon="mdi-check" /> {{ $t('misc.firstStartup.finished') }}
|
||||
</div>
|
||||
</v-stepper-window-item>
|
||||
|
||||
|
||||
<v-stepper-window-item
|
||||
:value="4"
|
||||
>
|
||||
<v-container class="px-0 py-2">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
variant="outlined"
|
||||
hide-details
|
||||
:label="$t('misc.yourFullName')"
|
||||
v-model="preferencesStore.studentName"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
variant="outlined"
|
||||
hide-details
|
||||
:label="$t('misc.registrationNumber')"
|
||||
v-model="preferencesStore.registrationNumber"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-stepper-window-item>
|
||||
</v-stepper-window>
|
||||
|
||||
|
||||
<!-- Next/Previous buttons -->
|
||||
<v-stepper-actions
|
||||
@click:next="next"
|
||||
<!-- Content -->
|
||||
<v-stepper-window>
|
||||
<v-stepper-window-item
|
||||
:value="1"
|
||||
class="text-h4 text-center"
|
||||
>
|
||||
<template #prev="{ props }">
|
||||
<v-spacer />
|
||||
</template>
|
||||
<div>
|
||||
{{ $t('preferences.serverState') }}:
|
||||
</div>
|
||||
|
||||
<template #next="{ props }">
|
||||
<outlined-button
|
||||
v-if="currentStep < 4"
|
||||
@click="props.onClick()"
|
||||
:disabled="preferencesStore.fetchInProgress"
|
||||
>
|
||||
{{ $t('misc.actions.next') }}
|
||||
</outlined-button>
|
||||
<server-state-text />
|
||||
</v-stepper-window-item>
|
||||
|
||||
<outlined-button
|
||||
v-else
|
||||
@click="showDialog = false; preferencesStore.firstStartup = false"
|
||||
:disabled="preferencesStore.studentName.length == 0 ||
|
||||
preferencesStore.registrationNumber.length == 0"
|
||||
prepend-icon="mdi-check"
|
||||
color="green"
|
||||
>
|
||||
{{ $t('misc.firstStartup.complete') }}
|
||||
</outlined-button>
|
||||
</template>
|
||||
</v-stepper-actions>
|
||||
</template>
|
||||
</v-stepper>
|
||||
</template>
|
||||
<v-stepper-window-item
|
||||
:value="2"
|
||||
>
|
||||
<div v-if="preferencesStore.fetchInProgress" class="text-center text-h4 pb-4">
|
||||
<div class="pb-4">
|
||||
{{ $t('misc.firstStartup.createDatabase') }}
|
||||
</div>
|
||||
|
||||
<v-progress-linear indeterminate />
|
||||
</div>
|
||||
|
||||
<div v-else class="text-center text-h4 pb-4 text-green">
|
||||
<v-icon icon="mdi-check" /> {{ $t('misc.firstStartup.finished') }}
|
||||
</div>
|
||||
</v-stepper-window-item>
|
||||
|
||||
|
||||
<v-stepper-window-item
|
||||
:value="3"
|
||||
>
|
||||
<div v-if="preferencesStore.fetchInProgress" class="text-center text-h4 pb-4">
|
||||
<div class="pb-4">
|
||||
{{ $t('misc.firstStartup.createExercises') }}
|
||||
</div>
|
||||
|
||||
<v-progress-linear indeterminate />
|
||||
</div>
|
||||
|
||||
<div v-else class="text-center text-h4 pb-4 text-green">
|
||||
<v-icon icon="mdi-check" /> {{ $t('misc.firstStartup.finished') }}
|
||||
</div>
|
||||
</v-stepper-window-item>
|
||||
|
||||
|
||||
<v-stepper-window-item
|
||||
:value="4"
|
||||
>
|
||||
<v-container class="px-0 py-2">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
variant="outlined"
|
||||
hide-details
|
||||
:label="$t('misc.yourFullName')"
|
||||
v-model="preferencesStore.studentName"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
variant="outlined"
|
||||
hide-details
|
||||
:label="$t('misc.registrationNumber')"
|
||||
v-model="preferencesStore.registrationNumber"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-stepper-window-item>
|
||||
</v-stepper-window>
|
||||
|
||||
|
||||
<!-- Next/Previous buttons -->
|
||||
<v-stepper-actions
|
||||
@click:next="next"
|
||||
>
|
||||
<template #prev="{ props }">
|
||||
<v-spacer />
|
||||
</template>
|
||||
|
||||
<template #next="{ props }">
|
||||
<outlined-button
|
||||
v-if="currentStep < 4"
|
||||
@click="props.onClick()"
|
||||
:disabled="preferencesStore.fetchInProgress"
|
||||
>
|
||||
{{ $t('misc.actions.next') }}
|
||||
</outlined-button>
|
||||
|
||||
<outlined-button
|
||||
v-else
|
||||
@click="showDialog = false; preferencesStore.firstStartup = false"
|
||||
:disabled="preferencesStore.studentName.length == 0 ||
|
||||
preferencesStore.registrationNumber.length == 0"
|
||||
prepend-icon="mdi-check"
|
||||
color="green"
|
||||
>
|
||||
{{ $t('misc.firstStartup.complete') }}
|
||||
</outlined-button>
|
||||
</template>
|
||||
</v-stepper-actions>
|
||||
</template>
|
||||
</v-stepper>
|
||||
</action-dialog>
|
||||
</template>
|
||||
Reference in New Issue
Block a user