Snapshot of main at 9f39a6e1e (2026-11-02)

This commit is contained in:
Ronald Huynen committed 2026-11-02 10:41:47 +01:00
commit 6ccf1792d7
2580 files changed
+1040202

No files matched your search

@@ -0,0 +1,167 @@
<div>
@if ($poll)
<div class="space-y-6">
@if ($state === 'form')
<form wire:submit="submit" class="space-y-6">
@foreach ($poll->questions as $question)
@php($type = $question->questionType())
<fieldset wire:key="poll-{{ $poll->id }}-question-{{ $question->id }}">
<legend class="mb-3 text-base font-semibold text-theme-primary">
{{ $question->labelFor($locale) }}
@if ($question->required)
<span class="text-red-600" aria-hidden="true">*</span>
<span class="sr-only">({{ __('required') }})</span>
@endif
</legend>
@include($type->inputView(), [
'type' => $type,
'question' => $question,
'settings' => $question->settings ?? [],
'prefix' => 'answers.' . $question->id,
'locale' => $locale,
])
</fieldset>
@endforeach
<div class="flex items-center justify-end space-x-3">
{{-- The poll page shows the closing date in its heading already --}}
@if ($poll->closes_at && $context === 'card')
<p class="mr-auto text-sm text-theme-secondary">
{{ __('Open until :date', ['date' => $poll->closes_at->locale($locale)->isoFormat('LLL')]) }}
</p>
@endif
<x-jetstream.button type="submit" wire:loading.attr="disabled" wire:target="submit" class="bg-theme-brand hover:bg-opacity-80">
<span wire:loading.remove wire:target="submit">{{ __('Submit vote') }}</span>
<span wire:loading wire:target="submit">{{ __('Processing...') }}</span>
</x-jetstream.button>
</div>
</form>
@endif
@if ($state === 'submitted')
<div class="rounded-md bg-green-50 border border-green-200 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3 text-sm text-green-800">
<p>{{ __('Thank you, your vote has been recorded.') }}</p>
</div>
</div>
</div>
@if ($receiptCode)
{{-- The code lives in x-data on this plain element: @js is not compiled inside component
attributes. navigator.clipboard needs HTTPS or localhost, so fall back to execCommand. --}}
<div class="p-4 bg-theme-surface rounded-md border border-theme-border"
x-data="{
copied: false,
code: @js($receiptCode),
copy() {
const done = () => { this.copied = true; setTimeout(() => this.copied = false, 2000) };
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(this.code).then(done);
return;
}
const field = document.createElement('textarea');
field.value = this.code;
field.setAttribute('readonly', '');
field.style.position = 'fixed';
field.style.opacity = '0';
document.body.appendChild(field);
field.select();
if (document.execCommand('copy')) done();
field.remove();
}
}">
<p class="text-sm text-theme-primary">
<strong>{{ __('Your receipt code') }}</strong>
</p>
<div class="mt-2 flex flex-wrap items-center gap-3">
<code class="select-all rounded-md border border-theme-border bg-theme-background px-3 py-2 font-mono text-lg tracking-wider text-theme-primary">{{ $receiptCode }}</code>
<x-jetstream.secondary-button type="button"
x-on:click="copy()">
<span x-show="!copied">{{ __('Copy') }}</span>
<span x-show="copied" x-cloak>{{ __('Copied') }}</span>
</x-jetstream.secondary-button>
@if ($receiptEmailed)
<span class="text-sm text-theme-secondary">{{ __('Sent to your email address.') }}</span>
@else
<x-jetstream.secondary-button type="button" wire:click="emailReceipt" wire:loading.attr="disabled" wire:target="emailReceipt">
<span wire:loading.remove wire:target="emailReceipt">{{ __('Email me this code') }}</span>
<span wire:loading wire:target="emailReceipt">{{ __('Sending...') }}</span>
</x-jetstream.secondary-button>
@endif
</div>
@error('receipt')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-theme-secondary">
{{ __('Keep this code to check later that your vote was counted as you cast it. It is shown only once: we store a fingerprint of it, not the code itself.') }}
</p>
{{-- The dedicated poll page has this link at the bottom already --}}
@if ($context !== 'page')
<p class="mt-2 text-sm">
<a href="{{ route('polls.verify', $poll) }}" class="text-theme-secondary underline" target="_blank">{{ __('Verify this poll') }}</a>
</p>
@endif
</div>
@endif
@endif
@if ($state === 'closed')
<div class="p-3 bg-theme-surface rounded-md border border-theme-border">
<p class="text-sm text-theme-primary">
{{ __('This poll is closed.') }}
@if ($response)
{{ __('You voted on :date.', ['date' => $response->submitted_at->locale($locale)->isoFormat('LLL')]) }}
@endif
</p>
</div>
@endif
@if ($state === 'voted' && $response)
<div class="p-3 bg-theme-surface rounded-md border border-theme-border flex flex-wrap items-center gap-3">
<p class="text-sm text-theme-primary mr-auto">
@if ($response->updated_at && $response->updated_at->gt($response->submitted_at->copy()->addSecond()))
{{ __('You voted on :date and changed your vote on :changed.', [
'date' => $response->submitted_at->locale($locale)->isoFormat('LLL'),
'changed' => $response->updated_at->locale($locale)->isoFormat('LLL'),
]) }}
@else
{{ __('You voted on :date.', ['date' => $response->submitted_at->locale($locale)->isoFormat('LLL')]) }}
@endif
</p>
@if ($poll->allow_vote_change && !$poll->isClosed())
<x-jetstream.secondary-button type="button" wire:click="changeVote" wire:loading.attr="disabled" wire:target="changeVote">
{{ __('Change vote') }}
</x-jetstream.secondary-button>
@endif
</div>
@endif
@if (!empty($summaries))
<div class="space-y-6">
<h3 class="text-base font-semibold text-theme-primary">{{ $state === 'closed' ? __('Results') : __('Results so far') }}</h3>
@foreach ($poll->questions as $question)
@php($type = $question->questionType())
<div wire:key="poll-{{ $poll->id }}-results-{{ $question->id }}">
<p class="mb-2 text-sm font-semibold text-theme-primary">{{ $question->labelFor($locale) }}</p>
@include($type->resultsView(), [
'type' => $type,
'question' => $question,
'settings' => $question->settings ?? [],
'summary' => $summaries[$question->id],
'locale' => $locale,
])
</div>
@endforeach
</div>
@endif
</div>
@endif
</div>