|
@@ -1,37 +1,102 @@
|
|
|
<div class="entries-container">
|
|
|
- <div class="entry">ENtry1</div>
|
|
|
- <div class="entry">entry 2</div>
|
|
|
- <div class="entry"></div>
|
|
|
- <div class="entry"></div>
|
|
|
- <div class="entry"></div>
|
|
|
+ @for (entry of entries; let index = $index; track entry) {
|
|
|
+ <div
|
|
|
+ (click)="activateEntry(index)"
|
|
|
+ [ngClass]="currentEntryIndex === index ? 'active' : ''"
|
|
|
+ class="entry"
|
|
|
+ >
|
|
|
+ <div class="entry-title">
|
|
|
+ @if (entries[index].title !== "") {
|
|
|
+ {{ entries[index].title }}
|
|
|
+ } @else {
|
|
|
+ Kein Titel
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ <div class="entry-date">
|
|
|
+ {{ entries[index].created | date: "shortDate" : "" : "de" }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ <div class="entry add-button" (click)="addEntry()">
|
|
|
+ <img src="assets/icons/UIIcons/add.svg" />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
-<!-- Title -->
|
|
|
-<!-- <mat-label>{{ "notes.title" | translate }}</mat-label> -->
|
|
|
-<mat-form-field class="title" appearance="outline">
|
|
|
- <input matInput name="name" />
|
|
|
-</mat-form-field>
|
|
|
+@if (currentEntryIndex !== -1) {
|
|
|
+ <div class="entry-container">
|
|
|
+ @if (isInEditMode) {
|
|
|
+ <!-- Title -->
|
|
|
+ <mat-form-field class="title-write" appearance="outline">
|
|
|
+ <input
|
|
|
+ matInput
|
|
|
+ name="name"
|
|
|
+ placeholder="Titel des Eintrags"
|
|
|
+ [(ngModel)]="currentEntry.title"
|
|
|
+ />
|
|
|
+ </mat-form-field>
|
|
|
|
|
|
-<!-- Datepicker -->
|
|
|
-<mat-form-field class="date" appearance="outline">
|
|
|
- <mat-label>Choose a date</mat-label>
|
|
|
- <input matInput [matDatepicker]="picker" />
|
|
|
- <mat-hint>MM/DD/YYYY</mat-hint>
|
|
|
- <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
|
|
|
- <mat-datepicker #picker></mat-datepicker>
|
|
|
-</mat-form-field>
|
|
|
-<!-- Entry -->
|
|
|
-<div class="entry-container"></div>
|
|
|
+ <!-- Datepicker -->
|
|
|
+ <mat-form-field class="date-write" appearance="outline">
|
|
|
+ <input
|
|
|
+ matInput
|
|
|
+ [matDatepicker]="picker"
|
|
|
+ placeholder="TT.MM.JJJJ"
|
|
|
+ [(ngModel)]="currentEntry.created"
|
|
|
+ />
|
|
|
+ <mat-datepicker-toggle
|
|
|
+ matIconSuffix
|
|
|
+ [for]="picker"
|
|
|
+ ></mat-datepicker-toggle>
|
|
|
+ <mat-datepicker #picker></mat-datepicker>
|
|
|
+ </mat-form-field>
|
|
|
+ <div class="NgxEditor__Wrapper">
|
|
|
+ <ngx-editor-menu [editor]="editor" [toolbar]="toolbar">
|
|
|
+ </ngx-editor-menu>
|
|
|
+ <ngx-editor
|
|
|
+ [editor]="editor"
|
|
|
+ [placeholder]="'notes.placeholder' | translate"
|
|
|
+ [(ngModel)]="currentEntry.content"
|
|
|
+ ></ngx-editor>
|
|
|
+ </div>
|
|
|
+ } @else {
|
|
|
+ <div class="title-row">
|
|
|
+ <div class="title-read">{{ entries[currentEntryIndex].title }}</div>
|
|
|
+ <div class="date-read">
|
|
|
+ {{ currentEntry.created | date: "longDate" : "" : "de" }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="read-container" [innerHTML]="currentEntry.content"></div>
|
|
|
+ }
|
|
|
+ <div class="button-row">
|
|
|
+ @if (isInEditMode) {
|
|
|
+ @if (isNewEntry) {
|
|
|
+ <ui-button width="w16" (click)="saveEntry()">Speichern</ui-button>
|
|
|
+ <ui-button width="w16" (click)="deleteEntry()">Löschen</ui-button>
|
|
|
+ } @else {
|
|
|
+ <ui-button width="w16" (click)="saveEntry()">Speichern</ui-button>
|
|
|
+ <ui-button width="w16" (click)="discardEntry()">Verwerfen</ui-button>
|
|
|
+ }
|
|
|
+ } @else {
|
|
|
+ <ui-button width="w16" (click)="isInEditMode = true"
|
|
|
+ >Bearbeiten</ui-button
|
|
|
+ >
|
|
|
+ <ui-button width="w16" (click)="deleteEntry()"
|
|
|
+ >Eintrag löschen</ui-button
|
|
|
+ >
|
|
|
+ }
|
|
|
|
|
|
-<!-- <div class="NgxEditor__Wrapper">
|
|
|
- <ngx-editor-menu [editor]="editor"> </ngx-editor-menu>
|
|
|
- <ngx-editor
|
|
|
- [editor]="editor"
|
|
|
- [(ngModel)]="html"
|
|
|
- [disabled]="false"
|
|
|
- [placeholder]="'Coming soon...'"
|
|
|
- ></ngx-editor>
|
|
|
-</div>
|
|
|
-<p [innerHTML]="htmlString"></p>
|
|
|
-
|
|
|
-<div [innerHTML]="html"></div> -->
|
|
|
+ <!-- <ui-button width="w16" (click)="isInEditMode = false"
|
|
|
+ >Zur Leseansicht</ui-button
|
|
|
+ >
|
|
|
+ } @else {
|
|
|
+ <ui-button width="w16" (click)="isInEditMode = true"
|
|
|
+ >Bearbeiten</ui-button
|
|
|
+ >
|
|
|
+ } -->
|
|
|
+ <!-- <ui-button style="width: 10rem" (click)="discardChanges()">Verwerfen</ui-button>
|
|
|
+ <ui-button style="width: 10rem" (click)="editEntry()">Bearbeiten</ui-button> -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+} @else {
|
|
|
+ <div class="empty">Noch kein Eintrag vorhanden</div>
|
|
|
+}
|