From 51d3da575db97537ac4a637098297c4adae3b01d Mon Sep 17 00:00:00 2001 From: Gion-Andri Cantieni Date: Mon, 4 Dec 2023 16:13:28 +0100 Subject: [PATCH] feat: show date modified in moderation view --- .../moderator-events/moderator-events.component.html | 10 ++++++---- .../moderator-events/moderator-events.component.ts | 2 ++ src/app/shared/data/event.ts | 3 +++ src/app/shared/directives/sortable.directive.ts | 2 +- src/app/shared/utils/dates.util.ts | 5 +++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/app/moderator-area/pages/moderator-events/moderator-events.component.html b/src/app/moderator-area/pages/moderator-events/moderator-events.component.html index 2e62eac..007efec 100644 --- a/src/app/moderator-area/pages/moderator-events/moderator-events.component.html +++ b/src/app/moderator-area/pages/moderator-events/moderator-events.component.html @@ -49,21 +49,23 @@

Moderaziun da las occurrenzas

- + + - + + + - - + diff --git a/src/app/moderator-area/pages/moderator-events/moderator-events.component.ts b/src/app/moderator-area/pages/moderator-events/moderator-events.component.ts index f9a312f..320f601 100644 --- a/src/app/moderator-area/pages/moderator-events/moderator-events.component.ts +++ b/src/app/moderator-area/pages/moderator-events/moderator-events.component.ts @@ -10,6 +10,7 @@ import { EventsService } from '../../../shared/services/events.service'; import { ModerationEventsFilter } from '../../../shared/data/filter'; import { Event, EventVersion } from '../../../shared/data/event'; import { SortableDirective, SortEvent } from '../../../shared/directives/sortable.directive'; +import { DatesUtil } from '../../../shared/utils/dates.util'; @Component({ selector: 'app-moderator-events', @@ -33,6 +34,7 @@ export class ModeratorEventsComponent implements OnInit { private modalService: NgbModal, private router: Router, private eventService: EventsService, + public datesUtil: DatesUtil, ) { } diff --git a/src/app/shared/data/event.ts b/src/app/shared/data/event.ts index 2c87b58..cec67df 100644 --- a/src/app/shared/data/event.ts +++ b/src/app/shared/data/event.ts @@ -13,6 +13,9 @@ export class Event { eventStatus?: EventStatusTypes = 'INVALID'; ownerEmail?: string; contactEmail?: string; + + createdDate?: number; + lastModifiedDate?: number; } export type EventStatusTypes = 'DRAFT' | 'IN_REVIEW' | 'PUBLISHED' | 'NEW_MODIFICATION' | 'REJECTED' | 'INVALID'; diff --git a/src/app/shared/directives/sortable.directive.ts b/src/app/shared/directives/sortable.directive.ts index 2f82189..ce93474 100644 --- a/src/app/shared/directives/sortable.directive.ts +++ b/src/app/shared/directives/sortable.directive.ts @@ -1,6 +1,6 @@ import { Directive, EventEmitter, Input, Output } from '@angular/core'; -export type SortColumn = 'DATE' | 'USER' | 'TITLE' | 'STATE' | ''; +export type SortColumn = 'MODIFIED_DATE' | 'DATE' | 'USER' | 'TITLE' | 'STATE' | ''; export type SortDirection = 'ASC' | 'DESC' | ''; const rotate: { [key: string]: SortDirection } = {ASC: 'DESC', DESC: '', '': 'ASC'}; diff --git a/src/app/shared/utils/dates.util.ts b/src/app/shared/utils/dates.util.ts index 7a567dd..867b9b3 100644 --- a/src/app/shared/utils/dates.util.ts +++ b/src/app/shared/utils/dates.util.ts @@ -40,4 +40,9 @@ export class DatesUtil { const date = dayjs().month(month - 1).year(year); return date.format('MMMM YYYY'); } + + getDateTimeString(date: number): string { + const djs = dayjs.unix(date); + return djs.format('DD-MM-YYYY hh:mm:ss'); + } }
DatasUltima midada UserDatas Titel StatusAcziunsAcziuns
{{ datesUtil.getDateTimeString(event.lastModifiedDate!) }}{{event.ownerEmail}}
{{occurrence.date}}
{{event.ownerEmail}}{{getEventVersion(event)?.title}}{{getEventVersion(event)?.title}}