Update admin view to include created date and last modified information

This commit is contained in:
Patrick Müller 2025-05-29 13:32:20 +02:00
parent 2d09046976
commit a2ef25ad34
Signed by: Paddy
GPG Key ID: D10B5E2CFD8E7C6D
5 changed files with 39 additions and 7 deletions

View File

@ -22,12 +22,19 @@
<td>
<input type="text" [(ngModel)]="event!.location">
</td>
<td>
{{event?.createdBy}}
</td>
<td class="{{invalidUrlError? 'has-error' : ''}}">
<input type="text" [(ngModel)]="event!.url">
</td>
<td>
By: {{event?.createdBy}}
<br>
At: {{printDate(event?.createdDate!)}}
</td>
<td>
By: {{event?.lastModifiedBy}}
<br>
At: {{printDate(event?.lastModifiedDate!)}}
</td>
<td>
<select [(ngModel)]="event!.status">
<option value="DRAFT">Draft</option>
@ -73,10 +80,17 @@
{{event?.location}}
</td>
<td>
{{event?.createdBy}}
{{event?.url}}
</td>
<td>
{{event?.url}}
By: {{event?.createdBy}}
<br>
At: {{printDate(event?.createdDate!)}}
</td>
<td>
By: {{event?.lastModifiedBy}}
<br>
At: {{printDate(event?.lastModifiedDate!)}}
</td>
<td>
{{getEventStatusFriendlyName()}}

View File

@ -141,6 +141,20 @@ export class EventComponent implements OnInit {
return `${hours}:${minutes}`;
}
printDate(date: Date): string {
try {
let year = date.getFullYear();
let month = (date.getMonth() + 1).toString().padStart(2, '0');
let day = date.getDate().toString().padStart(2, '0');
let hours = date.getHours().toString().padStart(2, '0');
let minutes = date.getMinutes().toString().padStart(2, '0');
return `${day}.${month}.${year}, ${hours}:${minutes}`;
} catch (e) {
return '';
}
}
parseDate(text: string): Date {
return new Date(text);
}

View File

@ -7,8 +7,9 @@
<th>Start</th>
<th>End</th>
<th>Location</th>
<th>Created by</th>
<th>URL</th>
<th>Created</th>
<th>Last Modified</th>
<th>Status</th>
<th>Edit</th>
<th>Move</th>

View File

@ -7,8 +7,10 @@ export interface Event {
startDateTime: Date;
endDateTime: Date;
createdDate: Date;
lastModifiedDate: Date;
location: string;
createdBy: string;
lastModifiedBy: string;
url: string;
wholeDay: boolean;
status: string;

View File

@ -57,7 +57,8 @@ export class AdminComponent implements OnInit {
...event,
startDateTime: new Date(event.startDateTime),
endDateTime: new Date(event.endDateTime),
createdDate: new Date(event.createdDate)
createdDate: new Date(event.createdDate),
lastModifiedDate: new Date(event.lastModifiedDate)
});
}
}