| @@ -49,9 +49,12 @@ export class ContactListComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| openModalNewContact() { | openModalNewContact() { | ||||
| let postInputs: any = {}; | |||||
| let contact: ContactJsonld = {} as ContactJsonld; | let contact: ContactJsonld = {} as ContactJsonld; | ||||
| contact.partnerIri = this.partner.id ?? null; | contact.partnerIri = this.partner.id ?? null; | ||||
| this.appHelperService.openModal(NewContactComponent, {'contact': contact}, this.getData); | |||||
| postInputs['contact'] = contact; | |||||
| postInputs['partner'] = this.partner; | |||||
| this.appHelperService.openModal(NewContactComponent, postInputs, this.getData); | |||||
| } | } | ||||
| navigateToContactDetails(element: any) { | navigateToContactDetails(element: any) { | ||||
| @@ -25,6 +25,11 @@ | |||||
| (change)="onBirthdayChange($event)"/> | (change)="onBirthdayChange($event)"/> | ||||
| </div> | </div> | ||||
| <div class="mb-3"> | |||||
| <label for="partner" class="form-label">{{ 'form.partner' | translate }}:</label> | |||||
| <input type="text" value="{{ partner?.name }}" class="form-control" id="partner" disabled/> | |||||
| </div> | |||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="position" class="form-label">{{ 'form.position' | translate }}:</label> | <label for="position" class="form-label">{{ 'form.position' | translate }}:</label> | ||||
| <input type="text" class="form-control" id="position" formControlName="position"/> | <input type="text" class="form-control" id="position" formControlName="position"/> | ||||
| @@ -1,7 +1,7 @@ | |||||
| import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; | import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; | ||||
| import {FormGroup} from "@angular/forms"; | import {FormGroup} from "@angular/forms"; | ||||
| import {contactForm} from "@app/_forms/apiForms"; | import {contactForm} from "@app/_forms/apiForms"; | ||||
| import {ContactJsonld, ContactService, MediaObjectService} from "@app/core/api/v1"; | |||||
| import {ContactJsonld, ContactService, MediaObjectService, PartnerJsonld} from "@app/core/api/v1"; | |||||
| import {ModalStatus} from "@app/_helpers/modal.states"; | import {ModalStatus} from "@app/_helpers/modal.states"; | ||||
| import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | ||||
| import {TranslateService} from "@ngx-translate/core"; | import {TranslateService} from "@ngx-translate/core"; | ||||
| @@ -15,6 +15,7 @@ import {AppHelperService} from "@app/_helpers/app-helper.service"; | |||||
| }) | }) | ||||
| export class NewContactComponent implements OnInit, AfterViewInit { | export class NewContactComponent implements OnInit, AfterViewInit { | ||||
| @Input() public contact!: ContactJsonld; | @Input() public contact!: ContactJsonld; | ||||
| @Input() public partner!: PartnerJsonld; | |||||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | ||||
| protected contactForm: FormGroup; | protected contactForm: FormGroup; | ||||
| @@ -110,8 +110,18 @@ export class DocumentListComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| openModalNewDocument() { | openModalNewDocument() { | ||||
| let postInputs: any = {}; | |||||
| let document: DocumentJsonld = {} as DocumentJsonld; | let document: DocumentJsonld = {} as DocumentJsonld; | ||||
| this.appHelperService.openModal(NewDocumentComponent, {'document': document}, this.listComponent.getData); | |||||
| if (this.partner !== undefined) { | |||||
| document.partnerIri = this.partner?.id; | |||||
| postInputs['partner'] = this.partner; | |||||
| } | |||||
| if (this.product !== undefined) { | |||||
| document.productIri = this.product?.id; | |||||
| postInputs['product'] = this.product; | |||||
| } | |||||
| postInputs['document'] = document; | |||||
| this.appHelperService.openModal(NewDocumentComponent, postInputs, this.listComponent.getData); | |||||
| } | } | ||||
| openModalEditDocument = (element: DocumentJsonld) => { | openModalEditDocument = (element: DocumentJsonld) => { | ||||
| @@ -14,32 +14,48 @@ | |||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="partner" class="form-label">{{ 'form.partner' | translate }}:</label> | <label for="partner" class="form-label">{{ 'form.partner' | translate }}:</label> | ||||
| <app-search-select #partnerSearchSelect | |||||
| [formId]="'partnerIri'" | |||||
| [formLabelLangKey]="'form.partner'" | |||||
| [documentForm]="documentForm" | |||||
| [getDataFunction]="getPartners" | |||||
| [displayedDataField]="'name'" | |||||
| [dataSet]="document.partner" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | |||||
| > | |||||
| </app-search-select> | |||||
| <input type="hidden" id="partner" formControlName="partner"/> | |||||
| <ng-container *ngIf="document.partnerIri === null || document.partnerIri === undefined"> | |||||
| <app-search-select #partnerSearchSelect *ngIf="document.id === null || document.id === undefined" | |||||
| [formId]="'partnerIri'" | |||||
| [formLabelLangKey]="'form.partner'" | |||||
| [documentForm]="documentForm" | |||||
| [getDataFunction]="getPartners" | |||||
| [displayedDataField]="'name'" | |||||
| [dataSet]="document.partner" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | |||||
| > | |||||
| </app-search-select> | |||||
| <input type="hidden" id="partner" formControlName="partner" | |||||
| *ngIf="document.id === null || document.id === undefined"/> | |||||
| </ng-container> | |||||
| <input type="text" | |||||
| *ngIf="document.partnerIri !== null && document.partnerIri !== undefined && (document.id === null || document.id === undefined)" | |||||
| class="form-control" disabled value="{{partner.name}}"/> | |||||
| <input type="text" *ngIf="document.id !== null && document.id !== undefined" class="form-control" | |||||
| disabled value="{{partner?.name}}"/> | |||||
| </div> | </div> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="product" class="form-label">{{ 'form.product' | translate }}:</label> | <label for="product" class="form-label">{{ 'form.product' | translate }}:</label> | ||||
| <app-search-select #productSearchSelect | |||||
| [formId]="'productIri'" | |||||
| [formLabelLangKey]="'form.product'" | |||||
| [documentForm]="documentForm" | |||||
| [getDataFunction]="getProducts" | |||||
| [displayedDataField]="'name'" | |||||
| [dataSet]="document.product" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | |||||
| > | |||||
| </app-search-select> | |||||
| <input type="hidden" id="product" formControlName="product"/> | |||||
| <ng-container *ngIf="document.productIri === null || document.productIri === undefined"> | |||||
| <app-search-select #productSearchSelect *ngIf="document.id === null || document.id === undefined" | |||||
| [formId]="'productIri'" | |||||
| [formLabelLangKey]="'form.product'" | |||||
| [documentForm]="documentForm" | |||||
| [getDataFunction]="getProducts" | |||||
| [displayedDataField]="'name'" | |||||
| [dataSet]="document.product" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | |||||
| > | |||||
| </app-search-select> | |||||
| <input type="hidden" id="product" formControlName="product" | |||||
| *ngIf="document.id === null || document.id === undefined"/> | |||||
| </ng-container> | |||||
| <input type="text" | |||||
| *ngIf="document.productIri !== null && document.productIri !== undefined && (document.id === null || document.id === undefined)" | |||||
| class="form-control" disabled value="{{product.name}}"/> | |||||
| <input type="text" *ngIf="document.id !== null && document.id !== undefined" class="form-control" | |||||
| disabled value="{{product?.name}}"/> | |||||
| </div> | </div> | ||||
| <div class="mb-3" *ngIf="documentForm.get('documentUrl')?.value === null"> | <div class="mb-3" *ngIf="documentForm.get('documentUrl')?.value === null"> | ||||
| @@ -1,7 +1,7 @@ | |||||
| import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | ||||
| import { | import { | ||||
| DocumentJsonld, DocumentObjectService, | DocumentJsonld, DocumentObjectService, | ||||
| DocumentService, PartnerService, ProductService | |||||
| DocumentService, PartnerJsonld, PartnerService, ProductJsonld, ProductService | |||||
| } from "@app/core/api/v1"; | } from "@app/core/api/v1"; | ||||
| import {ModalStatus} from "@app/_helpers/modal.states"; | import {ModalStatus} from "@app/_helpers/modal.states"; | ||||
| import {FormGroup} from "@angular/forms"; | import {FormGroup} from "@angular/forms"; | ||||
| @@ -20,6 +20,8 @@ import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-funct | |||||
| }) | }) | ||||
| export class NewDocumentComponent implements OnInit, AfterViewInit { | export class NewDocumentComponent implements OnInit, AfterViewInit { | ||||
| @Input() public document!: DocumentJsonld; | @Input() public document!: DocumentJsonld; | ||||
| @Input() public partner!: PartnerJsonld; | |||||
| @Input() public product!: ProductJsonld; | |||||
| @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; | ||||
| @@ -42,6 +44,7 @@ export class NewDocumentComponent implements OnInit, AfterViewInit { | |||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| this.documentForm = FormGroupInitializer.initFormGroup(this.documentForm, this.document); | this.documentForm = FormGroupInitializer.initFormGroup(this.documentForm, this.document); | ||||
| console.log(this.document); | |||||
| } | } | ||||
| ngAfterViewInit(): void { | ngAfterViewInit(): void { | ||||
| @@ -10,10 +10,15 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="mb-3"> | |||||
| <label for="partner" class="form-label">{{ 'form.partner' | translate }}:</label> | |||||
| <input type="text" class="form-control" value="{{partner?.name}}" id="partner" disabled/> | |||||
| </div> | |||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <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="posting.id === null || posting.id === undefined" | |||||
| #productSearchSelect | #productSearchSelect | ||||
| [formId]="'productIri'" | [formId]="'productIri'" | ||||
| [formLabelLangKey]="'form.product'" | [formLabelLangKey]="'form.product'" | ||||
| @@ -23,13 +28,13 @@ | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | [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="posting.id === null || posting.id === undefined" | |||||
| formControlName="product"/> | formControlName="product"/> | ||||
| </ng-container> | </ng-container> | ||||
| <input type="text" | <input type="text" | ||||
| *ngIf="posting.saleIri !== null && posting.saleIri !== undefined && (this.posting.id === null || this.posting.id === undefined)" | |||||
| *ngIf="posting.saleIri !== null && posting.saleIri !== undefined && (posting.id === null || posting.id === undefined)" | |||||
| class="form-control" disabled value="{{product.name}}"/> | class="form-control" disabled value="{{product.name}}"/> | ||||
| <input type="text" *ngIf="this.posting.id !== null && this.posting.id !== undefined" class="form-control" | |||||
| <input type="text" *ngIf="posting.id !== null && posting.id !== undefined" class="form-control" | |||||
| disabled value="{{posting.product?.name}}"/> | disabled value="{{posting.product?.name}}"/> | ||||
| </div> | </div> | ||||
| @@ -3,6 +3,8 @@ import {ModalStatus} from "@app/_helpers/modal.states"; | |||||
| import {FormGroup} from "@angular/forms"; | import {FormGroup} from "@angular/forms"; | ||||
| import {postForm} from "@app/_forms/apiForms"; | import {postForm} from "@app/_forms/apiForms"; | ||||
| import { | import { | ||||
| PartnerJsonld, | |||||
| PartnerService, | |||||
| PostJsonld, | PostJsonld, | ||||
| PostService, | PostService, | ||||
| ProductJsonld, | ProductJsonld, | ||||
| @@ -21,6 +23,7 @@ import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-funct | |||||
| export class NewPostComponent implements OnInit { | export class NewPostComponent implements OnInit { | ||||
| @Input() public posting!: PostJsonld; | @Input() public posting!: PostJsonld; | ||||
| @Input() public product!: ProductJsonld; | @Input() public product!: ProductJsonld; | ||||
| @Input() public partner!: PartnerJsonld; | |||||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | ||||
| @ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent; | @ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent; | ||||
| protected readonly SearchSelectComponent = SearchSelectComponent; | protected readonly SearchSelectComponent = SearchSelectComponent; | ||||
| @@ -30,6 +33,7 @@ export class NewPostComponent implements OnInit { | |||||
| constructor( | constructor( | ||||
| private postService: PostService, | private postService: PostService, | ||||
| protected productService: ProductService, | protected productService: ProductService, | ||||
| protected partnerService: PartnerService, | |||||
| protected appHelperService: AppHelperService, | protected appHelperService: AppHelperService, | ||||
| ) { | ) { | ||||
| this.postForm = postForm; | this.postForm = postForm; | ||||
| @@ -37,6 +41,11 @@ export class NewPostComponent implements OnInit { | |||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| this.postForm = FormGroupInitializer.initFormGroup(this.postForm, this.posting); | this.postForm = FormGroupInitializer.initFormGroup(this.postForm, this.posting); | ||||
| this.partnerService.partnersIdGet(this.appHelperService.extractId(this.posting.partnerIri)).subscribe( | |||||
| data => { | |||||
| this.partner = data; | |||||
| } | |||||
| ); | |||||
| } | } | ||||
| getProducts: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => { | getProducts: ListGetDataFunctionType = (index: number, pageSize: number, term?: string) => { | ||||
| @@ -139,6 +139,7 @@ export class PostListComponent implements OnInit, AfterViewInit { | |||||
| if (this.partner !== undefined) { | if (this.partner !== undefined) { | ||||
| post.partnerIri = this.partner?.id; | post.partnerIri = this.partner?.id; | ||||
| postInputs['partner'] = this.partner; | |||||
| } | } | ||||
| if (this.contact !== undefined) { | if (this.contact !== undefined) { | ||||
| post.contactIri = this.contact.id; | post.contactIri = this.contact.id; | ||||
| @@ -5,30 +5,46 @@ | |||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="partnerIri" class="form-label">{{ 'form.partner' | translate }}:</label> | <label for="partnerIri" class="form-label">{{ 'form.partner' | translate }}:</label> | ||||
| <app-search-select #partnerSearchSelect id="partnerIri" | |||||
| [formId]="'partnerIri'" | |||||
| [formLabelLangKey]="'form.partner'" | |||||
| [documentForm]="saleForm" | |||||
| [getDataFunction]="getPartners" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | |||||
| > | |||||
| </app-search-select> | |||||
| <input type="hidden" formControlName="partnerIri"/> | |||||
| <ng-container *ngIf="!partner"> | |||||
| <app-search-select #partnerSearchSelect id="partnerIri" | |||||
| *ngIf="sale.id === null || sale.id === undefined" | |||||
| [formId]="'partnerIri'" | |||||
| [formLabelLangKey]="'form.partner'" | |||||
| [documentForm]="saleForm" | |||||
| [getDataFunction]="getPartners" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | |||||
| > | |||||
| </app-search-select> | |||||
| <input type="hidden" formControlName="partnerIri" *ngIf="sale.id === null || sale.id === undefined"/> | |||||
| </ng-container> | |||||
| <input type="text" | |||||
| *ngIf="partner && (partner.id !== null && partner.id !== undefined) && (sale.id === null || sale.id === undefined)" | |||||
| class="form-control" disabled value="{{partner.name}}"/> | |||||
| <input type="text" *ngIf="sale.id !== null && sale.id !== undefined" class="form-control" | |||||
| disabled value="{{partner?.name}}"/> | |||||
| </div> | </div> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="productIri" class="form-label">{{ 'form.product' | translate }}:</label> | <label for="productIri" class="form-label">{{ 'form.product' | translate }}:</label> | ||||
| <app-search-select #productSearchSelect id="productIri" | |||||
| [formId]="'productIri'" | |||||
| [formLabelLangKey]="'form.product'" | |||||
| [documentForm]="saleForm" | |||||
| [getDataFunction]="getProducts" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | |||||
| > | |||||
| </app-search-select> | |||||
| <input type="hidden" formControlName="productIri"/> | |||||
| <ng-container *ngIf="!product"> | |||||
| <app-search-select #productSearchSelect id="productIri" | |||||
| *ngIf="sale.id === null || sale.id === undefined" | |||||
| [formId]="'productIri'" | |||||
| [formLabelLangKey]="'form.product'" | |||||
| [documentForm]="saleForm" | |||||
| [getDataFunction]="getProducts" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | |||||
| > | |||||
| </app-search-select> | |||||
| <input type="hidden" formControlName="productIri" *ngIf="sale.id === null || sale.id === undefined"/> | |||||
| </ng-container> | |||||
| <input type="text" | |||||
| *ngIf="product && (product.id !== null && product.id !== undefined) && (sale.id === null || sale.id === undefined)" | |||||
| class="form-control" disabled value="{{product.name}}"/> | |||||
| <input type="text" *ngIf="sale.id !== null && sale.id !== undefined" class="form-control" | |||||
| disabled value="{{product?.name}}"/> | |||||
| </div> | </div> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| @@ -1,7 +1,7 @@ | |||||
| import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | ||||
| import { | import { | ||||
| PartnerJsonld, | PartnerJsonld, | ||||
| PartnerService, | |||||
| PartnerService, ProductJsonld, | |||||
| ProductService, | ProductService, | ||||
| SaleJsonld, | SaleJsonld, | ||||
| SaleService | SaleService | ||||
| @@ -23,6 +23,7 @@ import {SearchSelectComponent} from "@app/_components/search-select/search-selec | |||||
| export class NewSaleComponent implements OnInit, AfterViewInit { | export class NewSaleComponent implements OnInit, AfterViewInit { | ||||
| @Input() public sale!: SaleJsonld; | @Input() public sale!: SaleJsonld; | ||||
| @Input() public partner!: PartnerJsonld; | @Input() public partner!: PartnerJsonld; | ||||
| @Input() public product!: ProductJsonld; | |||||
| @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; | ||||
| @@ -42,6 +43,12 @@ export class NewSaleComponent implements OnInit, AfterViewInit { | |||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| this.saleForm = FormGroupInitializer.initFormGroup(this.saleForm, this.sale); | this.saleForm = FormGroupInitializer.initFormGroup(this.saleForm, this.sale); | ||||
| if (this.partner && this.saleForm.get('partnerIri')?.value === null) { | |||||
| this.saleForm.get('partnerIri')?.setValue(this.partner.id); | |||||
| } | |||||
| if (this.product && this.saleForm.get('productIri')?.value === null) { | |||||
| this.saleForm.get('productIri')?.setValue(this.product.id); | |||||
| } | |||||
| } | } | ||||
| ngAfterViewInit(): void { | ngAfterViewInit(): void { | ||||
| @@ -118,7 +118,8 @@ export class SaleListComponent implements OnInit, AfterViewInit { | |||||
| let sale: SaleJsonld = {} as SaleJsonld; | let sale: SaleJsonld = {} as SaleJsonld; | ||||
| this.appHelperService.openModal(NewSaleComponent, { | this.appHelperService.openModal(NewSaleComponent, { | ||||
| 'sale': sale, | 'sale': sale, | ||||
| 'partner': this.partner | |||||
| 'partner': this.partner, | |||||
| 'product': this.product | |||||
| }, this.listComponent.getData); | }, this.listComponent.getData); | ||||
| } | } | ||||
| @@ -18,6 +18,11 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="mb-3"> | |||||
| <label for="partner" class="form-label">{{ 'form.partner' | translate }}:</label> | |||||
| <input type="text" value="{{ partner?.name }}" class="form-control" id="partner" disabled/> | |||||
| </div> | |||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="productIri" class="form-label">{{ 'form.product' | translate }}:</label> | <label for="productIri" class="form-label">{{ 'form.product' | translate }}:</label> | ||||
| <app-search-select #productSearchSelect id="productIri" | <app-search-select #productSearchSelect id="productIri" | ||||
| @@ -29,8 +34,8 @@ | |||||
| [dataSet]="task.product" | [dataSet]="task.product" | ||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | ||||
| > | > | ||||
| <input type="hidden" formControlName="productIri" value="{{task.productIri}}"/> | |||||
| </app-search-select> | </app-search-select> | ||||
| <input type="hidden" formControlName="productIri" value="{{task.productIri}}"/> | |||||
| </div> | </div> | ||||
| @@ -45,11 +50,8 @@ | |||||
| [dataSet]="task.assignedTo" | [dataSet]="task.assignedTo" | ||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefUsers()" | [listColDefinitions]="SearchSelectComponent.getDefaultColDefUsers()" | ||||
| > | > | ||||
| <input type="hidden" formControlName="assignedToIri" value="{{task.productIri}}"/> | |||||
| </app-search-select> | </app-search-select> | ||||
| <div class="form-text" *ngIf="taskForm.get('assignedTo')?.invalid && taskForm.get('assignedTo')?.touched"> | |||||
| {{ 'form.assign-to' | translate }} {{ 'form.mandatory' | translate }}. | |||||
| </div> | |||||
| <input type="hidden" formControlName="assignedToIri" value="{{task.productIri}}"/> | |||||
| </div> | </div> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| @@ -1,5 +1,7 @@ | |||||
| import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | ||||
| import { | import { | ||||
| PartnerJsonld, | |||||
| ProductJsonld, | |||||
| ProductService, | ProductService, | ||||
| TaskJsonld, | TaskJsonld, | ||||
| TaskService, | TaskService, | ||||
| @@ -20,6 +22,7 @@ import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-funct | |||||
| }) | }) | ||||
| export class NewTaskComponent implements OnInit, AfterViewInit { | export class NewTaskComponent implements OnInit, AfterViewInit { | ||||
| @Input() public task!: TaskJsonld; | @Input() public task!: TaskJsonld; | ||||
| @Input() public partner!: PartnerJsonld; | |||||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | ||||
| @ViewChild('userSearchSelect', {static: false}) userSearchSelect!: SearchSelectComponent; | @ViewChild('userSearchSelect', {static: false}) userSearchSelect!: SearchSelectComponent; | ||||
| @ViewChild('productSearchSelect', {static: false}) productSearchSelect!: SearchSelectComponent; | @ViewChild('productSearchSelect', {static: false}) productSearchSelect!: SearchSelectComponent; | ||||
| @@ -1,6 +1,5 @@ | |||||
| import {AfterViewInit, Component, Input, OnInit, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, Input, OnInit, ViewChild} from '@angular/core'; | ||||
| import {PagingComponent} from "@app/_components/paging/paging.component"; | import {PagingComponent} from "@app/_components/paging/paging.component"; | ||||
| import {Subscription} from "rxjs"; | |||||
| import { | import { | ||||
| PartnerJsonld, | PartnerJsonld, | ||||
| TaskJsonld, | TaskJsonld, | ||||
| @@ -33,7 +32,6 @@ export class TaskListComponent implements OnInit, AfterViewInit { | |||||
| protected taskCompactMode: boolean; | protected taskCompactMode: boolean; | ||||
| protected showCompletedTasks: boolean; | protected showCompletedTasks: boolean; | ||||
| protected taskNotes: Map<string, TaskNoteJsonld[]>; | protected taskNotes: Map<string, TaskNoteJsonld[]>; | ||||
| protected taskSub: Subscription; | |||||
| protected taskNotesVisibility: Map<string, boolean>; | protected taskNotesVisibility: Map<string, boolean>; | ||||
| @@ -47,7 +45,6 @@ export class TaskListComponent implements OnInit, AfterViewInit { | |||||
| this.taskNotes = new Map<string, TaskNoteJsonld[]>(); | this.taskNotes = new Map<string, TaskNoteJsonld[]>(); | ||||
| this.dataSource = new MatTableDataSource<TaskJsonld>(this.tasks); | this.dataSource = new MatTableDataSource<TaskJsonld>(this.tasks); | ||||
| this.taskNotesVisibility = new Map<string, boolean>(); | this.taskNotesVisibility = new Map<string, boolean>(); | ||||
| this.taskSub = new Subscription(); | |||||
| this.currentUser = this.accountService.userValue; | this.currentUser = this.accountService.userValue; | ||||
| if (localStorage.getItem('taskCompactMode') !== null) { | if (localStorage.getItem('taskCompactMode') !== null) { | ||||
| this.taskCompactMode = localStorage.getItem('taskCompactMode') === 'true'; | this.taskCompactMode = localStorage.getItem('taskCompactMode') === 'true'; | ||||
| @@ -93,7 +90,7 @@ export class TaskListComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| getTaskData = (taskIri: string) => { | getTaskData = (taskIri: string) => { | ||||
| this.taskSub = this.taskService.tasksIdGet(this.appHelperService.extractId(taskIri)).subscribe( | |||||
| this.taskService.tasksIdGet(this.appHelperService.extractId(taskIri)).subscribe( | |||||
| data => { | data => { | ||||
| for (let index = 0; index < this.tasks.length; index++) { | for (let index = 0; index < this.tasks.length; index++) { | ||||
| const item = this.tasks[index]; | const item = this.tasks[index]; | ||||
| @@ -135,10 +132,15 @@ export class TaskListComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| openModalNewTask() { | openModalNewTask() { | ||||
| let postInputs: any = {}; | |||||
| let task: TaskJsonld = {} as TaskJsonld; | let task: TaskJsonld = {} as TaskJsonld; | ||||
| task.partnerIri = this.partner.id; | task.partnerIri = this.partner.id; | ||||
| task.completed = false; | task.completed = false; | ||||
| this.appHelperService.openModal(NewTaskComponent, {'task': task}, this.getTasksData); | |||||
| if (this.partner !== undefined) { | |||||
| postInputs['partner'] = this.partner; | |||||
| } | |||||
| postInputs['task'] = task; | |||||
| this.appHelperService.openModal(NewTaskComponent, postInputs, this.getTasksData); | |||||
| } | } | ||||
| openModalEditTask(task: TaskJsonld) { | openModalEditTask(task: TaskJsonld) { | ||||