diff --git a/matsen-tool/src/app/_components/list/list.component.ts b/matsen-tool/src/app/_components/list/list.component.ts
index 5eed08d..29b8913 100644
--- a/matsen-tool/src/app/_components/list/list.component.ts
+++ b/matsen-tool/src/app/_components/list/list.component.ts
@@ -42,21 +42,6 @@ export class ListComponent implements OnInit, AfterViewInit {
public static COLUMN_TYPE_TEXT_LINKED: string = 'text_linked';
public static COLUMN_TYPE_WEBSITE: string = 'website';
- public static validColumnTypes: string[] = [
- ListComponent.COLUMN_TYPE_ADDRESS,
- ListComponent.COLUMN_TYPE_BTN_DOWNLOAD,
- ListComponent.COLUMN_TYPE_BTN_EDIT,
- ListComponent.COLUMN_TYPE_BTN_REMOVE,
- ListComponent.COLUMN_TYPE_CURRENCY,
- ListComponent.COLUMN_TYPE_DATE,
- ListComponent.COLUMN_TYPE_DETAIL,
- ListComponent.COLUMN_TYPE_EMAIL,
- ListComponent.COLUMN_TYPE_IMAGE,
- ListComponent.COLUMN_TYPE_POSITION,
- ListComponent.COLUMN_TYPE_TEXT,
- ListComponent.COLUMN_TYPE_TEXT_LINKED,
- ListComponent.COLUMN_TYPE_WEBSITE,
- ];
get COLUMN_TYPE_ADDRESS(): string { return ListComponent.COLUMN_TYPE_ADDRESS; }
get COLUMN_TYPE_BTN_DOWNLOAD(): string { return ListComponent.COLUMN_TYPE_BTN_DOWNLOAD; }
get COLUMN_TYPE_BTN_EDIT(): string { return ListComponent.COLUMN_TYPE_BTN_EDIT; }
@@ -115,11 +100,6 @@ export class ListComponent implements OnInit, AfterViewInit {
)
}
- setData(dataSource: any, dataLength: number): void {
- this.pagingComponent.dataSource = dataSource;
- this.pagingComponent.setDataLength(dataLength);
- }
-
onSortChange = (sortState: Sort) => {
this.pagingComponent.resetPageIndex()
this.onSortFunction(sortState);
diff --git a/matsen-tool/src/app/_components/search-select/search-select.component.html b/matsen-tool/src/app/_components/search-select/search-select.component.html
index 8a3b673..f5bef98 100644
--- a/matsen-tool/src/app/_components/search-select/search-select.component.html
+++ b/matsen-tool/src/app/_components/search-select/search-select.component.html
@@ -3,7 +3,6 @@
-
Observable;
- @Input() public dataSource: any;
@Input() public dataSet!: any;
@Input() public displayedDataField!: string;
@Input() public displayedDataSubResource!: string;
@@ -52,10 +51,6 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
}
}
- setData(dataSource: any, data: any[], dataLength: number): void {
- this.listComponent.setData(dataSource, dataLength);
- }
-
onSortChange = (sortState: Sort) => {
let order: OrderFilter;
if (sortState.direction === "") {
@@ -118,7 +113,7 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
];
}
- public static getDefaultColDefProducts(): ListColDefinition[] {
+ public static getDefaultColDefProducts(subResource?: string): ListColDefinition[] {
return [
ListComponent.getDefaultColPosition(),
{
@@ -126,12 +121,14 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
text: 'overview.image',
type: ListComponent.COLUMN_TYPE_IMAGE,
field: 'imageUrl',
+ subResource: subResource,
} as ListColDefinition,
{
name: 'name',
text: 'form.product',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'name',
+ subResource: subResource,
}
];
}
diff --git a/matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html b/matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html
index feef345..234ef93 100644
--- a/matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html
+++ b/matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html
@@ -18,8 +18,7 @@
diff --git a/matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts b/matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts
index 65e8391..dce59b6 100644
--- a/matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts
+++ b/matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts
@@ -107,4 +107,6 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit {
}
this.appHelperService.openModal(NewContactComponent, data, this.getContactData);
}
+
+ protected readonly AppHelperService = AppHelperService;
}
diff --git a/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts b/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts
index 2f2f758..50a9055 100644
--- a/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts
+++ b/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts
@@ -107,20 +107,14 @@ export class PartnerListComponent implements OnInit, AfterViewInit {
} as ListColDefinition
)
}
- if (this.user !== undefined) {
- this.getDataFunction = this.getPartnerData;
- } else if (this.product !== undefined) {
- this.getDataFunction = this.getUserPartnerData
- } else {
- this.getDataFunction = this.getPartnerData;
- }
+ this.getDataFunction = this.getGetDataFunction();
}
ngAfterViewInit() {
this.listComponent.getData();
}
- getData = (): ListGetDataFunctionType => {
+ getGetDataFunction = (): ListGetDataFunctionType => {
if (this.user !== undefined) {
return this.getUserPartnerData;
} else if (this.product !== undefined) {
@@ -207,7 +201,7 @@ export class PartnerListComponent implements OnInit, AfterViewInit {
openModalNewPartner() {
let partner: PartnerJsonld = {} as PartnerJsonld;
partner.partnerType = this.partnerType as TypeEnum;
- this.appHelperService.openModal(NewPartnerComponent, { 'partner': partner }, this.getData);
+ this.appHelperService.openModal(NewPartnerComponent, { 'partner': partner }, this.getGetDataFunction);
}
unassignPartner = (element: any)=> {
diff --git a/matsen-tool/src/app/_views/posts/new-post/new-post.component.html b/matsen-tool/src/app/_views/posts/new-post/new-post.component.html
index ea52720..1793df7 100644
--- a/matsen-tool/src/app/_views/posts/new-post/new-post.component.html
+++ b/matsen-tool/src/app/_views/posts/new-post/new-post.component.html
@@ -14,14 +14,13 @@
;
- protected dataSourceProducts;
constructor(
private postService: PostService,
@@ -39,9 +33,6 @@ export class NewPostComponent implements OnInit {
protected appHelperService: AppHelperService,
) {
this.postForm = postForm;
- this.postSub = new Subscription();
- this.products = [];
- this.dataSourceProducts = new MatTableDataSource(this.products);
}
ngOnInit(): void {
@@ -60,7 +51,7 @@ export class NewPostComponent implements OnInit {
if (this.postForm.valid) {
if (this.posting.id === null || this.posting.id === undefined) {
// Create new post
- this.postSub = this.postService.postsPost(
+ this.postService.postsPost(
this.postForm.value as PostJsonld
).subscribe(
data => {
@@ -70,7 +61,7 @@ export class NewPostComponent implements OnInit {
);
} else {
// Edit post
- this.postSub = this.postService.postsIdPatch(
+ this.postService.postsIdPatch(
this.appHelperService.extractId(this.posting.id),
this.postForm.value as PostJsonld
).subscribe(
diff --git a/matsen-tool/src/app/_views/products/assign-product/assign-product.component.html b/matsen-tool/src/app/_views/products/assign-product/assign-product.component.html
index d465b3f..e4d79e0 100644
--- a/matsen-tool/src/app/_views/products/assign-product/assign-product.component.html
+++ b/matsen-tool/src/app/_views/products/assign-product/assign-product.component.html
@@ -9,24 +9,22 @@
[formLabelLangKey]="'form.product'"
[documentForm]="form"
[getDataFunction]="getUnassignedProducts"
- [dataSource]="dataSourceProducts"
[displayedDataField]="'name'"
- [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()"
+ [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()"
>
-
diff --git a/matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts b/matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts
index d26a24e..7759a48 100644
--- a/matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts
+++ b/matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts
@@ -27,10 +27,6 @@ export class AssignProductComponent implements OnInit, AfterViewInit {
@ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent
protected readonly SearchSelectComponent = SearchSelectComponent;
- protected products: Array
;
- protected dataSourceProducts;
- protected partnerProducts: Array;
- protected dataSourcePartnerProducts;
protected form!: FormGroup;
constructor(
@@ -39,11 +35,6 @@ export class AssignProductComponent implements OnInit, AfterViewInit {
protected contactPartnerProductService: ContactPartnerProductService,
protected appHelperService: AppHelperService,
) {
- this.products = [];
- this.dataSourceProducts = new MatTableDataSource(this.products);
-
- this.partnerProducts = [];
- this.dataSourcePartnerProducts = new MatTableDataSource(this.partnerProducts);
}
ngOnInit(): void {
@@ -87,7 +78,6 @@ export class AssignProductComponent implements OnInit, AfterViewInit {
onSubmit() {
if (this.form.valid) {
if (this.partnerProduct !== undefined) {
- // Partner product
this.partnerProductService.partnerProductsPost(
this.form.value as PartnerProductJsonld
).subscribe(
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 29eedb4..27fafc0 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
@@ -4,12 +4,12 @@