pollthingy/resources/views/view_poll.blade.php

77 lines
2.9 KiB
PHP
Raw Permalink Normal View History

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 16:56:05 +02:00
@if ($new)
<section class="primary-box">
<span>Your poll has been created!</span><br>
2018-10-18 22:52:19 +02:00
<div class="text-browser"><br></div>
2018-10-19 20:16:58 +02:00
@if ($poll->admin_password != null)
<div class="some-top-margin">
<span>Admin URL: <a href="{{ action('PollController@admin', ['poll' => $poll, 'password' => $poll->admin_password]) }}">{{ action('PollController@admin', ['poll' => $poll, 'password' => $poll->admin_password]) }}</a></span>
</div>
<div class="text-browser"><br></div>
@endif
2018-10-17 16:56:05 +02:00
<div class="some-top-margin">
@if ($poll->duplicate_vote_checking == 'codes')
<span>Voting URLs:</span>
2018-10-23 02:40:49 +02:00
<textarea class="copyarea" readonly>{{ $poll->voting_codes()->get()->map(function($c) use($poll) { return action('PollController@view', ['poll' => $poll, 'code' => $c]); })->implode("\n") }}</textarea>
2018-10-17 16:56:05 +02:00
@else
<span>Poll URL: <a href="{{ action('PollController@view', ['poll' => $poll]) }}">{{ action('PollController@view', ['poll' => $poll]) }}</a></span>
2018-10-17 16:56:05 +02:00
@endif
</div>
</section>
@endif
<section @if($new) class="some-top-margin" @endif>
@if ($hasVoted)
2018-10-18 22:52:19 +02:00
@if (!$new || $poll->duplicate_vote_checking != 'codes')
<div class="text-browser"><br></div>
<div class="primary-box">
<span>You have already voted on this poll or need a code to vote.</span>
</div>
2018-10-17 15:12:20 +02:00
2018-10-18 22:52:19 +02:00
@if ($poll->results_visible)
<div class="some-top-margin">
<span><a href="{{ action('PollController@viewResults', ['poll' => $poll]) }}">Results</a></span>
</div>
2018-10-17 16:56:05 +02:00
@endif
2018-10-18 22:52:19 +02:00
@endif
2018-10-17 16:56:05 +02:00
@else
2018-10-18 22:52:19 +02:00
<div class="text-browser"><br></div>
2018-10-19 20:16:58 +02:00
@if ($code != null)
<form action="{{ action('PollController@vote', ['poll' => $poll, 'code' => $code]) }}" method="post">
@else
<form action="{{ action('PollController@vote', ['poll' => $poll]) }}" method="post">
@endif
2018-10-17 16:56:05 +02:00
@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
2018-10-16 04:28:44 +02:00
2018-10-17 15:12:20 +02:00
<div class="some-top-margin">
2018-10-17 16:56:05 +02:00
<input type="submit" class="btn" value="Submit vote">
2018-10-17 15:12:20 +02:00
</div>
2018-10-17 16:56:05 +02:00
</form>
@endif
</section>
2018-10-16 04:28:44 +02:00
@endsection