From 2b007e1b0f24f94dd7832c88cf604789a5e3701d Mon Sep 17 00:00:00 2001 From: Florian Eisenmenger Date: Fri, 22 Mar 2024 17:18:29 +0100 Subject: [PATCH] Documents WIP Tasks show and hide --- .../app/documents/documents.component.html | 10 +- .../src/app/documents/documents.component.ts | 107 ++++++------ .../new-document/new-document.component.html | 13 +- .../new-document/new-document.component.ts | 64 +++++++- .../partners-detail.component.html | 68 +++++--- .../partners-detail.component.ts | 15 ++ .../src/app/partners/partners.component.ts | 10 +- .../src/app/products/products.component.html | 4 +- .../src/app/products/products.component.ts | 20 +-- .../new-task-note.component.html | 4 +- .../tasks/new-task/new-task.component.html | 11 ++ .../src/app/tasks/tasks.component.html | 67 +++++++- matsen-tool/src/app/tasks/tasks.component.ts | 154 ++++++++++++++++-- matsen-tool/src/assets/i18n/de.json | 5 + 14 files changed, 427 insertions(+), 125 deletions(-) diff --git a/matsen-tool/src/app/documents/documents.component.html b/matsen-tool/src/app/documents/documents.component.html index 7aa537d..96cea3d 100644 --- a/matsen-tool/src/app/documents/documents.component.html +++ b/matsen-tool/src/app/documents/documents.component.html @@ -3,7 +3,7 @@

{{ 'basic.documents' | translate }}

