Skip to content

Commit

Permalink
[NAE-2010] Issue with displaying the Create Case button and non-funct…
Browse files Browse the repository at this point in the history
…ional language switching in the toolbar

- fix
  • Loading branch information
machacjozef committed Oct 4, 2024
1 parent b614674 commit bc426be
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
</button>
</mat-menu>
<mat-menu #languages="matMenu">
<button mat-menu-item (click)="setLang('en-UK')">{{ 'toolbar.menu.en' | translate }}
<mat-icon *ngIf="activeLang('en-UK')" class="main-toolbar-menu-icon"
<button mat-menu-item (click)="setLang('en')">{{ 'toolbar.menu.en' | translate }}
<mat-icon *ngIf="activeLang('en')" class="main-toolbar-menu-icon"
aria-hidden="false" aria-label="Example home icon">keyboard_arrow_left
</mat-icon>
</button>
<button mat-menu-item (click)="setLang('sk-SK')">{{ 'toolbar.menu.sk' | translate }}
<mat-icon *ngIf="activeLang('sk-SK')" class="main-toolbar-menu-icon"
<button mat-menu-item (click)="setLang('sk')">{{ 'toolbar.menu.sk' | translate }}
<mat-icon *ngIf="activeLang('sk')" class="main-toolbar-menu-icon"
aria-hidden="false" aria-label="Example home icon">keyboard_arrow_left
</mat-icon>
</button>
<button mat-menu-item (click)="setLang('de-DE')">{{ 'toolbar.menu.de' | translate }}
<mat-icon *ngIf="activeLang('de-DE')" class="main-toolbar-menu-icon"
<button mat-menu-item (click)="setLang('de')">{{ 'toolbar.menu.de' | translate }}
<mat-icon *ngIf="activeLang('de')" class="main-toolbar-menu-icon"
aria-hidden="false" aria-label="Example home icon">keyboard_arrow_left
</mat-icon>
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<button *ngIf="!resolvedCaseButtonTitle; else titleButton" class="create-case-mat-mini-fab" mat-mini-fab color="primary" (click)="createNewCase()" [class.spinner]="loading$ | async"
[disabled]="(loading$ | async) || disabled">
<mat-icon *ngIf="(loading$ | async) === false" class="net-upload" aria-hidden="false">{{!!resolvedCaseButtonIcon ? resolvedCaseButtonIcon : 'add'}}</mat-icon>
<!-- Button without title -->
<button *ngIf="!resolvedCaseButtonTitle && shouldShowCreateButton(); else titleButton" class="create-case-mat-mini-fab"
mat-mini-fab color="primary" (click)="createNewCase()"
[class.spinner]="loading$ | async" [disabled]="(loading$ | async) || disabled">
<mat-icon *ngIf="(loading$ | async) === false" class="net-upload" aria-hidden="false">
{{ !!resolvedCaseButtonIcon ? resolvedCaseButtonIcon : 'add' }}
</mat-icon>
</button>

<!-- Button with title -->
<ng-template #titleButton>
<button mat-flat-button class="height-44" color="primary" (click)="createNewCase()" [class.spinner]="loading$ | async"
[disabled]="(loading$ | async) || disabled">
<mat-icon *ngIf="!!resolvedCaseButtonIcon && (loading$ | async) === false" class="button-icon" aria-hidden="false">{{resolvedCaseButtonIcon}}</mat-icon>
<span *ngIf="(loading$ | async) === false">{{resolvedCaseButtonTitle}}</span>
<button *ngIf="shouldShowCreateButton()" mat-flat-button class="height-44" color="primary" (click)="createNewCase()"
[class.spinner]="loading$ | async" [disabled]="(loading$ | async) || disabled">
<mat-icon *ngIf="!!resolvedCaseButtonIcon && (loading$ | async) === false" class="button-icon"
aria-hidden="false">
{{ resolvedCaseButtonIcon }}
</mat-icon>
<span *ngIf="(loading$ | async) === false">{{ resolvedCaseButtonTitle }}</span>
</button>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export class CreateCaseButtonComponent implements OnInit {
}
}

public shouldShowCreateButton(): boolean {
return this._caseViewService.getAllowedNetsCount() >= 1;
}

public createNewCase(): Observable<Case> {
let myCase: Observable<Case>;
this._loading.on();
Expand Down

0 comments on commit bc426be

Please sign in to comment.