Add filters for printing cards on day of auditions.
This commit is contained in:
parent
8cd1c8e3ff
commit
23ba4ab439
|
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Entry;
|
||||
use App\Models\Event;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class PrintCards extends Controller
|
||||
{
|
||||
|
|
@ -25,9 +26,22 @@ class PrintCards extends Controller
|
|||
public function print(\App\Actions\Print\PrintCards $printer)
|
||||
{
|
||||
//dump(request()->all());
|
||||
|
||||
if (request()->audition == null) {
|
||||
return redirect()->back()->with('error', 'You must specify at least one audition');
|
||||
}
|
||||
$selectedAuditionIds = array_keys(request()->audition);
|
||||
$cards = Entry::whereIn('audition_id', $selectedAuditionIds)->get();
|
||||
$cardQuery = Entry::whereIn('audition_id', $selectedAuditionIds);
|
||||
|
||||
// Process Filters
|
||||
if (request()->filter == 'today') {
|
||||
$now = Carbon::now('America/Chicago')->format('Y-m-d');
|
||||
$cardQuery->where('created_at', '>=', $now);
|
||||
}
|
||||
if (request()->filter == 'idAfter') {
|
||||
$firstId = request()->idAfter;
|
||||
$cardQuery->where('id', '>=', $firstId);
|
||||
}
|
||||
$cards = $cardQuery->get();
|
||||
$sorts = [];
|
||||
// Process submitted sort criteria
|
||||
foreach (request()->sort as $sortField) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
</x-card.card>
|
||||
|
||||
{{--Sort Options--}}
|
||||
<x-card.card class="mx-auto max-w-3xl">
|
||||
<x-card.card class="mx-auto max-w-3xl mb-5">
|
||||
<x-card.heading>Card Sorting</x-card.heading>
|
||||
<div class="px-5 pb-5 pt-1">
|
||||
<x-form.select name="sort[1]">
|
||||
|
|
@ -52,6 +52,23 @@
|
|||
</x-form.select>
|
||||
</div>
|
||||
</x-card.card>
|
||||
|
||||
{{--Filter Options--}}
|
||||
<x-card.card class="mx-auto max-w-3xl">
|
||||
<x-card.heading>Filters</x-card.heading>
|
||||
<div class="px-5 pb-5 pt-1">
|
||||
<fieldset aria-label="Filters">
|
||||
|
||||
<x-form.option name="filter" id="no-filter" :checked="true" value="no-filter" option_text="Print All Cards"></x-form.option>
|
||||
<x-form.option name="filter" id="filter-today" :checked="false" value="today" option_text="Print Today's Entries"></x-form.option>
|
||||
<x-form.option name="filter" id="filter-id-after" :checked="false" value="idAfter" option_text="Print cards beginning with ID: ">
|
||||
<input type="number" name="idAfter" class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||||
</x-form.option>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
</x-card.card>
|
||||
|
||||
<x-form.button class="mt-5 mx-auto max-w-3xl" type="submit">Print Cards</x-form.button>
|
||||
@endforeach
|
||||
</x-form.form>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
@props([
|
||||
'name',
|
||||
'id',
|
||||
'checked' => false,
|
||||
'value',
|
||||
'option_text',
|
||||
])
|
||||
|
||||
<div class="relative flex items-start">
|
||||
<div class="flex h-6 items-center">
|
||||
<input id="{{ $id }}" name="{{ $name }}" type="radio" value="{{ $value }}" @if($checked) checked @endif class="h-4 w-4 border-gray-300 text-indigo-600 focus:ring-indigo-600">
|
||||
</div>
|
||||
<div class="ml-3 text-sm leading-6">
|
||||
<label for="no-filter" class="font-medium text-gray-900">{{ $option_text }}</label>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue