diff --git a/matsen-tool/src/app/_forms/apiForms.ts b/matsen-tool/src/app/_forms/apiForms.ts
index 0f7d13e..6de0bf9 100644
--- a/matsen-tool/src/app/_forms/apiForms.ts
+++ b/matsen-tool/src/app/_forms/apiForms.ts
@@ -213,6 +213,46 @@ export const productJsonldForm = new FormGroup({
createdAt: new FormControl(null, [])
});
+export const taskForm = new FormGroup({
+ headline: new FormControl(null, [Validators.required]),
+ description: new FormControl(null, [Validators.required]),
+ createdBy: new FormControl(null, []),
+ assignedTo: new FormControl(null, [Validators.required]),
+ dueAt: new FormControl(null, [Validators.required]),
+ partner: new FormControl(null, []),
+ contact: new FormControl(null, []),
+ prio: new FormControl(null, [Validators.required]),
+ completed: new FormControl(null, []),
+ createdAt: new FormControl(null, [])
+});
+
+export const taskJsonhalForm = new FormGroup({
+ _links: new FormControl(null, []),
+ headline: new FormControl(null, [Validators.required]),
+ description: new FormControl(null, [Validators.required]),
+ createdBy: new FormControl(null, []),
+ assignedTo: new FormControl(null, [Validators.required]),
+ dueAt: new FormControl(null, [Validators.required]),
+ partner: new FormControl(null, []),
+ contact: new FormControl(null, []),
+ prio: new FormControl(null, [Validators.required]),
+ completed: new FormControl(null, []),
+ createdAt: new FormControl(null, [])
+});
+
+export const taskJsonldForm = new FormGroup({
+ headline: new FormControl(null, [Validators.required]),
+ description: new FormControl(null, [Validators.required]),
+ createdBy: new FormControl(null, []),
+ assignedTo: new FormControl(null, [Validators.required]),
+ dueAt: new FormControl(null, [Validators.required]),
+ partner: new FormControl(null, []),
+ contact: new FormControl(null, []),
+ prio: new FormControl(null, [Validators.required]),
+ completed: new FormControl(null, []),
+ createdAt: new FormControl(null, [])
+});
+
export const userForm = new FormGroup({
email: new FormControl(null, [Validators.required, Validators.email]),
firstName: new FormControl(null, [Validators.required]),
diff --git a/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts b/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts
index a922c5f..43ca5c5 100644
--- a/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts
+++ b/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts
@@ -43,7 +43,7 @@ export class NewContactComponent implements OnInit {
// On submit form: Check if image is set
onSubmit() {
if (this.selectedImage !== null) {
- this.mediaSub = this.mediaService.mediasPost(
+ this.mediaSub = this.mediaService.mediaPost(
this.selectedImage
).subscribe(
data => {
diff --git a/matsen-tool/src/app/partners/new-partner/new-partner.component.ts b/matsen-tool/src/app/partners/new-partner/new-partner.component.ts
index 99c3a52..d1d5998 100644
--- a/matsen-tool/src/app/partners/new-partner/new-partner.component.ts
+++ b/matsen-tool/src/app/partners/new-partner/new-partner.component.ts
@@ -48,7 +48,7 @@ export class NewPartnerComponent implements OnInit {
// On submit form: Check if image is set
onSubmit() {
if (this.selectedImage !== null) {
- this.mediaSub = this.mediaService.mediasPost(
+ this.mediaSub = this.mediaService.mediaPost(
this.selectedImage
).subscribe(
data => {
diff --git a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html
index 0d59380..d133927 100644
--- a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html
+++ b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html
@@ -104,51 +104,35 @@
{{'basic.tasks' | translate}}
-
-
-
Matsen AG
-
- 01.10.2023
-
+
+
+
+
{{task.partner}}
+
+ {{ task.dueAt | date:'dd.MM.YYYY HH:mm' }}
+
- Wichtige Info: Unbedingt melden!
-
-
-
-
Some placeholder content for the collapse component. This panel is hidden by default
- but
- revealed when the user activates the relevant trigger.
-
+
{{task.headline}}
-
-
-
-
-
Matsen AG
-
- 01.10.2023
-
-
- Wichtige Info: Unbedingt melden!
-
-
-
-
Some placeholder content for the collapse component. This panel is hidden by default
- but
- revealed when the user activates the relevant trigger.
-
+
-
-
-
-
-
-
+
0" class="rounded-1"
+ [pageSizeOptions]="[10,20,30]"
+ [length]="tasksLength"
+ (page)="tasksHandlePageEvent($event)"
+ [pageSize]="tasksPageSize"
+ [pageIndex]="tasksPageIndex"
+ showFirstLastButtons>
+
diff --git a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts
index 04a684e..286b3ad 100644
--- a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts
+++ b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts
@@ -10,7 +10,7 @@ import {
PartnerJsonld,
PartnerService,
PostJsonld,
- PostService
+ PostService, TaskJsonld, TaskService
} from "@app/core/api/v1";
import {Subscription} from "rxjs";
import {environment} from "@environments/environment";
@@ -32,10 +32,11 @@ import {NewPartnerComponent} from "@app/partners/new-partner/new-partner.compone
})
export class PartnersDetailComponent implements OnInit, AfterViewInit {
@ViewChild(MatPaginator) contactsPaginator: MatPaginator;
- // @ViewChild(MatPaginator) tasksPaginator: MatPaginator;
+ @ViewChild(MatPaginator) tasksPaginator: MatPaginator;
@ViewChild(MatPaginator) postsPaginator: MatPaginator;
protected user: User | null;
+ protected readonly ApiConverter = ApiConverter;
protected readonly environment = environment;
protected id: string;
@@ -51,11 +52,13 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
protected contactsPageSize: number;
protected contactsPageIndex: number;
- // protected tasksDataSource;
- // protected tasksLength: number;
- // protected tasksPageEvent: PageEvent;
- // protected tasksPageSize: number;
- // protected tasksPageIndex: number;
+ protected tasksSub: Subscription;
+ protected tasks: Array
;
+ protected tasksDataSource;
+ protected tasksLength: number;
+ protected tasksPageEvent: PageEvent;
+ protected tasksPageSize: number;
+ protected tasksPageIndex: number;
protected postsSub: Subscription;
protected posts: Array;
@@ -78,7 +81,8 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
private route: ActivatedRoute,
private partnerService: PartnerService,
private contactService: ContactService,
- private postService: PostService
+ private postService: PostService,
+ private taskService: TaskService
) {
this.id = "";
this.partnerDetailSub = new Subscription();
@@ -95,13 +99,14 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
this.contactsPageSize = 6;
this.contactsPageIndex = 0;
- // TODO: Change Jsonld
- // this.tasksPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
- // this.tasksDataSource = new MatTableDataSource(this.contacts);
- // this.tasksLength = 0;
- // this.tasksPageEvent = new PageEvent();
- // this.tasksPageSize = 10;
- // this.tasksPageIndex = 0;
+ this.tasksSub = new Subscription();
+ this.tasks = [];
+ this.tasksPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
+ this.tasksDataSource = new MatTableDataSource(this.tasks);
+ this.tasksLength = 0;
+ this.tasksPageEvent = new PageEvent();
+ this.tasksPageSize = 10;
+ this.tasksPageIndex = 0;
this.postsSub = new Subscription();
this.posts = [];
@@ -120,11 +125,12 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
this.getPartnerData();
this.getContactsData();
this.getPostsData();
+ this.getTasksData();
}
ngAfterViewInit() {
this.contactsDataSource.paginator = this.contactsPaginator;
- // this.tasksDataSource.paginator = this.tasksPaginator;
+ this.tasksDataSource.paginator = this.tasksPaginator;
this.postsDataSource.paginator = this.postsPaginator;
}
@@ -167,6 +173,21 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
);
}
+ getTasksData() {
+ this.tasksSub = this.taskService.tasksGetCollection(
+ this.tasksPageIndex + 1,
+ this.tasksPageSize,
+ // TODO: Partner ID muss übergeben werden können, damit man nur die Partner-Tasks bekommt
+ // TODO: User-ID muss übergeben werden können, damit man nur die Tasks bekommt, die einem User zugewiesen sind
+ // this.id
+ ).subscribe(
+ data => {
+ this.tasks = data["hydra:member"];
+ this.tasksLength = Number(data["hydra:totalItems"]);
+ }
+ );
+ }
+
contactsHandlePageEvent(e: PageEvent) {
this.contactsPageEvent = e;
this.contactsLength = e.length;
@@ -176,11 +197,11 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
}
tasksHandlePageEvent(e: PageEvent) {
- // this.tasksPageEvent = e;
- // this.tasksLength = e.length;
- // this.tasksPageIndex = e.pageIndex.valueOf();
- // this.tasksPageSize = e.pageSize.valueOf();
- // this.getData();
+ this.tasksPageEvent = e;
+ this.tasksLength = e.length;
+ this.tasksPageIndex = e.pageIndex.valueOf();
+ this.tasksPageSize = e.pageSize.valueOf();
+ this.getTasksData();
}
postsHandlePageEvent(e: PageEvent) {
@@ -209,6 +230,19 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
});
}
+ openModalNewTask() {
+ const modalRefTask = this.modalService.open(NewTaskComponent, this.modalOptions);
+ let task: TaskJsonld = {} as TaskJsonld;
+ task.partner = this.partner.id ?? null;
+ modalRefTask.componentInstance.posting = task;
+ modalRefTask.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefTask.dismiss();
+ this.getTasksData();
+ }
+ });
+ }
+
openModalNewPosting() {
const modalRefPosting = this.modalService.open(NewPostingComponent, this.modalOptions);
let posting: PostJsonld = {} as PostJsonld;
@@ -257,12 +291,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
});
}
- openModalNewTask() {
- // TODO
- const modalRef = this.modalService.open(ModalComponent, this.modalOptions);
- modalRef.componentInstance.dynamicComponent = NewTaskComponent;
- }
-
openModalEditPartner() {
const modalRef = this.modalService.open(NewPartnerComponent, this.modalOptions);
modalRef.componentInstance.partner = this.partner;
diff --git a/matsen-tool/src/app/postings/new-comment/new-comment.component.ts b/matsen-tool/src/app/postings/new-comment/new-comment.component.ts
index c072c61..4123435 100644
--- a/matsen-tool/src/app/postings/new-comment/new-comment.component.ts
+++ b/matsen-tool/src/app/postings/new-comment/new-comment.component.ts
@@ -1,6 +1,6 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {ModalStatus} from "@app/_helpers/modal.states";
-import {CommentJsonld, CommentService, PostJsonld, PostService} from "@app/core/api/v1";
+import {CommentJsonld, CommentService, PostJsonld} from "@app/core/api/v1";
import {Subscription} from "rxjs";
import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer";
import {FormGroup} from "@angular/forms";
diff --git a/matsen-tool/src/app/products/new-product/new-product.component.ts b/matsen-tool/src/app/products/new-product/new-product.component.ts
index 4e9dd33..d3f0317 100644
--- a/matsen-tool/src/app/products/new-product/new-product.component.ts
+++ b/matsen-tool/src/app/products/new-product/new-product.component.ts
@@ -41,7 +41,7 @@ export class NewProductComponent implements OnInit {
onSubmit() {
if (this.selectedImage !== null) {
- this.mediaSub = this.mediaService.mediasPost(
+ this.mediaSub = this.mediaService.mediaPost(
this.selectedImage
).subscribe(
data => {
diff --git a/matsen-tool/src/app/tasks/new-task/new-task.component.html b/matsen-tool/src/app/tasks/new-task/new-task.component.html
index a9b6748..88b5545 100644
--- a/matsen-tool/src/app/tasks/new-task/new-task.component.html
+++ b/matsen-tool/src/app/tasks/new-task/new-task.component.html
@@ -1 +1,23 @@
-new-task works!
+{{'basic.new-task' | translate}}
+{{'basic.edit-task' | translate}}
+
diff --git a/matsen-tool/src/app/tasks/new-task/new-task.component.ts b/matsen-tool/src/app/tasks/new-task/new-task.component.ts
index e3c15b9..fff50b5 100644
--- a/matsen-tool/src/app/tasks/new-task/new-task.component.ts
+++ b/matsen-tool/src/app/tasks/new-task/new-task.component.ts
@@ -1,10 +1,36 @@
-import { Component } from '@angular/core';
+import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
+import {TaskJsonld} from "@app/core/api/v1";
+import {ModalStatus} from "@app/_helpers/modal.states";
+import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer";
+import {FormGroup} from "@angular/forms";
+import {Subscription} from "rxjs";
+import {taskForm} from "@app/_forms/apiForms";
@Component({
selector: 'app-new-task',
templateUrl: './new-task.component.html',
styleUrl: './new-task.component.scss'
})
-export class NewTaskComponent {
+export class NewTaskComponent implements OnInit {
+ @Input() public task!: TaskJsonld;
+ @Output() public submit: EventEmitter = new EventEmitter();
+
+ protected taskForm: FormGroup;
+ protected taskSub: Subscription;
+
+ constructor(
+
+ ) {
+ this.taskForm = taskForm;
+ this.taskSub = new Subscription();
+ }
+
+ ngOnInit(): void {
+ this.taskForm = FormGroupInitializer.initFormGroup(this.taskForm, this.task);
+ }
+
+ onSubmit() {
+
+ }
}
diff --git a/matsen-tool/src/assets/scss/_basics.scss b/matsen-tool/src/assets/scss/_basics.scss
index 99e5d40..0195420 100644
--- a/matsen-tool/src/assets/scss/_basics.scss
+++ b/matsen-tool/src/assets/scss/_basics.scss
@@ -29,3 +29,22 @@ img {
.spt-container {
margin-bottom: 3rem;
}
+
+
+.importance {
+ display: block;
+ width: 50vw;
+ height: 5px;
+ position: absolute;
+ right: 0;
+ top: -16px;
+ &[data-importance="low"] {
+ background: #77bb33;
+ }
+ &[data-importance="medium"] {
+ background: #ffee55;
+ }
+ &[data-importance="high"] {
+ background: #bb1414;
+ }
+}
\ No newline at end of file