info in modal

This commit is contained in:
Tykayn 2021-04-27 12:38:12 +02:00 committed by tykayn
parent 9a4a72a24c
commit 729dac9599
5 changed files with 28 additions and 28 deletions

View File

@ -14,7 +14,7 @@ import { Comment } from '../../core/models/comment.model';
styleUrls: ['./consultation.component.scss'], styleUrls: ['./consultation.component.scss'],
}) })
export class ConsultationComponent implements OnInit, OnDestroy { export class ConsultationComponent implements OnInit, OnDestroy {
public isCompactMode = false; public isCompactMode = true;
public poll: Poll; public poll: Poll;
public pollSlug: string; public pollSlug: string;
public passHash: string; public passHash: string;

View File

@ -18,7 +18,7 @@
</span> </span>
</div> </div>
<div class="column is-narrow"> <div class="column is-narrow">
<button class="button is-white" (click)="openModal(choice)"> <button class="button is-white" (click)="openModal(poll, choice)">
<i class="fa fa-info-circle"></i> <i class="fa fa-info-circle"></i>
</button> </button>
</div> </div>

View File

@ -22,8 +22,8 @@ export class PollResultsCompactComponent implements OnInit {
console.log('this.poll', this.poll); console.log('this.poll', this.poll);
} }
public openModal(choice: Choice): void { public openModal(poll: Poll, choice: Choice): void {
const config: MatDialogConfig<Choice> = { data: choice }; const config: MatDialogConfig<any> = { data: choice };
this.modalService.openModal<ChoiceDetailsComponent, Choice>(ChoiceDetailsComponent, config); this.modalService.openModal<ChoiceDetailsComponent, Choice>(ChoiceDetailsComponent, config);
} }
} }

View File

@ -1,34 +1,32 @@
<div class="columns is-mobile"> <div class="columns is-mobile">
<div class="column"> <div class="column">
<table class="table is-narrow is-fullwidth"> <h1 class="title is-1">Détail des réponses pour "{{ choice.name }}"</h1>
<hr />
<table class="is-fullwidth">
<thead> <thead>
<tr> <tr>
<th class="is-flex"> <th>oui</th>
<img class="image is-24x24" src="../../../assets/img/icon_voter_YES.svg" /> <th>peut être</th>
{{ choice.counts.get(answerEnum.YES) }} <th>non</th>
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let user of choice.participants.get(answerEnum.YES)"> <tr>
<td>{{ user.pseudo }}</td> <td>
</tr> <div class="pseudo" *ngFor="let people of choice.yes.people">
</tbody> {{ people }}
</table>
</div> </div>
<div class="column"> </td>
<table class="table is-narrow is-fullwidth"> <td>
<thead> <div class="pseudo" *ngFor="let people of choice.maybe.people">
<tr> {{ people }}
<th class="is-flex"> </div>
<img class="image is-24x24" src="../../../assets/img/icon_voter_MAYBE.svg" /> </td>
{{ choice.counts.get(answerEnum.MAYBE) }} <td>
</th> <div class="pseudo" *ngFor="let people of choice.no.people">
</tr> {{ people }}
</thead> </div>
<tbody> </td>
<tr *ngFor="let user of choice.participants.get(answerEnum.MAYBE)">
<td>{{ user.pseudo }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -3,6 +3,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Answer } from '../../../core/enums/answer.enum'; import { Answer } from '../../../core/enums/answer.enum';
import { Choice } from '../../../core/models/choice.model'; import { Choice } from '../../../core/models/choice.model';
import { Poll } from '../../../core/models/poll.model';
@Component({ @Component({
selector: 'app-choice-details', selector: 'app-choice-details',
@ -14,7 +15,8 @@ export class ChoiceDetailsComponent implements OnInit {
constructor( constructor(
public dialogRef: MatDialogRef<ChoiceDetailsComponent>, public dialogRef: MatDialogRef<ChoiceDetailsComponent>,
@Inject(MAT_DIALOG_DATA) public choice: Choice @Inject(MAT_DIALOG_DATA) public choice: Choice,
@Inject(MAT_DIALOG_DATA) public poll: Poll
) {} ) {}
ngOnInit(): void {} ngOnInit(): void {}