diff --git a/app/Contribution/Actions/FormAction.php b/app/Contribution/Actions/FormAction.php deleted file mode 100644 index e7ef6f76..00000000 --- a/app/Contribution/Actions/FormAction.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ - public function handle(): array - { - return [ - 'countries' => Country::select('name', 'id')->get(), - 'data' => [ - 'country' => Country::firstWhere('name', 'Deutschland')->id, - ], - 'compilers' => app(ContributionFactory::class)->compilerSelect(), - ]; - } - - public function asController(): Response - { - session()->put('menu', 'contribution'); - session()->put('title', 'Zuschüsse'); - - return Inertia::render('contribution/VIndex', $this->handle()); - } -} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 2ccc17e8..3c77eac0 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -32,6 +32,10 @@ class AppServiceProvider extends ServiceProvider Blade::componentNamespace('App\\View\\Mail', 'mail-view'); Model::preventLazyLoading(!app()->isProduction()); + + Blade::directive('rawAttribute', function ($expression) { + return 'has("' . $expression . '.raw")): ?> get("' . $expression . '.raw"); ?> get("' . $expression . '"))."`"; ?> '; + }); } /** diff --git a/app/View/Form/Label.php b/app/View/Form/Label.php index 3a3c1bf9..c87bb8aa 100644 --- a/app/View/Form/Label.php +++ b/app/View/Form/Label.php @@ -17,7 +17,6 @@ class Label extends Component ) { } - public function render() { return <<<'HTML' @@ -26,6 +25,7 @@ class Label extends Component + {{$attributes}} HTML; } diff --git a/app/View/Form/Text.php b/app/View/Form/Text.php index 946eab4d..97de0348 100644 --- a/app/View/Form/Text.php +++ b/app/View/Form/Text.php @@ -3,14 +3,14 @@ namespace App\View\Form; use App\View\Traits\HasFormDimensions; +use App\View\Traits\RendersAlpine; use Illuminate\View\Component; class Text extends Component { use HasFormDimensions; - - public string $id; + use RendersAlpine; public function __construct( public string $name, @@ -18,17 +18,23 @@ class Text extends Component 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(); + if (!$id) { + $this->id = str()->uuid()->toString(); + } } public function render() { return <<<'HTML' -