| @@ -2207,6 +2207,18 @@ paths: | |||
| style: form | |||
| explode: false | |||
| allowReserved: false | |||
| - | |||
| name: excludeProductId | |||
| in: query | |||
| description: '' | |||
| required: false | |||
| deprecated: false | |||
| allowEmptyValue: true | |||
| schema: | |||
| type: string | |||
| style: form | |||
| explode: false | |||
| allowReserved: false | |||
| - | |||
| name: 'order[name]' | |||
| in: query | |||
| @@ -1,10 +1,8 @@ | |||
| import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import { | |||
| ContactPartnerProductJsonld, | |||
| ContactPartnerProductService, PartnerJsonld, | |||
| PartnerProductJsonld, | |||
| PartnerProductService, PartnerService, | |||
| ProductService | |||
| PartnerJsonld, | |||
| PartnerProductJsonld, | |||
| PartnerProductService, PartnerService, | |||
| } from "@app/core/api/v1"; | |||
| import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | |||
| import {FormGroup} from "@angular/forms"; | |||
| @@ -16,63 +14,62 @@ import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-funct | |||
| import {TranslateService} from "@ngx-translate/core"; | |||
| @Component({ | |||
| selector: 'app-assign-partner', | |||
| templateUrl: './assign-partner.component.html', | |||
| styleUrl: './assign-partner.component.scss' | |||
| selector: 'app-assign-partner', | |||
| templateUrl: './assign-partner.component.html', | |||
| styleUrl: './assign-partner.component.scss' | |||
| }) | |||
| export class AssignPartnerComponent implements OnInit { | |||
| @Input() public partner!: PartnerJsonld; | |||
| @Input() public productIri!: string; | |||
| @Input() public partnerProduct!: PartnerProductJsonld; | |||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | |||
| @ViewChild('productSearchSelect', {static: false}) productSearchSelect!: SearchSelectComponent; | |||
| protected readonly SearchSelectComponent = SearchSelectComponent; | |||
| @Input() public partner!: PartnerJsonld; | |||
| @Input() public productIri!: string; | |||
| @Input() public partnerProduct!: PartnerProductJsonld; | |||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | |||
| @ViewChild('productSearchSelect', {static: false}) productSearchSelect!: SearchSelectComponent; | |||
| protected readonly SearchSelectComponent = SearchSelectComponent; | |||
| protected partnerText: string; | |||
| protected form!: FormGroup; | |||
| protected partnerText: string; | |||
| protected form!: FormGroup; | |||
| constructor( | |||
| protected partnerService: PartnerService, | |||
| protected partnerProductService: PartnerProductService, | |||
| protected appHelperService: AppHelperService, | |||
| protected translateService: TranslateService, | |||
| ) { | |||
| this.partnerText = ""; | |||
| } | |||
| constructor( | |||
| protected partnerService: PartnerService, | |||
| protected partnerProductService: PartnerProductService, | |||
| protected appHelperService: AppHelperService, | |||
| protected translateService: TranslateService, | |||
| ) { | |||
| this.partnerText = ""; | |||
| } | |||
| ngOnInit(): void { | |||
| this.translateService.get('basic.' + this.partner.partnerType).subscribe((translation: string) => { | |||
| this.partnerText = translation; | |||
| }); | |||
| if (this.partnerProduct !== undefined) { | |||
| this.form = FormGroupInitializer.initFormGroup(partnerProductForm, this.partnerProduct); | |||
| ngOnInit(): void { | |||
| this.translateService.get('basic.' + this.partner.partnerType).subscribe((translation: string) => { | |||
| this.partnerText = translation; | |||
| }); | |||
| if (this.partnerProduct !== undefined) { | |||
| this.form = FormGroupInitializer.initFormGroup(partnerProductForm, this.partnerProduct); | |||
| } | |||
| } | |||
| } | |||
| // TODO: Wie kriegen wir die Partner raus, die dieses Produkt bereits haben? | |||
| getUnassignedPartners: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => { | |||
| return this.partnerService.partnersGetCollection( | |||
| index, | |||
| pageSize, | |||
| undefined, | |||
| undefined, | |||
| term, | |||
| //this.appHelperService.extractId(this.partnerProduct.partnerIri) | |||
| ); | |||
| } | |||
| getUnassignedPartners: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => { | |||
| return this.partnerService.partnersGetCollection( | |||
| index, | |||
| pageSize, | |||
| this.partner.partnerType, | |||
| undefined, | |||
| term, | |||
| this.appHelperService.extractId(this.partnerProduct.productIri), | |||
| ); | |||
| } | |||
| onSubmit() { | |||
| if (this.form.valid) { | |||
| if (this.partnerProduct !== undefined) { | |||
| this.partnerProductService.partnerProductsPost( | |||
| this.form.value as PartnerProductJsonld | |||
| ).subscribe( | |||
| data => { | |||
| this.form.reset(); | |||
| this.submit.emit(ModalStatus.Submitted); | |||
| onSubmit() { | |||
| if (this.form.valid) { | |||
| if (this.partnerProduct !== undefined) { | |||
| this.partnerProductService.partnerProductsPost( | |||
| this.form.value as PartnerProductJsonld | |||
| ).subscribe( | |||
| data => { | |||
| this.form.reset(); | |||
| this.submit.emit(ModalStatus.Submitted); | |||
| } | |||
| ) | |||
| } | |||
| ) | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -144,6 +144,7 @@ export class PartnerListComponent implements OnInit, AfterViewInit { | |||
| this.partnerType, | |||
| undefined, | |||
| term, | |||
| undefined, | |||
| this.nameOrderFilter, | |||
| this.cityOrderFilter, | |||
| this.websiteOrderFilter | |||
| @@ -107,16 +107,17 @@ export class PartnerService { | |||
| * @param type | |||
| * @param type2 | |||
| * @param name | |||
| * @param excludeProductId | |||
| * @param orderName | |||
| * @param orderCity | |||
| * @param orderWebsite | |||
| * @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 partnersGetCollection(page?: number, itemsPerPage?: number, type?: string, type2?: Array<string>, name?: string, orderName?: 'asc' | 'desc', orderCity?: 'asc' | 'desc', orderWebsite?: 'asc' | 'desc', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiPartnersGetCollection200Response>; | |||
| public partnersGetCollection(page?: number, itemsPerPage?: number, type?: string, type2?: Array<string>, name?: string, orderName?: 'asc' | 'desc', orderCity?: 'asc' | 'desc', orderWebsite?: 'asc' | 'desc', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiPartnersGetCollection200Response>>; | |||
| public partnersGetCollection(page?: number, itemsPerPage?: number, type?: string, type2?: Array<string>, name?: string, orderName?: 'asc' | 'desc', orderCity?: 'asc' | 'desc', orderWebsite?: 'asc' | 'desc', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiPartnersGetCollection200Response>>; | |||
| public partnersGetCollection(page?: number, itemsPerPage?: number, type?: string, type2?: Array<string>, name?: string, orderName?: 'asc' | 'desc', orderCity?: 'asc' | 'desc', orderWebsite?: 'asc' | 'desc', 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 partnersGetCollection(page?: number, itemsPerPage?: number, type?: string, type2?: Array<string>, name?: string, excludeProductId?: string, orderName?: 'asc' | 'desc', orderCity?: 'asc' | 'desc', orderWebsite?: 'asc' | 'desc', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiPartnersGetCollection200Response>; | |||
| public partnersGetCollection(page?: number, itemsPerPage?: number, type?: string, type2?: Array<string>, name?: string, excludeProductId?: string, orderName?: 'asc' | 'desc', orderCity?: 'asc' | 'desc', orderWebsite?: 'asc' | 'desc', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiPartnersGetCollection200Response>>; | |||
| public partnersGetCollection(page?: number, itemsPerPage?: number, type?: string, type2?: Array<string>, name?: string, excludeProductId?: string, orderName?: 'asc' | 'desc', orderCity?: 'asc' | 'desc', orderWebsite?: 'asc' | 'desc', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiPartnersGetCollection200Response>>; | |||
| public partnersGetCollection(page?: number, itemsPerPage?: number, type?: string, type2?: Array<string>, name?: string, excludeProductId?: string, orderName?: 'asc' | 'desc', orderCity?: 'asc' | 'desc', orderWebsite?: 'asc' | 'desc', 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) { | |||
| @@ -141,6 +142,10 @@ export class PartnerService { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>name, 'name'); | |||
| } | |||
| if (excludeProductId !== undefined && excludeProductId !== null) { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>excludeProductId, 'excludeProductId'); | |||
| } | |||
| if (orderName !== undefined && orderName !== null) { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>orderName, 'order[name]'); | |||