Compare commits

...

6 Commits

Author SHA1 Message Date
philipp lang 381a7f9023 --wip-- [skip ci] 2025-03-28 01:16:44 +01:00
philipp lang f2c54363f2 Fix UserSeeder 2025-03-28 01:15:23 +01:00
philipp lang a573cea7c0 Add class merging for ui components 2025-03-28 01:15:05 +01:00
philipp lang 3ea0682b7c Mod sleect for contribution compilers 2025-03-28 00:53:49 +01:00
philipp lang 3db7e4592e Mod copydb 2025-03-28 00:50:04 +01:00
philipp lang 520c1d0a62 Add id to form elements instead of uuid 2025-03-28 00:49:26 +01:00
15 changed files with 116 additions and 26 deletions

View File

@ -32,8 +32,8 @@ class ContributionFactory
public function compilerSelect(): Collection
{
return collect($this->documents)->map(fn ($document) => [
'title' => $document::buttonName(),
'class' => $document,
'name' => $document::buttonName(),
'id' => $document,
]);
}

View File

@ -10,16 +10,15 @@ class Editor extends Component
use HasFormDimensions;
public string $id;
public function __construct(
public string $name,
public string $size = 'default',
public ?string $hint = null,
public bool $required = false,
public string $label = '',
public string $id = ''
) {
$this->id = str()->uuid()->toString();
$this->id = $this->id ? $this->id : $this->name;
}
public function render()

View File

@ -10,8 +10,6 @@ class Lever extends Component
use HasFormDimensions;
public string $id;
public function __construct(
public string $name,
public string $size = 'default',
@ -20,8 +18,9 @@ class Lever extends Component
public bool $disabled = false,
public bool $required = false,
public string $label = '',
public string $id = ''
) {
$this->id = str()->uuid()->toString();
$this->id = $this->id ? $this->id : $this->name;
}
public function render()

View File

@ -10,8 +10,6 @@ class Select extends Component
use HasFormDimensions;
public string $id;
public function __construct(
public string $name,
public string $size = 'default',
@ -20,8 +18,9 @@ class Select extends Component
public string $label = '',
public $options = [],
public bool $disabled = false,
public string $id = ''
) {
$this->id = str()->uuid()->toString();
$this->id = $this->id ? $this->id : $this->name;
}
public function render()

View File

@ -10,17 +10,16 @@ class Text extends Component
use HasFormDimensions;
public string $id;
public function __construct(
public string $name,
public string $size = 'default',
public ?string $hint = null,
public bool $required = false,
public string $label = '',
public string $type = 'text'
public string $type = 'text',
public string $id = ''
) {
$this->id = str()->uuid()->toString();
$this->id = $this->id ? $this->id : $this->name;
}
public function render()

View File

