Setting fo ri18n-ally, progress stepper on order page

This commit is contained in:
2024-09-12 18:38:56 +02:00
parent 0c20ef4366
commit 5134a9df31
12 changed files with 94 additions and 25 deletions

1
.gitignore vendored
View File

@@ -18,7 +18,6 @@ coverage
/cypress/screenshots/ /cypress/screenshots/
# Editor directories and files # Editor directories and files
.vscode/*
!.vscode/extensions.json !.vscode/extensions.json
.idea .idea
*.suo *.suo

15
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,15 @@
{
"i18n-ally.localesPaths": "software/src/locales",
"i18n-ally.regex.key": ".*?",
"i18n-ally.sourceLanguage": "en",
"i18n-ally.keysInUse": [
"date.long.*",
"yeah"
],
"i18n-ally.includeSubfolders": true,
"i18n-ally.dirStructure": "auto",
"i18n-ally.enabledFrameworks": [
"vue"
],
"i18n-ally.keystyle": "nested"
}

View File

@@ -3,17 +3,22 @@
{ {
"id": 0, "id": 0,
"accountId": 0, "accountId": 0,
"totalPrice": 0 "totalPrice": 0,
"shippingProgress": 4
}, },
{ {
"id": 1, "id": 1,
"accountId": 3, "accountId": 3,
"totalPrice": 0 "totalPrice": 7.99,
"shippingProgress": 5,
"createdAt": "2024-09-09 12:24:24.225 +00:00"
}, },
{ {
"id": 2, "id": 2,
"accountId": 3, "accountId": 3,
"totalPrice": 0 "totalPrice": 44.96,
"shippingProgress": 2,
"createdAt": "2024-09-12 09:57:24.225 +00:00"
} }
] ]
} }

View File

@@ -11,6 +11,9 @@ export class Order extends Model {
@Column @Column
totalPrice: number totalPrice: number
@Column
shippingProgress: number = 1
// Relations // Relations
@BelongsTo(() => Account) @BelongsTo(() => Account)

View File

@@ -1,6 +1,5 @@
{ {
"menu": "menu": {
{
"shopping": "Einkaufen", "shopping": "Einkaufen",
"products": "Produkte", "products": "Produkte",
"basket": "Warenkorb", "basket": "Warenkorb",
@@ -36,8 +35,14 @@
"emptyBasketTitle": "Keine Artikel im Warenkorb", "emptyBasketTitle": "Keine Artikel im Warenkorb",
"emptyBasketText": "Gehe zu unseren Produkten und lege Artikel in den Warenkorb", "emptyBasketText": "Gehe zu unseren Produkten und lege Artikel in den Warenkorb",
"totalPrice": "Gesamtpreis", "totalPrice": "Gesamtpreis",
"orderNow": "Jetzt bestellen", "orderNow": "Jetzt bestellen",
"orders": {
"orderFrom": "Bestellung vom",
"ordered": "Bestellt",
"preparingForShipping": "Versandvorbereitung",
"shipped": "Versendet",
"delivered": "Geliefert"
},
"userInfo": { "userInfo": {
"firstName": "Vorname", "firstName": "Vorname",
"lastName": "Nachname", "lastName": "Nachname",
@@ -46,7 +51,6 @@
"postalCode": "Postleitzahl", "postalCode": "Postleitzahl",
"city": "Stadt" "city": "Stadt"
}, },
"account": { "account": {
"username": "Username", "username": "Username",
"password": "Passwort", "password": "Passwort",
@@ -54,11 +58,11 @@
"register": "Account erstellen", "register": "Account erstellen",
"backToLogin": "Zurück zum Login" "backToLogin": "Zurück zum Login"
}, },
"bannerMessages": { "bannerMessages": {
"loginSuccessful": "Login erfolgreich!", "loginSuccessful": "Login erfolgreich!",
"wrongLogin": "Falscher Username oder falsches Passwort!", "wrongLogin": "Falscher Username oder falsches Passwort!",
"error": "Es ist ein Fehler aufgetreten...", "error": "Es ist ein Fehler aufgetreten...",
"databaseResetSuccessful": "Datenbank erfolgreich zurück gesetzt!" "databaseResetSuccessful": "Datenbank erfolgreich zurück gesetzt!"
} },
} "oclock": "Uhr"
}

View File

@@ -36,7 +36,13 @@
"emptyBasketText": "Go to our products and add some of them to the basket", "emptyBasketText": "Go to our products and add some of them to the basket",
"totalPrice": "Total price", "totalPrice": "Total price",
"orderNow": "Order now", "orderNow": "Order now",
"orders": {
"orderFrom": "Order from",
"ordered": "Ordered",
"preparingForShipping": "Preparing for shipping",
"shipped": "Shipped",
"delivered": "Delivered"
},
"userInfo": { "userInfo": {
"firstName": "First Name", "firstName": "First Name",
"lastName": "Family Name", "lastName": "Family Name",
@@ -45,7 +51,6 @@
"postalCode": "Postal Code", "postalCode": "Postal Code",
"city": "City" "city": "City"
}, },
"account": { "account": {
"backToLogin": "Back to Login", "backToLogin": "Back to Login",
"username": "Username", "username": "Username",
@@ -53,11 +58,11 @@
"noAccountRegister": "Create new Account!", "noAccountRegister": "Create new Account!",
"register": "Create Account" "register": "Create Account"
}, },
"bannerMessages": { "bannerMessages": {
"loginSuccessful": "Login erfolgreich!", "loginSuccessful": "Login erfolgreich!",
"wrongLogin": "Falscher Username oder falsches Passwort!", "wrongLogin": "Falscher Username oder falsches Passwort!",
"error": "Some error occurred...", "error": "Some error occurred...",
"databaseResetSuccessful": "Database reset successful!" "databaseResetSuccessful": "Database reset successful!"
} },
} "oclock": "o'clock"
}

View File

@@ -2,5 +2,5 @@
</script> </script>
<template> <template>
Account Account Page
</template> </template>

View File

@@ -99,12 +99,12 @@ function registerUser() {
<template #actions> <template #actions>
<v-btn prepend-icon="mdi-arrow-left" color="primary" variant="outlined" <v-btn prepend-icon="mdi-arrow-left" color="primary" variant="outlined"
@click="showRegisterCard = false"> @click="showRegisterCard = false">
{{ $t('backToLogin') }} {{ $t('account.backToLogin') }}
</v-btn> </v-btn>
<v-spacer /> <v-spacer />
<v-btn prepend-icon="mdi-account-plus" color="primary" variant="outlined" <v-btn prepend-icon="mdi-account-plus" color="primary" variant="outlined"
@click="registerUser"> @click="registerUser">
{{ $t('register') }} {{ $t('account.register') }}
</v-btn> </v-btn>
</template> </template>
</v-card> </v-card>

View File

@@ -14,6 +14,26 @@ axios.get("http://127.0.0.1:3000/orders", {
.then(res => { .then(res => {
orders.value = res.data orders.value = res.data
}) })
function getDotColor(order, step: number) {
if (order.shippingProgress == step)
{
return "orange"
} else if (order.shippingProgress >= step)
{
return "green"
} else
{
return "grey"
}
}
function formatDateTimeString(string: string) {
let date = new Date(string)
return date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getFullYear() + ', ' +
date.getHours() + ':' + date.getMinutes()
}
</script> </script>
<template> <template>
@@ -21,10 +41,28 @@ axios.get("http://127.0.0.1:3000/orders", {
<v-row v-for="order in orders"> <v-row v-for="order in orders">
<v-col> <v-col>
<v-card <v-card
:title="'Bestellung vom ' + order.createdAt" :title="$t('orders.orderFrom') + ' ' + formatDateTimeString(order.createdAt) + ' ' + $t('oclock')"
:subtitle="$t('totalPrice') + ': ' + order.totalPrice + ' €'" :subtitle="$t('totalPrice') + ': ' + order.totalPrice + ' €'"
> >
<v-table> <v-timeline direction="horizontal" side="start">
<v-timeline-item :dot-color="getDotColor(order, 1)" icon="mdi-basket-check">
{{ $t('orders.ordered') }}
</v-timeline-item>
<v-timeline-item :dot-color="getDotColor(order, 2)" icon="mdi-package-variant">
{{ $t('orders.preparingForShipping') }}
</v-timeline-item>
<v-timeline-item :dot-color="getDotColor(order, 3)" icon="mdi-truck-fast">
{{ $t('orders.shipped') }}
</v-timeline-item>
<v-timeline-item :dot-color="getDotColor(order, 4)" icon="mdi-package-check">
{{ $t('orders.delivered') }}
</v-timeline-item>
</v-timeline>
<v-table class="bg-surface-light">
<thead> <thead>
<tr> <tr>
<th>{{ $t('quantity') }}</th> <th>{{ $t('quantity') }}</th>

View File

@@ -1,6 +1,6 @@
import { createI18n } from "vue-i18n"; import { createI18n } from "vue-i18n";
import german from './../locales/german.json' import german from './../locales/de.json'
import english from './../locales/english.json' import english from './../locales/en.json'
type MessageSchema = typeof german type MessageSchema = typeof german

View File

@@ -1,4 +1,4 @@
import AccountPage from "@/pages/AccountPage.vue"; import AccountPage from "@/pages/accountPage/index.vue";
import OrdersPage from "@/pages/ordersPage/index.vue"; import OrdersPage from "@/pages/ordersPage/index.vue";
import PreferencesPage from "@/pages/preferencesPage/index.vue"; import PreferencesPage from "@/pages/preferencesPage/index.vue";
import ProductsPage from "@/pages/productsPage/index.vue"; import ProductsPage from "@/pages/productsPage/index.vue";