]> gitweb.hhaalo.de Git - speisekarten-editor.git/commitdiff
change: add food button to subtitle
authorBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jun 2022 17:23:05 +0000 (19:23 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jun 2022 17:23:05 +0000 (19:23 +0200)
src/app/app.component.html
src/app/app.component.ts

index 6b39e5f91b6762cf043ba43932c30977d2ca158f..4e4319ec580fa8431c697cfa19fdb7c2fff16641 100644 (file)
        type="button"
        id="buttonTitle"
        (click)="changeFormTitleVisible()">Titel 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">
        <label>Titel</label>
        <input [(ngModel)]="food.sideDish" name="sideDish" type="text" />
        <label>Preis</label>
        <input [(ngModel)]="food.price" name="price" type="text" />
-       <button class="button"
-               type="button"
-               id="addFood"
-               [disabled]="edit || disableByInsertMode()"
-               (click)="addFood()">Hinzufügen</button>
        <button class="button"
                type="button"
                id="insertFood"
                <button class="button"
                        type="button"
                        (click)="removeSubSection(title, i)">Lösche Unterteil</button>
+               <button class="button"
+                       type="button"
+                       id="buttonFood"
+                       [disabled]="disableFoodButton()"
+                       (click)="addNewFood(title, i)">Speise hinzufügen</button>
                <div *ngFor="let food of subtitle.Foods; let i = index"
                        class="foodmenu grid">
                        <div class="food">{{food.Food}}</div>
index 1da9ab523b30dbe1c9e215cf0f51b59621b2f0d4..2472b79558311cedd905f6549cdd050e6f60963c 100644 (file)
@@ -39,8 +39,11 @@ export class AppComponent
                this.formSubtitleVisible = !this.formSubtitleVisible;
        }
 
-       public changeFormFoodVisible(): void
+       public addNewFood(title: ITitle, index: number): void
        {
+               let titleIndex = this.foodcard.Titles.indexOf(title);
+               this.insertIndicies = [ titleIndex, index,
+                       title.Subtitles[index].Foods.length - 1 ];
                this.formFoodVisible = !this.formFoodVisible;
        }