diff --git a/app/Http/Livewire/Collaborators/Associates/Edit.php b/app/Http/Livewire/Collaborators/Associates/Edit.php new file mode 100644 index 0000000..f3f895e --- /dev/null +++ b/app/Http/Livewire/Collaborators/Associates/Edit.php @@ -0,0 +1,103 @@ +associate = $associate; + $this->name = $associate->name; + $this->birthday = $associate->birthday->format('d/m/Y'); + $this->document = $associate->document; + $this->address = $associate->address; + $this->profile = $associate->profile; + $this->email = $associate->email; + $this->discussion = $associate->discussion; + $this->contribution = $associate->contribution; + } + + public function save() + { + $this->validate([ + 'address.city' => ['required', 'string'], + 'address.complement' => ['nullable', 'string'], + 'address.country' => ['required', 'string'], + 'address.neighbourhood' => ['required', 'string'], + 'address.number' => ['required', 'string'], + 'address.postcode' => ['required', 'string'], + 'address.state' => ['required', 'string'], + 'address.street' => ['required', 'string'], + 'birthday' => ['required', 'date_format:d/m/Y'], + 'contribution' => ['required', 'numeric'], + 'discussion' => ['required', 'string', 'in:all,daily,occasional'], + 'document.number' => ['required', 'string'], + 'document.type' => ['required', 'string', 'in:cpf,identity,passport'], + 'email' => ['required', 'email', Rule::unique('associates')->ignore($this->associate->id)], + 'name' => ['required'], + 'profile.bike_activities' => ['nullable', 'string'], + 'profile.bike_use' => ['nullable', 'string'], + 'profile.comments' => ['nullable', 'string'], + 'profile.expectation' => ['nullable', 'string'], + 'profile.gender' => ['required', 'string', 'in:male,female,other'], + 'profile.occupation' => ['required', 'string'], + 'profile.org_participation' => ['nullable', 'string'], + 'profile.phone' => ['required', 'string'], + 'profile.scholarity' => ['required', 'string', 'in:primary-school,high-school,bachelor,master,phd'], + 'profile.secondary_emails' => ['nullable', 'string'], + 'profile.social' => ['nullable', 'string'], + 'profile.ucb_comments' => ['nullable', 'string'], + 'profile.website' => ['nullable', 'string'], + ]); + + $this->associate->update([ + 'address' => $this->address, + 'birthday' => Carbon::createFromFormat('d/m/Y', $this->birthday), + 'contribution' => $this->contribution, + 'discussion' => $this->discussion, + 'document' => $this->document, + 'email' => $this->email, + 'name' => $this->name, + 'profile' => $this->profile, + ]); + + session()->flash('notify-saved'); + } + + public function render() + { + return view('livewire.collaborators.associates.edit'); + } +} diff --git a/resources/lang/pt-BR.json b/resources/lang/pt-BR.json index 7131c2b..138f48b 100644 --- a/resources/lang/pt-BR.json +++ b/resources/lang/pt-BR.json @@ -1,5 +1,7 @@ { "Search:": "Buscar:", "Show": "Mostrar", - "entries": "registros" + "entries": "registros", + "Save": "Salvar", + "Saved": "Salvo" } diff --git a/resources/lang/pt-BR/associates.php b/resources/lang/pt-BR/associates.php index a461557..a58a2fa 100644 --- a/resources/lang/pt-BR/associates.php +++ b/resources/lang/pt-BR/associates.php @@ -2,6 +2,9 @@ return [ 'model' => 'Associados', + 'index' => 'Índice', + 'show' => 'Dados do associado', + 'edit' => 'Editar associado', 'attributes' => [ 'category' => 'Categoria', 'nature' => 'Natureza', diff --git a/resources/svg/breadcrumb-separator.svg b/resources/svg/breadcrumb-separator.svg new file mode 100644 index 0000000..998f18e --- /dev/null +++ b/resources/svg/breadcrumb-separator.svg @@ -0,0 +1 @@ + diff --git a/resources/views/livewire/associates/auth/register/individual.blade.php b/resources/views/livewire/associates/auth/register/individual.blade.php index ff77bea..45c8e1f 100644 --- a/resources/views/livewire/associates/auth/register/individual.blade.php +++ b/resources/views/livewire/associates/auth/register/individual.blade.php @@ -18,250 +18,7 @@
diff --git a/resources/views/livewire/associates/partials/forms/individual.blade.php b/resources/views/livewire/associates/partials/forms/individual.blade.php new file mode 100644 index 0000000..0352719 --- /dev/null +++ b/resources/views/livewire/associates/partials/forms/individual.blade.php @@ -0,0 +1,245 @@ ++ Conte-nos um pouco sobre você. +
+ ++ Endereço e meios de comunicação digitais. +
+ ++ Endereço e meios de comunicação digitais. +
+ +