From 1f2eb783337021e5216684f97f0fa3f052947c6b Mon Sep 17 00:00:00 2001 From: Spacelord Date: Mon, 15 May 2023 00:21:53 +0200 Subject: [PATCH] Current state --- prisma/schema.prisma | 45 ++++++++++--------- .../manage/imports/csvImport.eta.html | 2 +- src/frontend/manage/startpage.eta.html | 27 +++++++++++ src/frontend/partials/controls.eta.html | 33 ++++++++++---- src/frontend/partials/controlsFoot.eta.html | 1 + src/index.ts | 1 - src/routes/dev/index.ts | 4 +- src/routes/dev/setDemoData.ts | 27 ----------- src/routes/frontend/manage/categoryManager.ts | 6 +-- .../frontend/manage/import/csvImport.ts | 17 +++---- src/routes/frontend/manage/index.ts | 3 ++ src/routes/frontend/manage/startpage.ts | 7 +++ static/css/dashboard.css | 6 +++ static/js/handleSidebarTriangles.js | 17 +++++++ 14 files changed, 124 insertions(+), 72 deletions(-) create mode 100644 src/frontend/manage/startpage.eta.html delete mode 100644 src/routes/dev/setDemoData.ts create mode 100644 src/routes/frontend/manage/startpage.ts create mode 100644 static/js/handleSidebarTriangles.js diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 917e1ba..86e0172 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -25,7 +25,7 @@ generator dbml { projectName = "AssetFlow" } -enum Status { +enum itemStatus { normal borrowed stolen @@ -33,16 +33,16 @@ enum Status { } model Item { - id Int @id @unique @default(autoincrement()) - SKU String? @unique - amount Int @default(1) + id Int @id @unique @default(autoincrement()) + SKU String? @unique + amount Int @default(1) name String - Comment String? - status Status @default(normal) /// TODO: Would it be better to create a separate model for this as well instead of providing several static statuses to choose from(enum)? + comment String? + status itemStatus @default(normal) /// TODO: Would it be better to create a separate model for this as well instead of providing several static statuses to choose from(enum)? - manufacturer String /// TODO: Do we need this as a mandatory field? Probably we can add another model for manufacturer. + manufacturer String - category Category @relation(fields: [categoryId], references: [id]) + category itemCategory @relation(fields: [categoryId], references: [id]) categoryId Int items Item[] @relation("items") /// Item beinhaltet.. @@ -66,17 +66,16 @@ model StorageLocation { /// A StorageUnit is the base and can hold multiple StorageLocations. model StorageUnit { - id Int @id @default(autoincrement()) - name String - street String - houseNumber String - zipCode String - city String - country String + id Int @id @default(autoincrement()) + name String + + contactInfo contactInfo? @relation(fields: [contactInfoId], references: [id]) + contactInfoId Int? + StorageLocation StorageLocation[] } -model Category { +model itemCategory { id Int @id @default(autoincrement()) name String @unique description String? @@ -84,20 +83,24 @@ model Category { } /// TODO: Add relationship to StorageUnit, Item and if necessary to StorageLocation. -model Owner { - id Int @id @default(autoincrement()) - type OwnerType @default(person) - name String +model contactInfo { + id Int @id @default(autoincrement()) + type contactType @default(person) + name String? lastName String? street String houseNumber String zipCode String city String country String + + StorageUnit StorageUnit[] } -enum OwnerType { +enum contactType { person customer company + partner + enemy } diff --git a/src/frontend/manage/imports/csvImport.eta.html b/src/frontend/manage/imports/csvImport.eta.html index 14ccdde..6cb710b 100644 --- a/src/frontend/manage/imports/csvImport.eta.html +++ b/src/frontend/manage/imports/csvImport.eta.html @@ -1,5 +1,5 @@ <%~ E.includeFile("../../partials/head.eta.html", {"title": "Importer - CSV" }) %> - <%~ E.includeFile("../../partials/controls.eta.html", {"active": "SETT_CSV_IMPORT" }) %> + <%~ E.includeFile("../../partials/controls.eta.html", {"active": "SETT_IMPORT_CSV" }) %>

Import A CSV File

Upload a CSV file to import into the database. The CSV file must have the following columns: diff --git a/src/frontend/manage/startpage.eta.html b/src/frontend/manage/startpage.eta.html new file mode 100644 index 0000000..092a7df --- /dev/null +++ b/src/frontend/manage/startpage.eta.html @@ -0,0 +1,27 @@ +<%~ E.includeFile("../partials/head.eta.html", {"title": "Settings"}) %> <%~ E.includeFile("../partials/controls.eta.html", {"active": "SETT"}) %> + +

Manage your AssetFlow instance

+ +
+ +
+ +<%~ E.includeFile("../partials/controlsFoot.eta.html") %> <%~ E.includeFile("../partials/foot.eta.html") %> diff --git a/src/frontend/partials/controls.eta.html b/src/frontend/partials/controls.eta.html index 546caa6..742e064 100644 --- a/src/frontend/partials/controls.eta.html +++ b/src/frontend/partials/controls.eta.html @@ -1,5 +1,5 @@