4 Commits

Author SHA1 Message Date
85ccc7523f Merge branch 'master' into AFLOW-36-project-support 2023-11-01 20:08:24 +01:00
adc466e09a removed dots 2023-08-27 18:56:39 +02:00
ddb484cac9 inital UI work on AFLOW-40 2023-07-11 17:00:34 +02:00
cd37f096ca Inital work on AFLOW-37 2023-07-11 16:38:18 +02:00
7 changed files with 121 additions and 7 deletions

View File

@@ -38,7 +38,7 @@ model Item {
SKU String? @unique
amount Int @default(1)
name String
comment String? @db.VarChar(2048)
comment String? @db.VarChar(2048)
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)?
contactInfo contactInfo? @relation(fields: [contactInfoId], references: [id])
@@ -55,8 +55,8 @@ model Item {
storageLocation StorageLocation? @relation(fields: [storageLocationId], references: [id])
storageLocationId Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdBy String?
}
@@ -99,6 +99,21 @@ model contactInfo {
StorageUnit StorageUnit[]
Item Item[]
project project[]
projectAssignedUsers project[] @relation("projectAssignedUsers")
}
model project {
id Int @id @default(autoincrement())
name String @unique
description String? @db.VarChar(2048)
// People
manager contactInfo? @relation(fields: [contactInfoId], references: [id]) // Primary, manager of the project
assignedUsers contactInfo[] @relation("projectAssignedUsers") // Secondary, assigned users to the project, stagehands, etc.
contactInfoId Int?
// When does it start and end
startTime DateTime?
endTime DateTime?
}
/// TODO: Allow multiple types to be used?

View File

@@ -81,15 +81,37 @@
</li> -->
</ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
<a href="/projects/" class="nav-link"
>Projects<span class="badge rounded-pill bg-primary" >
Alpha
<span class="visually-hidden">Alpha feature</span>
</span>
</a>
</h6>
<ul class="nav flex-column mb-2">
<li class="nav-item">
<a class="nav-link <%= it.active == 'PROJ_HOME' ? 'active' : ''%>" href="/projects/"><i class="bi bi-kanban"></i> Manage Projects </a>
</li>
<li class="nav-item">
<a class="nav-link <%= it.active == 'PROJ_LIST' ? 'active' : ''%>" href="/projects/lists"><i class="bi bi-card-checklist"></i> Packaging Lists </a>
</li>
<li class="nav-item">
<a class="nav-link <%= it.active == 'PROJ_PEPS' ? 'active' : ''%>" href="/projects/people"><i class="bi bi-people-fill"></i> People </a>
</li>
</ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
<a href="/manage/" class="nav-link"
>Settings
<span class="badge rounded-pill bg-danger invisible">
2
<span class="badge rounded-pill bg-danger invisible" id="notifcationInfo">
1
<span class="visually-hidden">changes or updates</span>
</span>
</a>
</h6>
<ul class="nav flex-column mb-2">
<a class="nav-link <%= it.active == 'SETT_STORE' ? 'active' : ''%>" href="/manage/storages"
@@ -187,6 +209,11 @@
dataType: 'json',
success: function (data) {
$('#versionInfo').text(`AssetFlow Alpha ${data.version} ${data.commit}`);
if(data.updateAvailable ){
$('#notifcationInfo').show();
} else {
$('#notifcationInfo').hide();
}
},
error: function (data) {
createNewToast('<i class="bi bi-exclamation-triangle-fill"></i> Unable to load version information', "text-bg-danger", 3000, false)

View File

@@ -0,0 +1,49 @@
<%~ E.includeFile("../partials/head.eta.html", {"title": "Projects"}) %> <%~ E.includeFile("../partials/controls.eta.html", {"active": "PROJ_HOME"}) %>
<h1>Projectmanager</h1>
<div class="container text-center">
<div class="row">
<a class="card col m-2" href="/manage/categories">
<div class="card-body">
<h1 class="card-title"><i class="bi bi-tag"></i></h1>
<p class="card-text">Manage categories</p>
</div>
</a>
<a class="card col m-2" href="/manage/storages">
<div class="card-body">
<h1 class="card-title"><i class="bi bi-box-seam"></i></h1>
<p class="card-text">Manage storages</p>
</div>
</a>
<a class="card col m-2" href="/manage/import/csv">
<div class="card-body">
<h1 class="card-title"><i class="bi bi-filetype-csv"></i></h1>
<p class="card-text">Import data via CSV</p>
</div>
</a>
<a class="card col m-2" href="/manage/import/json">
<div class="card-body">
<h1 class="card-title"><i class="bi bi-filetype-json"></i></h1>
<p class="card-text">Import data via JSON</p>
</div>
</a>
</div>
</div>
<h2>Recent projects</h2>
<div class="container">
<table class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Status</th>
<!--<th scope="col">Actions</th>-->
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<%~ E.includeFile("../partials/controlsFoot.eta.html") %> <%~ E.includeFile("../partials/foot.eta.html") %>

View File

@@ -7,6 +7,7 @@ import testRoute from './test.js';
import dashboardRoute from './dashboard.js';
import itemsRoute from './items.js';
import manage_routes from './manage/index.js';
import project_routes from './projects/index.js';
// Router base is '/'
const Router = express.Router({ strict: false });
@@ -14,11 +15,13 @@ const Router = express.Router({ strict: false });
Router.route('/test').get(testRoute.get);
Router.route('/items').get(itemsRoute.get);
Router.route('/:id(\\w{8})').get(skuRoute.get);
Router.use('/projects', project_routes); // has to be before skuRoute
Router.route('/:id(\\w{8})').get(skuRoute.get); // we should probably deprecate this
Router.route('/s/:id').get(skuRouteDash.get);
Router.use('/manage', manage_routes);
Router.route('/').get(dashboardRoute.get);
export default Router;

View File

@@ -8,7 +8,7 @@ function post(req: Request, res: Response) {
// Handle file upload and import
console.log(req.files);
if (!req.files || Object.keys(req.files).length === 0) {
return res.status(400).send('No files were uploaded.');
return res.status(400).send('No files were uploaded');
}
const file: UploadedFile = req.files.formFile as UploadedFile;

View File

@@ -0,0 +1,9 @@
import express, { Request, Response } from 'express';
import { prisma, __path, log } from '../../../index.js';
function get(req: Request, res: Response) {
res.render(__path + '/src/frontend/projects/dashboard.eta.html');
}
export default { get };

View File

@@ -0,0 +1,11 @@
import express from 'express';
// Route imports
import dashboard from './dashboard.js';
// Router base is '/manage'
const Router = express.Router({ strict: false });
Router.route('/').get(dashboard.get);
export default Router;