Create OrdersPage, load orders from backend, move NavDrawer items to Component

This commit is contained in:
2024-09-11 20:49:55 +02:00
parent 55fd203c7f
commit 8594763fa6
34 changed files with 361 additions and 178 deletions

View File

@@ -0,0 +1,49 @@
<script setup lang="ts">
import { useUserStore } from '@/data/stores/userStore';
import axios from 'axios';
import { ref } from 'vue';
const userStore = useUserStore()
const orders = ref([])
axios.get("http://127.0.0.1:3000/orders", {
params: {
accountId: userStore.userAccountId
}
})
.then(res => {
orders.value = res.data
})
</script>
<template>
<v-container>
<v-row v-for="order in orders">
<v-col>
<v-card
:title="'Bestellung vom ' + order.createdAt"
:subtitle="$t('totalPrice') + ': ' + order.totalPrice + ' €'"
>
<v-table>
<thead>
<tr>
<th>{{ $t('quantity') }}</th>
<th>{{ $t('product.brand') }}</th>
<th>{{ $t('product.productName') }}</th>
<th>{{ $t('product.productPrice') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="orderItem in order.orderItem">
<td>{{ orderItem.quantity }}x</td>
<td>{{ orderItem.product.brand }}</td>
<td>{{ orderItem.product.name }}</td>
<td>{{ orderItem.product.price }} </td>
</tr>
</tbody>
</v-table>
</v-card>
</v-col>
</v-row>
</v-container>
</template>