53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { Component, Input } from '@angular/core';
|
|
import { PollService } from '../../../core/services/poll.service';
|
|
import { Poll } from '../../../core/models/poll.model';
|
|
import { environment } from 'src/environments/environment';
|
|
import { Title } from '@angular/platform-browser';
|
|
import { DateUtilitiesService } from '../../../core/services/date.utilities.service';
|
|
import { ClipboardService } from 'ngx-clipboard';
|
|
import { ToastService } from '../../../core/services/toast.service';
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
|
|
@Component({
|
|
selector: 'app-success',
|
|
templateUrl: './success.component.html',
|
|
styleUrls: ['./success.component.scss'],
|
|
})
|
|
export class SuccessComponent {
|
|
@Input() poll: Poll;
|
|
mailToRecieve: string;
|
|
window: any = window;
|
|
environment = environment;
|
|
today: Date = new Date();
|
|
|
|
constructor(
|
|
public pollService: PollService,
|
|
private dateUtils: DateUtilitiesService,
|
|
private _clipboardService: ClipboardService,
|
|
private toastService: ToastService,
|
|
private translate: TranslateService,
|
|
private titleService: Title
|
|
) {
|
|
this.titleService.setTitle(
|
|
environment.appTitle + ' - 🎉 succès de création de sondage - ' + this.pollService.form.value.title
|
|
);
|
|
|
|
this.pollService.poll.subscribe((newpoll: Poll) => {
|
|
this.poll = newpoll;
|
|
});
|
|
}
|
|
|
|
sendToEmail() {
|
|
alert('todo');
|
|
}
|
|
|
|
/**
|
|
* copy public url of new poll
|
|
* @param participationUrl
|
|
*/
|
|
copyText(participationUrl: string) {
|
|
this._clipboardService.copyFromContent(participationUrl);
|
|
this.toastService.display(this.translate.get('success.copy_message') + ` ${participationUrl}`);
|
|
}
|
|
}
|