();
@ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent;
protected readonly SearchSelectComponent = SearchSelectComponent;
@@ -30,6 +33,7 @@ export class NewPostComponent implements OnInit {
constructor(
private postService: PostService,
protected productService: ProductService,
+ protected partnerService: PartnerService,
protected appHelperService: AppHelperService,
) {
this.postForm = postForm;
@@ -37,6 +41,11 @@ export class NewPostComponent implements OnInit {
ngOnInit(): void {
this.postForm = FormGroupInitializer.initFormGroup(this.postForm, this.posting);
+ this.partnerService.partnersIdGet(this.appHelperService.extractId(this.posting.partnerIri)).subscribe(
+ data => {
+ this.partner = data;
+ }
+ );
}
getProducts: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => {
diff --git a/matsen-tool/src/app/_views/posts/post-list/post-list.component.ts b/matsen-tool/src/app/_views/posts/post-list/post-list.component.ts
index 295c868..93526bc 100644
--- a/matsen-tool/src/app/_views/posts/post-list/post-list.component.ts
+++ b/matsen-tool/src/app/_views/posts/post-list/post-list.component.ts
@@ -139,6 +139,7 @@ export class PostListComponent implements OnInit, AfterViewInit {
if (this.partner !== undefined) {
post.partnerIri = this.partner?.id;
+ postInputs['partner'] = this.partner;
}
if (this.contact !== undefined) {
post.contactIri = this.contact.id;
diff --git a/matsen-tool/src/app/_views/sales/new-sale/new-sale.component.html b/matsen-tool/src/app/_views/sales/new-sale/new-sale.component.html
index 5250e71..bc3319b 100644
--- a/matsen-tool/src/app/_views/sales/new-sale/new-sale.component.html
+++ b/matsen-tool/src/app/_views/sales/new-sale/new-sale.component.html
@@ -5,30 +5,46 @@
diff --git a/matsen-tool/src/app/_views/sales/new-sale/new-sale.component.ts b/matsen-tool/src/app/_views/sales/new-sale/new-sale.component.ts
index c115a35..c385059 100644
--- a/matsen-tool/src/app/_views/sales/new-sale/new-sale.component.ts
+++ b/matsen-tool/src/app/_views/sales/new-sale/new-sale.component.ts
@@ -1,7 +1,7 @@
import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
import {
PartnerJsonld,
- PartnerService,
+ PartnerService, ProductJsonld,
ProductService,
SaleJsonld,
SaleService
@@ -23,6 +23,7 @@ import {SearchSelectComponent} from "@app/_components/search-select/search-selec
export class NewSaleComponent implements OnInit, AfterViewInit {
@Input() public sale!: SaleJsonld;
@Input() public partner!: PartnerJsonld;
+ @Input() public product!: ProductJsonld;
@Output() public submit: EventEmitter = new EventEmitter();
@ViewChild('partnerSearchSelect', {static: false}) partnerSearchSelect!: SearchSelectComponent;
@ViewChild('productSearchSelect', {static: false}) productSearchSelect!: SearchSelectComponent;
@@ -42,6 +43,12 @@ export class NewSaleComponent implements OnInit, AfterViewInit {
ngOnInit(): void {
this.saleForm = FormGroupInitializer.initFormGroup(this.saleForm, this.sale);
+ if (this.partner && this.saleForm.get('partnerIri')?.value === null) {
+ this.saleForm.get('partnerIri')?.setValue(this.partner.id);
+ }
+ if (this.product && this.saleForm.get('productIri')?.value === null) {
+ this.saleForm.get('productIri')?.setValue(this.product.id);
+ }
}
ngAfterViewInit(): void {
diff --git a/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts b/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts
index f83f948..a614ecd 100644
--- a/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts
+++ b/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts
@@ -118,7 +118,8 @@ export class SaleListComponent implements OnInit, AfterViewInit {
let sale: SaleJsonld = {} as SaleJsonld;
this.appHelperService.openModal(NewSaleComponent, {
'sale': sale,
- 'partner': this.partner
+ 'partner': this.partner,
+ 'product': this.product
}, this.listComponent.getData);
}
diff --git a/matsen-tool/src/app/_views/tasks/new-task/new-task.component.html b/matsen-tool/src/app/_views/tasks/new-task/new-task.component.html
index 2011337..522c676 100644
--- a/matsen-tool/src/app/_views/tasks/new-task/new-task.component.html
+++ b/matsen-tool/src/app/_views/tasks/new-task/new-task.component.html
@@ -18,6 +18,11 @@
+
+
+
+
+
-
+
@@ -45,11 +50,8 @@
[dataSet]="task.assignedTo"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefUsers()"
>
-
-
- {{ 'form.assign-to' | translate }} {{ 'form.mandatory' | translate }}.
-
+
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 ec5b98e..9980444 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
@@ -1,5 +1,7 @@
import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
import {
+ PartnerJsonld,
+ ProductJsonld,
ProductService,
TaskJsonld,
TaskService,
@@ -20,6 +22,7 @@ import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-funct
})
export class NewTaskComponent implements OnInit, AfterViewInit {
@Input() public task!: TaskJsonld;
+ @Input() public partner!: PartnerJsonld;
@Output() public submit: EventEmitter = new EventEmitter();
@ViewChild('userSearchSelect', {static: false}) userSearchSelect!: SearchSelectComponent;
@ViewChild('productSearchSelect', {static: false}) productSearchSelect!: SearchSelectComponent;
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
index c208e69..e643684 100644
--- 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
@@ -1,6 +1,5 @@
import {AfterViewInit, Component, Input, OnInit, ViewChild} from '@angular/core';
import {PagingComponent} from "@app/_components/paging/paging.component";
-import {Subscription} from "rxjs";
import {
PartnerJsonld,
TaskJsonld,
@@ -33,7 +32,6 @@ export class TaskListComponent implements OnInit, AfterViewInit {
protected taskCompactMode: boolean;
protected showCompletedTasks: boolean;
protected taskNotes: Map;
- protected taskSub: Subscription;
protected taskNotesVisibility: Map;
@@ -47,7 +45,6 @@ export class TaskListComponent implements OnInit, AfterViewInit {
this.taskNotes = new Map();
this.dataSource = new MatTableDataSource(this.tasks);
this.taskNotesVisibility = new Map();
- this.taskSub = new Subscription();
this.currentUser = this.accountService.userValue;
if (localStorage.getItem('taskCompactMode') !== null) {
this.taskCompactMode = localStorage.getItem('taskCompactMode') === 'true';
@@ -93,7 +90,7 @@ export class TaskListComponent implements OnInit, AfterViewInit {
}
getTaskData = (taskIri: string) => {
- this.taskSub = this.taskService.tasksIdGet(this.appHelperService.extractId(taskIri)).subscribe(
+ this.taskService.tasksIdGet(this.appHelperService.extractId(taskIri)).subscribe(
data => {
for (let index = 0; index < this.tasks.length; index++) {
const item = this.tasks[index];
@@ -135,10 +132,15 @@ export class TaskListComponent implements OnInit, AfterViewInit {
}
openModalNewTask() {
+ let postInputs: any = {};
let task: TaskJsonld = {} as TaskJsonld;
task.partnerIri = this.partner.id;
task.completed = false;
- this.appHelperService.openModal(NewTaskComponent, {'task': task}, this.getTasksData);
+ if (this.partner !== undefined) {
+ postInputs['partner'] = this.partner;
+ }
+ postInputs['task'] = task;
+ this.appHelperService.openModal(NewTaskComponent, postInputs, this.getTasksData);
}
openModalEditTask(task: TaskJsonld) {