| @@ -42,21 +42,6 @@ export class ListComponent implements OnInit, AfterViewInit { | |||||
| public static COLUMN_TYPE_TEXT_LINKED: string = 'text_linked'; | public static COLUMN_TYPE_TEXT_LINKED: string = 'text_linked'; | ||||
| public static COLUMN_TYPE_WEBSITE: string = 'website'; | public static COLUMN_TYPE_WEBSITE: string = 'website'; | ||||
| public static validColumnTypes: string[] = [ | |||||
| ListComponent.COLUMN_TYPE_ADDRESS, | |||||
| ListComponent.COLUMN_TYPE_BTN_DOWNLOAD, | |||||
| ListComponent.COLUMN_TYPE_BTN_EDIT, | |||||
| ListComponent.COLUMN_TYPE_BTN_REMOVE, | |||||
| ListComponent.COLUMN_TYPE_CURRENCY, | |||||
| ListComponent.COLUMN_TYPE_DATE, | |||||
| ListComponent.COLUMN_TYPE_DETAIL, | |||||
| ListComponent.COLUMN_TYPE_EMAIL, | |||||
| ListComponent.COLUMN_TYPE_IMAGE, | |||||
| ListComponent.COLUMN_TYPE_POSITION, | |||||
| ListComponent.COLUMN_TYPE_TEXT, | |||||
| ListComponent.COLUMN_TYPE_TEXT_LINKED, | |||||
| ListComponent.COLUMN_TYPE_WEBSITE, | |||||
| ]; | |||||
| get COLUMN_TYPE_ADDRESS(): string { return ListComponent.COLUMN_TYPE_ADDRESS; } | get COLUMN_TYPE_ADDRESS(): string { return ListComponent.COLUMN_TYPE_ADDRESS; } | ||||
| get COLUMN_TYPE_BTN_DOWNLOAD(): string { return ListComponent.COLUMN_TYPE_BTN_DOWNLOAD; } | get COLUMN_TYPE_BTN_DOWNLOAD(): string { return ListComponent.COLUMN_TYPE_BTN_DOWNLOAD; } | ||||
| get COLUMN_TYPE_BTN_EDIT(): string { return ListComponent.COLUMN_TYPE_BTN_EDIT; } | get COLUMN_TYPE_BTN_EDIT(): string { return ListComponent.COLUMN_TYPE_BTN_EDIT; } | ||||
| @@ -115,11 +100,6 @@ export class ListComponent implements OnInit, AfterViewInit { | |||||
| ) | ) | ||||
| } | } | ||||
| setData(dataSource: any, dataLength: number): void { | |||||
| this.pagingComponent.dataSource = dataSource; | |||||
| this.pagingComponent.setDataLength(dataLength); | |||||
| } | |||||
| onSortChange = (sortState: Sort) => { | onSortChange = (sortState: Sort) => { | ||||
| this.pagingComponent.resetPageIndex() | this.pagingComponent.resetPageIndex() | ||||
| this.onSortFunction(sortState); | this.onSortFunction(sortState); | ||||
| @@ -3,7 +3,6 @@ | |||||
| <p #paragraphRef (click)="openSearchBox()" [class.search-empty]="!searchBoxFilled"></p> | <p #paragraphRef (click)="openSearchBox()" [class.search-empty]="!searchBoxFilled"></p> | ||||
| <span class="spt-clear" *ngIf="searchBoxFilled" (click)="clearSearch()"></span> | <span class="spt-clear" *ngIf="searchBoxFilled" (click)="clearSearch()"></span> | ||||
| </div> | </div> | ||||
| <!-- <p>NAME {{documentForm.get(formId)}}<span>X</span></p>--> | |||||
| <div class="search-toggle" [class.search-box-open]="searchBoxOpen"> | <div class="search-toggle" [class.search-box-open]="searchBoxOpen"> | ||||
| <app-list #listComponent | <app-list #listComponent | ||||
| [getDataFunction]="getDataFunction" | [getDataFunction]="getDataFunction" | ||||
| @@ -19,7 +19,6 @@ export class SearchSelectComponent implements OnInit, AfterViewInit { | |||||
| @Input() public documentForm!: FormGroup; | @Input() public documentForm!: FormGroup; | ||||
| @Input() public documentFormField!: string; | @Input() public documentFormField!: string; | ||||
| @Input() public getDataFunction!: (index: number, pageSize: number, term?: string) => Observable<any>; | @Input() public getDataFunction!: (index: number, pageSize: number, term?: string) => Observable<any>; | ||||
| @Input() public dataSource: any; | |||||
| @Input() public dataSet!: any; | @Input() public dataSet!: any; | ||||
| @Input() public displayedDataField!: string; | @Input() public displayedDataField!: string; | ||||
| @Input() public displayedDataSubResource!: string; | @Input() public displayedDataSubResource!: string; | ||||
| @@ -52,10 +51,6 @@ export class SearchSelectComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| } | } | ||||
| setData(dataSource: any, data: any[], dataLength: number): void { | |||||
| this.listComponent.setData(dataSource, dataLength); | |||||
| } | |||||
| onSortChange = (sortState: Sort) => { | onSortChange = (sortState: Sort) => { | ||||
| let order: OrderFilter; | let order: OrderFilter; | ||||
| if (sortState.direction === "") { | if (sortState.direction === "") { | ||||
| @@ -118,7 +113,7 @@ export class SearchSelectComponent implements OnInit, AfterViewInit { | |||||
| ]; | ]; | ||||
| } | } | ||||
| public static getDefaultColDefProducts(): ListColDefinition[] { | |||||
| public static getDefaultColDefProducts(subResource?: string): ListColDefinition[] { | |||||
| return [ | return [ | ||||
| ListComponent.getDefaultColPosition(), | ListComponent.getDefaultColPosition(), | ||||
| { | { | ||||
| @@ -126,12 +121,14 @@ export class SearchSelectComponent implements OnInit, AfterViewInit { | |||||
| text: 'overview.image', | text: 'overview.image', | ||||
| type: ListComponent.COLUMN_TYPE_IMAGE, | type: ListComponent.COLUMN_TYPE_IMAGE, | ||||
| field: 'imageUrl', | field: 'imageUrl', | ||||
| subResource: subResource, | |||||
| } as ListColDefinition, | } as ListColDefinition, | ||||
| { | { | ||||
| name: 'name', | name: 'name', | ||||
| text: 'form.product', | text: 'form.product', | ||||
| type: ListComponent.COLUMN_TYPE_TEXT, | type: ListComponent.COLUMN_TYPE_TEXT, | ||||
| field: 'name', | field: 'name', | ||||
| subResource: subResource, | |||||
| } | } | ||||
| ]; | ]; | ||||
| } | } | ||||
| @@ -18,8 +18,7 @@ | |||||
| </div> | </div> | ||||
| <div class="col-12 col-lg-6"> | <div class="col-12 col-lg-6"> | ||||
| <ul *ngFor="let contactPartnerProduct of contactPartnerProducts"> | <ul *ngFor="let contactPartnerProduct of contactPartnerProducts"> | ||||
| <!-- TODO: contactPartnerProduct.productName ist falsch, hier muss die ID rein --> | |||||
| <li><a href="/products/{{this.appHelperService.extractId(contactPartnerProduct.product?.id)}}">{{contactPartnerProduct.product?.name}}</a></li> | |||||
| <li><a href="{{ appHelperService.getResourceLink(contactPartnerProduct.product) }}">{{contactPartnerProduct.product?.name}}</a></li> | |||||
| </ul> | </ul> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -107,4 +107,6 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| this.appHelperService.openModal(NewContactComponent, data, this.getContactData); | this.appHelperService.openModal(NewContactComponent, data, this.getContactData); | ||||
| } | } | ||||
| protected readonly AppHelperService = AppHelperService; | |||||
| } | } | ||||
| @@ -107,20 +107,14 @@ export class PartnerListComponent implements OnInit, AfterViewInit { | |||||
| } as ListColDefinition | } as ListColDefinition | ||||
| ) | ) | ||||
| } | } | ||||
| if (this.user !== undefined) { | |||||
| this.getDataFunction = this.getPartnerData; | |||||
| } else if (this.product !== undefined) { | |||||
| this.getDataFunction = this.getUserPartnerData | |||||
| } else { | |||||
| this.getDataFunction = this.getPartnerData; | |||||
| } | |||||
| this.getDataFunction = this.getGetDataFunction(); | |||||
| } | } | ||||
| ngAfterViewInit() { | ngAfterViewInit() { | ||||
| this.listComponent.getData(); | this.listComponent.getData(); | ||||
| } | } | ||||
| getData = (): ListGetDataFunctionType => { | |||||
| getGetDataFunction = (): ListGetDataFunctionType => { | |||||
| if (this.user !== undefined) { | if (this.user !== undefined) { | ||||
| return this.getUserPartnerData; | return this.getUserPartnerData; | ||||
| } else if (this.product !== undefined) { | } else if (this.product !== undefined) { | ||||
| @@ -207,7 +201,7 @@ export class PartnerListComponent implements OnInit, AfterViewInit { | |||||
| openModalNewPartner() { | openModalNewPartner() { | ||||
| let partner: PartnerJsonld = {} as PartnerJsonld; | let partner: PartnerJsonld = {} as PartnerJsonld; | ||||
| partner.partnerType = this.partnerType as TypeEnum; | partner.partnerType = this.partnerType as TypeEnum; | ||||
| this.appHelperService.openModal(NewPartnerComponent, { 'partner': partner }, this.getData); | |||||
| this.appHelperService.openModal(NewPartnerComponent, { 'partner': partner }, this.getGetDataFunction); | |||||
| } | } | ||||
| unassignPartner = (element: any)=> { | unassignPartner = (element: any)=> { | ||||
| @@ -14,14 +14,13 @@ | |||||
| <label for="product" class="form-label">{{ 'form.product' | translate }}:</label> | <label for="product" class="form-label">{{ 'form.product' | translate }}:</label> | ||||
| <ng-container *ngIf="posting.saleIri === null || posting.saleIri === undefined"> | <ng-container *ngIf="posting.saleIri === null || posting.saleIri === undefined"> | ||||
| <app-search-select *ngIf="this.posting.id === null || this.posting.id === undefined" | <app-search-select *ngIf="this.posting.id === null || this.posting.id === undefined" | ||||
| #productSearchSelect | |||||
| [formId]="'productIri'" | |||||
| [formLabelLangKey]="'form.product'" | |||||
| [documentForm]="postForm" | |||||
| [getDataFunction]="getProducts" | |||||
| [dataSource]="dataSourceProducts" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | |||||
| #productSearchSelect | |||||
| [formId]="'productIri'" | |||||
| [formLabelLangKey]="'form.product'" | |||||
| [documentForm]="postForm" | |||||
| [getDataFunction]="getProducts" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | |||||
| > | > | ||||
| </app-search-select> | </app-search-select> | ||||
| <input id="product" type="hidden" *ngIf="this.posting.id === null || this.posting.id === undefined" | <input id="product" type="hidden" *ngIf="this.posting.id === null || this.posting.id === undefined" | ||||
| @@ -10,10 +10,7 @@ import { | |||||
| } from "@app/core/api/v1"; | } from "@app/core/api/v1"; | ||||
| import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {Subscription} from "rxjs"; | |||||
| import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | ||||
| import {MatTableDataSource} from "@angular/material/table"; | |||||
| import {SearchInputColDef} from "@app/_components/search-input/search-input-col-def"; | |||||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | ||||
| @Component({ | @Component({ | ||||
| @@ -29,9 +26,6 @@ export class NewPostComponent implements OnInit { | |||||
| protected readonly SearchSelectComponent = SearchSelectComponent; | protected readonly SearchSelectComponent = SearchSelectComponent; | ||||
| protected postForm: FormGroup; | protected postForm: FormGroup; | ||||
| protected postSub: Subscription; | |||||
| protected products: Array<ProductJsonld>; | |||||
| protected dataSourceProducts; | |||||
| constructor( | constructor( | ||||
| private postService: PostService, | private postService: PostService, | ||||
| @@ -39,9 +33,6 @@ export class NewPostComponent implements OnInit { | |||||
| protected appHelperService: AppHelperService, | protected appHelperService: AppHelperService, | ||||
| ) { | ) { | ||||
| this.postForm = postForm; | this.postForm = postForm; | ||||
| this.postSub = new Subscription(); | |||||
| this.products = []; | |||||
| this.dataSourceProducts = new MatTableDataSource<ProductJsonld>(this.products); | |||||
| } | } | ||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| @@ -60,7 +51,7 @@ export class NewPostComponent implements OnInit { | |||||
| if (this.postForm.valid) { | if (this.postForm.valid) { | ||||
| if (this.posting.id === null || this.posting.id === undefined) { | if (this.posting.id === null || this.posting.id === undefined) { | ||||
| // Create new post | // Create new post | ||||
| this.postSub = this.postService.postsPost( | |||||
| this.postService.postsPost( | |||||
| this.postForm.value as PostJsonld | this.postForm.value as PostJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| @@ -70,7 +61,7 @@ export class NewPostComponent implements OnInit { | |||||
| ); | ); | ||||
| } else { | } else { | ||||
| // Edit post | // Edit post | ||||
| this.postSub = this.postService.postsIdPatch( | |||||
| this.postService.postsIdPatch( | |||||
| this.appHelperService.extractId(this.posting.id), | this.appHelperService.extractId(this.posting.id), | ||||
| this.postForm.value as PostJsonld | this.postForm.value as PostJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| @@ -9,24 +9,22 @@ | |||||
| [formLabelLangKey]="'form.product'" | [formLabelLangKey]="'form.product'" | ||||
| [documentForm]="form" | [documentForm]="form" | ||||
| [getDataFunction]="getUnassignedProducts" | [getDataFunction]="getUnassignedProducts" | ||||
| [dataSource]="dataSourceProducts" | |||||
| [displayedDataField]="'name'" | [displayedDataField]="'name'" | ||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | |||||
| > | > | ||||
| <input type="hidden" id="product" formControlName="productIri" value="{{partnerProduct.productIri}}"/> | <input type="hidden" id="product" formControlName="productIri" value="{{partnerProduct.productIri}}"/> | ||||
| </app-search-select> | </app-search-select> | ||||
| </div> | </div> | ||||
| <div class="mb-3" *ngIf="this.contactPartnerProduct"> | <div class="mb-3" *ngIf="this.contactPartnerProduct"> | ||||
| <label for="partnerProduct" class="form-label">{{ 'form.product' | translate }}:</label> | <label for="partnerProduct" class="form-label">{{ 'form.product' | translate }}:</label> | ||||
| <app-search-select #partnerSearchSelect | |||||
| <app-search-select #productSearchSelect | |||||
| [formId]="'partnerProductIri'" | [formId]="'partnerProductIri'" | ||||
| [formLabelLangKey]="'form.product'" | [formLabelLangKey]="'form.product'" | ||||
| [documentForm]="form" | [documentForm]="form" | ||||
| [getDataFunction]="getUnassignedPartnerProducts" | [getDataFunction]="getUnassignedPartnerProducts" | ||||
| [dataSource]="dataSourcePartnerProducts" | |||||
| [displayedDataField]="'name'" | [displayedDataField]="'name'" | ||||
| [displayedDataSubResource]="'product'" | [displayedDataSubResource]="'product'" | ||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts('product')" | |||||
| > | > | ||||
| <input type="hidden" id="partnerProduct" formControlName="partnerProductIri" value="{{contactPartnerProduct.partnerProductIri}}"/> | <input type="hidden" id="partnerProduct" formControlName="partnerProductIri" value="{{contactPartnerProduct.partnerProductIri}}"/> | ||||
| </app-search-select> | </app-search-select> | ||||
| @@ -27,10 +27,6 @@ export class AssignProductComponent implements OnInit, AfterViewInit { | |||||
| @ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent | @ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent | ||||
| protected readonly SearchSelectComponent = SearchSelectComponent; | protected readonly SearchSelectComponent = SearchSelectComponent; | ||||
| protected products: Array<ProductJsonld>; | |||||
| protected dataSourceProducts; | |||||
| protected partnerProducts: Array<PartnerProductJsonld>; | |||||
| protected dataSourcePartnerProducts; | |||||
| protected form!: FormGroup; | protected form!: FormGroup; | ||||
| constructor( | constructor( | ||||
| @@ -39,11 +35,6 @@ export class AssignProductComponent implements OnInit, AfterViewInit { | |||||
| protected contactPartnerProductService: ContactPartnerProductService, | protected contactPartnerProductService: ContactPartnerProductService, | ||||
| protected appHelperService: AppHelperService, | protected appHelperService: AppHelperService, | ||||
| ) { | ) { | ||||
| this.products = []; | |||||
| this.dataSourceProducts = new MatTableDataSource<ProductJsonld>(this.products); | |||||
| this.partnerProducts = []; | |||||
| this.dataSourcePartnerProducts = new MatTableDataSource<PartnerProductJsonld>(this.partnerProducts); | |||||
| } | } | ||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| @@ -87,7 +78,6 @@ export class AssignProductComponent implements OnInit, AfterViewInit { | |||||
| onSubmit() { | onSubmit() { | ||||
| if (this.form.valid) { | if (this.form.valid) { | ||||
| if (this.partnerProduct !== undefined) { | if (this.partnerProduct !== undefined) { | ||||
| // Partner product | |||||
| this.partnerProductService.partnerProductsPost( | this.partnerProductService.partnerProductsPost( | ||||
| this.form.value as PartnerProductJsonld | this.form.value as PartnerProductJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| @@ -4,12 +4,12 @@ | |||||
| <form [formGroup]="saleForm" (ngSubmit)="onSubmit()"> | <form [formGroup]="saleForm" (ngSubmit)="onSubmit()"> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <app-search-select #partnerSearchSelect | |||||
| <label for="partnerIri" class="form-label">{{ 'form.partner' | translate }}:</label> | |||||
| <app-search-select #partnerSearchSelect id="partnerIri" | |||||
| [formId]="'partnerIri'" | [formId]="'partnerIri'" | ||||
| [formLabelLangKey]="'form.partner'" | [formLabelLangKey]="'form.partner'" | ||||
| [documentForm]="saleForm" | [documentForm]="saleForm" | ||||
| [getDataFunction]="getPartners" | [getDataFunction]="getPartners" | ||||
| [dataSource]="dataSourcePartners" | |||||
| [displayedDataField]="'name'" | [displayedDataField]="'name'" | ||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | ||||
| > | > | ||||
| @@ -18,12 +18,12 @@ | |||||
| </div> | </div> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <app-search-select #productSearchSelect | |||||
| <label for="productIri" class="form-label">{{ 'form.product' | translate }}:</label> | |||||
| <app-search-select #productSearchSelect id="productIri" | |||||
| [formId]="'productIri'" | [formId]="'productIri'" | ||||
| [formLabelLangKey]="'form.product'" | [formLabelLangKey]="'form.product'" | ||||
| [documentForm]="saleForm" | [documentForm]="saleForm" | ||||
| [getDataFunction]="getProducts" | [getDataFunction]="getProducts" | ||||
| [dataSource]="dataSourceProducts" | |||||
| [displayedDataField]="'name'" | [displayedDataField]="'name'" | ||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | ||||
| > | > | ||||
| @@ -26,17 +26,13 @@ import {ListColDefinition} from "@app/_components/list/list-col-definition"; | |||||
| }) | }) | ||||
| export class NewSaleComponent implements OnInit, AfterViewInit { | export class NewSaleComponent implements OnInit, AfterViewInit { | ||||
| @Input() public sale!: SaleJsonld; | @Input() public sale!: SaleJsonld; | ||||
| @Input() public partner!: PartnerJsonld; | |||||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | ||||
| @ViewChild('partnerSearchSelect', { static: false }) partnerSearchSelect!: SearchSelectComponent; | @ViewChild('partnerSearchSelect', { static: false }) partnerSearchSelect!: SearchSelectComponent; | ||||
| @ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent; | @ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent; | ||||
| protected readonly SearchSelectComponent = SearchSelectComponent; | protected readonly SearchSelectComponent = SearchSelectComponent; | ||||
| protected saleForm: FormGroup; | protected saleForm: FormGroup; | ||||
| protected saleSub: Subscription; | |||||
| protected partners: Array<PartnerJsonld>; | |||||
| protected dataSourcePartners; | |||||
| protected products: Array<ProductJsonld>; | |||||
| protected dataSourceProducts; | |||||
| constructor( | constructor( | ||||
| private saleService: SaleService, | private saleService: SaleService, | ||||
| @@ -46,11 +42,6 @@ export class NewSaleComponent implements OnInit, AfterViewInit { | |||||
| protected appHelperService: AppHelperService, | protected appHelperService: AppHelperService, | ||||
| ) { | ) { | ||||
| this.saleForm = saleForm; | this.saleForm = saleForm; | ||||
| this.saleSub = new Subscription(); | |||||
| this.partners = []; | |||||
| this.dataSourcePartners = new MatTableDataSource<PartnerJsonld>(this.partners); | |||||
| this.products = []; | |||||
| this.dataSourceProducts = new MatTableDataSource<ProductJsonld>(this.products); | |||||
| } | } | ||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| @@ -90,7 +81,7 @@ export class NewSaleComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| if (this.sale.id === null || this.sale.id === undefined) { | if (this.sale.id === null || this.sale.id === undefined) { | ||||
| // Create new sale | // Create new sale | ||||
| this.saleSub = this.saleService.salesPost( | |||||
| this.saleService.salesPost( | |||||
| this.saleForm.value as SaleJsonld | this.saleForm.value as SaleJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| @@ -100,7 +91,7 @@ export class NewSaleComponent implements OnInit, AfterViewInit { | |||||
| ); | ); | ||||
| } else { | } else { | ||||
| // Edit sale | // Edit sale | ||||
| this.saleSub = this.saleService.salesIdPatch( | |||||
| this.saleService.salesIdPatch( | |||||
| this.appHelperService.extractId(this.sale.id), | this.appHelperService.extractId(this.sale.id), | ||||
| this.saleForm.value as SaleJsonld | this.saleForm.value as SaleJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| @@ -120,7 +120,7 @@ export class SaleListComponent implements OnInit, AfterViewInit { | |||||
| openModalNewSale() { | openModalNewSale() { | ||||
| let sale: SaleJsonld = {} as SaleJsonld; | let sale: SaleJsonld = {} as SaleJsonld; | ||||
| this.appHelperService.openModal(NewSaleComponent, { 'sale': sale }, this.listComponent.getData); | |||||
| this.appHelperService.openModal(NewSaleComponent, { 'sale': sale, 'partner': this.partner }, this.listComponent.getData); | |||||
| } | } | ||||
| } | } | ||||
| @@ -17,7 +17,6 @@ | |||||
| [formLabelLangKey]="'form.product'" | [formLabelLangKey]="'form.product'" | ||||
| [documentForm]="taskNoteForm" | [documentForm]="taskNoteForm" | ||||
| [getDataFunction]="getContacts" | [getDataFunction]="getContacts" | ||||
| [dataSource]="dataSourceContacts" | |||||
| [displayedDataField]="'fullName'" | [displayedDataField]="'fullName'" | ||||
| [dataSet]="taskNote.contact" | [dataSet]="taskNote.contact" | ||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefContacts()" | [listColDefinitions]="SearchSelectComponent.getDefaultColDefContacts()" | ||||
| @@ -30,10 +30,7 @@ export class NewTaskNoteComponent implements OnInit, AfterViewInit { | |||||
| protected readonly SearchSelectComponent = SearchSelectComponent; | protected readonly SearchSelectComponent = SearchSelectComponent; | ||||
| protected taskNoteForm: FormGroup; | protected taskNoteForm: FormGroup; | ||||
| protected taskNoteSub: Subscription; | |||||
| protected contactTypes = Object.values(TaskNoteJsonld.ContactTypeEnum); | protected contactTypes = Object.values(TaskNoteJsonld.ContactTypeEnum); | ||||
| protected contacts: Array<ContactJsonld>; | |||||
| protected dataSourceContacts; | |||||
| constructor( | constructor( | ||||
| protected taskNoteService: TaskNoteService, | protected taskNoteService: TaskNoteService, | ||||
| @@ -41,9 +38,6 @@ export class NewTaskNoteComponent implements OnInit, AfterViewInit { | |||||
| protected contactService: ContactService | protected contactService: ContactService | ||||
| ) { | ) { | ||||
| this.taskNoteForm = taskNoteForm; | this.taskNoteForm = taskNoteForm; | ||||
| this.taskNoteSub = new Subscription(); | |||||
| this.contacts = []; | |||||
| this.dataSourceContacts = new MatTableDataSource<ContactJsonld>(this.contacts); | |||||
| } | } | ||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| @@ -77,7 +71,7 @@ export class NewTaskNoteComponent implements OnInit, AfterViewInit { | |||||
| if (this.taskNoteForm.valid) { | if (this.taskNoteForm.valid) { | ||||
| if (this.taskNote.id === null || this.taskNote.id === undefined) { | if (this.taskNote.id === null || this.taskNote.id === undefined) { | ||||
| // Create new taskNote | // Create new taskNote | ||||
| this.taskNoteSub = this.taskNoteService.taskNotesPost( | |||||
| this.taskNoteService.taskNotesPost( | |||||
| this.taskNoteForm.value as TaskNoteJsonld | this.taskNoteForm.value as TaskNoteJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| @@ -87,7 +81,7 @@ export class NewTaskNoteComponent implements OnInit, AfterViewInit { | |||||
| ); | ); | ||||
| } else { | } else { | ||||
| // Edit taskNote | // Edit taskNote | ||||
| this.taskNoteSub = this.taskNoteService.taskNotesIdPatch( | |||||
| this.taskNoteService.taskNotesIdPatch( | |||||
| this.appHelperService.extractId(this.taskNote.id), | this.appHelperService.extractId(this.taskNote.id), | ||||
| this.taskNoteForm.value as TaskNoteJsonld | this.taskNoteForm.value as TaskNoteJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| @@ -25,7 +25,6 @@ | |||||
| [formLabelLangKey]="'form.product'" | [formLabelLangKey]="'form.product'" | ||||
| [documentForm]="taskForm" | [documentForm]="taskForm" | ||||
| [getDataFunction]="getProducts" | [getDataFunction]="getProducts" | ||||
| [dataSource]="dataSourceProducts" | |||||
| [displayedDataField]="'name'" | [displayedDataField]="'name'" | ||||
| [dataSet]="task.product" | [dataSet]="task.product" | ||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | ||||
| @@ -42,7 +41,6 @@ | |||||
| [formLabelLangKey]="'form.user'" | [formLabelLangKey]="'form.user'" | ||||
| [documentForm]="taskForm" | [documentForm]="taskForm" | ||||
| [getDataFunction]="getUsers" | [getDataFunction]="getUsers" | ||||
| [dataSource]="dataSourceUsers" | |||||
| [displayedDataField]="'fullName'" | [displayedDataField]="'fullName'" | ||||
| [dataSet]="task.assignedTo" | [dataSet]="task.assignedTo" | ||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefUsers()" | [listColDefinitions]="SearchSelectComponent.getDefaultColDefUsers()" | ||||
| @@ -33,27 +33,15 @@ export class NewTaskComponent implements OnInit, AfterViewInit { | |||||
| protected readonly SearchSelectComponent = SearchSelectComponent; | protected readonly SearchSelectComponent = SearchSelectComponent; | ||||
| protected taskForm: FormGroup; | protected taskForm: FormGroup; | ||||
| protected taskSub: Subscription; | |||||
| protected dueAtValue: string; | protected dueAtValue: string; | ||||
| protected users: Array<UserJsonld>; | |||||
| protected dataSourceUsers; | |||||
| protected products: Array<ProductJsonld>; | |||||
| protected dataSourceProducts; | |||||
| constructor( | constructor( | ||||
| protected taskService: TaskService, | protected taskService: TaskService, | ||||
| protected userService: UserService, | protected userService: UserService, | ||||
| protected productService: ProductService, | protected productService: ProductService, | ||||
| protected appHelperService: AppHelperService | protected appHelperService: AppHelperService | ||||
| ) { | ) { | ||||
| this.users = []; | |||||
| this.dataSourceUsers = new MatTableDataSource<UserJsonld>(this.users); | |||||
| this.products = []; | |||||
| this.dataSourceProducts = new MatTableDataSource<ProductJsonld>(this.products); | |||||
| this.taskForm = taskForm; | this.taskForm = taskForm; | ||||
| this.taskSub = new Subscription(); | |||||
| this.dueAtValue = ""; | this.dueAtValue = ""; | ||||
| } | } | ||||
| @@ -101,7 +89,7 @@ export class NewTaskComponent implements OnInit, AfterViewInit { | |||||
| if (this.taskForm.valid) { | if (this.taskForm.valid) { | ||||
| if (this.task.id === null || this.task.id === undefined) { | if (this.task.id === null || this.task.id === undefined) { | ||||
| // Create new task | // Create new task | ||||
| this.taskSub = this.taskService.tasksPost( | |||||
| this.taskService.tasksPost( | |||||
| this.taskForm.value as TaskJsonld | this.taskForm.value as TaskJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| @@ -111,7 +99,7 @@ export class NewTaskComponent implements OnInit, AfterViewInit { | |||||
| ); | ); | ||||
| } else { | } else { | ||||
| // Edit task | // Edit task | ||||
| this.taskSub = this.taskService.tasksIdPatch( | |||||
| this.taskService.tasksIdPatch( | |||||
| this.appHelperService.extractId(this.task.id), | this.appHelperService.extractId(this.task.id), | ||||
| this.taskForm.value as TaskJsonld | this.taskForm.value as TaskJsonld | ||||
| ).subscribe( | ).subscribe( | ||||