Admin Order Page, refresh ERM diagram of database
This commit is contained in:
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 356 KiB After Width: | Height: | Size: 390 KiB |
@@ -2,6 +2,7 @@
|
|||||||
"orders": [
|
"orders": [
|
||||||
{
|
{
|
||||||
"username": "hagemeister93",
|
"username": "hagemeister93",
|
||||||
|
"shipped": true,
|
||||||
"tickets": [
|
"tickets": [
|
||||||
{
|
{
|
||||||
"date": "2024-10-18",
|
"date": "2024-10-18",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AutoIncrement, Column, ForeignKey, Model, PrimaryKey, Table, Unique } from "sequelize-typescript";
|
import { Column, ForeignKey, Model, PrimaryKey, Table } from "sequelize-typescript";
|
||||||
import { Genre } from "./genre.model";
|
import { Genre } from "./genre.model";
|
||||||
import { Band } from "./band.model";
|
import { Band } from "./band.model";
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,35 @@ import { City } from "../models/locations/city.model";
|
|||||||
import { Seat } from "../models/locations/seat.model";
|
import { Seat } from "../models/locations/seat.model";
|
||||||
import { SeatRow } from "../models/locations/seatRow.model";
|
import { SeatRow } from "../models/locations/seatRow.model";
|
||||||
import { SeatGroup } from "../models/locations/seatGroup.model";
|
import { SeatGroup } from "../models/locations/seatGroup.model";
|
||||||
|
import { Account } from "../models/user/account.model";
|
||||||
|
|
||||||
export const order = Router()
|
export const order = Router()
|
||||||
|
|
||||||
// Get all orders
|
// Get all orders
|
||||||
order.get("/", (req: Request, res: Response) => {
|
order.get("/", (req: Request, res: Response) => {
|
||||||
Order.findAll()
|
Order.findAll({
|
||||||
|
include: [
|
||||||
|
Account,
|
||||||
|
Address,
|
||||||
|
{
|
||||||
|
model: Ticket,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
model: Concert,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
model: Band
|
||||||
|
},
|
||||||
|
{
|
||||||
|
model: Location,
|
||||||
|
include: [ City ]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
.then(orders => {
|
.then(orders => {
|
||||||
res.status(200).json(orders)
|
res.status(200).json(orders)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
export class OrderModel {
|
export class OrderModel {
|
||||||
id: number
|
id: number
|
||||||
accountId: number
|
|
||||||
orderedAt: string
|
orderedAt: string
|
||||||
addressId: number
|
|
||||||
paymentId: number
|
|
||||||
shipped: boolean
|
shipped: boolean
|
||||||
}
|
}
|
||||||
67
software/src/pages/admin/ordersAdminPage/index.vue
Normal file
67
software/src/pages/admin/ordersAdminPage/index.vue
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import adminDataLayout from '@/layouts/adminDataLayout.vue';
|
||||||
|
import { useOrderStore } from '@/stores/order.store';
|
||||||
|
import moment from 'moment';
|
||||||
|
import { title } from 'process';
|
||||||
|
|
||||||
|
const orderStore = useOrderStore()
|
||||||
|
|
||||||
|
const headers = [
|
||||||
|
{ title: "Account", value: "account.username" },
|
||||||
|
{ title: "Name", value: "account" },
|
||||||
|
{ title: "Bestellt am", value: "orderedAt" },
|
||||||
|
{ title: "Adresse", value: "street" },
|
||||||
|
{ title: "Stadt", value: "city" },
|
||||||
|
{ title: "Versendet", value: "shipped" },
|
||||||
|
{ title: "", value: "edit", width: 130 }
|
||||||
|
]
|
||||||
|
|
||||||
|
orderStore.getAllOrders()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<admin-data-layout>
|
||||||
|
<v-data-table
|
||||||
|
:headers="headers"
|
||||||
|
:items="orderStore.orders"
|
||||||
|
>
|
||||||
|
<template #item.account="{ item }">
|
||||||
|
{{ item.account.firstName }} {{ item.account.lastName }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #item.orderedAt="{ item }">
|
||||||
|
{{ moment(item.orderedAt).format("DD.MM.YYYY, HH:mm:ss") }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #item.street="{ item }">
|
||||||
|
{{ item.address.street }} {{ item.address.houseNumber }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #item.city="{ item }">
|
||||||
|
{{ item.address.postalCode }} {{ item.address.city }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #item.shipped="{ item }">
|
||||||
|
<v-icon
|
||||||
|
:icon="item.shipped ? 'mdi-check' : 'mdi-close'"
|
||||||
|
:color="item.shipped ? 'green' : 'red'"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #item.edit="{ item }">
|
||||||
|
<v-btn
|
||||||
|
icon="mdi-eye"
|
||||||
|
variant="plain"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<v-btn
|
||||||
|
icon="mdi-delete"
|
||||||
|
variant="plain"
|
||||||
|
color="red"
|
||||||
|
@click="orderStore.deleteOrder(item)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</v-data-table>
|
||||||
|
</admin-data-layout>
|
||||||
|
</template>
|
||||||
@@ -5,6 +5,7 @@ import AccountsAdminPage from "@/pages/admin/accountsAdminPage/index.vue"
|
|||||||
import GenresAdminPage from "@/pages/admin/genresAdminPage/index.vue"
|
import GenresAdminPage from "@/pages/admin/genresAdminPage/index.vue"
|
||||||
import LocationsAdminPage from "@/pages/admin/locationsAdminPage/index.vue"
|
import LocationsAdminPage from "@/pages/admin/locationsAdminPage/index.vue"
|
||||||
import FilesAdminPage from "@/pages/admin/filesAdminPage/index.vue"
|
import FilesAdminPage from "@/pages/admin/filesAdminPage/index.vue"
|
||||||
|
import OrdersAdminPage from "@/pages/admin/ordersAdminPage/index.vue"
|
||||||
|
|
||||||
export const adminRoutes = [
|
export const adminRoutes = [
|
||||||
{
|
{
|
||||||
@@ -34,5 +35,9 @@ export const adminRoutes = [
|
|||||||
{
|
{
|
||||||
path: '/admin/files',
|
path: '/admin/files',
|
||||||
component: FilesAdminPage
|
component: FilesAdminPage
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/admin/orders',
|
||||||
|
component: OrdersAdminPage
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -34,6 +34,10 @@ export const useOrderStore = defineStore("orderStore", {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
this.orders = res.data
|
this.orders = res.data
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
async deleteOrder(order: OrderApiModel) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user