Browse Source

documents edit

master
Florian Eisenmenger 1 year ago
parent
commit
a2df86ac72
6 changed files with 26 additions and 42 deletions
  1. +5
    -5
      matsen-tool/src/app/_components/search-select/search-select.component.html
  2. +1
    -1
      matsen-tool/src/app/_components/search-select/search-select.component.ts
  3. +2
    -2
      matsen-tool/src/app/_views/documents/document-list/document-list.component.html
  4. +10
    -18
      matsen-tool/src/app/_views/documents/document-list/document-list.component.ts
  5. +8
    -15
      matsen-tool/src/app/_views/documents/new-document/new-document.component.html
  6. +0
    -1
      matsen-tool/src/app/_views/documents/new-document/new-document.component.ts

+ 5
- 5
matsen-tool/src/app/_components/search-select/search-select.component.html View File

@@ -5,11 +5,11 @@
</div>
<div class="search-toggle" [class.search-box-open]="searchBoxOpen">
<app-list #listComponent
[getDataFunction]="getDataFunction"
[onRowSelectedFunction]="onRowSelected"
[listColDefinitions]="listColDefinitions"
[showDetailButton]="false"
[showPosition]="false"
[getDataFunction]="getDataFunction"
[onRowSelectedFunction]="onRowSelected"
[listColDefinitions]="listColDefinitions"
[showDetailButton]="false"
[showPosition]="false"
>
</app-list>
</div>


+ 1
- 1
matsen-tool/src/app/_components/search-select/search-select.component.ts View File

@@ -74,7 +74,7 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
clearSearch() {
this.paragraphRef.nativeElement.textContent = '';
this.searchBoxFilled = false;
this.documentForm.get(this.formId)?.setValue(undefined);
this.documentForm.get(this.formId)?.setValue(null);
}

public getPageIndex() {


+ 2
- 2
matsen-tool/src/app/_views/documents/document-list/document-list.component.html View File

@@ -1,13 +1,13 @@
<div class="spt-container">
<div class="top-btn">
<button class="btn btn-primary" (click)="openModalNewDocument()">+ {{ 'basic.new-document' | translate }}
<button class="btn btn-primary" (click)="openModalNewEditDocument()">+ {{ 'basic.new-document' | translate }}
</button>
</div>
<app-list #listComponent
[getDataFunction]="getDataFunction"
[onSortFunction]="onSortChange"
[onDownloadFunction]="navigateToDocumentFile"
[onEditFunction]="openModalEditDocument"
[onEditFunction]="openModalNewEditDocument"
[listColDefinitions]="listColDefinitions"
[searchable]="true"
[showDetailButton]="false"


+ 10
- 18
matsen-tool/src/app/_views/documents/document-list/document-list.component.ts View File

@@ -123,23 +123,15 @@ export class DocumentListComponent implements OnInit, AfterViewInit {
window.open(element.documentUrl?.toString(), '_blank');
}

openModalNewDocument() {
let postInputs: any = {};
let document: DocumentJsonld = {} as DocumentJsonld;
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);
openModalNewEditDocument = (element?: DocumentJsonld) => {
const documentInputs: any = {
partner: this.partner,
product: this.product,
document: element || {
partnerIri: this.partner?.id,
productIri: this.product?.id
} as DocumentJsonld
};
this.appHelperService.openModal(NewDocumentComponent, documentInputs, this.listComponent.getData);
}

openModalEditDocument = (element: DocumentJsonld) => {
this.appHelperService.openModal(NewDocumentComponent, { 'document': element }, this.listComponent.getData);
}

}

+ 8
- 15
matsen-tool/src/app/_views/documents/new-document/new-document.component.html View File

@@ -14,8 +14,8 @@

<div class="mb-3">
<label for="partner" class="form-label">{{ 'form.partner' | translate }}:</label>
<ng-container *ngIf="document.partnerIri === null || document.partnerIri === undefined">
<app-search-select #partnerSearchSelect *ngIf="document.id === null || document.id === undefined"
<ng-container *ngIf="partner === undefined">
<app-search-select #partnerSearchSelect
[formId]="'partnerIri'"
[formLabelLangKey]="'form.partner'"
[documentForm]="documentForm"
@@ -26,19 +26,16 @@
>
</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"
<input type="text" class="form-control" *ngIf="partner !== undefined"
disabled value="{{partner?.name}}"/>
</div>

<div class="mb-3">
<label for="product" class="form-label">{{ 'form.product' | translate }}:</label>
<ng-container *ngIf="document.productIri === null || document.productIri === undefined">
<app-search-select #productSearchSelect *ngIf="document.id === null || document.id === undefined"
<ng-container *ngIf="product === undefined">
<app-search-select #productSearchSelect
[formId]="'productIri'"
[formLabelLangKey]="'form.product'"
[documentForm]="documentForm"
@@ -48,13 +45,9 @@
[listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()"
>
</app-search-select>
<input type="hidden" id="product" formControlName="product"
*ngIf="document.id === null || document.id === undefined"/>
<input type="hidden" id="product" formControlName="product"/>
</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"
<input type="text" class="form-control" *ngIf="product !== undefined"
disabled value="{{product?.name}}"/>
</div>



+ 0
- 1
matsen-tool/src/app/_views/documents/new-document/new-document.component.ts View File

@@ -44,7 +44,6 @@ export class NewDocumentComponent implements OnInit, AfterViewInit {

ngOnInit(): void {
this.documentForm = FormGroupInitializer.initFormGroup(this.documentForm, this.document);
console.log(this.document);
}

ngAfterViewInit(): void {


Loading…
Cancel
Save