| @@ -231,7 +231,8 @@ export const partnerFollowForm = new FormGroup({ | |||
| userName: new FormControl(null, []), | |||
| partner: new FormControl(null, [Validators.required]), | |||
| partnerName: new FormControl(null, []), | |||
| createdAt: new FormControl(null, []) | |||
| createdAt: new FormControl(null, []), | |||
| owner: new FormControl(null, []) | |||
| }); | |||
| export const partnerFollowJsonhalForm = new FormGroup({ | |||
| @@ -240,7 +241,8 @@ export const partnerFollowJsonhalForm = new FormGroup({ | |||
| userName: new FormControl(null, []), | |||
| partner: new FormControl(null, [Validators.required]), | |||
| partnerName: new FormControl(null, []), | |||
| createdAt: new FormControl(null, []) | |||
| createdAt: new FormControl(null, []), | |||
| owner: new FormControl(null, []) | |||
| }); | |||
| export const partnerFollowJsonldForm = new FormGroup({ | |||
| @@ -248,7 +250,8 @@ export const partnerFollowJsonldForm = new FormGroup({ | |||
| userName: new FormControl(null, []), | |||
| partner: new FormControl(null, [Validators.required]), | |||
| partnerName: new FormControl(null, []), | |||
| createdAt: new FormControl(null, []) | |||
| createdAt: new FormControl(null, []), | |||
| owner: new FormControl(null, []) | |||
| }); | |||
| export const partnerProductForm = new FormGroup({ | |||
| @@ -570,3 +573,31 @@ export const userJsonldForm = new FormGroup({ | |||
| active: new FormControl(null, []), | |||
| createdAt: new FormControl(null, []) | |||
| }); | |||
| export const userProductForm = new FormGroup({ | |||
| user: new FormControl(null, []), | |||
| userName: new FormControl(null, []), | |||
| product: new FormControl(null, [Validators.required]), | |||
| productName: new FormControl(null, []), | |||
| createdAt: new FormControl(null, []), | |||
| owner: new FormControl(null, []) | |||
| }); | |||
| export const userProductJsonhalForm = new FormGroup({ | |||
| _links: new FormControl(null, []), | |||
| user: new FormControl(null, []), | |||
| userName: new FormControl(null, []), | |||
| product: new FormControl(null, [Validators.required]), | |||
| productName: new FormControl(null, []), | |||
| createdAt: new FormControl(null, []), | |||
| owner: new FormControl(null, []) | |||
| }); | |||
| export const userProductJsonldForm = new FormGroup({ | |||
| user: new FormControl(null, []), | |||
| userName: new FormControl(null, []), | |||
| product: new FormControl(null, [Validators.required]), | |||
| productName: new FormControl(null, []), | |||
| createdAt: new FormControl(null, []), | |||
| owner: new FormControl(null, []) | |||
| }); | |||
| @@ -6,7 +6,7 @@ export class ApiConverter { | |||
| constructor(private sanitizer: DomSanitizer) {} | |||
| public static extractId(iri: string | undefined | null): string { | |||
| public extractId(iri: string | undefined | null): string { | |||
| if (iri !== undefined && iri !== null) { | |||
| const iriRegex = /\/(\d+)$/; | |||
| const match = iri.match(iriRegex); | |||
| @@ -17,7 +17,7 @@ export class ApiConverter { | |||
| return ""; | |||
| } | |||
| public static convertDate(dateString: string | null, withTime = false) { | |||
| public convertDate(dateString: string | null, withTime = false) { | |||
| // number 10 for input date (2024-03-15) | |||
| // number 16 for input datetime-local (2024-04-28T03:22) | |||
| if (dateString !== null) { | |||
| @@ -177,7 +177,7 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { | |||
| const modalRefContact = this.modalService.open(NewContactComponent, this.modalOptions); | |||
| modalRefContact.componentInstance.contact = this.contact; | |||
| if (this.contact.birthday !== undefined) { | |||
| modalRefContact.componentInstance.birthdayValue = ApiConverter.convertDate(this.contact.birthday); | |||
| modalRefContact.componentInstance.birthdayValue = this.apiConverter.convertDate(this.contact.birthday); | |||
| } | |||
| modalRefContact.componentInstance.submit.subscribe((modalStatus: ModalStatus) => { | |||
| if (modalStatus === ModalStatus.Submitted) { | |||
| @@ -28,7 +28,8 @@ export class NewContactComponent implements OnInit { | |||
| constructor( | |||
| private contactService: ContactService, | |||
| private mediaObjectService: MediaObjectService, | |||
| private translateService: TranslateService | |||
| private translateService: TranslateService, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.contactForm = contactForm; | |||
| this.selectedImage = null; | |||
| @@ -84,7 +85,7 @@ export class NewContactComponent implements OnInit { | |||
| } else { | |||
| // Edit contact | |||
| this.contactSub = this.contactService.contactsIdPatch( | |||
| ApiConverter.extractId(this.contact.id), | |||
| this.apiConverter.extractId(this.contact.id), | |||
| this.contactForm.value as ContactJsonld | |||
| ).subscribe( | |||
| data => { | |||
| @@ -19,6 +19,7 @@ api/saleSummary.service.ts | |||
| api/task.service.ts | |||
| api/taskNote.service.ts | |||
| api/user.service.ts | |||
| api/userProduct.service.ts | |||
| configuration.ts | |||
| encoder.ts | |||
| git_push.sh | |||
| @@ -58,6 +59,8 @@ model/apiTaskNotesGetCollection200Response.ts | |||
| model/apiTaskNotesGetCollection200Response1.ts | |||
| model/apiTasksGetCollection200Response.ts | |||
| model/apiTasksGetCollection200Response1.ts | |||
| model/apiUserProductsGetCollection200Response.ts | |||
| model/apiUserProductsGetCollection200Response1.ts | |||
| model/apiUsersGetCollection200Response.ts | |||
| model/apiUsersGetCollection200Response1.ts | |||
| model/comment.ts | |||
| @@ -118,5 +121,8 @@ model/taskNoteJsonld.ts | |||
| model/user.ts | |||
| model/userJsonhal.ts | |||
| model/userJsonld.ts | |||
| model/userProduct.ts | |||
| model/userProductJsonhal.ts | |||
| model/userProductJsonld.ts | |||
| param.ts | |||
| variables.ts | |||
| @@ -32,4 +32,6 @@ export * from './taskNote.service'; | |||
| import { TaskNoteService } from './taskNote.service'; | |||
| export * from './user.service'; | |||
| import { UserService } from './user.service'; | |||
| export const APIS = [CommentService, ContactService, ContactPartnerProductService, DocumentService, DocumentObjectService, LoginCheckService, MediaObjectService, PartnerService, PartnerFollowService, PartnerProductService, PostService, ProductService, SaleService, SaleSummaryService, TaskService, TaskNoteService, UserService]; | |||
| export * from './userProduct.service'; | |||
| import { UserProductService } from './userProduct.service'; | |||
| export const APIS = [CommentService, ContactService, ContactPartnerProductService, DocumentService, DocumentObjectService, LoginCheckService, MediaObjectService, PartnerService, PartnerFollowService, PartnerProductService, PostService, ProductService, SaleService, SaleSummaryService, TaskService, TaskNoteService, UserService, UserProductService]; | |||
| @@ -186,7 +186,7 @@ export class CommentService { | |||
| /** | |||
| * Retrieves a Comment resource. | |||
| * Retrieves a Comment resource. | |||
| * @param id CommentApi identifier | |||
| * @param id Comment identifier | |||
| * @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. | |||
| */ | |||
| @@ -261,7 +261,7 @@ export class CommentService { | |||
| /** | |||
| * Updates the Comment resource. | |||
| * Updates the Comment resource. | |||
| * @param id CommentApi identifier | |||
| * @param id Comment identifier | |||
| * @param comment The updated Comment resource | |||
| * @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. | |||
| @@ -198,7 +198,7 @@ export class ContactService { | |||
| /** | |||
| * Retrieves a Contact resource. | |||
| * Retrieves a Contact resource. | |||
| * @param id ContactApi identifier | |||
| * @param id Contact identifier | |||
| * @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. | |||
| */ | |||
| @@ -273,7 +273,7 @@ export class ContactService { | |||
| /** | |||
| * Updates the Contact resource. | |||
| * Updates the Contact resource. | |||
| * @param id ContactApi identifier | |||
| * @param id Contact identifier | |||
| * @param contact The updated Contact resource | |||
| * @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. | |||
| @@ -198,7 +198,7 @@ export class ContactPartnerProductService { | |||
| /** | |||
| * Removes the ContactPartnerProduct resource. | |||
| * Removes the ContactPartnerProduct resource. | |||
| * @param id ContactPartnerProductApi identifier | |||
| * @param id ContactPartnerProduct identifier | |||
| * @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. | |||
| */ | |||
| @@ -269,7 +269,7 @@ export class ContactPartnerProductService { | |||
| /** | |||
| * Retrieves a ContactPartnerProduct resource. | |||
| * Retrieves a ContactPartnerProduct resource. | |||
| * @param id ContactPartnerProductApi identifier | |||
| * @param id ContactPartnerProduct identifier | |||
| * @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. | |||
| */ | |||
| @@ -210,7 +210,7 @@ export class DocumentService { | |||
| /** | |||
| * Retrieves a Document resource. | |||
| * Retrieves a Document resource. | |||
| * @param id DocumentApi identifier | |||
| * @param id Document identifier | |||
| * @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. | |||
| */ | |||
| @@ -285,7 +285,7 @@ export class DocumentService { | |||
| /** | |||
| * Updates the Document resource. | |||
| * Updates the Document resource. | |||
| * @param id DocumentApi identifier | |||
| * @param id Document identifier | |||
| * @param document The updated Document resource | |||
| * @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. | |||
| @@ -218,7 +218,7 @@ export class PartnerService { | |||
| /** | |||
| * Retrieves a Partner resource. | |||
| * Retrieves a Partner resource. | |||
| * @param id PartnerApi identifier | |||
| * @param id Partner identifier | |||
| * @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. | |||
| */ | |||
| @@ -293,7 +293,7 @@ export class PartnerService { | |||
| /** | |||
| * Updates the Partner resource. | |||
| * Updates the Partner resource. | |||
| * @param id PartnerApi identifier | |||
| * @param id Partner identifier | |||
| * @param partner The updated Partner resource | |||
| * @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. | |||
| @@ -210,7 +210,7 @@ export class PartnerFollowService { | |||
| /** | |||
| * Removes the PartnerFollow resource. | |||
| * Removes the PartnerFollow resource. | |||
| * @param id PartnerFollowApi identifier | |||
| * @param id PartnerFollow identifier | |||
| * @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. | |||
| */ | |||
| @@ -281,7 +281,7 @@ export class PartnerFollowService { | |||
| /** | |||
| * Retrieves a PartnerFollow resource. | |||
| * Retrieves a PartnerFollow resource. | |||
| * @param id PartnerFollowApi identifier | |||
| * @param id PartnerFollow identifier | |||
| * @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. | |||
| */ | |||
| @@ -210,7 +210,7 @@ export class PartnerProductService { | |||
| /** | |||
| * Removes the PartnerProduct resource. | |||
| * Removes the PartnerProduct resource. | |||
| * @param id PartnerProductApi identifier | |||
| * @param id PartnerProduct identifier | |||
| * @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. | |||
| */ | |||
| @@ -281,7 +281,7 @@ export class PartnerProductService { | |||
| /** | |||
| * Retrieves a PartnerProduct resource. | |||
| * Retrieves a PartnerProduct resource. | |||
| * @param id PartnerProductApi identifier | |||
| * @param id PartnerProduct identifier | |||
| * @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. | |||
| */ | |||
| @@ -240,7 +240,7 @@ export class PostService { | |||
| /** | |||
| * Retrieves a Post resource. | |||
| * Retrieves a Post resource. | |||
| * @param id PostingApi identifier | |||
| * @param id Post identifier | |||
| * @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. | |||
| */ | |||
| @@ -315,7 +315,7 @@ export class PostService { | |||
| /** | |||
| * Updates the Post resource. | |||
| * Updates the Post resource. | |||
| * @param id PostingApi identifier | |||
| * @param id Post identifier | |||
| * @param postPostingPatch The updated Post resource | |||
| * @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. | |||
| @@ -196,7 +196,7 @@ export class ProductService { | |||
| /** | |||
| * Retrieves a Product resource. | |||
| * Retrieves a Product resource. | |||
| * @param id ProductApi identifier | |||
| * @param id Product identifier | |||
| * @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. | |||
| */ | |||
| @@ -271,7 +271,7 @@ export class ProductService { | |||
| /** | |||
| * Updates the Product resource. | |||
| * Updates the Product resource. | |||
| * @param id ProductApi identifier | |||
| * @param id Product identifier | |||
| * @param product The updated Product resource | |||
| * @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. | |||
| @@ -210,7 +210,7 @@ export class SaleService { | |||
| /** | |||
| * Retrieves a Sale resource. | |||
| * Retrieves a Sale resource. | |||
| * @param id SaleApi identifier | |||
| * @param id Sale identifier | |||
| * @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. | |||
| */ | |||
| @@ -285,7 +285,7 @@ export class SaleService { | |||
| /** | |||
| * Updates the Sale resource. | |||
| * Updates the Sale resource. | |||
| * @param id SaleApi identifier | |||
| * @param id Sale identifier | |||
| * @param sale The updated Sale resource | |||
| * @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. | |||
| @@ -222,7 +222,7 @@ export class TaskService { | |||
| /** | |||
| * Retrieves a Task resource. | |||
| * Retrieves a Task resource. | |||
| * @param id TaskApi identifier | |||
| * @param id Task identifier | |||
| * @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. | |||
| */ | |||
| @@ -297,7 +297,7 @@ export class TaskService { | |||
| /** | |||
| * Updates the Task resource. | |||
| * Updates the Task resource. | |||
| * @param id TaskApi identifier | |||
| * @param id Task identifier | |||
| * @param task The updated Task resource | |||
| * @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. | |||
| @@ -198,7 +198,7 @@ export class TaskNoteService { | |||
| /** | |||
| * Retrieves a TaskNote resource. | |||
| * Retrieves a TaskNote resource. | |||
| * @param id TaskNoteApi identifier | |||
| * @param id TaskNote identifier | |||
| * @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. | |||
| */ | |||
| @@ -273,7 +273,7 @@ export class TaskNoteService { | |||
| /** | |||
| * Updates the TaskNote resource. | |||
| * Updates the TaskNote resource. | |||
| * @param id TaskNoteApi identifier | |||
| * @param id TaskNote identifier | |||
| * @param taskNote The updated TaskNote resource | |||
| * @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. | |||
| @@ -196,7 +196,7 @@ export class UserService { | |||
| /** | |||
| * Retrieves a User resource. | |||
| * Retrieves a User resource. | |||
| * @param id UserApi identifier | |||
| * @param id User identifier | |||
| * @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. | |||
| */ | |||
| @@ -0,0 +1,444 @@ | |||
| /** | |||
| * Matsen API Platform | |||
| * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |||
| * | |||
| * The version of the OpenAPI document: 1.0.0 | |||
| * | |||
| * | |||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | |||
| * https://openapi-generator.tech | |||
| * Do not edit the class manually. | |||
| */ | |||
| /* tslint:disable:no-unused-variable member-ordering */ | |||
| import { Inject, Injectable, Optional } from '@angular/core'; | |||
| import { HttpClient, HttpHeaders, HttpParams, | |||
| HttpResponse, HttpEvent, HttpParameterCodec, HttpContext | |||
| } from '@angular/common/http'; | |||
| import { CustomHttpParameterCodec } from '../encoder'; | |||
| import { Observable } from 'rxjs'; | |||
| // @ts-ignore | |||
| import { ApiUserProductsGetCollection200Response } from '../model/apiUserProductsGetCollection200Response'; | |||
| // @ts-ignore | |||
| import { ApiUserProductsGetCollection200Response1 } from '../model/apiUserProductsGetCollection200Response1'; | |||
| // @ts-ignore | |||
| import { UserProduct } from '../model/userProduct'; | |||
| // @ts-ignore | |||
| import { UserProductJsonhal } from '../model/userProductJsonhal'; | |||
| // @ts-ignore | |||
| import { UserProductJsonld } from '../model/userProductJsonld'; | |||
| // @ts-ignore | |||
| import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; | |||
| import { Configuration } from '../configuration'; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| }) | |||
| export class UserProductService { | |||
| protected basePath = 'http://localhost'; | |||
| public defaultHeaders = new HttpHeaders(); | |||
| public configuration = new Configuration(); | |||
| public encoder: HttpParameterCodec; | |||
| constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) { | |||
| if (configuration) { | |||
| this.configuration = configuration; | |||
| } | |||
| if (typeof this.configuration.basePath !== 'string') { | |||
| if (Array.isArray(basePath) && basePath.length > 0) { | |||
| basePath = basePath[0]; | |||
| } | |||
| if (typeof basePath !== 'string') { | |||
| basePath = this.basePath; | |||
| } | |||
| this.configuration.basePath = basePath; | |||
| } | |||
| this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); | |||
| } | |||
| // @ts-ignore | |||
| private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { | |||
| if (typeof value === "object" && value instanceof Date === false) { | |||
| httpParams = this.addToHttpParamsRecursive(httpParams, value); | |||
| } else { | |||
| httpParams = this.addToHttpParamsRecursive(httpParams, value, key); | |||
| } | |||
| return httpParams; | |||
| } | |||
| private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { | |||
| if (value == null) { | |||
| return httpParams; | |||
| } | |||
| if (typeof value === "object") { | |||
| if (Array.isArray(value)) { | |||
| (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); | |||
| } else if (value instanceof Date) { | |||
| if (key != null) { | |||
| httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10)); | |||
| } else { | |||
| throw Error("key may not be null if value is Date"); | |||
| } | |||
| } else { | |||
| Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( | |||
| httpParams, value[k], key != null ? `${key}.${k}` : k)); | |||
| } | |||
| } else if (key != null) { | |||
| httpParams = httpParams.append(key, value); | |||
| } else { | |||
| throw Error("key may not be null if value is not object or array"); | |||
| } | |||
| return httpParams; | |||
| } | |||
| /** | |||
| * Retrieves the collection of UserProduct resources. | |||
| * Retrieves the collection of UserProduct resources. | |||
| * @param page The collection page number | |||
| * @param itemsPerPage The number of items per page | |||
| * @param user | |||
| * @param user2 | |||
| * @param product | |||
| * @param product2 | |||
| * @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 userProductsGetCollection(page?: number, itemsPerPage?: number, user?: string, user2?: Array<string>, product?: string, product2?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<ApiUserProductsGetCollection200Response>; | |||
| public userProductsGetCollection(page?: number, itemsPerPage?: number, user?: string, user2?: Array<string>, product?: string, product2?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ApiUserProductsGetCollection200Response>>; | |||
| public userProductsGetCollection(page?: number, itemsPerPage?: number, user?: string, user2?: Array<string>, product?: string, product2?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ApiUserProductsGetCollection200Response>>; | |||
| public userProductsGetCollection(page?: number, itemsPerPage?: number, user?: string, user2?: Array<string>, product?: string, product2?: 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) { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>page, 'page'); | |||
| } | |||
| if (itemsPerPage !== undefined && itemsPerPage !== null) { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>itemsPerPage, 'itemsPerPage'); | |||
| } | |||
| if (user !== undefined && user !== null) { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>user, 'user'); | |||
| } | |||
| if (user2) { | |||
| user2.forEach((element) => { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>element, 'user[]'); | |||
| }) | |||
| } | |||
| if (product !== undefined && product !== null) { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>product, 'product'); | |||
| } | |||
| if (product2) { | |||
| product2.forEach((element) => { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>element, 'product[]'); | |||
| }) | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| let localVarCredential: string | undefined; | |||
| // authentication (JWT) required | |||
| localVarCredential = this.configuration.lookupCredential('JWT'); | |||
| if (localVarCredential) { | |||
| localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); | |||
| } | |||
| let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | |||
| if (localVarHttpHeaderAcceptSelected === undefined) { | |||
| // to determine the Accept header | |||
| const httpHeaderAccepts: string[] = [ | |||
| 'application/ld+json', | |||
| 'application/json', | |||
| 'text/html', | |||
| 'application/hal+json' | |||
| ]; | |||
| localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | |||
| } | |||
| if (localVarHttpHeaderAcceptSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | |||
| } | |||
| let localVarHttpContext: HttpContext | undefined = options && options.context; | |||
| if (localVarHttpContext === undefined) { | |||
| localVarHttpContext = new HttpContext(); | |||
| } | |||
| let localVarTransferCache: boolean | undefined = options && options.transferCache; | |||
| if (localVarTransferCache === undefined) { | |||
| localVarTransferCache = true; | |||
| } | |||
| let responseType_: 'text' | 'json' | 'blob' = 'json'; | |||
| if (localVarHttpHeaderAcceptSelected) { | |||
| if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | |||
| responseType_ = 'text'; | |||
| } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | |||
| responseType_ = 'json'; | |||
| } else { | |||
| responseType_ = 'blob'; | |||
| } | |||
| } | |||
| let localVarPath = `/api/user_products`; | |||
| return this.httpClient.request<ApiUserProductsGetCollection200Response>('get', `${this.configuration.basePath}${localVarPath}`, | |||
| { | |||
| context: localVarHttpContext, | |||
| params: localVarQueryParameters, | |||
| responseType: <any>responseType_, | |||
| withCredentials: this.configuration.withCredentials, | |||
| headers: localVarHeaders, | |||
| observe: observe, | |||
| transferCache: localVarTransferCache, | |||
| reportProgress: reportProgress | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Removes the UserProduct resource. | |||
| * Removes the UserProduct resource. | |||
| * @param id UserProduct identifier | |||
| * @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 userProductsIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>; | |||
| public userProductsIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; | |||
| public userProductsIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; | |||
| public userProductsIdDelete(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any> { | |||
| if (id === null || id === undefined) { | |||
| throw new Error('Required parameter id was null or undefined when calling userProductsIdDelete.'); | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| let localVarCredential: string | undefined; | |||
| // authentication (JWT) required | |||
| localVarCredential = this.configuration.lookupCredential('JWT'); | |||
| if (localVarCredential) { | |||
| localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); | |||
| } | |||
| let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | |||
| if (localVarHttpHeaderAcceptSelected === undefined) { | |||
| // to determine the Accept header | |||
| const httpHeaderAccepts: string[] = [ | |||
| ]; | |||
| localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | |||
| } | |||
| if (localVarHttpHeaderAcceptSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | |||
| } | |||
| let localVarHttpContext: HttpContext | undefined = options && options.context; | |||
| if (localVarHttpContext === undefined) { | |||
| localVarHttpContext = new HttpContext(); | |||
| } | |||
| let localVarTransferCache: boolean | undefined = options && options.transferCache; | |||
| if (localVarTransferCache === undefined) { | |||
| localVarTransferCache = true; | |||
| } | |||
| let responseType_: 'text' | 'json' | 'blob' = 'json'; | |||
| if (localVarHttpHeaderAcceptSelected) { | |||
| if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | |||
| responseType_ = 'text'; | |||
| } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | |||
| responseType_ = 'json'; | |||
| } else { | |||
| responseType_ = 'blob'; | |||
| } | |||
| } | |||
| let localVarPath = `/api/user_products/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; | |||
| return this.httpClient.request<any>('delete', `${this.configuration.basePath}${localVarPath}`, | |||
| { | |||
| context: localVarHttpContext, | |||
| responseType: <any>responseType_, | |||
| withCredentials: this.configuration.withCredentials, | |||
| headers: localVarHeaders, | |||
| observe: observe, | |||
| transferCache: localVarTransferCache, | |||
| reportProgress: reportProgress | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Retrieves a UserProduct resource. | |||
| * Retrieves a UserProduct resource. | |||
| * @param id UserProduct identifier | |||
| * @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 userProductsIdGet(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<UserProductJsonld>; | |||
| public userProductsIdGet(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<UserProductJsonld>>; | |||
| public userProductsIdGet(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<UserProductJsonld>>; | |||
| public userProductsIdGet(id: 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> { | |||
| if (id === null || id === undefined) { | |||
| throw new Error('Required parameter id was null or undefined when calling userProductsIdGet.'); | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| let localVarCredential: string | undefined; | |||
| // authentication (JWT) required | |||
| localVarCredential = this.configuration.lookupCredential('JWT'); | |||
| if (localVarCredential) { | |||
| localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); | |||
| } | |||
| let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | |||
| if (localVarHttpHeaderAcceptSelected === undefined) { | |||
| // to determine the Accept header | |||
| const httpHeaderAccepts: string[] = [ | |||
| 'application/ld+json', | |||
| 'application/json', | |||
| 'text/html', | |||
| 'application/hal+json' | |||
| ]; | |||
| localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | |||
| } | |||
| if (localVarHttpHeaderAcceptSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | |||
| } | |||
| let localVarHttpContext: HttpContext | undefined = options && options.context; | |||
| if (localVarHttpContext === undefined) { | |||
| localVarHttpContext = new HttpContext(); | |||
| } | |||
| let localVarTransferCache: boolean | undefined = options && options.transferCache; | |||
| if (localVarTransferCache === undefined) { | |||
| localVarTransferCache = true; | |||
| } | |||
| let responseType_: 'text' | 'json' | 'blob' = 'json'; | |||
| if (localVarHttpHeaderAcceptSelected) { | |||
| if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | |||
| responseType_ = 'text'; | |||
| } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | |||
| responseType_ = 'json'; | |||
| } else { | |||
| responseType_ = 'blob'; | |||
| } | |||
| } | |||
| let localVarPath = `/api/user_products/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; | |||
| return this.httpClient.request<UserProductJsonld>('get', `${this.configuration.basePath}${localVarPath}`, | |||
| { | |||
| context: localVarHttpContext, | |||
| responseType: <any>responseType_, | |||
| withCredentials: this.configuration.withCredentials, | |||
| headers: localVarHeaders, | |||
| observe: observe, | |||
| transferCache: localVarTransferCache, | |||
| reportProgress: reportProgress | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Creates a UserProduct resource. | |||
| * Creates a UserProduct resource. | |||
| * @param userProductJsonld The new UserProduct resource | |||
| * @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 userProductsPost(userProductJsonld: UserProductJsonld, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<UserProductJsonld>; | |||
| public userProductsPost(userProductJsonld: UserProductJsonld, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<UserProductJsonld>>; | |||
| public userProductsPost(userProductJsonld: UserProductJsonld, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<UserProductJsonld>>; | |||
| public userProductsPost(userProductJsonld: UserProductJsonld, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext, transferCache?: boolean}): Observable<any> { | |||
| if (userProductJsonld === null || userProductJsonld === undefined) { | |||
| throw new Error('Required parameter userProductJsonld was null or undefined when calling userProductsPost.'); | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| let localVarCredential: string | undefined; | |||
| // authentication (JWT) required | |||
| localVarCredential = this.configuration.lookupCredential('JWT'); | |||
| if (localVarCredential) { | |||
| localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential); | |||
| } | |||
| let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | |||
| if (localVarHttpHeaderAcceptSelected === undefined) { | |||
| // to determine the Accept header | |||
| const httpHeaderAccepts: string[] = [ | |||
| 'application/ld+json', | |||
| 'application/json', | |||
| 'text/html', | |||
| 'application/hal+json' | |||
| ]; | |||
| localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | |||
| } | |||
| if (localVarHttpHeaderAcceptSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | |||
| } | |||
| let localVarHttpContext: HttpContext | undefined = options && options.context; | |||
| if (localVarHttpContext === undefined) { | |||
| localVarHttpContext = new HttpContext(); | |||
| } | |||
| let localVarTransferCache: boolean | undefined = options && options.transferCache; | |||
| if (localVarTransferCache === undefined) { | |||
| localVarTransferCache = true; | |||
| } | |||
| // to determine the Content-Type header | |||
| const consumes: string[] = [ | |||
| 'application/ld+json', | |||
| 'application/json', | |||
| 'text/html', | |||
| 'application/hal+json' | |||
| ]; | |||
| const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); | |||
| if (httpContentTypeSelected !== undefined) { | |||
| localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); | |||
| } | |||
| let responseType_: 'text' | 'json' | 'blob' = 'json'; | |||
| if (localVarHttpHeaderAcceptSelected) { | |||
| if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | |||
| responseType_ = 'text'; | |||
| } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | |||
| responseType_ = 'json'; | |||
| } else { | |||
| responseType_ = 'blob'; | |||
| } | |||
| } | |||
| let localVarPath = `/api/user_products`; | |||
| return this.httpClient.request<UserProductJsonld>('post', `${this.configuration.basePath}${localVarPath}`, | |||
| { | |||
| context: localVarHttpContext, | |||
| body: userProductJsonld, | |||
| responseType: <any>responseType_, | |||
| withCredentials: this.configuration.withCredentials, | |||
| headers: localVarHeaders, | |||
| observe: observe, | |||
| transferCache: localVarTransferCache, | |||
| reportProgress: reportProgress | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| /** | |||
| * Matsen API Platform | |||
| * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |||
| * | |||
| * The version of the OpenAPI document: 1.0.0 | |||
| * | |||
| * | |||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | |||
| * https://openapi-generator.tech | |||
| * Do not edit the class manually. | |||
| */ | |||
| import { UserProductJsonld } from './userProductJsonld'; | |||
| import { ApiCommentsGetCollection200ResponseHydraSearch } from './apiCommentsGetCollection200ResponseHydraSearch'; | |||
| import { ApiCommentsGetCollection200ResponseHydraView } from './apiCommentsGetCollection200ResponseHydraView'; | |||
| export interface ApiUserProductsGetCollection200Response { | |||
| 'hydra:member': Array<UserProductJsonld>; | |||
| 'hydra:totalItems'?: number; | |||
| 'hydra:view'?: ApiCommentsGetCollection200ResponseHydraView; | |||
| 'hydra:search'?: ApiCommentsGetCollection200ResponseHydraSearch; | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| /** | |||
| * Matsen API Platform | |||
| * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |||
| * | |||
| * The version of the OpenAPI document: 1.0.0 | |||
| * | |||
| * | |||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | |||
| * https://openapi-generator.tech | |||
| * Do not edit the class manually. | |||
| */ | |||
| import { UserProductJsonhal } from './userProductJsonhal'; | |||
| import { ApiCommentsGetCollection200Response1Links } from './apiCommentsGetCollection200Response1Links'; | |||
| export interface ApiUserProductsGetCollection200Response1 { | |||
| _embedded: Array<UserProductJsonhal>; | |||
| totalItems?: number; | |||
| itemsPerPage?: number; | |||
| _links: ApiCommentsGetCollection200Response1Links; | |||
| } | |||
| @@ -33,6 +33,8 @@ export * from './apiTaskNotesGetCollection200Response'; | |||
| export * from './apiTaskNotesGetCollection200Response1'; | |||
| export * from './apiTasksGetCollection200Response'; | |||
| export * from './apiTasksGetCollection200Response1'; | |||
| export * from './apiUserProductsGetCollection200Response'; | |||
| export * from './apiUserProductsGetCollection200Response1'; | |||
| export * from './apiUsersGetCollection200Response'; | |||
| export * from './apiUsersGetCollection200Response1'; | |||
| export * from './comment'; | |||
| @@ -92,3 +94,6 @@ export * from './taskNoteJsonld'; | |||
| export * from './user'; | |||
| export * from './userJsonhal'; | |||
| export * from './userJsonld'; | |||
| export * from './userProduct'; | |||
| export * from './userProductJsonhal'; | |||
| export * from './userProductJsonld'; | |||
| @@ -20,5 +20,6 @@ export interface PartnerFollow { | |||
| partner: string | null; | |||
| readonly partnerName?: string | null; | |||
| readonly createdAt?: string | null; | |||
| readonly owner?: string | null; | |||
| } | |||
| @@ -22,5 +22,6 @@ export interface PartnerFollowJsonhal { | |||
| partner: string | null; | |||
| readonly partnerName?: string | null; | |||
| readonly createdAt?: string | null; | |||
| readonly owner?: string | null; | |||
| } | |||
| @@ -24,5 +24,6 @@ export interface PartnerFollowJsonld { | |||
| partner: string | null; | |||
| readonly partnerName?: string | null; | |||
| readonly createdAt?: string | null; | |||
| readonly owner?: string | null; | |||
| } | |||
| @@ -0,0 +1,25 @@ | |||
| /** | |||
| * Matsen API Platform | |||
| * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |||
| * | |||
| * The version of the OpenAPI document: 1.0.0 | |||
| * | |||
| * | |||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | |||
| * https://openapi-generator.tech | |||
| * Do not edit the class manually. | |||
| */ | |||
| /** | |||
| * | |||
| */ | |||
| export interface UserProduct { | |||
| readonly user?: string | null; | |||
| readonly userName?: string | null; | |||
| product: string | null; | |||
| readonly productName?: string | null; | |||
| readonly createdAt?: string | null; | |||
| readonly owner?: string | null; | |||
| } | |||
| @@ -0,0 +1,27 @@ | |||
| /** | |||
| * Matsen API Platform | |||
| * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |||
| * | |||
| * The version of the OpenAPI document: 1.0.0 | |||
| * | |||
| * | |||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | |||
| * https://openapi-generator.tech | |||
| * Do not edit the class manually. | |||
| */ | |||
| import { CommentJsonhalLinks } from './commentJsonhalLinks'; | |||
| /** | |||
| * | |||
| */ | |||
| export interface UserProductJsonhal { | |||
| _links?: CommentJsonhalLinks; | |||
| readonly user?: string | null; | |||
| readonly userName?: string | null; | |||
| product: string | null; | |||
| readonly productName?: string | null; | |||
| readonly createdAt?: string | null; | |||
| readonly owner?: string | null; | |||
| } | |||
| @@ -0,0 +1,29 @@ | |||
| /** | |||
| * Matsen API Platform | |||
| * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |||
| * | |||
| * The version of the OpenAPI document: 1.0.0 | |||
| * | |||
| * | |||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | |||
| * https://openapi-generator.tech | |||
| * Do not edit the class manually. | |||
| */ | |||
| import { CommentJsonldContext } from './commentJsonldContext'; | |||
| /** | |||
| * | |||
| */ | |||
| export interface UserProductJsonld { | |||
| context?: CommentJsonldContext; | |||
| readonly id?: string; | |||
| readonly type?: string; | |||
| readonly user?: string | null; | |||
| readonly userName?: string | null; | |||
| product: string | null; | |||
| readonly productName?: string | null; | |||
| readonly createdAt?: string | null; | |||
| readonly owner?: string | null; | |||
| } | |||
| @@ -34,7 +34,8 @@ export class NewDocumentComponent implements OnInit { | |||
| private documentObjectService: DocumentObjectService, | |||
| private translateService: TranslateService, | |||
| private partnerService: PartnerService, | |||
| private productService: ProductService | |||
| private productService: ProductService, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.documentForm = documentForm; | |||
| this.documentSub = new Subscription(); | |||
| @@ -120,7 +121,7 @@ export class NewDocumentComponent implements OnInit { | |||
| } else { | |||
| // Edit contact | |||
| this.documentSub = this.documentService.documentsIdPatch( | |||
| ApiConverter.extractId(this.document.id), | |||
| this.apiConverter.extractId(this.document.id), | |||
| this.documentForm.value as DocumentJsonld | |||
| ).subscribe( | |||
| data => { | |||
| @@ -69,7 +69,7 @@ | |||
| <div class="tasks mb-3" *ngFor="let task of tasks"> | |||
| <div class="card p-3"> | |||
| <div class="position-relative"> | |||
| <h3 class="m-0" *ngIf="task.partner"><a href="/{{task.partnerType}}/{{ApiConverter.extractId(task.partner)}}">{{task.partnerName}}</a></h3> | |||
| <h3 class="m-0" *ngIf="task.partner"><a href="/{{task.partnerType}}/{{apiConverter.extractId(task.partner)}}">{{task.partnerName}}</a></h3> | |||
| <span class="info d-flex position-absolute"> | |||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY':'GMT+0000' }}</span> | |||
| <span class="importance" [attr.data-importance]="task.prio"></span> | |||
| @@ -159,7 +159,7 @@ export class HomeComponent implements OnInit, AfterViewInit { | |||
| openModalEditTask(task: TaskJsonld) { | |||
| const modalRefTaskEdit = this.modalService.open(NewTaskComponent, this.modalOptions); | |||
| modalRefTaskEdit.componentInstance.task = task; | |||
| modalRefTaskEdit.componentInstance.dueAtValue = ApiConverter.convertDate(task.dueAt); | |||
| modalRefTaskEdit.componentInstance.dueAtValue = this.apiConverter.convertDate(task.dueAt); | |||
| modalRefTaskEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => { | |||
| if (modalStatus === ModalStatus.Submitted) { | |||
| modalRefTaskEdit.dismiss(); | |||
| @@ -28,7 +28,8 @@ export class NewPartnerComponent implements OnInit { | |||
| constructor( | |||
| private partnerService: PartnerService, | |||
| private mediaObjectService: MediaObjectService, | |||
| private translateService: TranslateService | |||
| private translateService: TranslateService, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.partnerForm = partnerForm; | |||
| this.selectedImage = null; | |||
| @@ -78,7 +79,7 @@ export class NewPartnerComponent implements OnInit { | |||
| } else { | |||
| // Edit contact | |||
| this.partnerSub = this.partnerService.partnersIdPatch( | |||
| ApiConverter.extractId(this.partner.id), | |||
| this.apiConverter.extractId(this.partner.id), | |||
| this.partnerForm.value as PartnerJsonld | |||
| ).subscribe( | |||
| data => { | |||
| @@ -35,7 +35,8 @@ | |||
| [class.bi-heart-fill]="partnerFollow !== null" | |||
| [class.user-follows]="partnerFollow !== null" | |||
| data-type="user-tool" data-action="follow" | |||
| (click)="followPartner($event)"></span> | |||
| (click)="followPartner($event)"> | |||
| </span> | |||
| <span class="position-absolute bi bi-pencil p-2" data-type="user-tool" data-action="edit" | |||
| (click)="openModalEditPartner()"></span> | |||
| </div> | |||
| @@ -47,7 +48,7 @@ | |||
| <div class="card-body row" *ngIf="partnerProducts"> | |||
| <div class="col-12"> | |||
| <ul *ngFor="let partnerProduct of partnerProducts"> | |||
| <li><a href="/products/{{ApiConverter.extractId(partnerProduct.product)}}">{{partnerProduct.productName}}</a></li> | |||
| <li><a href="/products/{{this.apiConverter.extractId(partnerProduct.product)}}">{{partnerProduct.productName}}</a></li> | |||
| </ul> | |||
| </div> | |||
| </div> | |||
| @@ -101,7 +102,7 @@ | |||
| <div class="tasks mb-3" *ngFor="let task of tasks"> | |||
| <div class="card p-3"> | |||
| <div class="position-relative"> | |||
| <h3 class="m-0" *ngIf="task.partner"><a href="/{{task.partnerType}}/{{ApiConverter.extractId(task.partner)}}">{{task.partnerName}}</a></h3> | |||
| <h3 class="m-0" *ngIf="task.partner"><a href="/{{task.partnerType}}/{{this.apiConverter.extractId(task.partner)}}">{{task.partnerName}}</a></h3> | |||
| <span class="info d-flex position-absolute"> | |||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY':'GMT+0000' }}</span> | |||
| <span class="importance" [attr.data-importance]="task.prio"></span> | |||
| @@ -40,7 +40,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| @ViewChild(MatPaginator) postsPaginator: MatPaginator; | |||
| protected user: User | null; | |||
| protected readonly ApiConverter = ApiConverter; | |||
| protected readonly environment = environment; | |||
| protected id: string; | |||
| @@ -268,7 +267,7 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| navigateToContactDetails(element: any) { | |||
| const contact: ContactJsonld = element as ContactJsonld; | |||
| this.router.navigate(['/contacts', ApiConverter.extractId(contact.id)]); | |||
| this.router.navigate(['/contacts', this.apiConverter.extractId(contact.id)]); | |||
| } | |||
| openModalNewContact() { | |||
| @@ -340,7 +339,7 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| openModalEditTask(task: TaskJsonld) { | |||
| const modalRefTaskEdit = this.modalService.open(NewTaskComponent, this.modalOptions); | |||
| modalRefTaskEdit.componentInstance.task = task; | |||
| modalRefTaskEdit.componentInstance.dueAtValue = ApiConverter.convertDate(task.dueAt); | |||
| modalRefTaskEdit.componentInstance.dueAtValue = this.apiConverter.convertDate(task.dueAt); | |||
| modalRefTaskEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => { | |||
| if (modalStatus === ModalStatus.Submitted) { | |||
| modalRefTaskEdit.dismiss(); | |||
| @@ -439,7 +438,7 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| ); | |||
| } else { | |||
| this.partnerFollowSub = this.partnerFollowService.partnerFollowsIdDelete( | |||
| ApiConverter.extractId(this.partnerFollow.id) | |||
| this.apiConverter.extractId(this.partnerFollow.id) | |||
| ).subscribe( | |||
| data => { | |||
| this.partnerFollow = null; | |||
| @@ -52,7 +52,8 @@ export class PartnersComponent implements OnInit, AfterViewInit { | |||
| private partnerService: PartnerService, | |||
| private router: Router, | |||
| private modalService: NgbModal, | |||
| private translateService: TranslateService | |||
| private translateService: TranslateService, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.partnersSort = new MatSort(); | |||
| this.partnersPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype); | |||
| @@ -152,7 +153,7 @@ export class PartnersComponent implements OnInit, AfterViewInit { | |||
| navigateToPartnerDetails(element: any) { | |||
| const partner: PartnerJsonld = element as PartnerJsonld; | |||
| this.router.navigate(['/' + partner.partnerType, ApiConverter.extractId(partner.id)]); | |||
| this.router.navigate(['/' + partner.partnerType, this.apiConverter.extractId(partner.id)]); | |||
| } | |||
| openModalNewPartner() { | |||
| @@ -20,7 +20,8 @@ export class NewCommentComponent implements OnInit { | |||
| protected commentSub: Subscription; | |||
| constructor( | |||
| private commentService: CommentService | |||
| private commentService: CommentService, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.commentForm = commentForm; | |||
| this.commentSub = new Subscription(); | |||
| @@ -45,7 +46,7 @@ export class NewCommentComponent implements OnInit { | |||
| } else { | |||
| // Edit comment | |||
| this.commentSub = this.commentService.commentsIdPatch( | |||
| ApiConverter.extractId(this.comment.id), | |||
| this.apiConverter.extractId(this.comment.id), | |||
| this.commentForm.value as CommentJsonld | |||
| ).subscribe( | |||
| data => { | |||
| @@ -20,7 +20,8 @@ export class NewPostingComponent implements OnInit { | |||
| protected postSub: Subscription; | |||
| constructor( | |||
| private postService: PostService | |||
| private postService: PostService, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.postForm = postForm; | |||
| this.postSub = new Subscription(); | |||
| @@ -46,7 +47,7 @@ export class NewPostingComponent implements OnInit { | |||
| } else { | |||
| // Edit post | |||
| this.postSub = this.postService.postsIdPatch( | |||
| ApiConverter.extractId(this.posting.id), | |||
| this.apiConverter.extractId(this.posting.id), | |||
| this.postForm.value as PostJsonld | |||
| ).subscribe( | |||
| data => { | |||
| @@ -26,7 +26,8 @@ export class NewProductComponent implements OnInit { | |||
| constructor( | |||
| private productService: ProductService, | |||
| private mediaObjectService: MediaObjectService, | |||
| private translateService: TranslateService | |||
| private translateService: TranslateService, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.productForm = productForm; | |||
| this.productSub = new Subscription(); | |||
| @@ -69,7 +70,7 @@ export class NewProductComponent implements OnInit { | |||
| } else { | |||
| // Edit product | |||
| this.productSub = this.productService.productsIdPatch( | |||
| ApiConverter.extractId(this.product.id), | |||
| this.apiConverter.extractId(this.product.id), | |||
| this.productForm.value as ProductJsonld | |||
| ).subscribe( | |||
| data => { | |||
| @@ -22,6 +22,13 @@ | |||
| ngSrc="{{product.imageUrl}}" width="247" height="94" | |||
| alt="{{product.name}}" title="{{product.name}}"/> | |||
| </div> | |||
| <span class="position-absolute bi p-2" | |||
| [class.bi-heart]="userProduct === null" | |||
| [class.bi-heart-fill]="userProduct !== null" | |||
| [class.user-follows]="userProduct !== null" | |||
| data-type="user-tool" data-action="follow" | |||
| (click)="followProduct($event)"> | |||
| </span> | |||
| <span class="position-absolute bi bi-pencil p-2" data-type="user-tool" data-action="edit" | |||
| (click)="openModalEditProduct()"></span> | |||
| </div> | |||
| @@ -2,11 +2,18 @@ import {AfterViewInit, Component, OnInit} from '@angular/core'; | |||
| import {environment} from "@environments/environment"; | |||
| import {ActivatedRoute} from "@angular/router"; | |||
| import {Subscription} from "rxjs"; | |||
| import {ProductJsonld, ProductService} from "@app/core/api/v1"; | |||
| import {NewContactComponent} from "@app/contacts/new-contact/new-contact.component"; | |||
| import { | |||
| ProductJsonld, | |||
| ProductService, | |||
| UserProductJsonld, | |||
| UserProductService | |||
| } from "@app/core/api/v1"; | |||
| import {ModalStatus} from "@app/_helpers/modal.states"; | |||
| import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap"; | |||
| import {NewProductComponent} from "@app/products/new-product/new-product.component"; | |||
| import {User} from "@app/_models"; | |||
| import {AccountService} from "@app/_services"; | |||
| import {ApiConverter} from "@app/_helpers/api.converter"; | |||
| @Component({ | |||
| selector: 'app-products-detail', | |||
| @@ -19,6 +26,9 @@ export class ProductsDetailComponent implements OnInit, AfterViewInit { | |||
| protected id: string; | |||
| protected productDetailSub: Subscription; | |||
| protected product: ProductJsonld; | |||
| protected userProductSub: Subscription; | |||
| protected userProduct: UserProductJsonld | null; | |||
| protected user: User | null; | |||
| protected modalOptions: NgbModalOptions = { | |||
| centered: true | |||
| @@ -26,12 +36,19 @@ export class ProductsDetailComponent implements OnInit, AfterViewInit { | |||
| constructor( | |||
| private route: ActivatedRoute, | |||
| private accountService: AccountService, | |||
| private productService: ProductService, | |||
| private modalService: NgbModal | |||
| private userProductService: UserProductService, | |||
| private modalService: NgbModal, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.id = ""; | |||
| this.user = this.accountService.userValue; | |||
| this.productDetailSub = new Subscription(); | |||
| this.product = {} as ProductJsonld; | |||
| this.userProductSub = new Subscription(); | |||
| this.userProduct = null; | |||
| } | |||
| ngOnInit() { | |||
| @@ -39,6 +56,8 @@ export class ProductsDetailComponent implements OnInit, AfterViewInit { | |||
| this.id = params['id']; | |||
| }); | |||
| this.getProductData(); | |||
| this.getUserProductStatus(); | |||
| } | |||
| ngAfterViewInit() { | |||
| @@ -55,6 +74,46 @@ export class ProductsDetailComponent implements OnInit, AfterViewInit { | |||
| ); | |||
| } | |||
| getUserProductStatus() { | |||
| this.userProductSub = this.userProductService.userProductsGetCollection( | |||
| 1, | |||
| 50, | |||
| this.user?.id, | |||
| undefined, | |||
| this.product.id | |||
| ).subscribe( | |||
| data => { | |||
| let userProduct = data["hydra:member"]; | |||
| if (userProduct.length > 0) { | |||
| this.userProduct = userProduct[0]; | |||
| } | |||
| } | |||
| ) | |||
| } | |||
| followProduct(event: any) { | |||
| if (this.userProduct === null) { | |||
| this.userProductSub = this.userProductService.userProductsPost( | |||
| { | |||
| user: this.user?.id, | |||
| product: this.product.id, | |||
| } as UserProductJsonld | |||
| ).subscribe( | |||
| data => { | |||
| this.userProduct = data; | |||
| } | |||
| ); | |||
| } else { | |||
| this.userProductSub = this.userProductService.userProductsIdDelete( | |||
| this.apiConverter.extractId(this.userProduct.id) | |||
| ).subscribe( | |||
| data => { | |||
| this.userProduct = null; | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| openModalEditProduct() { | |||
| const modalRefProduct = this.modalService.open(NewProductComponent, this.modalOptions); | |||
| modalRefProduct.componentInstance.product = this.product; | |||
| @@ -41,7 +41,8 @@ export class ProductsComponent implements OnInit, AfterViewInit { | |||
| constructor( | |||
| private router: Router, | |||
| private modalService: NgbModal, | |||
| private productService: ProductService | |||
| private productService: ProductService, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.sort = new MatSort(); | |||
| this.displayedColumns = ['pos', 'image', 'name', 'storage', 'number']; | |||
| @@ -118,7 +119,7 @@ export class ProductsComponent implements OnInit, AfterViewInit { | |||
| navigateToProductDetails(element: any) { | |||
| const product: ProductJsonld = element as ProductJsonld; | |||
| this.router.navigate(['/products', ApiConverter.extractId(product.id)]); | |||
| this.router.navigate(['/products', this.apiConverter.extractId(product.id)]); | |||
| } | |||
| openModalNewProduct() { | |||
| @@ -34,7 +34,8 @@ export class NewSaleComponent implements OnInit { | |||
| private saleService: SaleService, | |||
| private partnerService: PartnerService, | |||
| private productService: ProductService, | |||
| private translateService: TranslateService | |||
| private translateService: TranslateService, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.saleForm = saleForm; | |||
| @@ -112,7 +113,7 @@ export class NewSaleComponent implements OnInit { | |||
| } else { | |||
| // Edit sale | |||
| this.saleSub = this.saleService.salesIdPatch( | |||
| ApiConverter.extractId(this.sale.id), | |||
| this.apiConverter.extractId(this.sale.id), | |||
| this.saleForm.value as SaleJsonld | |||
| ).subscribe( | |||
| data => { | |||
| @@ -53,7 +53,7 @@ | |||
| {{ 'overview.sale-partner' | translate }} | |||
| </th> | |||
| <td mat-cell *matCellDef="let element"> | |||
| <a [routerLink]="['/customer', ApiConverter.extractId(element.partner)]">{{ element.partnerName }}</a> | |||
| <a [routerLink]="['/customer', apiConverter.extractId(element.partner)]">{{ element.partnerName }}</a> | |||
| </td> | |||
| </ng-container> | |||
| @@ -63,7 +63,7 @@ | |||
| {{ 'overview.productname' | translate }} | |||
| </th> | |||
| <td mat-cell *matCellDef="let element"> | |||
| <a [routerLink]="['/products', ApiConverter.extractId(element.product)]">{{ element.productName }}</a> | |||
| <a [routerLink]="['/products', apiConverter.extractId(element.product)]">{{ element.productName }}</a> | |||
| </td> | |||
| </ng-container> | |||
| @@ -63,6 +63,7 @@ export class SalesComponent implements OnInit { | |||
| private translateService: TranslateService, | |||
| private modalService: NgbModal, | |||
| private router: Router, | |||
| protected apiConverter: ApiConverter, | |||
| ) { | |||
| this.sort = new MatSort(); | |||
| this.displayedColumns = ['pos', 'user', 'partner', 'product', 'turnover', 'profit', 'date', 'details']; | |||
| @@ -161,7 +162,7 @@ export class SalesComponent implements OnInit { | |||
| navigateToSaleDetails(element: any) { | |||
| const sale: SaleJsonld = element as SaleJsonld; | |||
| this.router.navigate(['/sales', ApiConverter.extractId(sale.id)]); | |||
| this.router.navigate(['/sales', this.apiConverter.extractId(sale.id)]); | |||
| } | |||
| openModalNewSale() { | |||
| @@ -178,5 +179,4 @@ export class SalesComponent implements OnInit { | |||
| } | |||
| protected readonly Number = Number; | |||
| protected readonly ApiConverter = ApiConverter; | |||
| } | |||
| @@ -20,7 +20,8 @@ export class NewTaskNoteComponent { | |||
| protected taskNoteSub: Subscription; | |||
| constructor( | |||
| private taskNoteService: TaskNoteService | |||
| private taskNoteService: TaskNoteService, | |||
| protected apiConverter: ApiConverter | |||
| ) { | |||
| this.taskNoteForm = taskNoteForm; | |||
| this.taskNoteSub = new Subscription(); | |||
| @@ -45,7 +46,7 @@ export class NewTaskNoteComponent { | |||
| } else { | |||
| // Edit taskNote | |||
| this.taskNoteSub = this.taskNoteService.taskNotesIdPatch( | |||
| ApiConverter.extractId(this.taskNote.id), | |||
| this.apiConverter.extractId(this.taskNote.id), | |||
| this.taskNoteForm.value as TaskNoteJsonld | |||
| ).subscribe( | |||
| data => { | |||
| @@ -23,6 +23,21 @@ export class NewTaskComponent implements OnInit { | |||
| protected formatter = (apiData: any) => apiData.name; | |||
| constructor( | |||
| private taskService: TaskService, | |||
| private userService: UserService, | |||
| private partnerService: PartnerService, | |||
| protected apiConverter: ApiConverter | |||
| ) { | |||
| this.taskForm = taskForm; | |||
| this.taskSub = new Subscription(); | |||
| this.dueAtValue = ""; | |||
| } | |||
| ngOnInit(): void { | |||
| this.taskForm = FormGroupInitializer.initFormGroup(this.taskForm, this.task); | |||
| } | |||
| protected searchUsers: OperatorFunction<string, readonly { id: any; name: any }[]> = (text$: Observable<string>) => | |||
| text$.pipe( | |||
| debounceTime(200), | |||
| @@ -41,20 +56,6 @@ export class NewTaskComponent implements OnInit { | |||
| map((partners) => partners.slice(0, 10)), | |||
| ); | |||
| constructor( | |||
| private taskService: TaskService, | |||
| private userService: UserService, | |||
| private partnerService: PartnerService | |||
| ) { | |||
| this.taskForm = taskForm; | |||
| this.taskSub = new Subscription(); | |||
| this.dueAtValue = ""; | |||
| } | |||
| ngOnInit(): void { | |||
| this.taskForm = FormGroupInitializer.initFormGroup(this.taskForm, this.task); | |||
| } | |||
| protected fetchUsers(term: string): Observable<{ id: any; name: any }[]> { | |||
| return this.userService.usersGetCollection(1, 50, undefined, term).pipe( | |||
| map((response) => response['hydra:member'].map(user => ({ id: user.id, name: user.firstName + ' ' + user.lastName }))), | |||
| @@ -96,7 +97,7 @@ export class NewTaskComponent implements OnInit { | |||
| } else { | |||
| // Edit task | |||
| this.taskSub = this.taskService.tasksIdPatch( | |||
| ApiConverter.extractId(this.task.id), | |||
| this.apiConverter.extractId(this.task.id), | |||
| this.taskForm.value as TaskJsonld | |||
| ).subscribe( | |||
| data => { | |||
| @@ -7,7 +7,7 @@ | |||
| <div class="tasks mb-3" *ngFor="let task of tasks"> | |||
| <div class="card p-3"> | |||
| <div class="position-relative"> | |||
| <h3 class="m-0" *ngIf="task.partner"><a href="/{{task.partnerType}}/{{ApiConverter.extractId(task.partner)}}">{{task.partnerName}}</a></h3> | |||
| <h3 class="m-0" *ngIf="task.partner"><a href="/{{task.partnerType}}/{{this.apiConverter.extractId(task.partner)}}">{{task.partnerName}}</a></h3> | |||
| <span class="info d-flex position-absolute"> | |||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY':'GMT+0000' }}</span> | |||
| <span class="importance" [attr.data-importance]="task.prio"></span> | |||
| @@ -118,7 +118,7 @@ export class TasksComponent implements OnInit, AfterViewInit { | |||
| openModalEditTask(task: TaskJsonld) { | |||
| const modalRefTaskEdit = this.modalService.open(NewTaskComponent, this.modalOptions); | |||
| modalRefTaskEdit.componentInstance.task = task; | |||
| modalRefTaskEdit.componentInstance.dueAtValue = ApiConverter.convertDate(task.dueAt); | |||
| modalRefTaskEdit.componentInstance.dueAtValue = this.apiConverter.convertDate(task.dueAt); | |||
| modalRefTaskEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => { | |||
| if (modalStatus === ModalStatus.Submitted) { | |||
| modalRefTaskEdit.dismiss(); | |||