Files
timebank-cc-public/resources/views/livewire/polls/partials/settings.blade.php
T

104 lines
6.8 KiB
PHP

@php($hasVotes = (bool) $editingPoll?->hasResponses())
@php($sealed = (bool) $editingPoll?->sealed_at)
<div class="space-y-6">
@if ($sealed)
{{-- A sealed result is final: savePoll refuses status and date changes too --}}
<p class="text-sm text-theme-secondary">{{ __('This poll is closed and sealed: its result is final, so its status and dates cannot change any more.') }}</p>
@endif
<fieldset @disabled($sealed) @class(['grid grid-cols-1 gap-4 sm:grid-cols-3', 'opacity-60' => $sealed])>
<div>
<label class="block text-sm text-gray-700 mb-2">{{ __('Status') }}</label>
<select wire:model.live="form.status" class="w-full border border-primary-300 bg-theme-background rounded-md shadow-sm text-sm">
{{-- A poll with votes cannot go back to draft (savePoll refuses it too) --}}
<option value="draft" @disabled($editingPoll?->hasResponses())>{{ __('Draft') }}</option>
<option value="open">{{ __('Open') }}</option>
<option value="closed">{{ __('Closed') }}</option>
</select>
@include('polls.types._error', ['field' => 'form.status'])
</div>
<div>
<label class="block text-sm text-gray-700 mb-2">{{ __('Opens (optional)') }}</label>
@include('polls.types._date', ['model' => 'form.opens_at', 'key' => 'poll-' . $editingPollId . '-opens_at'])
@include('polls.types._error', ['field' => 'form.opens_at'])
</div>
<div>
<label class="block text-sm text-gray-700 mb-2">{{ __('Closes (optional)') }}</label>
@include('polls.types._date', ['model' => 'form.closes_at', 'key' => 'poll-' . $editingPollId . '-closes_at'])
@include('polls.types._error', ['field' => 'form.closes_at'])
</div>
</fieldset>
@if ($originalStatus === 'draft' && ($form['status'] ?? null) === 'open')
<div class="rounded-md bg-gray-50 border border-gray-300 p-4" role="alert">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3 text-sm text-gray-700">
<p>{{ __('When you save, the poll opens: its post and questions become read-only and the post is published. Check the texts, image and questions first.') }}</p>
</div>
</div>
</div>
@endif
@php($latePublications = $this->latePublications())
@if ($latePublications)
<div class="rounded-md bg-gray-50 border border-gray-300 p-4" role="alert">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3 text-sm text-gray-700">
<p>{{ __('The post of this poll is published later than the poll opens: :dates. Until then the poll is not shown in that language. Change the publication date on the Posts page.', ['dates' => $this->formatLatePublications($latePublications)]) }}</p>
</div>
</div>
</div>
@endif
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div>
<label class="block text-sm text-gray-700 mb-2">{{ __('Votes by organizations, banks and admins') }}</label>
{{-- The one-vote rule depends on it, so it is fixed once people voted (savePoll refuses it too) --}}
<select wire:model="form.vote_scope" @disabled($hasVotes) class="w-full border border-primary-300 bg-theme-background rounded-md shadow-sm text-sm disabled:opacity-60">
<option value="per_profile">{{ __('One vote per profile') }}</option>
<option value="per_user">{{ __('One vote per linked user') }}</option>
</select>
@include('polls.types._error', ['field' => 'form.vote_scope'])
</div>
<div>
<label class="block text-sm text-gray-700 mb-2">{{ __('Who may vote for an organization or bank') }}</label>
<select wire:model="form.member_scope" class="w-full border border-primary-300 bg-theme-background rounded-md shadow-sm text-sm">
<option value="all_users">{{ __('All linked users') }}</option>
<option value="managers_coordinators">{{ __('Only managers and coordinators') }}</option>
</select>
</div>
<div>
<label class="block text-sm text-gray-700 mb-2">{{ __('Results visible to voters') }}</label>
<select wire:model="form.results_visibility" class="w-full border border-primary-300 bg-theme-background rounded-md shadow-sm text-sm">
<option value="never">{{ __('Never') }}</option>
<option value="after_vote">{{ __('After voting') }}</option>
<option value="after_close">{{ __('After the poll closes') }}</option>
</select>
</div>
<div>
<label class="block text-sm text-gray-700 mb-2">{{ __('Verification') }}</label>
<select wire:model="form.verification" class="w-full border border-primary-300 bg-theme-background rounded-md shadow-sm text-sm">
<option value="public">{{ __('Public: receipts and anonymous ballot list') }}</option>
<option value="receipts">{{ __('Receipts only') }}</option>
<option value="off">{{ __('Off') }}</option>
</select>
</div>
</div>
<div class="space-y-3">
@include('polls.types._checkbox', ['model' => 'form.allow_vote_change', 'label' => __('Voters may change their vote until the poll closes')])
{{-- Anonymity was promised to the voters: it can be switched on, never off, once people voted --}}
@include('polls.types._checkbox', ['model' => 'form.anonymous', 'label' => __('Anonymous: hide who voted in the results (votes are still recorded once per voter)'), 'disabled' => $hasVotes && $editingPoll?->anonymous])
@include('polls.types._error', ['field' => 'form.anonymous'])
</div>
</div>