Select::make('location_id')
->label(__('manage.location'))
->options(fn() => $this->organisation->locations->pluck('label', 'id'))
->createOptionForm([
SingleLayout::make()->schema([
TextInput::make('name')->label(__('manage.name_location'))->required(),
TextInput::make('address')->label(__('manage.address')),
TextInput::make('zipcode')->label(__('manage.zipcode')),
TextInput::make('city')->label(__('manage.city'))->required(),
])
])->reactive()->createOptionUsing(function($data, Forms\Set $set){
$location = new Location();
$location->organisation_id = $this->organisation->id;
$location->fill($data);
$location->save();
$set('location_id', $location->id);
return $location->id;
}),
Select::make('location_id')
->label(__('manage.location'))
->options(fn() => $this->organisation->locations->pluck('label', 'id'))
->createOptionForm([
SingleLayout::make()->schema([
TextInput::make('name')->label(__('manage.name_location'))->required(),
TextInput::make('address')->label(__('manage.address')),
TextInput::make('zipcode')->label(__('manage.zipcode')),
TextInput::make('city')->label(__('manage.city'))->required(),
])
])->reactive()->createOptionUsing(function($data, Forms\Set $set){
$location = new Location();
$location->organisation_id = $this->organisation->id;
$location->fill($data);
$location->save();
$set('location_id', $location->id);
return $location->id;
}),