funky-framadate-front/src/app/features/administration/success/success.component.ts

34 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Component, Input, OnInit } from '@angular/core';
import { PollService } from '../../../core/services/poll.service';
import { Poll } from '../../../core/models/poll.model';
2021-04-30 16:12:02 +02:00
import { environment } from 'src/environments/environment';
import { Title } from '@angular/platform-browser';
2021-05-18 22:51:06 +02:00
import { DateUtilitiesService } from '../../../core/services/date.utilities.service';
2020-12-16 17:21:01 +01:00
@Component({
selector: 'app-success',
templateUrl: './success.component.html',
styleUrls: ['./success.component.scss'],
})
2021-04-30 23:33:56 +02:00
export class SuccessComponent {
@Input() poll: Poll;
mailToRecieve: string;
2021-04-30 16:00:22 +02:00
window: any = window;
2021-04-30 16:12:02 +02:00
environment = environment;
2021-05-18 22:51:06 +02:00
constructor(public pollService: PollService, private dateUtils: DateUtilitiesService, private titleService: Title) {
this.titleService.setTitle(environment.appTitle + ' - 🎉 succès de création de sondage -');
this.pollService.poll.subscribe((newpoll: Poll) => {
this.poll = newpoll;
});
}
sendToEmail() {
alert('todo');
}
2021-05-18 22:51:06 +02:00
getExpiracyDateFromPoll(poll: Poll): Date {
return this.dateUtils.addDaysToDate(poll.default_expiracy_days_from_now, new Date());
}
2020-12-16 17:21:01 +01:00
}