Fix to upload documents (#1621)

Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
José Alberto Hernández
2023-01-03 20:47:10 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 9d19d1b061
commit 28d5d7595f
14 changed files with 227 additions and 284 deletions
@@ -1,26 +1,27 @@
<h1 mat-dialog-title>Upload Client Documents</h1>
<h1 mat-dialog-title>Upload {{ entityType }} Documents</h1>
<div>
<form [formGroup]="uploadDocumentForm" fxLayout="column">
<form [formGroup]="uploadDocumentForm" fxLayout="column">
<mat-form-field fxFlex>
<mat-label>File Name</mat-label>
<input formControlName="fileName" required matInput />
<mat-error *ngIf="uploadDocumentForm.controls.fileName.hasError('required')">
File Name is <strong>required</strong>
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label>File Name</mat-label>
<input formControlName="fileName" required matInput />
<mat-error *ngIf="uploadDocumentForm.controls.fileName.hasError('required')">
File Name is <strong>required</strong>
</mat-error>
</mat-form-field>
<mat-form-field fxFlex *ngIf="!documentIdentifier">
<mat-label>Description</mat-label>
<input formControlName="description" matInput />
</mat-form-field>
<mat-form-field fxFlex *ngIf="!documentIdentifier">
<mat-label>Description</mat-label>
<input formControlName="description" matInput />
</mat-form-field>
<mifosx-file-upload flex="60%" (change)="onFileSelect($event)"></mifosx-file-upload>
<mifosx-file-upload flex="60%" (change)="onFileSelect($event)"></mifosx-file-upload>
<mat-dialog-actions align="end">
<button mat-raised-button mat-dialog-close>Cancel</button>
<button mat-raised-button color="primary" [disabled]="!uploadDocumentForm.valid" [mat-dialog-close]="uploadDocumentForm.value">Confirm</button>
</mat-dialog-actions>
<mat-dialog-actions align="end">
<button mat-raised-button mat-dialog-close>Cancel</button>
<button mat-raised-button color="primary" [disabled]="!uploadDocumentForm.valid"
[mat-dialog-close]="uploadDocumentForm.value">Confirm</button>
</mat-dialog-actions>
</form>
</div>
</form>
</div>
@@ -15,6 +15,8 @@ export class UploadDocumentDialogComponent implements OnInit {
uploadDocumentData: any = [];
/** Triggers description field */
documentIdentifier = false;
/** Entity Type */
entityType: string;
/**
* @param {MatDialogRef} dialogRef Dialog reference element
@@ -25,6 +27,7 @@ export class UploadDocumentDialogComponent implements OnInit {
private formBuilder: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.documentIdentifier = data.documentIdentifier;
this.entityType = data.entityType;
}
ngOnInit() {