diff --git a/app/Associate.php b/app/Associate.php index 27427a9..f08779a 100644 --- a/app/Associate.php +++ b/app/Associate.php @@ -56,13 +56,29 @@ class Associate extends Authenticatable // /** - * Get the associate's category + * Get the associate's category. */ public function category() { return $this->belongsTo(AssociateCategory::class, 'associate_category_id'); } + /** + * Get the associate's nature. + */ + public function nature() + { + return $this->belongsTo(AssociateNature::class, 'associate_nature_id'); + } + + /** + * Get the associate's type. + */ + public function type() + { + return $this->belongsTo(AssociateType::class, 'associate_type_id'); + } + // // // ===================================================================== diff --git a/app/AssociateCategory.php b/app/AssociateCategory.php index 17cac60..20e6f78 100644 --- a/app/AssociateCategory.php +++ b/app/AssociateCategory.php @@ -10,21 +10,9 @@ class AssociateCategory extends Model use Sushi; protected $rows = [ - [ - 'key' => 'individual', - 'name' => 'Associado Indivíduo', - ], - [ - 'key' => 'supporting-institution', - 'name' => 'Associada Instituição Apoiadora', - ], - [ - 'key' => 'acting-institution', - 'name' => 'Associada Instituição Atuante', - ], - [ - 'key' => 'company', - 'name' => 'Associada Empresa Apoiadora', - ], + ['key' => 'individual'], + ['key' => 'supporting-institution'], + ['key' => 'acting-institution'], + ['key' => 'company'], ]; } diff --git a/app/Http/Livewire/Collaborators/Associates/Show.php b/app/Http/Livewire/Collaborators/Associates/Show.php new file mode 100644 index 0000000..6c545d6 --- /dev/null +++ b/app/Http/Livewire/Collaborators/Associates/Show.php @@ -0,0 +1,27 @@ +associate = $associate; + } + + public function render() + { + return view('livewire.collaborators.associates.show'); + } +} diff --git a/resources/lang/pt-BR.json b/resources/lang/pt-BR.json new file mode 100644 index 0000000..7131c2b --- /dev/null +++ b/resources/lang/pt-BR.json @@ -0,0 +1,5 @@ +{ + "Search:": "Buscar:", + "Show": "Mostrar", + "entries": "registros" +} diff --git a/resources/lang/pt-BR/associate_natures.php b/resources/lang/pt-BR/associate_natures.php new file mode 100644 index 0000000..8314f11 --- /dev/null +++ b/resources/lang/pt-BR/associate_natures.php @@ -0,0 +1,7 @@ + 'Pessoa Física', + 'informal' => 'Coletivo Informal', + 'company' => 'Pessoa Jurídica', +]; diff --git a/resources/lang/pt-BR/associate_types.php b/resources/lang/pt-BR/associate_types.php new file mode 100644 index 0000000..7129d73 --- /dev/null +++ b/resources/lang/pt-BR/associate_types.php @@ -0,0 +1,8 @@ + 'Indivíduo', + 'collective' => 'Coletivo Informal', + 'association' => 'Associação Formal', + 'company' => 'Empresa Privada', +]; diff --git a/resources/lang/pt-BR/associates.php b/resources/lang/pt-BR/associates.php index e6af50d..a461557 100644 --- a/resources/lang/pt-BR/associates.php +++ b/resources/lang/pt-BR/associates.php @@ -4,6 +4,8 @@ return [ 'model' => 'Associados', 'attributes' => [ 'category' => 'Categoria', + 'nature' => 'Natureza', + 'type' => 'Tipo', 'name' => 'Nome completo', 'birthday' => 'Data de nascimento', 'document' => [ diff --git a/resources/views/components/input/select.blade.php b/resources/views/components/input/select.blade.php index b8fa48b..b4f0180 100644 --- a/resources/views/components/input/select.blade.php +++ b/resources/views/components/input/select.blade.php @@ -2,11 +2,17 @@ 'state' => null, ]) +@php + $class = 'block w-full px-3 py-2 border border-gray-300 rounded-md placeholder-gray-400 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:text-sm sm:leading-5'; + + if ($state === false) { + $class .= ' border-red-300 text-red-900 placeholder-red-300 focus:border-red-300 focus:shadow-outline-red'; + } +@endphp +
diff --git a/resources/views/livewire/collaborators/associates/index.blade.php b/resources/views/livewire/collaborators/associates/index.blade.php index 9f70566..2d3a995 100644 --- a/resources/views/livewire/collaborators/associates/index.blade.php +++ b/resources/views/livewire/collaborators/associates/index.blade.php @@ -4,16 +4,40 @@ {{ __('associates.model') }} -
+
- - - - - - + + +
@@ -42,10 +66,10 @@ @foreach ($associates as $associate) - + - -
+ diff --git a/resources/views/livewire/collaborators/associates/show.blade.php b/resources/views/livewire/collaborators/associates/show.blade.php new file mode 100644 index 0000000..ab215f8 --- /dev/null +++ b/resources/views/livewire/collaborators/associates/show.blade.php @@ -0,0 +1,327 @@ +
+
+ +
+ +
+ +
+ +
+

+ {{ $associate->name }} +

+

+ {{ $associate->email }} +

