Header in a Card Form builder
Is it possible to add a header to a card tag by enclosing a code segment?
Is it possible to add a title to highlight this segment?
Card::make()
->schema([
Select::make('parameter.with_date')
->required()
->label('Añadir rango de fechas')
->options([
'no' => 'No',
'si' => 'Si',
])->reactive(),
DateTimePicker::make('parameter.start_date')->label('Rango de Fecha inicial')->required()->hidden(fn(callable $get) => $get('parameter.with_date') == '' || $get('parameter.with_date') == 'no'),
DateTimePicker::make('parameter.end_date')->label('Rango de Fecha final')->required()->hidden(fn(callable $get) => $get('parameter.with_date') == '' || $get('parameter.with_date') == 'no'),
Select::make('parameter.with_dinamic_input')
->required()
->label('Seleccionar campo dinamico?')
->options([
'no' => 'No',
'si' => 'Si',
])->reactive()->hidden(fn(callable $get) => $get('parameter.with_date') == '' || $get('parameter.with_date') == 'no'),
Select::make('parameter.with_dinamic_input_target')
->label('Campo de texto')
->required()
->options(function($livewire){
$form = ModelForm::find($livewire->ownerRecord->id);
if ($form) {
$inputs = $form->inputs;
return array_column(array_filter($inputs, function ($input) {
return $input['type'] == "Date";
}), 'title', 'id');
}
})
->reactive()->hidden(fn(callable $get) => $get('parameter.with_dinamic_input') == '' || $get('parameter.with_dinamic_input') == 'no'),
])->columns(3),
Card::make()
->schema([
Select::make('parameter.with_date')
->required()
->label('Añadir rango de fechas')
->options([
'no' => 'No',
'si' => 'Si',
])->reactive(),
DateTimePicker::make('parameter.start_date')->label('Rango de Fecha inicial')->required()->hidden(fn(callable $get) => $get('parameter.with_date') == '' || $get('parameter.with_date') == 'no'),
DateTimePicker::make('parameter.end_date')->label('Rango de Fecha final')->required()->hidden(fn(callable $get) => $get('parameter.with_date') == '' || $get('parameter.with_date') == 'no'),
Select::make('parameter.with_dinamic_input')
->required()
->label('Seleccionar campo dinamico?')
->options([
'no' => 'No',
'si' => 'Si',
])->reactive()->hidden(fn(callable $get) => $get('parameter.with_date') == '' || $get('parameter.with_date') == 'no'),
Select::make('parameter.with_dinamic_input_target')
->label('Campo de texto')
->required()
->options(function($livewire){
$form = ModelForm::find($livewire->ownerRecord->id);
if ($form) {
$inputs = $form->inputs;
return array_column(array_filter($inputs, function ($input) {
return $input['type'] == "Date";
}), 'title', 'id');
}
})
->reactive()->hidden(fn(callable $get) => $get('parameter.with_dinamic_input') == '' || $get('parameter.with_dinamic_input') == 'no'),
])->columns(3),
0 Replies