mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
landing link on consultation, check allowed answers
This commit is contained in:
parent
424961b8bb
commit
5f555136cf
@ -1,24 +1,22 @@
|
||||
<div>
|
||||
<h2 class="title is-2">
|
||||
vous invite à participer à son sondage
|
||||
</h2>
|
||||
<div class="step-container" *ngIf="pollService._poll && pollService._poll.getValue()">
|
||||
<h2 class="title is-2">{{ pollService._poll.getValue().creatorPseudo }} vous invite à participer à son sondage</h2>
|
||||
<div>
|
||||
<div class="badge creator"></div>
|
||||
<h3 class="title is-3">
|
||||
{{ pollService._poll.getValue().title }}
|
||||
</h3>
|
||||
<p class="description">
|
||||
Si l’administrateur du sondage a ajouter une description elle sera affiché ici.
|
||||
{{ pollService._poll.getValue().description }}
|
||||
</p>
|
||||
<p class="date-end-box">
|
||||
Fin du sondage le
|
||||
<strong class="date-end">
|
||||
14/11/2021
|
||||
{{ pollService._poll.getValue().expiracy_date | date }}
|
||||
</strong>
|
||||
</p>
|
||||
<button
|
||||
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
|
||||
</button>
|
||||
|
@ -1,5 +1,13 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
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({
|
||||
selector: 'app-consultation-landing',
|
||||
@ -7,7 +15,69 @@ import { PollService } from '../../../core/services/poll.service';
|
||||
styleUrls: ['./consultation-landing.component.scss'],
|
||||
})
|
||||
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 { SuccessComponent } from './success/success.component';
|
||||
import { ConsultationUserComponent } from './consultation-user/consultation-user.component';
|
||||
import { PageNotFoundComponent } from '../../shared/components/page-not-found/page-not-found.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ConsultationLandingComponent,
|
||||
children: [],
|
||||
},
|
||||
|
||||
{ path: 'simple', component: ConsultationComponent },
|
||||
{ path: 'secure/:pass_hash', component: ConsultationComponent },
|
||||
{ path: 'prompt', component: PasswordPromptComponent },
|
||||
{ path: 'simple', component: WipTodoComponent },
|
||||
{ path: 'table', component: WipTodoComponent },
|
||||
|
||||
{ path: 'user-info', component: ConsultationUserComponent },
|
||||
{ path: 'success', component: SuccessComponent },
|
||||
{ path: 'page-not-found', component: PageNotFoundComponent },
|
||||
{ path: '**', redirectTo: 'page-not-found', pathMatch: 'full' },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
|
@ -31,9 +31,24 @@
|
||||
<div class="column is-narrow">
|
||||
<div class="buttons has-addons is-right">
|
||||
<!-- TODO limit answers possible with poll allowed_answers-->
|
||||
<app-choice-button [poll]="poll" [choice]="choice" [answerKind]="'YES'"></app-choice-button>
|
||||
<app-choice-button [poll]="poll" [choice]="choice" [answerKind]="'MAYBE'"></app-choice-button>
|
||||
<app-choice-button [poll]="poll" [choice]="choice" [answerKind]="'NO'"></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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -49,7 +49,24 @@
|
||||
</div>
|
||||
</td>
|
||||
<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>
|
||||
</tr>
|
||||
<tr class="stats">
|
||||
|
@ -24,7 +24,6 @@ export const routes: Routes = [
|
||||
{
|
||||
path: 'poll/:custom_url/consultation',
|
||||
loadChildren: () => import('./features/consultation/consultation.module').then((m) => m.ConsultationModule),
|
||||
// resolve: { poll: PollService },
|
||||
},
|
||||
{
|
||||
path: 'success',
|
||||
|
@ -14,17 +14,17 @@ const apiV1 = {
|
||||
export const environment = {
|
||||
frontDomain: 'https://framadate-api.cipherbliss.com',
|
||||
production: true,
|
||||
display_routes: true,
|
||||
showDemoWarning: true,
|
||||
display_routes: false,
|
||||
showDemoWarning: false,
|
||||
autofill_creation: true,
|
||||
autofill_participation: true,
|
||||
autofill_participation: false,
|
||||
advanced_options_display: false,
|
||||
autoSendNewPoll: false,
|
||||
interval_days_default: 7,
|
||||
showStepperShortcuts: true,
|
||||
expiresDaysDelay: 60,
|
||||
maxCountOfAnswers: 150,
|
||||
appTitle: 'FramaDate Funky',
|
||||
maxCountOfAnswers: 300,
|
||||
appTitle: 'FramaDate',
|
||||
appVersion: '2.1.0',
|
||||
appLogo: 'assets/img/logo.png',
|
||||
api: {
|
||||
|
@ -10,13 +10,13 @@ endpoints.baseHref = apiV1.baseHref;
|
||||
export const environment = {
|
||||
frontDomain: 'http://127.0.0.1:4200',
|
||||
production: false,
|
||||
display_routes: true, // demo paths to test polls
|
||||
autofill_creation: true,
|
||||
display_routes: false, // demo paths to test polls
|
||||
autofill_creation: false,
|
||||
advanced_options_display: false,
|
||||
autofill_participation: false,
|
||||
showDemoWarning: false,
|
||||
autoSendNewPoll: false,
|
||||
showStepperShortcuts: true,
|
||||
showStepperShortcuts: false,
|
||||
interval_days_default: 7,
|
||||
expiresDaysDelay: 60,
|
||||
maxCountOfAnswers: 300,
|
||||
|
Loading…
Reference in New Issue
Block a user