2021-04-30 14:15:21 +02:00
|
|
|
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';
|
2021-05-03 12:36:03 +02:00
|
|
|
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 {
|
2021-04-30 14:15:21 +02:00
|
|
|
@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) {
|
2021-05-03 12:36:03 +02:00
|
|
|
this.titleService.setTitle(environment.appTitle + ' - 🎉 succès de création de sondage -');
|
2021-04-30 14:15:21 +02:00
|
|
|
|
2021-05-03 12:36:03 +02:00
|
|
|
this.pollService.poll.subscribe((newpoll: Poll) => {
|
|
|
|
this.poll = newpoll;
|
|
|
|
});
|
|
|
|
}
|
2021-04-30 14:15:21 +02:00
|
|
|
|
|
|
|
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
|
|
|
}
|