From 0ebb85436eb85bbf0c4bf3afdc3d73dd0a35b9ce Mon Sep 17 00:00:00 2001 From: Lorena Mondini <60662357+Lorslux@users.noreply.github.com> Date: Mon, 19 Jun 2023 10:58:04 +0200 Subject: [PATCH 01/15] fixed button add new categories --- .../event-dashboard/event-dashboard.component.html | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/projects/admin/src/app/event/event-dashboard/event-dashboard.component.html b/frontend/projects/admin/src/app/event/event-dashboard/event-dashboard.component.html index a1d4c85d4..e6c7b490c 100644 --- a/frontend/projects/admin/src/app/event/event-dashboard/event-dashboard.component.html +++ b/frontend/projects/admin/src/app/event/event-dashboard/event-dashboard.component.html @@ -287,14 +287,14 @@
email-log works!
+ +{{ mails$ | async | json }}diff --git a/frontend/projects/admin/src/app/event/email-log/email-log.component.ts b/frontend/projects/admin/src/app/event/email-log/email-log.component.ts index 3a55c133d..4d27acc76 100644 --- a/frontend/projects/admin/src/app/event/email-log/email-log.component.ts +++ b/frontend/projects/admin/src/app/event/email-log/email-log.component.ts @@ -1,15 +1,34 @@ import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { MailService } from 'projects/admin/src/event/mail.service'; +import { Observable, map, mergeMap, of, switchMap } from 'rxjs'; +import { EventService } from '../../shared/event.service'; @Component({ selector: 'app-email-log', templateUrl: './email-log.component.html', - styleUrls: ['./email-log.component.scss'] + styleUrls: ['./email-log.component.scss'], }) export class EmailLogComponent implements OnInit { + public mails$: Observable
email-log works!
+Here you can find all the e-mails generated by the current event
+{{ mails$ | async | json }}+
Recipent | +Subject | +Message | +Status | +Checksum | +Requested | +Sent | +
---|---|---|---|---|---|---|
{{ mailDetail.recipient }} | +{{ mailDetail.subject }} | +{{ mailDetail.message }} | +{{ mailDetail.status }} | +{{ mailDetail.checksum }} | +{{ mailDetail.requestTimestamp | date }} | +{{ mailDetail.sentTimestamp | date }} | +
email-detail works!
diff --git a/frontend/projects/admin/src/app/event/email-detail/email-detail.component.scss b/frontend/projects/admin/src/app/event/email-detail/email-detail.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts b/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts new file mode 100644 index 000000000..d9c315f2e --- /dev/null +++ b/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-email-detail', + templateUrl: './email-detail.component.html', + styleUrls: ['./email-detail.component.scss'] +}) +export class EmailDetailComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/frontend/projects/admin/src/app/event/email-log/email-log.component.html b/frontend/projects/admin/src/app/event/email-log/email-log.component.html index 09e254cf1..0be6550f2 100644 --- a/frontend/projects/admin/src/app/event/email-log/email-log.component.html +++ b/frontend/projects/admin/src/app/event/email-log/email-log.component.html @@ -7,15 +7,15 @@email-detail works!
+{{ mail$ | async | json }}diff --git a/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts b/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts index d9c315f2e..cf4aea6df 100644 --- a/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts +++ b/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts @@ -1,15 +1,34 @@ import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { MailService } from 'projects/admin/src/event/mail.service'; +import { EventService } from '../../shared/event.service'; +import { Observable, map, mergeMap, of } from 'rxjs'; +import { Mail } from '../../model/mail'; @Component({ selector: 'app-email-detail', templateUrl: './email-detail.component.html', - styleUrls: ['./email-detail.component.scss'] + styleUrls: ['./email-detail.component.scss'], }) export class EmailDetailComponent implements OnInit { + public mail$: Observable
Here you can find all the e-mails generated by the current event
+ +Recipent | -Subject | -Message | -Status | -Checksum | -Requested | -Sent | ++ | + | + | + | + | + | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{ mailDetail.recipient }} | -{{ mailDetail.subject }} | +||||||||||||
{{ mail.recipient }} | +{{ mail.subject }} | - {{ mailDetail.message }} + {{ mail.message }} | -{{ mailDetail.status }} | +{{ mail.status }} | - {{ mailDetail.checksum }} + {{ mail.checksum }} | -{{ mailDetail.requestTimestamp | date : dateTimeFormat }} | -{{ mailDetail.sentTimestamp | date : dateTimeFormat }} | +{{ mail.requestTimestamp | date : dateTimeFormat }} | +{{ mail.sentTimestamp | date : dateTimeFormat }} |
{{ mail$ | async | json }}
{{ mail$ | async | json }}diff --git a/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts b/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts index cf4aea6df..9d8b13770 100644 --- a/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts +++ b/frontend/projects/admin/src/app/event/email-detail/email-detail.component.ts @@ -4,6 +4,7 @@ import { MailService } from 'projects/admin/src/event/mail.service'; import { EventService } from '../../shared/event.service'; import { Observable, map, mergeMap, of } from 'rxjs'; import { Mail } from '../../model/mail'; +import { EventInfo } from '../../model/event'; @Component({ selector: 'app-email-detail', @@ -20,15 +21,31 @@ export class EmailDetailComponent implements OnInit { ) {} ngOnInit(): void { - this.loadMails(); + this.loadMail(); } - loadMails() { + loadMail() { this.mail$ = this.route.paramMap.pipe( - map((pm) => pm.get('eventId')), - mergeMap((eventId) => - eventId != null ? this.eventService.getEvent(eventId) : of() - ), - mergeMap((event) => this.mailService.getMailInfo(event.shortName, 0, '')) + mergeMap((pm) => { + const eventId = pm.get('eventId'); + const mailId = pm.get('emailId'); + if (eventId != null && mailId != null) { + return this.eventService + .getEvent(eventId) + .pipe( + map((event) => new ShortNameAndMailId(event.shortName, mailId)) + ); + } + return of(); + }), + mergeMap((shortNameAndMailId) => + this.mailService.getMail( + shortNameAndMailId.shortName, + shortNameAndMailId.mailId + ) + ) ); } } +class ShortNameAndMailId { + constructor(public shortName: string, public mailId: string) {} +} diff --git a/frontend/projects/admin/src/app/event/email-log/email-log.component.ts b/frontend/projects/admin/src/app/event/email-log/email-log.component.ts index 5395013d5..dec392de3 100644 --- a/frontend/projects/admin/src/app/event/email-log/email-log.component.ts +++ b/frontend/projects/admin/src/app/event/email-log/email-log.component.ts @@ -26,10 +26,7 @@ export class EmailLogComponent implements OnInit { } loadMails() { - if (!this.route.parent) { - return; - } - this.mailLog$ = this.route.parent.paramMap.pipe( + this.mailLog$ = this.route.paramMap.pipe( map((pm) => pm.get('eventId')), mergeMap((eventId) => eventId != null ? this.eventService.getEvent(eventId) : of() diff --git a/frontend/projects/admin/src/app/event/event.module.ts b/frontend/projects/admin/src/app/event/event.module.ts index 635c2545a..176cd2d55 100644 --- a/frontend/projects/admin/src/app/event/event.module.ts +++ b/frontend/projects/admin/src/app/event/event.module.ts @@ -56,6 +56,7 @@ import { EventDetailComponent } from './event-detail/event-detail.component'; children: [ { path: '', component: EventDetailComponent }, { path: 'email-log', component: EmailLogComponent }, + { path: 'email-log/:emailId', component: EmailDetailComponent }, ], }, ]), diff --git a/frontend/projects/admin/src/event/mail.service.ts b/frontend/projects/admin/src/event/mail.service.ts index ac8942342..eb2a90674 100644 --- a/frontend/projects/admin/src/event/mail.service.ts +++ b/frontend/projects/admin/src/event/mail.service.ts @@ -25,7 +25,7 @@ export class MailService { ); } - getMail(eventShortName: string, emailId: number): Observable
{{ mail$ | async | json }}+
{{ mail.message }}+
{{ mail.message }}