landing link on consultation, check allowed answers
This commit is contained in:
parent
424961b8bb
commit
5f555136cf
|
@ -1,24 +1,22 @@
|
||||||
<div>
|
<div class="step-container" *ngIf="pollService._poll && pollService._poll.getValue()">
|
||||||
<h2 class="title is-2">
|
<h2 class="title is-2">{{ pollService._poll.getValue().creatorPseudo }} vous invite à participer à son sondage</h2>
|
||||||
vous invite à participer à son sondage
|
|
||||||
</h2>
|
|
||||||
<div>
|
<div>
|
||||||
<div class="badge creator"></div>
|
<div class="badge creator"></div>
|
||||||
<h3 class="title is-3">
|
<h3 class="title is-3">
|
||||||
{{ pollService._poll.getValue().title }}
|
{{ pollService._poll.getValue().title }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="description">
|
<p class="description">
|
||||||
Si l’administrateur du sondage a ajouter une description elle sera affiché ici.
|
{{ pollService._poll.getValue().description }}
|
||||||
</p>
|
</p>
|
||||||
<p class="date-end-box">
|
<p class="date-end-box">
|
||||||
Fin du sondage le
|
Fin du sondage le
|
||||||
<strong class="date-end">
|
<strong class="date-end">
|
||||||
14/11/2021
|
{{ pollService._poll.getValue().expiracy_date | date }}
|
||||||
</strong>
|
</strong>
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
class="button is-primary"
|
class="button is-primary"
|
||||||
[routerLink]="['consultation/' + pollService._poll.getValue().custom_url + '/simple']"
|
[routerLink]="['/poll/' + pollService._poll.getValue().custom_url + '/consultation/simple']"
|
||||||
>
|
>
|
||||||
Je donne mes disponibilités
|
Je donne mes disponibilités
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { PollService } from '../../../core/services/poll.service';
|
import { PollService } from '../../../core/services/poll.service';
|
||||||
|
import { Poll } from '../../../core/models/poll.model';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
||||||
|
import { PollUtilitiesService } from '../../../core/services/poll.utilities.service';
|
||||||
|
import { StorageService } from '../../../core/services/storage.service';
|
||||||
|
import { ApiService } from '../../../core/services/api.service';
|
||||||
|
import { DateService } from '../../../core/services/date.service';
|
||||||
|
import { ToastService } from '../../../core/services/toast.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-consultation-landing',
|
selector: 'app-consultation-landing',
|
||||||
|
@ -7,7 +15,69 @@ import { PollService } from '../../../core/services/poll.service';
|
||||||
styleUrls: ['./consultation-landing.component.scss'],
|
styleUrls: ['./consultation-landing.component.scss'],
|
||||||
})
|
})
|
||||||
export class ConsultationLandingComponent implements OnInit {
|
export class ConsultationLandingComponent implements OnInit {
|
||||||
constructor(public pollService: PollService) {}
|
public poll: Poll;
|
||||||
|
public pollSlug: string;
|
||||||
|
public pass_hash: string;
|
||||||
|
public fetching = true;
|
||||||
|
public isArchived: boolean;
|
||||||
|
public isAdmin: boolean;
|
||||||
|
|
||||||
ngOnInit(): void {}
|
private routeSubscription: Subscription;
|
||||||
|
window: any;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private router: Router,
|
||||||
|
private utils: PollUtilitiesService,
|
||||||
|
private _Activatedroute: ActivatedRoute,
|
||||||
|
public storageService: StorageService,
|
||||||
|
public api: ApiService,
|
||||||
|
public pollService: PollService,
|
||||||
|
public dateService: DateService,
|
||||||
|
public toastService: ToastService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetch poll data on init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void {
|
||||||
|
console.log('constultation de poll');
|
||||||
|
this.pollService.poll.subscribe((newpoll: Poll) => {
|
||||||
|
this.poll = newpoll;
|
||||||
|
if (newpoll) {
|
||||||
|
this.isArchived = new Date(newpoll.expiracy_date) < new Date();
|
||||||
|
this.poll.is_archived = this.isArchived;
|
||||||
|
this.isAdmin = this.poll.admin_key !== null;
|
||||||
|
this.poll.choices_grouped.map((elem) => (elem.subSetToYes = false));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this._Activatedroute.paramMap.subscribe((params: ParamMap) => {
|
||||||
|
console.log('params _Activatedroute', params);
|
||||||
|
this.pollSlug = params.get('custom_url');
|
||||||
|
this.pass_hash = params.get('pass_hash');
|
||||||
|
|
||||||
|
console.log('this.pass_hash ', this.pass_hash);
|
||||||
|
if (this.pass_hash) {
|
||||||
|
this.pollService.loadPollByCustomUrlWithPasswordHash(this.pollSlug, this.pass_hash).then((resp) => {
|
||||||
|
console.log('loadPollByCustomUrlWithPasswordHash resp', resp);
|
||||||
|
this.fetching = false;
|
||||||
|
this.storageService.vote_stack.id = null;
|
||||||
|
this.storageService.setChoicesForVoteStack(this.pollService._poll.getValue().choices);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.pollService.loadPollByCustomUrl(this.pollSlug).then((resp) => {
|
||||||
|
console.log('loadPollByCustomUrl resp', resp);
|
||||||
|
this.fetching = false;
|
||||||
|
this.storageService.vote_stack.id = null;
|
||||||
|
this.storageService.setChoicesForVoteStack(this.pollService._poll.getValue().choices);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (this.routeSubscription) {
|
||||||
|
this.routeSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,22 +7,23 @@ import { PasswordPromptComponent } from './password/password-prompt/password-pro
|
||||||
import { ConsultationLandingComponent } from './consultation-landing/consultation-landing.component';
|
import { ConsultationLandingComponent } from './consultation-landing/consultation-landing.component';
|
||||||
import { SuccessComponent } from './success/success.component';
|
import { SuccessComponent } from './success/success.component';
|
||||||
import { ConsultationUserComponent } from './consultation-user/consultation-user.component';
|
import { ConsultationUserComponent } from './consultation-user/consultation-user.component';
|
||||||
|
import { PageNotFoundComponent } from '../../shared/components/page-not-found/page-not-found.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: ConsultationLandingComponent,
|
component: ConsultationLandingComponent,
|
||||||
children: [],
|
|
||||||
},
|
},
|
||||||
|
{ path: 'simple', component: ConsultationComponent },
|
||||||
{ path: 'secure/:pass_hash', component: ConsultationComponent },
|
{ path: 'secure/:pass_hash', component: ConsultationComponent },
|
||||||
{ path: 'prompt', component: PasswordPromptComponent },
|
{ path: 'prompt', component: PasswordPromptComponent },
|
||||||
{ path: 'simple', component: WipTodoComponent },
|
|
||||||
{ path: 'table', component: WipTodoComponent },
|
{ path: 'table', component: WipTodoComponent },
|
||||||
|
|
||||||
{ path: 'user-info', component: ConsultationUserComponent },
|
{ path: 'user-info', component: ConsultationUserComponent },
|
||||||
{ path: 'success', component: SuccessComponent },
|
{ path: 'success', component: SuccessComponent },
|
||||||
|
{ path: 'page-not-found', component: PageNotFoundComponent },
|
||||||
|
{ path: '**', redirectTo: 'page-not-found', pathMatch: 'full' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
|
|
|
@ -31,9 +31,24 @@
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow">
|
||||||
<div class="buttons has-addons is-right">
|
<div class="buttons has-addons is-right">
|
||||||
<!-- TODO limit answers possible with poll allowed_answers-->
|
<!-- TODO limit answers possible with poll allowed_answers-->
|
||||||
<app-choice-button [poll]="poll" [choice]="choice" [answerKind]="'YES'"></app-choice-button>
|
<app-choice-button
|
||||||
<app-choice-button [poll]="poll" [choice]="choice" [answerKind]="'MAYBE'"></app-choice-button>
|
[poll]="poll"
|
||||||
<app-choice-button [poll]="poll" [choice]="choice" [answerKind]="'NO'"></app-choice-button>
|
[choice]="choice"
|
||||||
|
[answerKind]="'YES'"
|
||||||
|
*ngIf="poll.allowed_answers.indexOf('yes') !== -1"
|
||||||
|
></app-choice-button>
|
||||||
|
<app-choice-button
|
||||||
|
[poll]="poll"
|
||||||
|
[choice]="choice"
|
||||||
|
[answerKind]="'MAYBE'"
|
||||||
|
*ngIf="poll.allowed_answers.indexOf('maybe') !== -1"
|
||||||
|
></app-choice-button>
|
||||||
|
<app-choice-button
|
||||||
|
[poll]="poll"
|
||||||
|
[choice]="choice"
|
||||||
|
[answerKind]="'NO'"
|
||||||
|
*ngIf="poll.allowed_answers.indexOf('no') !== -1"
|
||||||
|
></app-choice-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -49,7 +49,24 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td *ngFor="let choice of poll.choices">
|
<td *ngFor="let choice of poll.choices">
|
||||||
<app-choice-button [poll]="poll" [choice]="choice" [answerKind]="'YES'"></app-choice-button>
|
<app-choice-button
|
||||||
|
[poll]="poll"
|
||||||
|
[choice]="choice"
|
||||||
|
[answerKind]="'YES'"
|
||||||
|
*ngIf="poll.allowed_answers.indexOf('yes') !== -1"
|
||||||
|
></app-choice-button>
|
||||||
|
<app-choice-button
|
||||||
|
[poll]="poll"
|
||||||
|
[choice]="choice"
|
||||||
|
[answerKind]="'MAYBE'"
|
||||||
|
*ngIf="poll.allowed_answers.indexOf('maybe') !== -1"
|
||||||
|
></app-choice-button>
|
||||||
|
<app-choice-button
|
||||||
|
[poll]="poll"
|
||||||
|
[choice]="choice"
|
||||||
|
[answerKind]="'NO'"
|
||||||
|
*ngIf="poll.allowed_answers.indexOf('no') !== -1"
|
||||||
|
></app-choice-button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="stats">
|
<tr class="stats">
|
||||||
|
|
|
@ -24,7 +24,6 @@ export const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: 'poll/:custom_url/consultation',
|
path: 'poll/:custom_url/consultation',
|
||||||
loadChildren: () => import('./features/consultation/consultation.module').then((m) => m.ConsultationModule),
|
loadChildren: () => import('./features/consultation/consultation.module').then((m) => m.ConsultationModule),
|
||||||
// resolve: { poll: PollService },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'success',
|
path: 'success',
|
||||||
|
|
|
@ -14,17 +14,17 @@ const apiV1 = {
|
||||||
export const environment = {
|
export const environment = {
|
||||||
frontDomain: 'https://framadate-api.cipherbliss.com',
|
frontDomain: 'https://framadate-api.cipherbliss.com',
|
||||||
production: true,
|
production: true,
|
||||||
display_routes: true,
|
display_routes: false,
|
||||||
showDemoWarning: true,
|
showDemoWarning: false,
|
||||||
autofill_creation: true,
|
autofill_creation: true,
|
||||||
autofill_participation: true,
|
autofill_participation: false,
|
||||||
advanced_options_display: false,
|
advanced_options_display: false,
|
||||||
autoSendNewPoll: false,
|
autoSendNewPoll: false,
|
||||||
interval_days_default: 7,
|
interval_days_default: 7,
|
||||||
showStepperShortcuts: true,
|
showStepperShortcuts: true,
|
||||||
expiresDaysDelay: 60,
|
expiresDaysDelay: 60,
|
||||||
maxCountOfAnswers: 150,
|
maxCountOfAnswers: 300,
|
||||||
appTitle: 'FramaDate Funky',
|
appTitle: 'FramaDate',
|
||||||
appVersion: '2.1.0',
|
appVersion: '2.1.0',
|
||||||
appLogo: 'assets/img/logo.png',
|
appLogo: 'assets/img/logo.png',
|
||||||
api: {
|
api: {
|
||||||
|
|
|
@ -10,13 +10,13 @@ endpoints.baseHref = apiV1.baseHref;
|
||||||
export const environment = {
|
export const environment = {
|
||||||
frontDomain: 'http://127.0.0.1:4200',
|
frontDomain: 'http://127.0.0.1:4200',
|
||||||
production: false,
|
production: false,
|
||||||
display_routes: true, // demo paths to test polls
|
display_routes: false, // demo paths to test polls
|
||||||
autofill_creation: true,
|
autofill_creation: false,
|
||||||
advanced_options_display: false,
|
advanced_options_display: false,
|
||||||
autofill_participation: false,
|
autofill_participation: false,
|
||||||
showDemoWarning: false,
|
showDemoWarning: false,
|
||||||
autoSendNewPoll: false,
|
autoSendNewPoll: false,
|
||||||
showStepperShortcuts: true,
|
showStepperShortcuts: false,
|
||||||
interval_days_default: 7,
|
interval_days_default: 7,
|
||||||
expiresDaysDelay: 60,
|
expiresDaysDelay: 60,
|
||||||
maxCountOfAnswers: 300,
|
maxCountOfAnswers: 300,
|
||||||
|
|
Loading…
Reference in New Issue