66 lines
3.2 KiB
PHP
66 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace Modules\Contribution\Components;
|
|
|
|
use App\Contribution\ContributionFactory;
|
|
use App\Country;
|
|
use Illuminate\Support\Collection;
|
|
use Livewire\Component;
|
|
|
|
class FillList extends Component
|
|
{
|
|
|
|
public Collection $countries;
|
|
public ?int $country = null;
|
|
public Collection $compilers;
|
|
public string $eventName = '';
|
|
public string $dateFrom = '';
|
|
public string $dateUntil = '';
|
|
public string $zipLocation = '';
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->countries = Country::select('name', 'id')->get();
|
|
$this->country = Country::firstWhere('name', 'Deutschland')->id;
|
|
$this->compilers = app(ContributionFactory::class)->compilerSelect();
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return <<<'HTML'
|
|
<x-page::layout title="Zuschüsse" menu="contribution">
|
|
<form target="_BLANK" class="max-w-4xl w-full mx-auto gap-6 grid-cols-2 grid p-6">
|
|
<x-form::text name="event_name" wire:model="eventName" class="col-span-full" label="Veranstaltungs-Name" required></x-form::text>
|
|
<x-form::text name="date_until" wire:model="dateUntil" type="date" label="Datum bis" required></x-form::text>
|
|
<x-form::text name="date_until" wire:model="dateUntil" type="date" label="Datum bis"></x-form::text>
|
|
<x-form::text name="date_from" wire:model="dateFrom" type="date" label="Datum von" required></x-form::text>
|
|
<x-form::text name="zip_location" wire:model="zipLocation" label="PLZ / Ort" required></x-form::text>
|
|
<x-form::select id="country" wire:model="country" :options="$countries" name="country" label="Land" required></x-form::select>
|
|
|
|
<x-ui::box class="col-span-2" title="Mitglieder finden" x-data="memberSearch()">
|
|
<span x-text="JSON.stringify(members)"></span>
|
|
<div class="mt-2 grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2 col-span-2">
|
|
<x-form::text name="search_text" ref="searchInput" x-model="searchString" class="col-span-2" label="Suchen …" size="sm" @keydown.enter.prevent="onSubmitFirstMemberResult"></x-form::text>
|
|
|
|
<template x-for="member in searchHelper.getHits()" :key="member.id">
|
|
<x-form::lever
|
|
name="members"
|
|
::label="member.fullname"
|
|
::id="member.id"
|
|
::value="member.id"
|
|
size="sm"
|
|
ref="input"
|
|
x-model="members"
|
|
@keydown.enter.prevent="onSubmitMemberResult($event.target.value)"
|
|
></x-form::lever>
|
|
</template>
|
|
</div>
|
|
</x-ui::box>
|
|
|
|
<button v-for="(compiler, index) in compilers" :key="index" class="btn btn-primary mt-3 inline-block" @click.prevent="submit(compiler.class)" v-text="compiler.title"></button>
|
|
</form>
|
|
</x-page::layout>
|
|
HTML;
|
|
}
|
|
}
|