-
diff --git a/matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.ts b/matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.ts
index b24e7bd..e6c5082 100644
--- a/matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.ts
+++ b/matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.ts
@@ -12,7 +12,7 @@ import {NewCommentComponent} from "@app/_views/posts/new-comment/new-comment.com
import {NewContactComponent} from "@app/_views/contacts/new-contact/new-contact.component";
import {NewSaleComponent} from "@app/_views/sales/new-sale/new-sale.component";
import {ActivatedRoute} from "@angular/router";
-import {ApiConverter} from "@app/_helpers/api.converter";
+import {ApiHelperService} from "@app/_helpers/api-helper.service";
@Component({
selector: 'app-sales-detail',
@@ -47,7 +47,7 @@ export class SalesDetailComponent implements OnInit, AfterViewInit {
private route: ActivatedRoute,
private postService: PostService,
private modalService: NgbModal,
- protected apiConverter: ApiConverter
+ protected apiHelperService: ApiHelperService
) {
this.user = this.accountService.userValue;
diff --git a/matsen-tool/src/app/_views/sales/sales.component.html b/matsen-tool/src/app/_views/sales/sales.component.html
index 0ec8ca5..97ac289 100644
--- a/matsen-tool/src/app/_views/sales/sales.component.html
+++ b/matsen-tool/src/app/_views/sales/sales.component.html
@@ -53,7 +53,7 @@
{{ 'overview.sale-partner' | translate }}
- {{ element.partnerName }}
+ {{ element.partnerName }}
|
@@ -63,7 +63,7 @@
{{ 'overview.productname' | translate }}
- {{ element.productName }}
+ {{ element.productName }}
|
diff --git a/matsen-tool/src/app/_views/sales/sales.component.ts b/matsen-tool/src/app/_views/sales/sales.component.ts
index 0495ddc..ebda07b 100644
--- a/matsen-tool/src/app/_views/sales/sales.component.ts
+++ b/matsen-tool/src/app/_views/sales/sales.component.ts
@@ -16,7 +16,7 @@ import {ModalStatus} from "@app/_helpers/modal.states";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {MatTableDataSource} from "@angular/material/table";
import {OrderFilter} from "@app/_models/orderFilter";
-import {ApiConverter} from "@app/_helpers/api.converter";
+import {ApiHelperService} from "@app/_helpers/api-helper.service";
import {Router} from "@angular/router";
import {registerLocaleData} from "@angular/common";
import localeDe from '@angular/common/locales/de';
@@ -63,7 +63,7 @@ export class SalesComponent implements OnInit {
private translateService: TranslateService,
private modalService: NgbModal,
private router: Router,
- protected apiConverter: ApiConverter,
+ protected apiHelperService: ApiHelperService,
) {
this.sort = new MatSort();
this.displayedColumns = ['pos', 'user', 'partner', 'product', 'turnover', 'profit', 'date', 'details'];
@@ -162,7 +162,7 @@ export class SalesComponent implements OnInit {
navigateToSaleDetails(element: any) {
const sale: SaleJsonld = element as SaleJsonld;
- this.router.navigate(['/sales', this.apiConverter.extractId(sale.id)]);
+ this.router.navigate(['/sales', this.apiHelperService.extractId(sale.id)]);
}
openModalNewSale() {
diff --git a/matsen-tool/src/app/_views/tasks/new-task-note/new-task-note.component.ts b/matsen-tool/src/app/_views/tasks/new-task-note/new-task-note.component.ts
index 5920df3..6315b22 100644
--- a/matsen-tool/src/app/_views/tasks/new-task-note/new-task-note.component.ts
+++ b/matsen-tool/src/app/_views/tasks/new-task-note/new-task-note.component.ts
@@ -4,7 +4,7 @@ import {ModalStatus} from "@app/_helpers/modal.states";
import {FormGroup} from "@angular/forms";
import {Subscription} from "rxjs";
import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer";
-import {ApiConverter} from "@app/_helpers/api.converter";
+import {ApiHelperService} from "@app/_helpers/api-helper.service";
import {taskNoteForm} from "@app/_forms/apiForms";
@Component({
@@ -21,7 +21,7 @@ export class NewTaskNoteComponent {
constructor(
private taskNoteService: TaskNoteService,
- protected apiConverter: ApiConverter
+ protected apiHelperService: ApiHelperService
) {
this.taskNoteForm = taskNoteForm;
this.taskNoteSub = new Subscription();
@@ -46,7 +46,7 @@ export class NewTaskNoteComponent {
} else {
// Edit taskNote
this.taskNoteSub = this.taskNoteService.taskNotesIdPatch(
- this.apiConverter.extractId(this.taskNote.id),
+ this.apiHelperService.extractId(this.taskNote.id),
this.taskNoteForm.value as TaskNoteJsonld
).subscribe(
data => {
diff --git a/matsen-tool/src/app/_views/tasks/new-task/new-task.component.ts b/matsen-tool/src/app/_views/tasks/new-task/new-task.component.ts
index 48b2015..ba7e0b9 100644
--- a/matsen-tool/src/app/_views/tasks/new-task/new-task.component.ts
+++ b/matsen-tool/src/app/_views/tasks/new-task/new-task.component.ts
@@ -5,7 +5,7 @@ import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer";
import {FormGroup} from "@angular/forms";
import {debounceTime, distinctUntilChanged, Observable, OperatorFunction, Subscription, switchMap} from "rxjs";
import {taskForm} from "@app/_forms/apiForms";
-import {ApiConverter} from "@app/_helpers/api.converter";
+import {ApiHelperService} from "@app/_helpers/api-helper.service";
import {filter, map} from "rxjs/operators";
@Component({
@@ -27,7 +27,7 @@ export class NewTaskComponent implements OnInit {
private taskService: TaskService,
private userService: UserService,
private partnerService: PartnerService,
- protected apiConverter: ApiConverter
+ protected apiHelperService: ApiHelperService
) {
this.taskForm = taskForm;
this.taskSub = new Subscription();
@@ -97,7 +97,7 @@ export class NewTaskComponent implements OnInit {
} else {
// Edit task
this.taskSub = this.taskService.tasksIdPatch(
- this.apiConverter.extractId(this.task.id),
+ this.apiHelperService.extractId(this.task.id),
this.taskForm.value as TaskJsonld
).subscribe(
data => {
diff --git a/matsen-tool/src/app/_views/tasks/task-list/task-list.component.html b/matsen-tool/src/app/_views/tasks/task-list/task-list.component.html
new file mode 100644
index 0000000..bd00f71
--- /dev/null
+++ b/matsen-tool/src/app/_views/tasks/task-list/task-list.component.html
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+ {{ task.dueAt | date:'dd.MM.YYYY':'GMT+0000' }}
+
+
+
{{ task.headline }}
+
+
+
Zugewiesen an: {{ task.assignedToName }}
+
+
+
+
+
+
+
+
+
{{ taskNote.createdAt | date:'dd.MM.YYYY' }}
+
{{ taskNote.ownerName }}
+
+
+
{{ taskNote.message }}
+
+
+
+
+
+
+
+
+ {{ 'basic.hide-comments' | translate }}
+ {{ 'basic.show-comments' | translate }}
+
+ {{ 'basic.comment-it' | translate }}
+
+
+
0" class="rounded-1"
+ [pageSizeOptions]="this.pageSizeOptions"
+ [length]="dataLength"
+ (page)="handlePageEvent($event)"
+ [pageSize]="pageSize"
+ [pageIndex]="pageIndex"
+ showFirstLastButtons>
+
+
+
\ No newline at end of file
diff --git a/matsen-tool/src/app/_views/tasks/task-list/task-list.component.scss b/matsen-tool/src/app/_views/tasks/task-list/task-list.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/matsen-tool/src/app/_views/tasks/task-list/task-list.component.spec.ts b/matsen-tool/src/app/_views/tasks/task-list/task-list.component.spec.ts
new file mode 100644
index 0000000..54ae0bd
--- /dev/null
+++ b/matsen-tool/src/app/_views/tasks/task-list/task-list.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TaskListComponent } from './task-list.component';
+
+describe('TaskListComponent', () => {
+ let component: TaskListComponent;
+ let fixture: ComponentFixture
;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [TaskListComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(TaskListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/matsen-tool/src/app/_views/tasks/task-list/task-list.component.ts b/matsen-tool/src/app/_views/tasks/task-list/task-list.component.ts
new file mode 100644
index 0000000..1be83d3
--- /dev/null
+++ b/matsen-tool/src/app/_views/tasks/task-list/task-list.component.ts
@@ -0,0 +1,134 @@
+import {AfterViewInit, ChangeDetectorRef, Component, Input, OnInit, ViewChild} from '@angular/core';
+import {ListComponent} from "@app/_components/list/list.component";
+import {Subscription} from "rxjs";
+import {PartnerJsonld, TaskJsonld, TaskNoteJsonld, TaskService} from "@app/core/api/v1";
+import {MatPaginator, MatPaginatorIntl} from "@angular/material/paginator";
+import {MatTableDataSource} from "@angular/material/table";
+import {NewTaskComponent} from "@app/_views/tasks/new-task/new-task.component";
+import {ModalStatus} from "@app/_helpers/modal.states";
+import {NewTaskNoteComponent} from "@app/_views/tasks/new-task-note/new-task-note.component";
+import {ApiHelperService} from "@app/_helpers/api-helper.service";
+import {NgbModal} from "@ng-bootstrap/ng-bootstrap";
+import {AccountService} from "@app/_services";
+import {User} from "@app/_models";
+
+@Component({
+ selector: 'app-task-list',
+ templateUrl: './task-list.component.html',
+ styleUrl: './task-list.component.scss'
+})
+export class TaskListComponent extends ListComponent implements OnInit, AfterViewInit {
+
+ @Input() public partner!: PartnerJsonld;
+
+ @ViewChild(MatPaginator) tasksPaginator: MatPaginator;
+
+ protected user: User | null;
+ protected tasksSub: Subscription;
+ protected tasks: Array;
+ protected tasksDataSource;
+
+ protected taskNotesVisibility: Map;
+
+ constructor(
+ private taskService: TaskService,
+ private accountService: AccountService,
+ private modalService: NgbModal,
+ protected apiHelperService: ApiHelperService,
+ ) {
+ super();
+ this.tasksSub = new Subscription();
+ this.tasks = [];
+ this.tasksPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
+ this.tasksDataSource = new MatTableDataSource(this.tasks);
+ this.tasksPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
+ this.taskNotesVisibility = new Map();
+ this.user = this.accountService.userValue;
+ }
+
+ ngOnInit() {
+ this.getData();
+ }
+
+ ngAfterViewInit() {
+ this.tasksDataSource.paginator = this.tasksPaginator;
+ }
+
+ override getData() {
+ this.tasksSub = this.taskService.tasksGetCollection(
+ this.pageIndex + 1,
+ this.pageSize,
+ undefined,
+ undefined,
+ this.partner.id
+ ).subscribe(
+ data => {
+ this.tasks = data["hydra:member"];
+ console.log(this.tasks);
+ this.dataLength = Number(data["hydra:totalItems"]);
+ this.tasks.forEach(task => {
+ if (task.id) {
+ this.taskNotesVisibility.set(task.id, false);
+ }
+ });
+ }
+ );
+ }
+
+ showTaskNotes(task: TaskJsonld) {
+ if (task.id) {
+ const currentVisibility = this.taskNotesVisibility.get(task.id);
+ this.taskNotesVisibility.set(task.id, !currentVisibility);
+ }
+ }
+
+ openModalNewTask() {
+ const modalRefTask = this.modalService.open(NewTaskComponent, this.modalOptions);
+ let task: TaskJsonld = {} as TaskJsonld;
+ task.partner = this.partner.id ?? null;
+ task.completed = false;
+ modalRefTask.componentInstance.task = task;
+ modalRefTask.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefTask.dismiss();
+ this.getData();
+ }
+ });
+ }
+
+ 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.getData();
+ }
+ });
+ }
+
+ openModalEditTask(task: TaskJsonld) {
+ const modalRefTaskEdit = this.modalService.open(NewTaskComponent, this.modalOptions);
+ modalRefTaskEdit.componentInstance.task = task;
+ modalRefTaskEdit.componentInstance.dueAtValue = this.apiHelperService.convertDate(task.dueAt);
+ modalRefTaskEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefTaskEdit.dismiss();
+ this.getData();
+ }
+ });
+ }
+
+ 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.getData();
+ }
+ });
+ }
+}
diff --git a/matsen-tool/src/app/_views/tasks/tasks.component.html b/matsen-tool/src/app/_views/tasks/tasks.component.html
index b6a14f6..9bd8c42 100644
--- a/matsen-tool/src/app/_views/tasks/tasks.component.html
+++ b/matsen-tool/src/app/_views/tasks/tasks.component.html
@@ -7,14 +7,14 @@
-
+
{{ task.dueAt | date:'dd.MM.YYYY':'GMT+0000' }}
{{task.headline}}
-
+
Zugewiesen an: {{task.assignedToName}}
@@ -29,7 +29,7 @@
{{ taskNote.ownerName }}
diff --git a/matsen-tool/src/app/_views/tasks/tasks.component.ts b/matsen-tool/src/app/_views/tasks/tasks.component.ts
index eb264dd..fbb599d 100644
--- a/matsen-tool/src/app/_views/tasks/tasks.component.ts
+++ b/matsen-tool/src/app/_views/tasks/tasks.component.ts
@@ -1,7 +1,7 @@
import {AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core';
import {NewTaskComponent} from "@app/_views/tasks/new-task/new-task.component";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
-import {ApiConverter} from "@app/_helpers/api.converter";
+import {ApiHelperService} from "@app/_helpers/api-helper.service";
import {Subscription} from "rxjs";
import {TaskJsonld, TaskNoteJsonld, TaskService} from "@app/core/api/v1";
import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
@@ -20,7 +20,6 @@ export class TasksComponent implements OnInit, AfterViewInit {
@ViewChild(MatPaginator) tasksPaginator: MatPaginator;
protected user: User | null;
- protected readonly ApiConverter = ApiConverter;
protected tasksSub: Subscription;
protected tasks: Array
;
@@ -40,7 +39,7 @@ export class TasksComponent implements OnInit, AfterViewInit {
private modalService: NgbModal,
private accountService: AccountService,
private taskService: TaskService,
- protected apiConverter: ApiConverter
+ protected apiHelperService: ApiHelperService
) {
this.user = this.accountService.userValue;
@@ -118,7 +117,7 @@ export class TasksComponent implements OnInit, AfterViewInit {
openModalEditTask(task: TaskJsonld) {
const modalRefTaskEdit = this.modalService.open(NewTaskComponent, this.modalOptions);
modalRefTaskEdit.componentInstance.task = task;
- modalRefTaskEdit.componentInstance.dueAtValue = this.apiConverter.convertDate(task.dueAt);
+ modalRefTaskEdit.componentInstance.dueAtValue = this.apiHelperService.convertDate(task.dueAt);
modalRefTaskEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefTaskEdit.dismiss();
diff --git a/matsen-tool/src/app/app.module.ts b/matsen-tool/src/app/app.module.ts
index b11020c..d9cd429 100644
--- a/matsen-tool/src/app/app.module.ts
+++ b/matsen-tool/src/app/app.module.ts
@@ -51,6 +51,8 @@ import { ProfileComponent } from './_views/profile/profile.component';
import { PostListComponent } from './_views/posts/post-list/post-list.component';
import {ContactListComponent} from "@app/_views/contacts/contact-list/contact-list.component";
import {ApiModule, Configuration, ConfigurationParameters} from "@app/core/api/v1";
+import { TaskListComponent } from './_views/tasks/task-list/task-list.component';
+import { SearchInputComponent } from './_components/search-input/search-input.component';
export function apiConfigFactory(): Configuration {
const params: ConfigurationParameters = {
@@ -123,6 +125,8 @@ export function HttpLoaderFactory(http: HttpClient) {
PostListComponent,
ContactListComponent,
ContactListComponent,
+ TaskListComponent,
+ SearchInputComponent,
],
providers: [
{provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true},
diff --git a/matsen-tool/src/assets/i18n/de.json b/matsen-tool/src/assets/i18n/de.json
index af3b6e5..7b7712b 100644
--- a/matsen-tool/src/assets/i18n/de.json
+++ b/matsen-tool/src/assets/i18n/de.json
@@ -94,6 +94,7 @@
"country": "Land",
"website": "Website",
"upload-image": "Bild hochladen",
+ "upload-file": "Datei hochladen",
"firstname": "Vorname",
"lastname": "Nachname",
"birthday": "Geburtstag",
@@ -114,7 +115,7 @@
"product": "Produkt",
"turnover": "Umsatz",
"profit": "Gewinn",
- "send": "Abschicken"
+ "send": "Speichern"
},
"sales":
{