ソースを参照

Merge branch 'master' of ssh://gitea.spawntree.de:1122/spawntree/matsen-tool-fe

master
Florian Eisenmenger 1年前
コミット
1d89a93cb3
16個のファイルの変更129行の追加3行の削除
  1. +1
    -1
      matsen-tool/openapi.json
  2. +12
    -0
      matsen-tool/openapi.yaml
  3. +3
    -0
      matsen-tool/src/app/_forms/apiForms.ts
  4. +5
    -0
      matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html
  5. +3
    -0
      matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts
  6. +2
    -0
      matsen-tool/src/app/_views/products/assign-product/assign-product.component.html
  7. +0
    -0
      matsen-tool/src/app/_views/products/assign-product/assign-product.component.scss
  8. +23
    -0
      matsen-tool/src/app/_views/products/assign-product/assign-product.component.spec.ts
  9. +17
    -0
      matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts
  10. +2
    -1
      matsen-tool/src/app/_views/products/product-list/product-list.component.html
  11. +43
    -1
      matsen-tool/src/app/_views/products/product-list/product-list.component.ts
  12. +2
    -0
      matsen-tool/src/app/app.module.ts
  13. +5
    -0
      matsen-tool/src/app/core/api/v1/model/contactPartnerProduct.ts
  14. +5
    -0
      matsen-tool/src/app/core/api/v1/model/contactPartnerProductJsonhal.ts
  15. +5
    -0
      matsen-tool/src/app/core/api/v1/model/contactPartnerProductJsonld.ts
  16. +1
    -0
      matsen-tool/src/assets/i18n/de.json

+ 1
- 1
matsen-tool/openapi.json
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 12
- 0
matsen-tool/openapi.yaml ファイルの表示

@@ -4447,6 +4447,7 @@ components:
required:
- contact
- partnerProduct
- product
properties:
contact:
type:
@@ -4460,6 +4461,9 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
product:
description: '?ProductApi'
$ref: '#/components/schemas/Product'
productName:
readOnly: true
type:
@@ -4478,6 +4482,7 @@ components:
required:
- contact
- partnerProduct
- product
properties:
_links:
type: object
@@ -4500,6 +4505,9 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
product:
description: '?ProductApi'
$ref: '#/components/schemas/Product.jsonhal'
productName:
readOnly: true
type:
@@ -4518,6 +4526,7 @@ components:
required:
- contact
- partnerProduct
- product
properties:
'@context':
readOnly: true
@@ -4554,6 +4563,9 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
product:
description: '?ProductApi'
$ref: '#/components/schemas/Product.jsonld'
productName:
readOnly: true
type:


+ 3
- 0
matsen-tool/src/app/_forms/apiForms.ts ファイルの表示

@@ -77,6 +77,7 @@ export const contactJsonldForm = new FormGroup({
export const contactPartnerProductForm = new FormGroup({
contact: new FormControl(null, [Validators.required]),
partnerProduct: new FormControl(null, [Validators.required]),
product: new FormControl(null, [Validators.required]),
productName: new FormControl(null, []),
createdAt: new FormControl(null, [])
});
@@ -85,6 +86,7 @@ export const contactPartnerProductJsonhalForm = new FormGroup({
_links: new FormControl(null, []),
contact: new FormControl(null, [Validators.required]),
partnerProduct: new FormControl(null, [Validators.required]),
product: new FormControl(null, [Validators.required]),
productName: new FormControl(null, []),
createdAt: new FormControl(null, [])
});
@@ -92,6 +94,7 @@ export const contactPartnerProductJsonhalForm = new FormGroup({
export const contactPartnerProductJsonldForm = new FormGroup({
contact: new FormControl(null, [Validators.required]),
partnerProduct: new FormControl(null, [Validators.required]),
product: new FormControl(null, [Validators.required]),
productName: new FormControl(null, []),
createdAt: new FormControl(null, [])
});


+ 5
- 0
matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html ファイルの表示

@@ -40,3 +40,8 @@
[contact]="contact"
></app-post-list>
</app-toggle>
<app-toggle #toggleProducts [headline]="'basic.products' | translate">
<app-product-list *ngIf="toggleProducts.isOpened" #productListComponent
[contact]="contact">
</app-product-list>
</app-toggle>

+ 3
- 0
matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts ファイルの表示

@@ -13,6 +13,7 @@ import {AccountService} from "@app/_services";
import {AppHelperService} from "@app/_helpers/app-helper.service";
import {PostListComponent} from "@app/_views/posts/post-list/post-list.component";
import {ToggleComponent} from "@app/_components/toggle/toggle.component";
import {ProductListComponent} from "@app/_views/products/product-list/product-list.component";

@Component({
selector: 'app-contacts-detail',
@@ -22,6 +23,8 @@ import {ToggleComponent} from "@app/_components/toggle/toggle.component";
export class ContactsDetailComponent implements OnInit, AfterViewInit {
@ViewChild("togglePosts", { static: true }) togglePosts!: ToggleComponent;
@ViewChild("postListComponent", { static: false }) postsComponent!: PostListComponent;
@ViewChild("toggleProducts", { static: true }) toggleProducts!: ToggleComponent;
@ViewChild("productListComponent", { static: false }) productsComponent!: ProductListComponent;

protected user: User | null;



+ 2
- 0
matsen-tool/src/app/_views/products/assign-product/assign-product.component.html ファイルの表示

@@ -0,0 +1,2 @@
<h2 >{{'basic.assign-product' | translate}}</h2>


+ 0
- 0
matsen-tool/src/app/_views/products/assign-product/assign-product.component.scss ファイルの表示


+ 23
- 0
matsen-tool/src/app/_views/products/assign-product/assign-product.component.spec.ts ファイルの表示

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AssignProductComponent } from './assign-product.component';

describe('AssignProductComponent', () => {
let component: AssignProductComponent;
let fixture: ComponentFixture<AssignProductComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AssignProductComponent]
})
.compileComponents();
fixture = TestBed.createComponent(AssignProductComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 17
- 0
matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts ファイルの表示

@@ -0,0 +1,17 @@
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
import {ContactJsonld, PartnerJsonld, ProductJsonld, UserJsonld} from "@app/core/api/v1";
import {ModalStatus} from "@app/_helpers/modal.states";
import {SearchInputComponent} from "@app/_components/search-input/search-input.component";

@Component({
selector: 'app-assign-product',
templateUrl: './assign-product.component.html',
styleUrl: './assign-product.component.scss'
})
export class AssignProductComponent {
@Input() public user!: UserJsonld;
@Input() public partner!: PartnerJsonld;
@Input() public contact!: ContactJsonld;
@Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>();
@ViewChild('productSearchInput', { static: false }) $productSearchInput!: SearchInputComponent;
}

+ 2
- 1
matsen-tool/src/app/_views/products/product-list/product-list.component.html ファイルの表示

@@ -1,6 +1,7 @@
<div class="spt-container">
<div class="top-btn">
<button class="btn btn-primary" (click)="openModalNewProduct()">+ {{ 'basic.new-product' | translate }}</button>
<button *ngIf="bShowNewProductButton" class="btn btn-primary" (click)="openModalNewProduct()">+ {{ 'basic.new-product' | translate }}</button>
<button *ngIf="!bShowNewProductButton" class="btn btn-primary" (click)="openModalAssignProduct()">+ {{ 'basic.assign-product' | translate }}</button>
</div>
<app-paging #pagingComponent
[getDataFunction]="getData"


+ 43
- 1
matsen-tool/src/app/_views/products/product-list/product-list.component.ts ファイルの表示

@@ -3,6 +3,7 @@ import {MatSort, Sort} from "@angular/material/sort";
import {PagingComponent} from "@app/_components/paging/paging.component";
import {Subscription} from "rxjs";
import {
ContactJsonld, ContactPartnerProductService,
PartnerJsonld,
PartnerProductService,
ProductJsonld,
@@ -15,6 +16,7 @@ import {AppHelperService} from "@app/_helpers/app-helper.service";
import {MatTableDataSource} from "@angular/material/table";
import {OrderFilter} from "@app/_models/orderFilter";
import {NewProductComponent} from "@app/_views/products/new-product/new-product.component";
import {AssignProductComponent} from "@app/_views/products/assign-product/assign-product.component";

@Component({
selector: 'app-product-list',
@@ -25,6 +27,7 @@ export class ProductListComponent implements OnInit, AfterViewInit {

@Input() public user!: UserJsonld;
@Input() public partner!: PartnerJsonld;
@Input() public contact!: ContactJsonld;
@ViewChild(MatSort) sort;
@ViewChild("pagingComponent", { static: false }) pagingComponent!: PagingComponent;

@@ -33,12 +36,14 @@ export class ProductListComponent implements OnInit, AfterViewInit {
protected productsSub: Subscription;
protected products: Array<ProductJsonld>;
protected dataSource;
protected bShowNewProductButton: boolean;

constructor(
private router: Router,
private productService: ProductService,
private userProductService: UserProductService,
private partnerProductService: PartnerProductService,
private contactPartnerProductService: ContactPartnerProductService,
protected appHelperService: AppHelperService,
) {
this.sort = new MatSort();
@@ -47,14 +52,18 @@ export class ProductListComponent implements OnInit, AfterViewInit {
this.productsSub = new Subscription();
this.products = [];
this.dataSource = new MatTableDataSource<ProductJsonld>(this.products);
this.bShowNewProductButton = true;
}

ngOnInit(){
this.bShowNewProductButton =
this.user === undefined && this.partner === undefined && this.contact === undefined;
}

ngAfterViewInit() {
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.pagingComponent.paginator;
//this.bShowNewProductButton = this.user === undefined && this.partner === undefined;
this.pagingComponent.getData();
}

@@ -63,6 +72,8 @@ export class ProductListComponent implements OnInit, AfterViewInit {
this.getUserProducts();
} else if (this.partner !== undefined) {
this.getPartnerProducts();
} else if (this.contact !== undefined) {
this.getContactPartnerProduct();
} else {
this.getProducts();
}
@@ -93,12 +104,29 @@ export class ProductListComponent implements OnInit, AfterViewInit {
this.partner.id,
).subscribe(
data => {
console.log(data);
let partnerProducts = data["hydra:member"];
this.products = [];
partnerProducts.forEach(item => {
this.products.push(item.product);
})
this.pagingComponent.dataLength = Number(data["hydra:totalItems"]);
this.dataSource = new MatTableDataSource<ProductJsonld>(this.products);
}
);
}

getContactPartnerProduct = () => {
this.productsSub = this.contactPartnerProductService.contactPartnerProductsGetCollection(
this.pagingComponent.getPageIndex(),
this.pagingComponent.getPageSize(),
this.contact.id,
).subscribe(
data => {
let contactProduct = data["hydra:member"];
this.products = [];
contactProduct.forEach(item => {
this.products.push(item.product);
})
console.log(this.products);
this.pagingComponent.dataLength = Number(data["hydra:totalItems"]);
this.dataSource = new MatTableDataSource<ProductJsonld>(this.products);
@@ -142,4 +170,18 @@ export class ProductListComponent implements OnInit, AfterViewInit {
product.name = "";
this.appHelperService.openModal(NewProductComponent, { 'product': product }, this.getData);
}

openModalAssignProduct() {
let data = {};
if (this.user !== undefined) {
this.appHelperService.openModal(AssignProductComponent, { 'user' : this.user }, this.getUserProducts);
} else if (this.partner !== undefined) {
data = { 'partner' : this.partner };
this.appHelperService.openModal(AssignProductComponent, { 'partner' : this.partner }, this.getPartnerProducts);
} else if (this.contact !== undefined) {
this.appHelperService.openModal(AssignProductComponent, { 'contact' : this.contact }, this.getContactPartnerProduct);
} else {
throw new Error('data not found')
}
}
}

+ 2
- 0
matsen-tool/src/app/app.module.ts ファイルの表示

@@ -61,6 +61,7 @@ import { SaleSummaryComponent } from './_views/sales/sale-summary/sale-summary.c
import { UsersComponent } from './_views/user/users.component';
import { UserDetailComponent } from './_views/user/user-detail/user-detail.component';
import { UserListComponent } from './_views/user/user-list/user-list.component';
import { AssignProductComponent } from './_views/products/assign-product/assign-product.component';


export function apiConfigFactory(): Configuration {
@@ -145,6 +146,7 @@ export function HttpLoaderFactory(http: HttpClient) {
UsersComponent,
UserDetailComponent,
UserListComponent,
AssignProductComponent,
],
providers: [
{provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true},


+ 5
- 0
matsen-tool/src/app/core/api/v1/model/contactPartnerProduct.ts ファイルの表示

@@ -9,6 +9,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Product } from './product';


/**
@@ -17,6 +18,10 @@
export interface ContactPartnerProduct {
contact: string | null;
partnerProduct: string | null;
/**
* ?ProductApi
*/
product: Product;
readonly productName?: string | null;
readonly createdAt?: string | null;
}


+ 5
- 0
matsen-tool/src/app/core/api/v1/model/contactPartnerProductJsonhal.ts ファイルの表示

@@ -10,6 +10,7 @@
* Do not edit the class manually.
*/
import { CommentJsonhalLinks } from './commentJsonhalLinks';
import { ProductJsonhal } from './productJsonhal';


/**
@@ -19,6 +20,10 @@ export interface ContactPartnerProductJsonhal {
_links?: CommentJsonhalLinks;
contact: string | null;
partnerProduct: string | null;
/**
* ?ProductApi
*/
product: ProductJsonhal;
readonly productName?: string | null;
readonly createdAt?: string | null;
}


+ 5
- 0
matsen-tool/src/app/core/api/v1/model/contactPartnerProductJsonld.ts ファイルの表示

@@ -10,6 +10,7 @@
* Do not edit the class manually.
*/
import { CommentJsonldContext } from './commentJsonldContext';
import { ProductJsonld } from './productJsonld';


/**
@@ -21,6 +22,10 @@ export interface ContactPartnerProductJsonld {
readonly type?: string;
contact: string | null;
partnerProduct: string | null;
/**
* ?ProductApi
*/
product: ProductJsonld;
readonly productName?: string | null;
readonly createdAt?: string | null;
}


+ 1
- 0
matsen-tool/src/assets/i18n/de.json ファイルの表示

@@ -28,6 +28,7 @@
"users": "Benutzer",
"new": "Neuer",
"new-product": "Neues Produkt",
"assign-product": "Produkt zuordnen",
"new-document": "Neues Dokument",
"new-task": "Neue Aufgabe",
"new-contact": "Neuer Kontakt",


読み込み中…
キャンセル
保存