+
+ +
+ +
+
+ +
+
+ ID +
+
+ {{ $associate->id }} +
+
+ +
+
+ {{ __('associates.attributes.category') }} +
+
+ {{ __('associate_categories.' . $associate->category->key) }} +
+
+ +
+
+ {{ __('associates.attributes.nature') }} +
+
+ {{ __('associate_natures.' . $associate->nature->key) }} +
+
+ +
+
+ {{ __('associates.attributes.type') }} +
+
+ {{ __('associate_types.' . $associate->type->key) }} +
+
+ +
+
+ {{ __('associates.attributes.nature') }} +
+
+ {{ $associate->birthday->format('d/m/Y') }} +
+
+ +
+
+ {{ __('associates.attributes.name') }} +
+
+ {{ $associate->name }} +
+
+ +
+
+ {{ __('associates.attributes.birthday') }} +
+
+ {{ $associate->birthday->format('d/m/Y') }} +
+
+ +
+
+ {{ __('associates.attributes.profile.gender') }} +
+
+ {{ $associate->profile['gender'] }} +
+
+ +
+
+ {{ __('associates.attributes.document.type') }} +
+
+ {{ $associate->document['type'] }} +
+
+ +
+
+ {{ __('associates.attributes.document.number') }} +
+
+ {{ $associate->document['number'] }} +
+
+ +
+
+ {{ __('associates.attributes.profile.scholarity') }} +
+
+ {{ $associate->profile['scholarity'] }} +
+
+ +
+
+ {{ __('associates.attributes.address.country') }} +
+
+ {{ $associate->address['country'] }} +
+
+ +
+
+ {{ __('associates.attributes.address.postcode') }} +
+
+ {{ $associate->address['postcode'] }} +
+
+ +
+
+ {{ __('associates.attributes.address.street') }} +
+
+ {{ $associate->address['street'] }} +
+
+ +
+
+ {{ __('associates.attributes.address.number') }} +
+
+ {{ $associate->address['number'] }} +
+
+ +
+
+ {{ __('associates.attributes.address.complement') }} +
+
+ {{ $associate->address['complement'] }} +
+
+ +
+
+ {{ __('associates.attributes.address.neighbourhood') }} +
+
+ {{ $associate->address['neighbourhood'] }} +
+
+ +
+
+ {{ __('associates.attributes.address.city') }} +
+
+ {{ $associate->address['city'] }} +
+
+ +
+
+ {{ __('associates.attributes.address.state') }} +
+
+ {{ $associate->address['state'] }} +
+
+ +
+
+ {{ __('associates.attributes.profile.phone') }} +
+
+ {{ $associate->profile['phone'] }} +
+
+ +
+
+ {{ __('associates.attributes.email') }} +
+
+ {{ $associate->email }} +
+
+ +
+
+ {{ __('associates.attributes.profile.secondary_emails') }} +
+
+ {{ $associate->profile['secondary_emails'] }} +
+
+ +
+
+ {{ __('associates.attributes.profile.website') }} +
+
+ {{ $associate->profile['website'] }} +
+
+ +
+
+ {{ __('associates.attributes.profile.social') }} +
+
+ {{ $associate->profile['social'] }} +
+
+ +
+
+ {{ __('associates.attributes.discussion') }} +
+
+ {{ $associate->discussion }} +
+
+ +
+
+ {{ __('associates.attributes.profile.expectation') }} +
+
+ {{ $associate->profile['expectation'] }} +
+
+ +
+
+ {{ __('associates.attributes.profile.bike_use') }} +
+
+ {{ $associate->profile['bike_use'] }} +
+
+ +
+
+ {{ __('associates.attributes.profile.org_participation') }} +
+
+ {{ $associate->profile['org_participation'] }} +
+
+ +
+
+ {{ __('associates.attributes.profile.bike_activities') }} +
+
+ {{ $associate->profile['bike_activities'] }} +
+
+ +
+
+ {{ __('associates.attributes.contribution') }} +
+
+
    +
  • +
    + + + + + resume_back_end_developer.pdf + +
    + +
  • +
  • +
    + + + + + coverletter_back_end_developer.pdf + +
    + +
  • +
+
+
+
+
+
+
diff --git a/routes/web.php b/routes/web.php index ede8fb2..422e327 100644 --- a/routes/web.php +++ b/routes/web.php @@ -43,6 +43,10 @@ Route::prefix('admin')->name('collaborators.')->group(function () { Route::livewire('associates', 'collaborators.associates.index') ->layout('layouts.collaborators') ->name('associates.index'); + + Route::livewire('associates/{associate}', 'collaborators.associates.show') + ->layout('layouts.collaborators') + ->name('associates.show'); }); }); diff --git a/tests/Feature/Collaborators/Associates/ShowTest.php b/tests/Feature/Collaborators/Associates/ShowTest.php new file mode 100644 index 0000000..2ea0eeb --- /dev/null +++ b/tests/Feature/Collaborators/Associates/ShowTest.php @@ -0,0 +1,43 @@ +create(); + $this->be($collaborator, 'collaborators'); + + $associate = factory(Associate::class)->create(); + + $this->get(route('collaborators.associates.show', compact('associate'))) + ->assertSuccessful() + ->assertSeeLivewire('collaborators.associates.show'); + } + + /** @test */ + public function show_page_displays_correct_associate_data() + { + $collaborator = factory(Collaborator::class)->create(); + $this->be($collaborator, 'collaborators'); + + $associate = factory(Associate::class)->create(['name' => 'José da Silva']); + factory(Associate::class)->create(['name' => 'Maria da Conceição']); + + $this->get(route('collaborators.associates.show', compact('associate'))) + ->assertSee('José da Silva') + ->assertDontSee('Maria da Conceição'); + + } +}