Enable UI to work with event status
This commit is contained in:
parent
39ffa5e52c
commit
0962a36b59
|
@ -28,6 +28,12 @@
|
||||||
<td class="{{invalidUrlError? 'has-error' : ''}}">
|
<td class="{{invalidUrlError? 'has-error' : ''}}">
|
||||||
<input type="text" [(ngModel)]="event!.url">
|
<input type="text" [(ngModel)]="event!.url">
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<select [(ngModel)]="event!.status">
|
||||||
|
<option value="DRAFT">Draft</option>
|
||||||
|
<option value="PUBLIC">Published</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button (click)="toggleEdit()">Save</button>
|
<button (click)="toggleEdit()">Save</button>
|
||||||
<p class="has-error" *ngIf="showDateError">Start Date must not be after end date!</p>
|
<p class="has-error" *ngIf="showDateError">Start Date must not be after end date!</p>
|
||||||
|
@ -69,6 +75,9 @@
|
||||||
<td>
|
<td>
|
||||||
{{event?.url}}
|
{{event?.url}}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
{{getEventStatusFriendlyName()}}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button (click)="toggleEdit()">Edit</button>
|
<button (click)="toggleEdit()">Edit</button>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -175,4 +175,15 @@ export class EventComponent implements OnInit {
|
||||||
|
|
||||||
return validUrl;
|
return validUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getEventStatusFriendlyName(): string {
|
||||||
|
switch (this.event!.status) {
|
||||||
|
case 'DRAFT':
|
||||||
|
return 'Draft';
|
||||||
|
case 'PUBLIC':
|
||||||
|
return 'Published';
|
||||||
|
default:
|
||||||
|
return 'Error';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
<th>Created by</th>
|
<th>Created by</th>
|
||||||
<th>URL</th>
|
<th>URL</th>
|
||||||
|
<th>Status</th>
|
||||||
<th>Edit</th>
|
<th>Edit</th>
|
||||||
<th>Delete</th>
|
<th>Delete</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -11,4 +11,5 @@ export interface Event {
|
||||||
createdBy: string;
|
createdBy: string;
|
||||||
url: string;
|
url: string;
|
||||||
wholeDay: boolean;
|
wholeDay: boolean;
|
||||||
|
status: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ export class AdminComponent implements OnInit {
|
||||||
|
|
||||||
this.api.getEvents(this.selectedCalendar).subscribe((events: Event[]): void => {
|
this.api.getEvents(this.selectedCalendar).subscribe((events: Event[]): void => {
|
||||||
for (let event of events) {
|
for (let event of events) {
|
||||||
|
if(event.status !== 'DELETED') {
|
||||||
this.events.push({
|
this.events.push({
|
||||||
...event,
|
...event,
|
||||||
startDateTime: new Date(event.startDateTime),
|
startDateTime: new Date(event.startDateTime),
|
||||||
|
@ -59,6 +60,7 @@ export class AdminComponent implements OnInit {
|
||||||
createdDate: new Date(event.createdDate)
|
createdDate: new Date(event.createdDate)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.filterEvents();
|
this.filterEvents();
|
||||||
this.sortEvents();
|
this.sortEvents();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user