From b13e5e66cef0192dd531f9838c49c51d62f18b57 Mon Sep 17 00:00:00 2001 From: Alexander Gabriel Date: Fri, 20 Feb 2026 22:53:10 +0000 Subject: [PATCH] =?UTF-8?q?bestellformular=20=C3=BCbersetzt=20und=20action?= =?UTF-8?q?s=20ins=20formular=20eingebaut,=20darstellung=20ver=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/Orders/Schemas/OrderForm.php | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/app/Filament/Resources/Orders/Schemas/OrderForm.php b/app/Filament/Resources/Orders/Schemas/OrderForm.php index 7cc8fcf..063bb3f 100644 --- a/app/Filament/Resources/Orders/Schemas/OrderForm.php +++ b/app/Filament/Resources/Orders/Schemas/OrderForm.php @@ -9,6 +9,7 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Schemas\Schema; use Filament\Support\Icons\Heroicon; +use Illuminate\Database\Eloquent\Model; class OrderForm { @@ -17,20 +18,53 @@ class OrderForm return $schema ->components([ TextInput::make('name') - ->required(), - TextInput::make('url') - ->suffixIcon(Heroicon::GlobeAlt) - ->url(), + ->label('Name')->inlineLabel() + ->required() + ->columnSpan(1), TextInput::make('count') + ->label('Anzahl')->inlineLabel() ->required() ->numeric() ->default(1), - Select::make("orderstatus_id")->relationship("orderstatus", "name")->visibleOn(["edit"]), - DateTimePicker::make('orderdatetime')->visibleOn(["edit", "view"])->disabled(), + TextInput::make('url') + ->label('URL')->inlineLabel() + ->suffixIcon(Heroicon::GlobeAlt) + ->url() + ->columnSpan(1), Select::make('user_id') + ->label('Bestellt von')->inlineLabel() ->relationship("user", "name") ->required() ->default(filament()->auth()->user()->id), + Select::make("orderstatus_id") + ->label('Bestellstatus')->inlineLabel() + ->relationship("orderstatus", "name") + ->visibleOn(["edit"]) + ->prefixActions([ + Action::make('bestellt_single') + ->icon(Heroicon::ShoppingCart)->label("Bestellt")->action(function(Model $record) { + $orderstatusBestellt = Orderstatus::where("name", "bestellt")->first(); + $record->orderstatus_id = $orderstatusBestellt->id; + $record->save(); + })->visible(function(Model $record) {$orderstatusErfasst = Orderstatus::where("name", "erfasst")->first();return ($orderstatusErfasst->id == $record->orderstatus_id);}), + Action::make('angekommen_single') + ->icon(Heroicon::BuildingOffice)->label("Angekommen")->action(function(Model $record) { + $orderstatusAngekommen = Orderstatus::where("name", "angekommen")->first(); + $record->orderstatus_id = $orderstatusAngekommen->id; + $record->save(); + })->visible(function(Model $record) {$orderstatusBestellt = Orderstatus::where("name", "bestellt")->first();return ($orderstatusBestellt->id == $record->orderstatus_id);}), + Action::make('genommen_single') + ->icon(Heroicon::Check)->label("Genommen")->action(function(Model $record) { + $orderstatusGenommen = Orderstatus::where("name", "genommen")->first(); + $record->orderstatus_id = $orderstatusGenommen->id; + $record->save(); + })->visible(function(Model $record) {$orderstatusAngekommen = Orderstatus::where("name", "angekommen")->first();return ($orderstatusAngekommen->id == $record->orderstatus_id);}), + Action::make("url_oeffnen")->icon(Heroicon::Link)->label("URL öffnen")->url(function (Model $record) { return $record->url;}, true), + ]), + DateTimePicker::make('orderdatetime') + ->label('Bestellzeitpunkt')->inlineLabel() + ->visibleOn(["edit", "view"]) + ->disabled(), ])->columns(1); } }