Quellcode durchsuchen

wip search

master
Daniel vor 1 Jahr
Ursprung
Commit
a3791ddcad
13 geänderte Dateien mit 119 neuen und 43 gelöschten Zeilen
  1. +1
    -1
      matsen-tool/openapi.json
  2. +24
    -0
      matsen-tool/openapi.yaml
  3. +6
    -0
      matsen-tool/src/app/_components/paging/paging.component.html
  4. +20
    -2
      matsen-tool/src/app/_components/paging/paging.component.ts
  5. +1
    -0
      matsen-tool/src/app/_views/partners/partner-list/partner-list.component.html
  6. +13
    -9
      matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts
  7. +2
    -0
      matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts
  8. +1
    -0
      matsen-tool/src/app/_views/products/product-list/product-list.component.html
  9. +30
    -21
      matsen-tool/src/app/_views/products/product-list/product-list.component.ts
  10. +1
    -1
      matsen-tool/src/app/app.module.ts
  11. +9
    -4
      matsen-tool/src/app/core/api/v1/api/partnerFollow.service.ts
  12. +9
    -4
      matsen-tool/src/app/core/api/v1/api/partnerProduct.service.ts
  13. +2
    -1
      matsen-tool/src/assets/i18n/de.json

+ 1
- 1
matsen-tool/openapi.json
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 24
- 0
matsen-tool/openapi.yaml Datei anzeigen

@@ -1462,6 +1462,18 @@ paths:
style: form
explode: true
allowReserved: false
-
name: partner.name
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: user
in: query
@@ -1723,6 +1735,18 @@ paths:
style: form
explode: true
allowReserved: false
-
name: partner.name
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: product
in: query


+ 6
- 0
matsen-tool/src/app/_components/paging/paging.component.html Datei anzeigen

@@ -6,6 +6,12 @@
[pageIndex]="pageIndex"
showFirstLastButtons>
</mat-paginator>
<div *ngIf="searchable">
<form [formGroup]="searchForm">
<input type="text" formControlName="inputText" placeholder="{{'form.search-placeholder' | translate}}">
</form>
</div>

<ng-content></ng-content>
<mat-paginator *ngIf="dataLength > 0" class=""
[pageSizeOptions]="pageSizeOptions"


+ 20
- 2
matsen-tool/src/app/_components/paging/paging.component.ts Datei anzeigen

@@ -1,5 +1,7 @@
import {ChangeDetectorRef, Component, Input, OnInit, ViewChild} from '@angular/core';
import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
import {FormBuilder, FormGroup} from "@angular/forms";
import {debounceTime, distinctUntilChanged} from "rxjs";

