]> gitweb.hhaalo.de Git - speisekarten-editor.git/commitdiff
change: disable buttons contitions
authorBastian Dehn <hhaalo@arcor.de>
Mon, 6 Jun 2022 11:54:12 +0000 (13:54 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 6 Jun 2022 11:54:12 +0000 (13:54 +0200)
src/app/app.component.html
src/app/app.component.ts

index 9a712eac3ede496a4be74bf0e36e202e5491187f..5f965b83ed6997ee42e151f7f4361722bc969a3e 100644 (file)
@@ -5,10 +5,12 @@
 <button class="button main"
        type="button"
        id="buttonSubtitle"
+       [disabled]="disableSubtitleButton()"
        (click)="changeFormSubtitleVisible()">Untertitel hinzufügen</button>
 <button class="button main"
        type="button"
        id="buttonFood"
+       [disabled]="disableFoodButton()"
        (click)="changeFormFoodVisible()">Speise hinzufügen</button>
 
 <form #formTitle="ngForm" *ngIf="formTitleVisible" class="form">
index 900d1a4a3ba6beb35befdab3ce026643107b73d4..9eeab51a4013b58c030a72fd21b0db2277e2b412 100644 (file)
@@ -41,6 +41,26 @@ export class AppComponent
                this.formFoodVisible = !this.formFoodVisible;
        }
 
+       public disableFoodButton(): boolean
+       {
+               if (this.foodcard.Titles.length < 1)
+                       return true;
+
+               let lastTitle = this.getLastTitle();
+               if (lastTitle.Subtitles.length < 1)
+                       return true;
+
+               return false;
+       }
+
+       public disableSubtitleButton(): boolean
+       {
+               if (this.foodcard.Titles.length < 1)
+                       return true;
+
+               return false;
+       }
+
        public addTitle(): void
        {
                this.foodcard.Titles.push({