- @@ -11,7 +11,7 @@ {{ 'overview.number' | translate }} @@ -44,10 +44,10 @@
{{ (pageSize * pageIndex) + dataSource.filteredData.indexOf(element) + 1 }} + *matCellDef="let element">{{ (documentsPageSize * documentsPageIndex) + documentsDataSource.filteredData.indexOf(element) + 1 }}
diff --git a/matsen-tool/src/app/documents/documents.component.ts b/matsen-tool/src/app/documents/documents.component.ts index 5984eef..ae214f9 100644 --- a/matsen-tool/src/app/documents/documents.component.ts +++ b/matsen-tool/src/app/documents/documents.component.ts @@ -2,15 +2,17 @@ import {ChangeDetectorRef, Component, ViewChild} from '@angular/core'; import {MatSort, MatSortModule, Sort} from "@angular/material/sort"; import {MatPaginator, MatPaginatorIntl, MatPaginatorModule, PageEvent} from "@angular/material/paginator"; import {Subscription} from "rxjs"; -import {PartnerJsonld} from "@app/core/api/v1"; +import {DocumentJsonldDocumentObjectRead, DocumentService, PartnerJsonld, ProductJsonld} from "@app/core/api/v1"; import {Router, RouterLink, RouterLinkActive} from "@angular/router"; import {MatTableDataSource, MatTableModule} from "@angular/material/table"; import {OrderFilter} from "@app/_models/orderFilter"; import {NgIf} from "@angular/common"; import {ModalComponent} from "@app/_components/modal/modal.component"; -import {NgbModal} from "@ng-bootstrap/ng-bootstrap"; +import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap"; import {NewDocumentComponent} from "@app/documents/new-document/new-document.component"; import {TranslateModule} from "@ngx-translate/core"; +import {NewProductComponent} from "@app/products/new-product/new-product.component"; +import {ModalStatus} from "@app/_helpers/modal.states"; @Component({ selector: 'app-documents', @@ -21,71 +23,67 @@ import {TranslateModule} from "@ngx-translate/core"; }) export class DocumentsComponent { @ViewChild(MatSort) sort; - @ViewChild(MatPaginator) paginator: MatPaginator; + @ViewChild(MatPaginator) documentsPaginator: MatPaginator; - protected documentsSub: Subscription; - protected documents: Array; - protected dataType!: string; - - protected dataSource; protected displayedColumns: string[]; - protected length: number; - protected pageEvent: PageEvent; - protected pageSize: number; - protected pageIndex: number; + protected documentsSub: Subscription; + protected documents: Array; + protected documentsDataSource; + protected documentsLength: number; + protected documentsPageEvent: PageEvent; + protected documentsPageSize: number; + protected documentsPageIndex: number; + + protected modalOptions: NgbModalOptions = { + centered: true + }; constructor( private router: Router, - private modalService: NgbModal + private modalService: NgbModal, + private documentService: DocumentService ) { this.sort = new MatSort(); - this.paginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype); - this.dataSource = new MatTableDataSource; //(this.documents) this.displayedColumns = ['pos', 'name', 'type', 'date']; this.documentsSub = new Subscription(); this.documents = []; - - this.length = 0; - this.pageEvent = new PageEvent(); - this.pageSize = 10; - this.pageIndex = 0; + this.documentsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype); + this.documentsDataSource = new MatTableDataSource(this.documents); + this.documentsLength = 0; + this.documentsPageEvent = new PageEvent(); + this.documentsPageSize = 10; + this.documentsPageIndex = 0; } ngOnInit() { - this.getData(); + this.getDocumentsData(); } ngAfterViewInit() { - this.dataSource.sort = this.sort; - this.dataSource.paginator = this.paginator; + this.documentsDataSource.sort = this.sort; + this.documentsDataSource.paginator = this.documentsPaginator; } - getData() { - // this.documentsSub = this.documentService.documentsGetCollection( - // this.pageIndex + 1, - // this.pageSize, - // this.dataType, - // undefined, - // this.nameOrderAsc, - // this.storageOrderAsc, - // this.numberOrderAsc - // ).subscribe( - // data => { - // this.documents = data["hydra:member"]; - // this.dataSource = new MatTableDataSource(this.documents); - // console.log(data); - // this.length = Number(data["hydra:totalItems"]); - // this.paginator.length = this.length; - // } - // ); + getDocumentsData() { + this.documentsSub = this.documentService.documentsGetCollection( + this.documentsPageIndex + 1, + this.documentsPageSize + ).subscribe( + data => { + this.documents = data["hydra:member"]; + this.documentsDataSource = new MatTableDataSource(this.documents); + this.documentsLength = Number(data["hydra:totalItems"]); + this.documentsPaginator.length = this.documentsLength; + } + ); } /** Announce the change in sort state for assistive technology. */ onSortChange(sortState: Sort) { // Reset page index to first page - this.pageIndex = 0; + this.documentsPageIndex = 0; let order: OrderFilter; if (sortState.direction === "") { @@ -108,15 +106,15 @@ export class DocumentsComponent { // this.websiteOrderAsc = order; // break; // } - this.getData(); + this.getDocumentsData(); } handlePageEvent(e: PageEvent) { - this.pageEvent = e; - this.length = e.length; - this.pageIndex = e.pageIndex.valueOf(); - this.pageSize = e.pageSize.valueOf(); - this.getData(); + this.documentsPageEvent = e; + this.documentsLength = e.length; + this.documentsPageIndex = e.pageIndex.valueOf(); + this.documentsPageSize = e.pageSize.valueOf(); + this.getDocumentsData(); } navigateToDocumentFile(element: any) { @@ -127,7 +125,16 @@ export class DocumentsComponent { } openModalNewDocument() { - const modalRef = this.modalService.open(ModalComponent); - modalRef.componentInstance.dynamicComponent = NewDocumentComponent; + const modalRefDocument = this.modalService.open(NewDocumentComponent, this.modalOptions); + // TODO: Warum muss ich einen leeren String übergeben, damit es funktioniert? + let document: ProductJsonld = {} as ProductJsonld; + document.name = ""; + modalRefDocument.componentInstance.document = document; + modalRefDocument.componentInstance.submit.subscribe((modalStatus: ModalStatus) => { + if (modalStatus === ModalStatus.Submitted) { + modalRefDocument.dismiss(); + this.getDocumentsData(); + } + }); } } diff --git a/matsen-tool/src/app/documents/new-document/new-document.component.html b/matsen-tool/src/app/documents/new-document/new-document.component.html index 7d3c2b3..fb48dd0 100644 --- a/matsen-tool/src/app/documents/new-document/new-document.component.html +++ b/matsen-tool/src/app/documents/new-document/new-document.component.html @@ -1 +1,12 @@ -

new-document works!

+

{{'basic.new-document' | translate}}

+

{{'basic.edit-document' | translate}}

+
+
+
+ + +
+ + +
+
diff --git a/matsen-tool/src/app/documents/new-document/new-document.component.ts b/matsen-tool/src/app/documents/new-document/new-document.component.ts index 10d4e9e..931412d 100644 --- a/matsen-tool/src/app/documents/new-document/new-document.component.ts +++ b/matsen-tool/src/app/documents/new-document/new-document.component.ts @@ -1,10 +1,70 @@ -import { Component } from '@angular/core'; +import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; +import { + DocumentJsonldDocumentObjectRead, + DocumentService, + MediaService, + ProductJsonld, + ProductService +} from "@app/core/api/v1"; +import {ModalStatus} from "@app/_helpers/modal.states"; +import {FormGroup} from "@angular/forms"; +import {Subscription} from "rxjs"; +import {TranslateService} from "@ngx-translate/core"; +import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; +import {ApiConverter} from "@app/_helpers/api.converter"; +import {documentDocumentObjectReadForm} from "@app/_forms/apiForms"; @Component({ selector: 'app-new-document', templateUrl: './new-document.component.html', styleUrl: './new-document.component.scss' }) -export class NewDocumentComponent { +export class NewDocumentComponent implements OnInit { + @Input() public document!: DocumentJsonldDocumentObjectRead; + @Output() public submit: EventEmitter = new EventEmitter(); + protected documentForm: FormGroup; + protected documentSub: Subscription; + + protected selectedImage: File | null; + protected mediaSub: Subscription; + + constructor( + private documentService: DocumentService, + private mediaService: MediaService, + private translateService: TranslateService + ) { + this.documentForm = documentDocumentObjectReadForm; + this.documentSub = new Subscription(); + + this.selectedImage = null; + this.mediaSub = new Subscription(); + } + + ngOnInit(): void { + this.documentForm = FormGroupInitializer.initFormGroup(this.documentForm, this.document); + } + + onSubmit() { + // if (this.documentForm.valid) { + // if (this.document.id === null || this.document.id === undefined) { + // // Create new product + // this.documentSub = this.documentService.documentsPost( + // this.documentForm.value as DocumentJsonldDocumentObjectRead + // ).subscribe( + // data => { + // this.documentForm.reset(); + // this.submit.emit(ModalStatus.Submitted); + // } + // ); + // } + // } + } + + onFileSelected(event: any) { + const file: File = event.target.files[0]; + if (file) { + this.selectedImage = file; + } + } } 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 aa6b510..bb901f7 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 @@ -26,8 +26,9 @@
- {{partner.name}} + {{partner.name}}
@@ -37,8 +38,9 @@
-

{{'basic.contacts' | translate}}

- +

{{ 'basic.contacts' | translate }}

+
@@ -59,7 +61,8 @@
- {{'basic.details' | translate}} + {{ 'basic.details' | translate }}
@@ -101,46 +104,55 @@
-

{{'basic.tasks' | translate}}

- +

{{ 'basic.tasks' | translate }}

+
-
-

{{task.description}}

-

Zugewiesen an: {{task.assignedTo}}

+

{{ task.description }}

+

Zugewiesen an: {{ task.assignedToName }}

-
-
-
-

{{ 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 }}
-

{{'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 }}
; + 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}}

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 5b4cf3d..caaf19a 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 @@ -18,6 +18,17 @@
+
+ + +
+ {{'form.partner' | translate}} {{'form.mandatory' | translate}}. +
+
+
-

{{'basic.tasks' | translate}}

- -
-

tasks works!

+
+
+
+

{{'basic.tasks' | translate}}

+ +
+
+
+ +
+
+

{{task.description}}

+

Zugewiesen an: {{task.assignedToName}}

+ +
+
+
+
+
+
+
+

{{ taskNote.createdAt | date:'dd.MM.YYYY HH:mm' }}

+

{{ taskNote.ownerName }}

+
+
+

{{ taskNote.message }}

+
+ +
+
+
+ +
+ + {{ 'basic.hide-comments' | translate }} + {{ 'basic.show-comments' | translate }} + + {{'basic.comment-it' | translate}} +
+
+ + +
+
\ 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