@ -19,9 +19,7 @@ class Action extends Component
public function render()
{
return <<<'HTML'
<a x-tooltip.raw="{{$slot}}" href="#" {{ $attributes }} class="inline-flex
w-6 h-5 flex items-center justify-center rounded {{ $allColors($variant) }}
">
<a x-tooltip.raw="{{$slot}}" href="#" {{ $attributes->merge(['class' => 'inline-flex w-6 h-5 flex items-center justify-center rounded '.$allColors($variant)]) }}>
<x-ui::sprite class="w-3 h-3 flex-none" :src="$icon"></x-ui::sprite>
</a>
HTML;

View File

@ -19,7 +19,7 @@ class Badge extends Component
public function render()
{
return <<<'HTML'
<button type="button" href="#" {{ $attributes }} class="h-6 px-3 space-x-2 items-center rounded-full {{ $allColors($variant) }} hidden lg:flex">
<button type="button" href="#" {{ $attributes->merge(['class' => 'h-6 px-3 space-x-2 items-center rounded-full hidden lg:flex '.$allColors($variant)]) }}>
<x-ui::sprite class="w-3 h-3 flex-none" :src="$icon"></x-ui::sprite>
<span class="text-sm">
{{$slot}}

View File

@ -24,7 +24,7 @@ class BooleanDisplay extends Component
public function render()
{
return <<<'HTML'
<div x-tooltip.raw="{{$hint}}" class="flex space-x-2 items-center group @if($dark) dark @endif">
<div x-tooltip.raw="{{$hint}}" {{ $attributes->merge(['class' => 'flex space-x-2 items-center group '.($dark ? 'dark' : '')]) }}">
<div class="border-2 rounded-full w-5 h-5 flex items-center justify-center
@if ($value) border-green-700 group-[.dark]:border-green-500
@else border-red-700 group-[.dark]:border-red-500

View File

@ -14,7 +14,7 @@ class Button extends Component
public function render()
{
return <<<'HTML'
<button type="{{$type}}" class="px-3 py-2 uppercase no-underline text-sm items-center justify-center bg-primary-700 rounded text-primary-300">
<button type="{{$type}}" {{ $attributes->merge(['class' => 'px-3 py-2 uppercase no-underline text-sm items-center justify-center bg-primary-700 rounded text-primary-300']) }}>
{{$slot}}
</button>
HTML;

View File

@ -19,7 +19,7 @@ class Menulist extends Component
public function render()
{
return <<<'HTML'
<div class="p-6 bg-gray-700 border-r border-gray-600 flex-none w-maxc flex flex-col justify-between">
<div {{$attributes->merge(['class' => 'p-6 bg-gray-700 border-r border-gray-600 flex-none w-maxc flex flex-col justify-between']) }}">
<div class="grid gap-1">
@foreach($entries as $entry)
<a href="{{$entry['url']}}" class="rounded py-1 px-3 text-gray-400 duration-200 hover:bg-gray-600 {{$activeClass($entry)}}" @if($entry['is_active']) data-active @endif>

View File

@ -3,8 +3,8 @@
echo "drop database scoutrobot;" | sudo mysql
echo "create database scoutrobot;" | sudo mysql
ssh -l stammsilva zoomyboy.de "cd /usr/share/webapps/nami_silva && docker compose exec db mysqldump -udb -p$SCOUTROBOT_DB_PASSWORD db" > db.tmp
sudo mysql scoutrobot < db.tmp
ssh -l stamm-silva zoomyboy.de "cd /usr/share/webapps/adrema_silva && docker compose exec db mysqldump -udb -p$SCOUTROBOT_DB_PASSWORD db" > db.tmp
sudo mysql adrema < db.tmp
rm db.tmp
echo 'app(\App\Form\FormSettings::class)->fill(["registerUrl" => "http://stammsilva.test/anmeldung/{slug}/register", "clearCacheUrl" => "http://stammsilva.test/adrema/clear-cache"])->save();' | php artisan tinker

View File

@ -19,7 +19,8 @@ class UserSeeder extends Seeder
'email' => env('USER_EMAIL', 'admin@example.com'),
'email_verified_at' => now(),
'password' => Hash::make(env('USER_PASSWORD', 'admin')),
'name' => 'Adrema Benutzer',
'firstname' => 'Adrema',
'lastname' => 'Benutzer',
]);
}
}

View File

@ -104,6 +104,8 @@ services:
meilisearch:
image: getmeili/meilisearch:v1.6
ports:
- "7700:7700"
volumes:
- ./data/meilisearch:/meili_data
env_file:

View File

@ -2,14 +2,107 @@
namespace Modules\Contribution\Components;
use App\Contribution\ContributionFactory;
use App\Country;
use Illuminate\Support\Collection;
use App\Member\Member;
use Livewire\Component;
class FillList extends Component
{
public string $eventName = '';
public Carbon $dateFrom;
public Carbon $dateUntil;
public int $country;
public $members = [];
public Collection $countries;
public string $search = '';
public Collection $compilers;
public Collection $memberResults;
public function mount(): void
{
$this->compilers = app(ContributionFactory::class)->compilerSelect();
$this->countries = Country::select('name', 'id')->get()->toBase();
$this->clearSearch();
}
/** @todo implement compilation of document */
public function submit(): void
{
}
public function updatedSearch(): void
{
$this->memberResults = Member::search($this->search, fn ($engine, $query, $options) => $engine->search($query, [
...$options,
'filter' => ['birthday IS NOT NULL', 'address IS NOT EMPTY']
]))->get()->toBase();
}
public function onSubmitFirstMemberResult(): void
{
if (count($this->memberResults) === 0) {
$this->clearSearch();
return;
}
$this->onSubmitMemberResult($this->memberResults[0]->id);
}
public function onSubmitMemberResult(int $memberId): void
{
if (in_array($memberId, $this->members)) {
$this->members = array_values(array_filter($this->members, fn ($m) => $m !== $memberId));
} else {
$this->members[] = $memberId;
}
$this->js('document.querySelector("#search_input").focus()');
$this->clearSearch();
}
public function clearSearch(): void
{
$this->search = '';
$this->memberResults = collect([]);
}
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-2" label="Veranstaltungs-Name" required></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="date_until" wire:model="dateUntil" type="date" label="Datum bis" required></x-form::text>
<x-form::text name="zipLocation" v-model="values.zipLocation" label="PLZ / Ort" required></x-form::text>
<x-form::select name="country" wire:model="country" :options="$countries" label="Land" required></x-form::select>
<x-form::select name="compiler" wire:model="compiler" :options="$compilers" label="Formular" required></x-form::select>
<x-ui::box class="col-span-2" title="Mitglieder finden">
<x-form::text name="search_text" id="search_input" wire:model.live="search" class="col-span-2" label="Suchen …" size="sm" wire:keydown.enter="onSubmitFirstMemberResult"></x-form::text>
<div class="mt-2 grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2 col-span-2">
@foreach($memberResults as $member)
<x-form::lever
id="members-{{$member->id}}"
:wire:key="$member->id"
wire:model="members"
:label="$member->fullname"
name="members"
:value="$member->id"
size="sm"
wire:keydown.enter="onSubmitMemberResult({{$member->id}})"
></x-form::lever>
@endforeach
</div>
</x-ui::box>
<x-ui::button class="col-span-2" type="submit">Formular erstellen</x-ui::button>
</form>
</x-page::layout>
HTML;
}

View File

@ -12,7 +12,7 @@ class ContributionRequestFactory extends RequestFactory
{
public function definition(): array
{
$compilers = collect(app(ContributionFactory::class)->compilerSelect())->pluck('class');
$compilers = collect(app(ContributionFactory::class)->compilerSelect())->pluck('id');
return [
'country' => Country::factory()->create()->id,