@Component({
selector: 'app-paging',
@@ -12,6 +14,7 @@ export class PagingComponent implements OnInit {
@Input() public getDataFunction!: Function;
@Input() public pageSize!: number;
@Input() public pageSizeOptions!: number[];
@Input() public searchable: boolean;

@ViewChild(MatPaginator) public paginator!: MatPaginator;

@@ -21,25 +24,40 @@ export class PagingComponent implements OnInit {
public dataLength: number;
public pageEvent: PageEvent;
protected pageIndex: number;
protected searchForm!: FormGroup;

constructor(
private fb: FormBuilder
) {
this.dataLength = 0;
this.pageEvent = new PageEvent();
this.pageIndex = 0;
this.searchable = false;
}

ngOnInit() {
this.pageSize = this.pageSize !== undefined ? this.pageSize : this.defaultPageSize;
this.pageSizeOptions = this.pageSizeOptions !== undefined ? this.pageSizeOptions : this.defaultPageSizeOptions;
this.paginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);

if (this.searchable) {
this.searchForm = this.fb.group({
inputText: ['']
});
this.searchForm.get('inputText')?.valueChanges.pipe(
debounceTime(1000), // Warte 2 Sekunden
distinctUntilChanged() // Nur bei Änderungen auslösen
).subscribe(value => {
this.getData()
});
}
}

ngAfterViewInit() {
}

getData() {
this.getDataFunction();
this.getDataFunction(this.searchForm ? this.searchForm.get('inputText')?.value : undefined);
}

handlePageEvent(e: PageEvent) {
@@ -47,7 +65,7 @@ export class PagingComponent implements OnInit {
this.dataLength = e.length;
this.pageIndex = e.pageIndex.valueOf();
this.pageSize = e.pageSize.valueOf();
this.getDataFunction();
this.getData();
}

resetPageIndex(): void


+ 1
- 0
matsen-tool/src/app/_views/partners/partner-list/partner-list.component.html Datei anzeigen

@@ -5,6 +5,7 @@
<app-paging #pagingComponent
[getDataFunction]="getData"
[dataSource]="dataSource"
[searchable]="true"
>
<div class="table-responsive">
<table mat-table [dataSource]="dataSource" matSort (matSortChange)="onSortChange($event)" class="mat-elevation-z8">


+ 13
- 9
matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts Datei anzeigen

@@ -77,23 +77,23 @@ export class PartnerListComponent implements OnInit, AfterViewInit {
this.pagingComponent.getData();
}

getData = () => {
getData = (searchValue = undefined) => {
if (this.user !== undefined) {
this.getUserPartnerData();
this.getUserPartnerData(searchValue);
} else if (this.product !== undefined) {
this.getPartnerProducts();
this.getPartnerProducts(searchValue);
} else {
this.getPartnerData();
this.getPartnerData(searchValue);
}
}

getPartnerData = () => {
getPartnerData = (searchValue = undefined) => {
this.partnersSub = this.partnerService.partnersGetCollection(
this.pagingComponent.getPageIndex(),
this.pagingComponent.getPageSize(),
this.partnerType,
undefined,
undefined,
searchValue,
this.nameOrderAsc,
this.cityOrderAsc,
this.websiteOrderAsc
@@ -106,12 +106,13 @@ export class PartnerListComponent implements OnInit, AfterViewInit {
);
}

getUserPartnerData = () => {
getUserPartnerData = (searchValue = undefined) => {
this.partnersSub = this.partnerFollowService.partnerFollowsGetCollection(
this.pagingComponent.getPageIndex(),
this.pagingComponent.getPageSize(),
undefined,
undefined,
searchValue,
this.user.id,
undefined,
this.partnerType
@@ -130,16 +131,19 @@ export class PartnerListComponent implements OnInit, AfterViewInit {
);
}

getPartnerProducts = () => {
getPartnerProducts = (searchValue = undefined) => {
console.log(this.partnerType);
console.log(searchValue);
this.partnersSub = this.partnerProductService.partnerProductsGetCollection(
this.pagingComponent.getPageIndex(),
this.pagingComponent.getPageSize(),
undefined,
undefined,
searchValue,
this.product.id,
undefined,
undefined,
this.partnerType
this.partnerType,
).subscribe(
data => {
let partnerProducts = data["hydra:member"];


+ 2
- 0
matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts Datei anzeigen

@@ -53,6 +53,7 @@ export class AssignProductComponent implements OnInit {
undefined,
undefined,
undefined,
undefined,
term
);

@@ -76,6 +77,7 @@ export class AssignProductComponent implements OnInit {
undefined,
undefined,
undefined,
undefined,
term
);



+ 1
- 0
matsen-tool/src/app/_views/products/product-list/product-list.component.html Datei anzeigen

@@ -6,6 +6,7 @@
<app-paging #pagingComponent
[getDataFunction]="getData"
[dataSource]="dataSource"
[searchable]="true"
>
<div class="table-responsive">
<table mat-table [dataSource]="dataSource" matSort (matSortChange)="onSortChange($event)"


+ 30
- 21
matsen-tool/src/app/_views/products/product-list/product-list.component.ts Datei anzeigen

@@ -63,23 +63,37 @@ export class ProductListComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.pagingComponent.paginator;
//this.bShowNewProductButton = this.user === undefined && this.partner === undefined;
this.pagingComponent.getData();
}

getData = () => {
getData = (searchValue = undefined) => {

if (this.user !== undefined) {
this.getUserProducts();
this.getUserProducts(searchValue);
} else if (this.partner !== undefined) {
this.getPartnerProducts();
this.getPartnerProducts(searchValue);
} else if (this.contact !== undefined) {
this.getContactPartnerProduct();
this.getContactPartnerProduct(searchValue);
} else {
this.getProducts();
this.getProducts(searchValue);
}
}

getUserProducts = () => {
getProducts = (searchValue = undefined) => {
this.productsSub = this.productService.productsGetCollection(
this.pagingComponent.getPageIndex(),
this.pagingComponent.getPageSize(),
searchValue
).subscribe(
data => {
this.products = data["hydra:member"];
this.pagingComponent.dataLength = Number(data["hydra:totalItems"]);
this.dataSource = new MatTableDataSource<ProductJsonld>(this.products);
}
);
}

getUserProducts = (searchValue = undefined) => {
this.productsSub = this.userProductService.userProductsGetCollection(
this.pagingComponent.getPageIndex(),
this.pagingComponent.getPageSize(),
@@ -100,11 +114,15 @@ export class ProductListComponent implements OnInit, AfterViewInit {
);
}

getPartnerProducts = () => {
getPartnerProducts = (searchValue= undefined) => {
this.productsSub = this.partnerProductService.partnerProductsGetCollection(
this.pagingComponent.getPageIndex(),
this.pagingComponent.getPageSize(),
this.partner.id,
undefined,
undefined,
undefined,
searchValue
).subscribe(
data => {
let partnerProducts = data["hydra:member"];
@@ -120,11 +138,13 @@ export class ProductListComponent implements OnInit, AfterViewInit {
);
}

getContactPartnerProduct = () => {
getContactPartnerProduct = (searchValue = undefined) => {
this.productsSub = this.contactPartnerProductService.contactPartnerProductsGetCollection(
this.pagingComponent.getPageIndex(),
this.pagingComponent.getPageSize(),
this.contact.id,
undefined,
searchValue
).subscribe(
data => {
let contactProduct = data["hydra:member"];
@@ -141,18 +161,7 @@ export class ProductListComponent implements OnInit, AfterViewInit {
);
}

getProducts = () => {
this.productsSub = this.productService.productsGetCollection(
this.pagingComponent.getPageIndex(),
this.pagingComponent.getPageSize()
).subscribe(
data => {
this.products = data["hydra:member"];
this.pagingComponent.dataLength = Number(data["hydra:totalItems"]);
this.dataSource = new MatTableDataSource<ProductJsonld>(this.products);
}
);
}


onSortChange = (sortState: Sort) => {
this.pagingComponent.resetPageIndex()


+ 1
- 1
matsen-tool/src/app/app.module.ts Datei anzeigen

@@ -103,7 +103,7 @@ export function HttpLoaderFactory(http: HttpClient) {
MatOptionModule,
MatAutocompleteModule,
MatFormFieldModule,
MatInputModule
MatInputModule,
],
declarations: [
AppComponent,


+ 9
- 4
matsen-tool/src/app/core/api/v1/api/partnerFollow.service.ts Datei anzeigen

@@ -106,6 +106,7 @@ export class PartnerFollowService {
* @param itemsPerPage The number of items per page
* @param partner
* @param partner2
* @param partnerName
* @param user
* @param user2
* @param partnerType
@@ -113,10 +114,10 @@ export class PartnerFollowService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public partnerFollowsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, user?: string, user2?: Array<string>, partnerType?: string, partnerType2?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiPartnerFollowsGetCollection200Response>;
public partnerFollowsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, user?: string, user2?: Array<string>, partnerType?: string, partnerType2?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiPartnerFollowsGetCollection200Response>>;
public partnerFollowsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, user?: string, user2?: Array<string>, partnerType?: string, partnerType2?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiPartnerFollowsGetCollection200Response>>;
public partnerFollowsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, user?: string, user2?: Array<string>, partnerType?: string, partnerType2?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
public partnerFollowsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, partnerName?: string, user?: string, user2?: Array<string>, partnerType?: string, partnerType2?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiPartnerFollowsGetCollection200Response>;
public partnerFollowsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, partnerName?: string, user?: string, user2?: Array<string>, partnerType?: string, partnerType2?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiPartnerFollowsGetCollection200Response>>;
public partnerFollowsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, partnerName?: string, user?: string, user2?: Array<string>, partnerType?: string, partnerType2?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiPartnerFollowsGetCollection200Response>>;
public partnerFollowsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, partnerName?: string, user?: string, user2?: Array<string>, partnerType?: string, partnerType2?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {

let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (page !== undefined && page !== null) {
@@ -137,6 +138,10 @@ export class PartnerFollowService {
<any>element, 'partner[]');
})
}
if (partnerName !== undefined && partnerName !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>partnerName, 'partner.name');
}
if (user !== undefined && user !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>user, 'user');


+ 9
- 4
matsen-tool/src/app/core/api/v1/api/partnerProduct.service.ts Datei anzeigen

@@ -106,6 +106,7 @@ export class PartnerProductService {
* @param itemsPerPage The number of items per page
* @param partner
* @param partner2
* @param partnerName
* @param product
* @param product2
* @param productName
@@ -114,10 +115,10 @@ export class PartnerProductService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public partnerProductsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, product?: string, product2?: Array<string>, productName?: string, partnerType?: string, partnerType2?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiPartnerProductsGetCollection200Response>;
public partnerProductsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, product?: string, product2?: Array<string>, productName?: string, partnerType?: string, partnerType2?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiPartnerProductsGetCollection200Response>>;
public partnerProductsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, product?: string, product2?: Array<string>, productName?: string, partnerType?: string, partnerType2?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiPartnerProductsGetCollection200Response>>;
public partnerProductsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, product?: string, product2?: Array<string>, productName?: string, partnerType?: string, partnerType2?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
public partnerProductsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, partnerName?: string, product?: string, product2?: Array<string>, productName?: string, partnerType?: string, partnerType2?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiPartnerProductsGetCollection200Response>;
public partnerProductsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, partnerName?: string, product?: string, product2?: Array<string>, productName?: string, partnerType?: string, partnerType2?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiPartnerProductsGetCollection200Response>>;
public partnerProductsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, partnerName?: string, product?: string, product2?: Array<string>, productName?: string, partnerType?: string, partnerType2?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiPartnerProductsGetCollection200Response>>;
public partnerProductsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, partnerName?: string, product?: string, product2?: Array<string>, productName?: string, partnerType?: string, partnerType2?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<any> {

let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (page !== undefined && page !== null) {
@@ -138,6 +139,10 @@ export class PartnerProductService {
<any>element, 'partner[]');
})
}
if (partnerName !== undefined && partnerName !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>partnerName, 'partner.name');
}
if (product !== undefined && product !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>product, 'product');


+ 2
- 1
matsen-tool/src/assets/i18n/de.json Datei anzeigen

@@ -121,7 +121,8 @@
"turnover": "Umsatz",
"profit": "Gewinn",
"quantity": "Anzahl",
"send": "Speichern"
"send": "Speichern",
"search-placeholder": "Suche"
},
"sales":
{


Laden…
Abbrechen
Speichern