]> gitweb.hhaalo.de Git - speisekarten-editor.git/commitdiff
add: bearbeiten von title
authorBastian Dehn <hhaalo@arcor.de>
Mon, 6 Jun 2022 13:57:38 +0000 (15:57 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 6 Jun 2022 13:57:38 +0000 (15:57 +0200)
src/app/app.component.html
src/app/app.component.ts

index d15fe622045fe654914c3b1abd223aba7cc2dbf7..4bff8ff3b267a1f68acb5288bd2f4ecc913a118e 100644 (file)
        <button class="button"
                type="button"
                id="addTitle"
+               [disabled]="edit"
                (click)="addTitle()">Hinzufügen</button>
+       <button class="button"
+               type="button"
+               id="saveTitle"
+               [disabled]="!edit"
+               (click)="saveTitle()">Speichern</button>
 </form>
 
 <form #formSubtitle="ngForm" *ngIf="formSubtitleVisible" class="form">
 
 <div *ngFor="let title of foodcard.Titles">
        <h1>{{title.Title}}</h1>
+       <button class="button"
+               type="button"
+               (click)="editTitle(title)">Bearbeiten</button>
        <div *ngFor="let subtitle of title.Subtitles">
                <h2>{{subtitle.Subtitle}}</h2>
                <button class="button"
+                       type="button"
                        (click)="editSubtitle(subtitle)">Bearbeiten</button>
                <div *ngFor="let food of subtitle.Foods; let i = index">
                        <div class="food">{{food.Food}}</div>
                        <div class="sideDish">{{food.sideDish}}</div>
                        <div class="price">{{food.price}}</div>
-                       <button type="button"
+                       <button class="button"
+                               type="button"
                                (click)="removeFood(subtitle, i)">Löschen</button>
-                       <button type="button"
+                       <button class="button"
+                               type="button"
                                (click)="editFood(food)">Bearbeiten</button>
                </div>
        </div>
index 17ac977466848d7be878b71abd0870287dac95e8..bd5626c23b8561cb42e4e9e4f9a44ca5c15a6b22 100644 (file)
@@ -63,6 +63,20 @@ export class AppComponent
                this.formTitleVisible = false;
        }
 
+       public saveTitle(): void
+       {
+               this.title = { Title: "", Subtitles: [] }
+               this.formTitleVisible = false;
+               this.edit = false;
+       }
+
+       public editTitle(title: ITitle): void
+       {
+               this.formTitleVisible = true;
+               this.title = title;
+               this.edit = true;
+       }
+
        public addSubtitle(): void
        {
                let lastTitle = this.getLastTitle()