From 25e67f427adead188ef5d58012ad82239c9e898f Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Wed, 28 Jun 2017 15:00:45 +0800 Subject: [PATCH] Add user spouse by click add button --- .../views/users/partials/parent-spouse.blade.php | 28 ++++++++++++++++++---- tests/Feature/ManageUserFamiliesTest.php | 5 +++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/resources/views/users/partials/parent-spouse.blade.php b/resources/views/users/partials/parent-spouse.blade.php index ac6725e..e3eb4fb 100644 --- a/resources/views/users/partials/parent-spouse.blade.php +++ b/resources/views/users/partials/parent-spouse.blade.php @@ -4,8 +4,8 @@ - - + @@ -66,13 +76,22 @@ diff --git a/tests/Feature/ManageUserFamiliesTest.php b/tests/Feature/ManageUserFamiliesTest.php index 6cee777..2aef4d8 100644 --- a/tests/Feature/ManageUserFamiliesTest.php +++ b/tests/Feature/ManageUserFamiliesTest.php @@ -111,6 +111,7 @@ class ManageUserFamiliesTest extends TestCase $user = $this->loginAsUser(['gender_id' => 1]); $this->visit(route('profile')); $this->seePageIs(route('profile')); + $this->click('Tambah Isteri'); $this->seeElement('input', ['name' => 'set_wife']); $this->submitForm('set_wife_button', [ @@ -136,9 +137,9 @@ class ManageUserFamiliesTest extends TestCase $user = $this->loginAsUser(['gender_id' => 2]); $this->visit(route('profile')); $this->seePageIs(route('profile')); + $this->click('Tambah Suami'); $this->seeElement('input', ['name' => 'set_husband']); - $this->submitForm('set_husband_button', [ 'set_husband' => 'Nama Suami', ]); @@ -202,6 +203,7 @@ class ManageUserFamiliesTest extends TestCase $this->visit(route('profile')); $this->seePageIs(route('profile')); + $this->click('Tambah Isteri'); $this->seeElement('input', ['name' => 'set_wife']); $this->seeElement('select', ['name' => 'set_wife_id']); @@ -224,6 +226,7 @@ class ManageUserFamiliesTest extends TestCase $this->visit(route('profile')); $this->seePageIs(route('profile')); + $this->click('Tambah Suami'); $this->seeElement('input', ['name' => 'set_husband']); $this->seeElement('select', ['name' => 'set_husband_id']);
Ayah + Ayah @if ($user->father_id) {{ $user->father->profileLink() }} @else @@ -43,13 +43,22 @@
Isteri +
+ @if (request('action') == 'add_spouse') + {{ link_to_route('users.show', 'Batal', [$user->id], ['class' => 'btn btn-default btn-xs']) }} + @else + {{ link_to_route('users.show', 'Tambah Isteri', [$user->id, 'action' => 'add_spouse'], ['class' => 'btn btn-success btn-xs']) }} + @endif +
@if ($user->wifes->isEmpty() == false)
    @foreach($user->wifes as $wife)
  • {{ $wife->profileLink() }}
  • @endforeach
- @else + @endif + @if (request('action') == 'add_spouse') +
{{ Form::open(['route' => ['family-actions.add-wife', $user->id]]) }} {!! FormField::select('set_wife_id', $femalePersonList, ['label' => false]) !!}
@@ -59,6 +68,7 @@
{{ Form::close() }} +
@endif
Suami +
+ @if (request('action') == 'add_spouse') + {{ link_to_route('users.show', 'Batal', [$user->id], ['class' => 'btn btn-default btn-xs']) }} + @else + {{ link_to_route('users.show', 'Tambah Suami', [$user->id, 'action' => 'add_spouse'], ['class' => 'btn btn-success btn-xs']) }} + @endif +
@if ($user->husbands->isEmpty() == false)
    @foreach($user->husbands as $husband)
  • {{ $husband->profileLink() }}
  • @endforeach
- @else + @endif + @if (request('action') == 'add_spouse') +
{{ Form::open(['route' => ['family-actions.add-husband', $user->id]]) }} {!! FormField::select('set_husband_id', $malePersonList, ['label' => false]) !!}
@@ -82,6 +101,7 @@
{{ Form::close() }} +
@endif