From 6dddb31732ac7006a868235018bdb35b3c452d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Thu, 23 Nov 2023 11:27:01 +0000 Subject: [PATCH] fix: make fields optional (#127) --- .../Resources/OrganisationResource.php | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/app/Filament/Resources/OrganisationResource.php b/app/Filament/Resources/OrganisationResource.php index 27faa06..9114188 100644 --- a/app/Filament/Resources/OrganisationResource.php +++ b/app/Filament/Resources/OrganisationResource.php @@ -94,18 +94,15 @@ public static function form(Form $form): Form ->placeholder('2006') ->numeric() ->minValue(1900) - ->maxValue(today()->year) - ->required(), + ->maxValue(today()->year), TextInput::make('cif') ->label(__('organisation.field.cif')) - ->rule(new ValidCIF) - ->required(), + ->rule(new ValidCIF), TextInput::make('registration_number') ->label(__('organisation.field.registration_number')) - ->maxLength(50) - ->required(), + ->maxLength(50), TextInput::make('email') ->label(__('organisation.field.email_organisation')) @@ -124,8 +121,7 @@ public static function form(Form $form): Form ->maxLength(1000) ->rows(2) ->helperText(__('organisation.help.description')) - ->columnSpanFull() - ->required(), + ->columnSpanFull(), ]), Section::make(__('organisation.field.contact_person')) @@ -133,31 +129,26 @@ public static function form(Form $form): Form ->schema([ TextInput::make('contact_person.first_name') ->label(__('organisation.field.contact_person_first_name')) - ->maxLength(100) - ->required(), + ->maxLength(100), TextInput::make('contact_person.last_name') ->label(__('organisation.field.contact_person_last_name')) - ->maxLength(100) - ->required(), + ->maxLength(100), TextInput::make('contact_person.role') ->label(__('organisation.field.role')) ->columnSpanFull() - ->maxLength(200) - ->required(), + ->maxLength(200), TextInput::make('contact_person.email') ->label(__('organisation.field.email')) ->maxLength(200) - ->email() - ->required(), + ->email(), TextInput::make('contact_person.phone') ->label(__('organisation.field.phone')) ->maxLength(14) - ->tel() - ->required(), + ->tel(), ]), ]), @@ -183,8 +174,7 @@ public static function form(Form $form): Form TextInput::make('address') ->label(__('organisation.field.address')) ->maxLength(200) - ->columnSpanFull() - ->required(), + ->columnSpanFull(), ]), Section::make(__('organisation.field.other_information')) @@ -244,7 +234,6 @@ public static function form(Form $form): Form Section::make(__('organisation.section.branches')) ->schema([ Toggle::make('has_branches') - ->required() ->label(__('organisation.field.has_branches')) ->reactive(), @@ -293,8 +282,7 @@ public static function form(Form $form): Form Section::make(__('organisation.section.other_information')) ->schema([ Toggle::make('social_services_accreditation') - ->label(__('organisation.field.social_services_accreditation')) - ->required(), + ->label(__('organisation.field.social_services_accreditation')), ]), ]); }