2020-04-22 12:56:18 +02:00
|
|
|
import { Location } from '@angular/common';
|
2020-04-14 11:28:33 +02:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2020-04-22 12:56:18 +02:00
|
|
|
|
2020-05-01 19:10:17 +02:00
|
|
|
import { environment } from '../../../../../environments/environment';
|
2020-04-14 11:28:33 +02:00
|
|
|
import { PollUtilities } from '../../config/PollUtilities';
|
2020-04-22 12:56:18 +02:00
|
|
|
import { ConfigService } from '../../services/config.service';
|
|
|
|
import { BaseComponent } from '../example/base-page/base.component';
|
2019-08-10 16:57:36 +02:00
|
|
|
|
|
|
|
@Component({
|
2020-04-22 12:56:18 +02:00
|
|
|
selector: 'app-visibility',
|
2020-04-21 10:50:26 +02:00
|
|
|
templateUrl: './visibility.component.html',
|
|
|
|
styleUrls: ['./visibility.component.scss'],
|
2019-08-10 16:57:36 +02:00
|
|
|
})
|
|
|
|
export class VisibilityComponent extends BaseComponent implements OnInit {
|
2020-04-22 12:56:18 +02:00
|
|
|
public location: Location;
|
|
|
|
public showCustomPassword = false;
|
|
|
|
public baseUrl = environment.api.baseHref;
|
2019-08-10 16:57:36 +02:00
|
|
|
|
2020-04-21 10:50:26 +02:00
|
|
|
constructor(public config: ConfigService, public utils: PollUtilities) {
|
|
|
|
super(config);
|
|
|
|
}
|
2019-08-10 16:57:36 +02:00
|
|
|
|
2020-04-22 12:56:18 +02:00
|
|
|
ngOnInit(): void {
|
2020-04-21 10:50:26 +02:00
|
|
|
this.config.customUrl = this.utils.makeSlug(this.config);
|
|
|
|
this.config.expirationDate = this.config
|
|
|
|
.addDaysToDate(this.config.expiracyDateDefaultInDays, new Date())
|
|
|
|
.toISOString()
|
|
|
|
.substring(0, 10);
|
|
|
|
}
|
2019-11-23 14:58:44 +01:00
|
|
|
|
2020-04-22 12:56:18 +02:00
|
|
|
public submitCreationAndGoToEnd(): void {
|
2020-04-21 10:50:26 +02:00
|
|
|
this.config.createPoll();
|
|
|
|
}
|
2019-08-10 16:57:36 +02:00
|
|
|
}
|