-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip: donor form] * feat: donor form * fix: removing donor message typo
- Loading branch information
1 parent
aa8575f
commit 4ad7d5f
Showing
8 changed files
with
135 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire; | ||
|
||
use Filament\Forms; | ||
use Filament\Forms\Concerns\InteractsWithForms; | ||
use Filament\Forms\Contracts\HasForms; | ||
use Filament\Notifications\Notification; | ||
use Livewire\Component; | ||
|
||
class DonorForm extends Component implements HasForms | ||
{ | ||
use InteractsWithForms; | ||
|
||
public array $donation = [ | ||
'name' => '', | ||
'email' => '', | ||
'full_address' => '', | ||
'job_title' => 'Developer/QA/PM', | ||
'social_type' => '', | ||
'social_url' => 'https://twitter.com/danielhe4rt' | ||
]; | ||
|
||
public function render() | ||
{ | ||
return view('livewire.donor-form'); | ||
} | ||
|
||
public function mount() | ||
{ | ||
$this->form->fill($this->donation); | ||
} | ||
|
||
protected function getFormSchema(): array | ||
{ | ||
return [ | ||
Forms\Components\TextInput::make('name') | ||
->label('Nome e Sobrenome') | ||
->string() | ||
->required(), | ||
Forms\Components\TextInput::make('email') | ||
->label('Seu Email') | ||
->email() | ||
->required(), | ||
Forms\Components\TextInput::make('full_address') | ||
->label('Local de Doação') | ||
->placeholder('Cachoeira Paulista - SP / BR') | ||
->required(), | ||
Forms\Components\TextInput::make('job_title') | ||
->label('Cargo/Titulo') | ||
->placeholder('Desenvolvedor / Estudante') | ||
->required(), | ||
Forms\Components\Select::make('social_type') | ||
->options([ | ||
'twitter' => 'Twitter', | ||
'instagram' => 'Instagram', | ||
'github' => 'Github', | ||
'none' => 'Não uso rede social' | ||
]), | ||
Forms\Components\TextInput::make('social_url') | ||
->placeholder('https://twitter.com/danielhe4rt') | ||
->url(), | ||
]; | ||
} | ||
|
||
public function submit(): void | ||
{ | ||
Notification::make() | ||
->title('Obrigado pela doação!') | ||
->body('Iremos revisar sua submissão e em breve estará em nosso site!') | ||
->success() | ||
->send(); | ||
} | ||
|
||
public function getFormStatePath(): string | ||
{ | ||
return 'donation'; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="w-full"> | ||
<form class="h-auto" wire:submit.prevent="submit"> | ||
{{ $this->form }} | ||
|
||
<button | ||
class="p-1 w-full font-heading font-semibold text-xs text-gray-900 uppercase tracking-px overflow-hidden rounded-md"> | ||
<div class="relative p-5 px-11 bg-gradient-green overflow-hidden rounded-md"> | ||
<div | ||
class="absolute top-0 left-0 transform -translate-y-full group-hover:-translate-y-0 h-full w-full bg-white transition ease-in-out duration-500"></div> | ||
<p class="relative z-10">Send message</p> | ||
</div> | ||
</button> | ||
</form> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters