2018-10-16 04:28:44 +02:00
|
|
|
@extends('layouts.app')
|
|
|
|
|
|
|
|
@section('title', $poll->question)
|
|
|
|
|
|
|
|
@php
|
|
|
|
$type = $poll->allow_multiple_answers ? "checkbox" : "radio";
|
|
|
|
@endphp
|
|
|
|
|
|
|
|
@section('content')
|
2018-10-17 15:12:20 +02:00
|
|
|
@if($hasVoted)
|
|
|
|
<section>
|
|
|
|
<span>You have already voted on this poll.</span>
|
|
|
|
|
|
|
|
<br>
|
2018-10-16 04:28:44 +02:00
|
|
|
|
2018-10-17 15:12:20 +02:00
|
|
|
@if($poll->results_visible)
|
|
|
|
<div class="some-top-margin">
|
|
|
|
<span><a href="{{ action('PollController@viewResults', ['poll' => $poll]) }}">Results</a></span>
|
|
|
|
</div>
|
|
|
|
@endif
|
2018-10-16 04:28:44 +02:00
|
|
|
</section>
|
2018-10-17 15:12:20 +02:00
|
|
|
@else
|
|
|
|
<form action"={{ action('PollController@vote', ['poll' => $poll]) }}" method="post">
|
|
|
|
@csrf
|
|
|
|
|
|
|
|
@foreach ($poll->options as $option)
|
|
|
|
<label class="{{$type}} no-bottom-margin">
|
|
|
|
<input type="{{$type}}" name="options[]" value="{{$option->id}}">
|
|
|
|
<span class="{{$type}}__label">{{$option->text}}</span>
|
|
|
|
</label>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
@endforeach
|
|
|
|
|
|
|
|
<section class="some-top-margin">
|
|
|
|
<input type="submit" class="btn" value="Submit vote">
|
|
|
|
</section>
|
|
|
|
</form>
|
|
|
|
@endif
|
2018-10-16 04:28:44 +02:00
|
|
|
@endsection
|