Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
afsakar committed Aug 9, 2024
1 parent 869e895 commit fe5106a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"pest_2.35.0","defects":[],"times":{"P\\Tests\\ExampleTest::__pest_evaluable_it_can_test":0.019,"P\\Tests\\ArchTest::__pest_evaluable_it_will_not_use_debugging_functions":0.599}}
{"version":"pest_2.35.0","defects":[],"times":{"P\\Tests\\ExampleTest::__pest_evaluable_it_can_test":0.001,"P\\Tests\\ArchTest::__pest_evaluable_it_will_not_use_debugging_functions":0.143}}
10 changes: 4 additions & 6 deletions src/Fields/FieldBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ protected static function makeSections($builder): Forms\Components\Group
$newSections = [];
$fields = [];

$grid = 2;

foreach ($sections as $section) {

foreach ($section->fields as $field) {
Expand All @@ -45,10 +43,10 @@ protected static function makeSections($builder): Forms\Components\Group
->columns([
'xs' => 1,
'sm' => 1,
'md' => $section->columns ?? $grid,
'lg' => $section->columns ?? $grid,
'xl' => $section->columns ?? $grid,
'default' => $section->columns ?? $grid,
'md' => $section->columns ?? 1,
'lg' => $section->columns ?? 1,
'xl' => $section->columns ?? 1,
'default' => 1,
])
->schema([
self::placeholder($section->title),
Expand Down
23 changes: 8 additions & 15 deletions src/Filament/Forms/FormPicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,17 @@

use Afsakar\FormMaker\Models\FormBuilder;
use Filament\Forms;
use Filament\Forms\Components\Concerns\EntanglesStateWithSingularRelationship;

class FormPicker extends Forms\Components\Group
class FormPicker extends Forms\Components\Select
{
use EntanglesStateWithSingularRelationship;
use Forms\Components\Concerns\CanBeCollapsed;
use Forms\Components\Concerns\CanBeValidated;

protected function setUp(): void
{
$this->schema([
Forms\Components\Select::make('form_builder_id')
->label('Form Seç')
->native(false)
->searchable()
->preload()
->options(fn () => FormBuilder::pluck('name', 'id')->toArray())
->required(),
]);
parent::setUp();

$this->native(false);
$this->searchable();
$this->preload();
$this->options(fn () => FormBuilder::pluck('name', 'id')->toArray());
$this->required();
}
}
2 changes: 1 addition & 1 deletion src/Filament/Resources/FormBuilderCollectionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function form(Form $form): Form
'list' => 'Liste',
'model' => 'Model',
])
->default('list'),
->required(),
Forms\Components\Select::make('model')
->label('Model')
->visible(fn ($get) => $get('type') === 'model')
Expand Down
2 changes: 1 addition & 1 deletion src/Models/FormBuilderCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FormBuilderCollection extends Model
*/
protected $fillable = [
'name',
'types',
'type',
'values',
'model',
];
Expand Down

0 comments on commit fe5106a

Please sign in to comment.