-
-
{{task.partner}}
+ {{ task.partnerName }}
{{ task.dueAt | date:'dd.MM.YYYY HH:mm':'GMT+0000' }}
- {{task.headline}}
+ {{ task.headline }}
-
-
-
-
{{ taskNote.createdAt | date:'dd.MM.YYYY HH:mm' }}
-
{{ taskNote.ownerName }}
-
-
-
{{ taskNote.message }}
+
+
+
+
+
{{ taskNote.createdAt | date:'dd.MM.YYYY HH:mm' }}
+
{{ taskNote.ownerName }}
+
+
+
{{ taskNote.message }}
+
+
-
- {{'basic.comment-it' | translate}}
+
+ {{ 'basic.hide-comments' | translate }}
+ {{ 'basic.show-comments' | translate }}
+
+ {{ 'basic.comment-it' | translate }}
0" class="rounded-1"
@@ -156,8 +168,8 @@
-
{{'basic.posts' | translate}}
-
+ {{ 'basic.posts' | translate }}
+
@@ -170,7 +182,8 @@
{{ post.headline }}
{{ post.message }}
-
@@ -189,7 +202,8 @@
- {{'basic.comment-it' | translate}}
+ {{ 'basic.comment-it' | translate }}
0" class="rounded-1"
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 ea86f1a..5860e64 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
@@ -61,6 +61,8 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
protected tasksPageSize: number;
protected tasksPageIndex: number;
+ protected taskNotesVisibility: Map;
+
protected postsSub: Subscription;
protected posts: Array;
protected postsDataSource;
@@ -108,6 +110,7 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
this.tasksPageEvent = new PageEvent();
this.tasksPageSize = 10;
this.tasksPageIndex = 0;
+ this.taskNotesVisibility = new Map();
this.postsSub = new Subscription();
this.posts = [];
@@ -184,6 +187,11 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
data => {
this.tasks = data["hydra:member"];
this.tasksLength = Number(data["hydra:totalItems"]);
+ this.tasks.forEach(task => {
+ if (task.id) {
+ this.taskNotesVisibility.set(task.id, false);
+ }
+ });
console.log(this.tasks);
}
);
@@ -339,4 +347,11 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
}
});
}
+
+ showTaskNotes(task: TaskJsonld) {
+ if (task.id) {
+ const currentVisibility = this.taskNotesVisibility.get(task.id);
+ this.taskNotesVisibility.set(task.id, !currentVisibility);
+ }
+ }
}
diff --git a/matsen-tool/src/app/partners/partners.component.ts b/matsen-tool/src/app/partners/partners.component.ts
index 6587f92..58f8dda 100644
--- a/matsen-tool/src/app/partners/partners.component.ts
+++ b/matsen-tool/src/app/partners/partners.component.ts
@@ -84,7 +84,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
this.translateService.get('basic.' + this.dataType + 'One').subscribe((translation: string) => {
this.partnerNameOne = translation;
});
- this.getData();
+ this.getPartnersData();
}
ngAfterViewInit() {
@@ -92,7 +92,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
this.dataSource.paginator = this.paginator;
}
- getData() {
+ getPartnersData() {
this.partnersSub = this.partnerService.partnersGetCollection(
this.pageIndex + 1,
this.pageSize,
@@ -138,7 +138,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
this.websiteOrderAsc = order;
break;
}
- this.getData();
+ this.getPartnersData();
}
handlePageEvent(e: PageEvent) {
@@ -146,7 +146,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
this.length = e.length;
this.pageIndex = e.pageIndex.valueOf();
this.pageSize = e.pageSize.valueOf();
- this.getData();
+ this.getPartnersData();
}
navigateToPartnerDetails(element: any) {
@@ -163,7 +163,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
modalRefContact.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefContact.dismiss();
- this.getData();
+ this.getPartnersData();
}
});
}
diff --git a/matsen-tool/src/app/products/products.component.html b/matsen-tool/src/app/products/products.component.html
index 6a397db..8ed6d2d 100644
--- a/matsen-tool/src/app/products/products.component.html
+++ b/matsen-tool/src/app/products/products.component.html
@@ -11,7 +11,7 @@
{{ 'overview.number' | translate }}
{{ (productsPageSize * productPageIndex) + productsDataSource.filteredData.indexOf(element) + 1 }}
+ *matCellDef="let element">{{ (productsPageSize * productsPageIndex) + productsDataSource.filteredData.indexOf(element) + 1 }}
|
@@ -61,7 +61,7 @@
[length]="productsLength"
(page)="handlePageEvent($event)"
[pageSize]="productsPageSize"
- [pageIndex]="productPageIndex"
+ [pageIndex]="productsPageIndex"
showFirstLastButtons>
diff --git a/matsen-tool/src/app/products/products.component.ts b/matsen-tool/src/app/products/products.component.ts
index a5f596d..abcbbd3 100644
--- a/matsen-tool/src/app/products/products.component.ts
+++ b/matsen-tool/src/app/products/products.component.ts
@@ -32,7 +32,7 @@ export class ProductsComponent implements OnInit, AfterViewInit {
protected productsLength: number;
protected productsPageEvent: PageEvent;
protected productsPageSize: number;
- protected productPageIndex: number;
+ protected productsPageIndex: number;
protected modalOptions: NgbModalOptions = {
centered: true
@@ -53,11 +53,11 @@ export class ProductsComponent implements OnInit, AfterViewInit {
this.productsLength = 0;
this.productsPageEvent = new PageEvent();
this.productsPageSize = 10;
- this.productPageIndex = 0;
+ this.productsPageIndex = 0;
}
ngOnInit() {
- this.getProductData();
+ this.getProductsData();
}
ngAfterViewInit() {
@@ -65,9 +65,9 @@ export class ProductsComponent implements OnInit, AfterViewInit {
this.productsDataSource.paginator = this.productsPaginator;
}
- getProductData() {
+ getProductsData() {
this.productsSub = this.productService.productsGetCollection(
- this.productPageIndex + 1,
+ this.productsPageIndex + 1,
this.productsPageSize
).subscribe(
data => {
@@ -82,7 +82,7 @@ export class ProductsComponent implements OnInit, AfterViewInit {
/** Announce the change in sort state for assistive technology. */
onSortChange(sortState: Sort) {
// Reset page index to first page
- this.productPageIndex = 0;
+ this.productsPageIndex = 0;
let order: OrderFilter;
if (sortState.direction === "") {
@@ -105,15 +105,15 @@ export class ProductsComponent implements OnInit, AfterViewInit {
// this.websiteOrderAsc = order;
// break;
// }
- this.getProductData();
+ this.getProductsData();
}
handlePageEvent(e: PageEvent) {
this.productsPageEvent = e;
this.productsLength = e.length;
- this.productPageIndex = e.pageIndex.valueOf();
+ this.productsPageIndex = e.pageIndex.valueOf();
this.productsPageSize = e.pageSize.valueOf();
- this.getProductData();
+ this.getProductsData();
}
navigateToProductDetails(element: any) {
@@ -130,7 +130,7 @@ export class ProductsComponent implements OnInit, AfterViewInit {
modalRefProduct.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefProduct.dismiss();
- this.getProductData();
+ this.getProductsData();
}
});
}
diff --git a/matsen-tool/src/app/tasks/new-task-note/new-task-note.component.html b/matsen-tool/src/app/tasks/new-task-note/new-task-note.component.html
index c1a35b2..3c7c23d 100644
--- a/matsen-tool/src/app/tasks/new-task-note/new-task-note.component.html
+++ b/matsen-tool/src/app/tasks/new-task-note/new-task-note.component.html
@@ -1,5 +1,5 @@
-
{{'basic.new-comment' | translate}}
-
{{'basic.edit-comment' | translate}}
+
{{'basic.new-task-note' | translate}}
+
{{'basic.edit-task-note' | translate}}
+
+
+
+
+ {{'form.partner' | translate}} {{'form.mandatory' | translate}}.
+
+
+
-
{{'basic.tasks' | translate}}
-
-
-
tasks works!
+
+
+
+
{{'basic.tasks' | translate}}
+
+
+
+
+
+
{{task.partnerName}}
+
+ {{ task.dueAt | date:'dd.MM.YYYY HH:mm':'GMT+0000' }}
+
+
+ {{task.headline}}
+
+
+
+
+
+
+
+
{{ taskNote.createdAt | date:'dd.MM.YYYY HH:mm' }}
+
{{ taskNote.ownerName }}
+
+
+
{{ taskNote.message }}
+
+
+
+
+
+
+
+
+ {{ 'basic.hide-comments' | translate }}
+ {{ 'basic.show-comments' | translate }}
+
+ {{'basic.comment-it' | translate}}
+
+
+
0" class="rounded-1"
+ [pageSizeOptions]="[10,20,30]"
+ [length]="tasksLength"
+ (page)="tasksHandlePageEvent($event)"
+ [pageSize]="tasksPageSize"
+ [pageIndex]="tasksPageIndex"
+ showFirstLastButtons>
+
+
+
\ No newline at end of file
diff --git a/matsen-tool/src/app/tasks/tasks.component.ts b/matsen-tool/src/app/tasks/tasks.component.ts
index ecf567c..459b0dc 100644
--- a/matsen-tool/src/app/tasks/tasks.component.ts
+++ b/matsen-tool/src/app/tasks/tasks.component.ts
@@ -1,27 +1,149 @@
-import {Component, OnInit} from '@angular/core';
+import {AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core';
import {NewTaskComponent} from "@app/tasks/new-task/new-task.component";
-import {NgbModal} from "@ng-bootstrap/ng-bootstrap";
+import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {ModalComponent} from "@app/_components/modal/modal.component";
+import {ApiConverter} from "@app/_helpers/api.converter";
+import {Subscription} from "rxjs";
+import {TaskJsonld, TaskNoteJsonld, TaskService} from "@app/core/api/v1";
+import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
+import {MatTableDataSource} from "@angular/material/table";
+import {User} from "@app/_models";
+import {AccountService} from "@app/_services";
+import {ModalStatus} from "@app/_helpers/modal.states";
+import {NewTaskNoteComponent} from "@app/tasks/new-task-note/new-task-note.component";
@Component({
- selector: 'app-tasks',
- templateUrl: './tasks.component.html',
- styleUrl: './tasks.component.scss'
+ selector: 'app-tasks',
+ templateUrl: './tasks.component.html',
+ styleUrl: './tasks.component.scss'
})
-export class TasksComponent implements OnInit {
+export class TasksComponent implements OnInit, AfterViewInit {
+ @ViewChild(MatPaginator) tasksPaginator: MatPaginator;
- constructor(
- private modalService: NgbModal
- ) {
+ protected user: User | null;
+ protected readonly ApiConverter = ApiConverter;
- }
+ protected tasksSub: Subscription;
+ protected tasks: Array
;
+ protected tasksDataSource;
+ protected tasksLength: number;
+ protected tasksPageEvent: PageEvent;
+ protected tasksPageSize: number;
+ protected tasksPageIndex: number;
- ngOnInit() {
+ protected taskNotesVisibility: Map;
- }
+ protected modalOptions: NgbModalOptions = {
+ centered: true
+ };
- openModalNewTask() {
- const modalRef = this.modalService.open(ModalComponent);
- modalRef.componentInstance.dynamicComponent = NewTaskComponent;
- }
+ constructor(
+ private modalService: NgbModal,
+ private accountService: AccountService,
+ private taskService: TaskService
+ ) {
+ this.user = this.accountService.userValue;
+
+ 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.taskNotesVisibility = new Map();
+ }
+
+ ngOnInit() {
+ this.getTasksData();
+ }
+
+ ngAfterViewInit() {
+ this.tasksDataSource.paginator = this.tasksPaginator;
+ }
+
+ getTasksData() {
+ this.tasksSub = this.taskService.tasksGetCollection(
+ this.tasksPageIndex + 1,
+ this.tasksPageSize,
+ // TODO: User-ID muss übergeben werden können, damit man nur die Tasks bekommt, die einem User zugewiesen sind
+ ).subscribe(
+ data => {
+ this.tasks = data["hydra:member"];
+ this.tasksLength = Number(data["hydra:totalItems"]);
+ this.tasks.forEach(task => {
+ if (task.id) {
+ this.taskNotesVisibility.set(task.id, false);
+ }
+ });
+ console.log(this.tasks);
+ }
+ );
+ }
+
+ tasksHandlePageEvent(e: PageEvent) {
+ this.tasksPageEvent = e;
+ this.tasksLength = e.length;
+ this.tasksPageIndex = e.pageIndex.valueOf();
+ this.tasksPageSize = e.pageSize.valueOf();
+ this.getTasksData();
+ }
+
+ openModalNewTask() {
+ const modalRefTask = this.modalService.open(NewTaskComponent, this.modalOptions);
+ let task: TaskJsonld = {} as TaskJsonld;
+ task.partner = null;
+ task.completed = false;
+ modalRefTask.componentInstance.task = task;
+ modalRefTask.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefTask.dismiss();
+ this.getTasksData();
+ }
+ });
+ }
+
+ openModalNewTaskNote(task: TaskJsonld) {
+ const modalRefTaskNote = this.modalService.open(NewTaskNoteComponent, this.modalOptions);
+ let taskNote: TaskNoteJsonld = {} as TaskNoteJsonld;
+ taskNote.task = task.id ?? null;
+ modalRefTaskNote.componentInstance.taskNote = taskNote;
+ modalRefTaskNote.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefTaskNote.dismiss();
+ this.getTasksData();
+ }
+ });
+ }
+
+ openModalEditTask(task: TaskJsonld) {
+ const modalRefTaskEdit = this.modalService.open(NewTaskComponent, this.modalOptions);
+ modalRefTaskEdit.componentInstance.task = task;
+ modalRefTaskEdit.componentInstance.dueAtValue = ApiConverter.convertDate(task.dueAt);
+ modalRefTaskEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefTaskEdit.dismiss();
+ this.getTasksData();
+ }
+ });
+ }
+
+ openModalEditTaskNote(taskNote: TaskNoteJsonld) {
+ const modalRefTaskNote = this.modalService.open(NewTaskNoteComponent, this.modalOptions);
+ modalRefTaskNote.componentInstance.taskNote = taskNote;
+ modalRefTaskNote.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefTaskNote.dismiss();
+ this.getTasksData();
+ }
+ });
+ }
+
+ showTaskNotes(task: TaskJsonld) {
+ if (task.id) {
+ const currentVisibility = this.taskNotesVisibility.get(task.id);
+ this.taskNotesVisibility.set(task.id, !currentVisibility);
+ }
+ }
}
diff --git a/matsen-tool/src/assets/i18n/de.json b/matsen-tool/src/assets/i18n/de.json
index f4ceef8..587f174 100644
--- a/matsen-tool/src/assets/i18n/de.json
+++ b/matsen-tool/src/assets/i18n/de.json
@@ -26,6 +26,7 @@
"new-contact": "Neuer Kontakt",
"new-post": "Neue Notiz",
"new-comment": "Neuer Kommentar",
+ "new-task-note": "Neue Anmerkung",
"edit-before": "",
"edit-after": "bearbeiten",
"edit-product": "Produkt bearbeiten",
@@ -34,8 +35,11 @@
"edit-contact": "Kontakt bearbeiten",
"edit-post": "Notiz bearbeiten",
"edit-comment": "Kommentar bearbeiten",
+ "edit-task-note": "Anmerkung bearbeiten",
"details": "Details",
"comment-it": "Kommentieren",
+ "show-comments": "Kommentare anzeigen",
+ "hide-comments": "Kommentare ausblenden",
"back": "Zurück"
},
"user":
@@ -85,6 +89,7 @@
"prio-low": "niedrig",
"prio-medium": "mittel",
"prio-high": "hoch",
+ "partner": "Partner",
"send": "Abschicken"
}
}
\ No newline at end of file