ismaeltj9
ismaeltj9
FFilament
Created by ismaeltj9 on 10/24/2023 in #❓┊help
Bulk action to Get Selected Material and Create New Order With These Materials
Hello, I created this bulk action to get material selected and pass to a new order: Tables\Actions\BulkAction::make('Create Order') ->action(function (Collection $records) { redirect(OrderResource::getUrl('create'), [$records]); }), This is my form where I have a repeater to prefill with the material collection, but I have no ideia how to do: public static function form(Form $form): Form { return $form ->schema([ TextInput::make('number') ->required() ->maxLength(32), TextInput::make('total_price') ->numeric(), Select::make('status') ->options([ 'new' => 'Novo', 'processing' => 'Processado', 'shipped' => 'Enviado', 'delivered' => 'Entregue', 'cancelled' => 'Cancelado', ]) ->required(), Repeater::make('items') ->relationship() ->schema([ Select::make('material_id') ->relationship('material', 'name') ->columnSpan([ 'md' => 3, ]) ->required(), TextInput::make('qty') ->columnSpan([ 'md' => 2, ]) ->required(), TextInput::make('unit_price') ->disabled() ->dehydrated() ->columnSpan([ 'md' => 3, ]) ->required(), ]) ->defaultItems(1) ->columnSpan('full') ]); }
5 replies