Skip to content
Snippets Groups Projects
Commit 6166ace9 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5698 use new inputs for attachments

parent 7601b2f4
No related branches found
No related tags found
No related merge requests found
Showing with 13 additions and 32 deletions
......@@ -24,12 +24,15 @@ import { SpinnerIconComponent } from '../icons/spinner-icon/spinner-icon.compone
<ods-spinner-icon *ngIf="isLoading && !isError" size="large" />
</div>
<div class="flex grow flex-col items-start break-all text-start text-text">
<p *ngIf="!isError && caption" class="text-sm">
<p *ngIf="!isError && !isLoading && caption" class="text-sm">
{{ caption }}
</p>
<p *ngIf="isError && errorCaption" class="text-sm text-error">
{{ errorCaption }}
</p>
<p *ngIf="isLoading && loadingCaption" class="text-sm">
{{ loadingCaption }}
</p>
<p *ngIf="description && !isError" class="text-xs text-text/65">
{{ description }}
</p>
......@@ -43,6 +46,7 @@ import { SpinnerIconComponent } from '../icons/spinner-icon/spinner-icon.compone
export class AttachmentComponent {
@Input() caption: string = '';
@Input() errorCaption: string = '';
@Input() loadingCaption: string = '';
@Input() fileType: string = '';
@Input() description = '';
@Input() isLoading: boolean = false;
......
......@@ -20,12 +20,10 @@
<ods-attachment
data-test-id="attachment-upload-in-progress"
*ngIf="uploadFileInProgress.loading || uploadFileInProgress.error"
[caption]="
uploadFileInProgress.error ? 'Fehler beim Hochladen' : uploadFileInProgress.fileName
"
[loadingCaption]="uploadFileInProgress.fileName"
errorCaption="Fehler beim Hochladen"
[error]="uploadFileInProgress.error"
description="Anhang wird hochgeladen"
fileType=""
[isLoading]="uploadFileInProgress.loading"
></ods-attachment>
</ng-container>
......
......@@ -17,8 +17,11 @@
</ng-container>
<ods-attachment
*ngIf="uploadBescheidDocumentInProgress.loading || uploadBescheidDocumentInProgress.error"
[caption]="attachmentCaption"
[attr.data-test-id]="attachmentDataTestId"
errorCaption="Fehler beim Hochladen"
[loadingCaption]="uploadBescheidDocumentInProgress.fileName"
[attr.data-test-id]="
'upload-bescheid-document-error-' + !!uploadBescheidDocumentInProgress.error
"
[isLoading]="uploadBescheidDocumentInProgress.loading"
[error]="uploadBescheidDocumentInProgress.error"
></ods-attachment>
......
......@@ -17,7 +17,7 @@ describe('VorgangDetailBescheidenResultDokumentComponent', () => {
let fixture: ComponentFixture<VorgangDetailBescheidenResultDokumentComponent>;
const createBescheidDocumentError: string = getDataTestIdOf('create-bescheid-document-error');
const uploadBescheidDocumentError: string = getDataTestIdOf('upload-bescheid-document-error');
const uploadBescheidDocumentError: string = getDataTestIdOf('upload-bescheid-document-error-true');
const missingBescheidDocumentErrorMessage: string = getDataTestIdOf(
'missing-bescheid-document-error-message',
);
......
......@@ -25,30 +25,6 @@ export class VorgangDetailBescheidenResultDokumentComponent {
@Output() deleteFile: EventEmitter<void> = new EventEmitter<void>();
get attachmentCaption() {
if (this.uploadBescheidDocumentInProgress.loading) {
return 'Bescheiddokument wird hochgeladen';
}
if (this.uploadBescheidDocumentInProgress.error) {
return 'Fehler beim Hochladen';
}
return this.bescheidDocumentFile.resource.name;
}
get attachmentDataTestId() {
if (this.uploadBescheidDocumentInProgress.loading) {
return 'upload-bescheid-document-loading';
}
if (this.uploadBescheidDocumentInProgress.error) {
return 'upload-bescheid-document-error';
}
return 'upload-bescheid-document-file';
}
constructor(private bescheidService: BescheidService) {}
handleBescheidDocument(bescheid: BescheidResource): void {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment