11 changed files with 194 additions and 166 deletions
-
2app/Http/Controllers/HomeController.php
-
2app/Http/Controllers/UsersController.php
-
3app/User.php
-
160resources/views/home.blade.php
-
2resources/views/layouts/app.blade.php
-
35resources/views/users/partials/childs.blade.php
-
91resources/views/users/partials/parent-spouse.blade.php
-
45resources/views/users/partials/profile.blade.php
-
16resources/views/users/show.blade.php
-
2tests/Feature/ManageUserFamiliesTest.php
-
2tests/Feature/UsersProfileTest.php
@ -1,160 +0,0 @@ |
|||
@extends('layouts.app') |
|||
|
|||
@section('content') |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-md-6"> |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading">Profile : {{ $currentUser->name ?: $currentUser->nickname }}</div> |
|||
|
|||
<div class="panel-body"> |
|||
<table class="table table-condensed"> |
|||
<tbody> |
|||
<tr> |
|||
<th class="col-sm-4">Nama Panggilan</th> |
|||
<td class="col-sm-6">{{ $currentUser->nickname }}</td> |
|||
</tr> |
|||
<tr> |
|||
<th>Nama</th> |
|||
<td>{{ $currentUser->profileLink() }}</td> |
|||
</tr> |
|||
<tr> |
|||
<th>Jenis Kelamin</th> |
|||
<td>{{ $currentUser->gender }}</td> |
|||
</tr> |
|||
<tr> |
|||
<th>Ayah</th> |
|||
<td> |
|||
@if ($currentUser->father_id) |
|||
{{ $currentUser->father->profileLink() }} |
|||
@else |
|||
{{ Form::open(['route' => ['family-actions.set-father', $currentUser->id]]) }} |
|||
{!! FormField::select('set_father_id', $malePersonList, ['label' => false]) !!} |
|||
<div class="input-group"> |
|||
{{ Form::text('set_father', null, ['class' => 'form-control input-sm']) }} |
|||
<span class="input-group-btn"> |
|||
{{ Form::submit('update', ['class' => 'btn btn-info btn-sm', 'id' => 'set_father_button']) }} |
|||
</span> |
|||
</div> |
|||
{{ Form::close() }} |
|||
@endif |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<th>Ibu</th> |
|||
<td> |
|||
@if ($currentUser->mother_id) |
|||
{{ $currentUser->mother->profileLink() }} |
|||
@else |
|||
{{ Form::open(['route' => ['family-actions.set-mother', $currentUser->id]]) }} |
|||
{!! FormField::select('set_mother_id', $femalePersonList, ['label' => false]) !!} |
|||
<div class="input-group"> |
|||
{{ Form::text('set_mother', null, ['class' => 'form-control input-sm']) }} |
|||
<span class="input-group-btn"> |
|||
{{ Form::submit('update', ['class' => 'btn btn-info btn-sm', 'id' => 'set_mother_button']) }} |
|||
</span> |
|||
</div> |
|||
{{ Form::close() }} |
|||
@endif |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading">Keluarga</div> |
|||
|
|||
<div class="panel-body"> |
|||
<table class="table table-condensed"> |
|||
<tbody> |
|||
@if ($currentUser->gender_id == 1) |
|||
<tr> |
|||
<th>Isteri</th> |
|||
<td> |
|||
@if ($currentUser->wifes->isEmpty() == false) |
|||
<ul> |
|||
@foreach($currentUser->wifes as $wife) |
|||
<li>{{ $wife->profileLink() }}</li> |
|||
@endforeach |
|||
</ul> |
|||
@else |
|||
{{ Form::open(['route' => ['family-actions.add-wife', $currentUser->id]]) }} |
|||
{!! FormField::select('set_wife_id', $femalePersonList, ['label' => false]) !!} |
|||
<div class="input-group"> |
|||
{{ Form::text('set_wife', null, ['class' => 'form-control input-sm']) }} |
|||
<span class="input-group-btn"> |
|||
{{ Form::submit('update', ['class' => 'btn btn-info btn-sm', 'id' => 'set_wife_button']) }} |
|||
</span> |
|||
</div> |
|||
{{ Form::close() }} |
|||
@endif |
|||
</td> |
|||
</tr> |
|||
@else |
|||
<tr> |
|||
<th>Suami</th> |
|||
<td> |
|||
@if ($currentUser->husbands->isEmpty() == false) |
|||
<ul> |
|||
@foreach($currentUser->husbands as $husband) |
|||
<li>{{ $husband->profileLink() }}</li> |
|||
@endforeach |
|||
</ul> |
|||
@else |
|||
{{ Form::open(['route' => ['family-actions.add-husband', $currentUser->id]]) }} |
|||
{!! FormField::select('set_husband_id', $malePersonList, ['label' => false]) !!} |
|||
<div class="input-group"> |
|||
{{ Form::text('set_husband', null, ['class' => 'form-control input-sm']) }} |
|||
<span class="input-group-btn"> |
|||
{{ Form::submit('update', ['class' => 'btn btn-info btn-sm', 'id' => 'set_husband_button']) }} |
|||
</span> |
|||
</div> |
|||
{{ Form::close() }} |
|||
@endif |
|||
</td> |
|||
</tr> |
|||
@endif |
|||
</tbody> |
|||
</table> |
|||
<legend>Anak-Anak</legend> |
|||
<ul class="list-group"> |
|||
@foreach($currentUser->childs as $child) |
|||
<li class="list-group-item"> |
|||
{{ $child->profileLink() }} ({{ $child->gender }}) |
|||
</li> |
|||
@endforeach |
|||
<li class="list-group-item"> |
|||
{{ Form::open(['route' => ['family-actions.add-child', $currentUser->id]]) }} |
|||
<div class="row"> |
|||
<div class="col-md-4"> |
|||
{!! FormField::text('add_child_name', ['label' => 'Nama Anak']) !!} |
|||
</div> |
|||
<div class="col-md-4"> |
|||
{!! FormField::radios('add_child_gender_id', [1 => 'Laki-laki', 2 => 'Perempuan'], ['label' => 'Jenis Kelamin Anak']) !!} |
|||
</div> |
|||
<div class="col-md-4"> |
|||
{!! FormField::select('add_child_parent_id', $usersMariageList, ['label' => 'Dari Pernikahan']) !!} |
|||
</div> |
|||
</div> |
|||
{{ Form::submit('Tambah Anak', ['class' => 'btn btn-success btn-sm']) }} |
|||
{{ Form::close() }} |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@if (count($errors) > 0) |
|||
<div class="alert alert-danger"> |
|||
<ul> |
|||
@foreach ($errors->all() as $error) |
|||
<li>{{ $error }}</li> |
|||
@endforeach |
|||
</ul> |
|||
</div> |
|||
@endif |
|||
</div> |
|||
@endsection |
|||
@ -0,0 +1,35 @@ |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"> |
|||
<div class="pull-right" style="margin: -3px -6px"> |
|||
{{ link_to_route('users.show', 'Tambah Anak', [$user->id, 'action' => 'add_child'], ['class' => 'btn btn-success btn-xs']) }} |
|||
</div> |
|||
<h3 class="panel-title">Anak-Anak</h3> |
|||
</div> |
|||
|
|||
<ul class="list-group"> |
|||
@foreach($user->childs as $child) |
|||
<li class="list-group-item"> |
|||
{{ $child->profileLink() }} ({{ $child->gender }}) |
|||
</li> |
|||
@endforeach |
|||
@if (request('action') == 'add_child') |
|||
<li class="list-group-item"> |
|||
{{ Form::open(['route' => ['family-actions.add-child', $user->id]]) }} |
|||
<div class="row"> |
|||
<div class="col-md-4"> |
|||
{!! FormField::text('add_child_name', ['label' => 'Nama Anak']) !!} |
|||
</div> |
|||
<div class="col-md-4"> |
|||
{!! FormField::radios('add_child_gender_id', [1 => 'Laki-laki', 2 => 'Perempuan'], ['label' => 'Jenis Kelamin Anak']) !!} |
|||
</div> |
|||
<div class="col-md-4"> |
|||
{!! FormField::select('add_child_parent_id', $usersMariageList, ['label' => 'Dari Pernikahan']) !!} |
|||
</div> |
|||
</div> |
|||
{{ Form::submit('Tambah Anak', ['class' => 'btn btn-success btn-sm']) }} |
|||
{{ link_to_route('users.show', 'Batal', [$user->id], ['class' => 'btn btn-default btn-sm']) }} |
|||
{{ Form::close() }} |
|||
</li> |
|||
@endif |
|||
</ul> |
|||
</div> |
|||
@ -0,0 +1,91 @@ |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"><h3 class="panel-title">Keluarga</h3></div> |
|||
|
|||
<table class="table"> |
|||
<tbody> |
|||
<tr> |
|||
<th>Ayah</th> |
|||
<td> |
|||
@if ($user->father_id) |
|||
{{ $user->father->profileLink() }} |
|||
@else |
|||
{{ Form::open(['route' => ['family-actions.set-father', $user->id]]) }} |
|||
{!! FormField::select('set_father_id', $malePersonList, ['label' => false]) !!} |
|||
<div class="input-group"> |
|||
{{ Form::text('set_father', null, ['class' => 'form-control input-sm']) }} |
|||
<span class="input-group-btn"> |
|||
{{ Form::submit('update', ['class' => 'btn btn-info btn-sm', 'id' => 'set_father_button']) }} |
|||
</span> |
|||
</div> |
|||
{{ Form::close() }} |
|||
@endif |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<th>Ibu</th> |
|||
<td> |
|||
@if ($user->mother_id) |
|||
{{ $user->mother->profileLink() }} |
|||
@else |
|||
{{ Form::open(['route' => ['family-actions.set-mother', $user->id]]) }} |
|||
{!! FormField::select('set_mother_id', $femalePersonList, ['label' => false]) !!} |
|||
<div class="input-group"> |
|||
{{ Form::text('set_mother', null, ['class' => 'form-control input-sm']) }} |
|||
<span class="input-group-btn"> |
|||
{{ Form::submit('update', ['class' => 'btn btn-info btn-sm', 'id' => 'set_mother_button']) }} |
|||
</span> |
|||
</div> |
|||
{{ Form::close() }} |
|||
@endif |
|||
</td> |
|||
</tr> |
|||
@if ($user->gender_id == 1) |
|||
<tr> |
|||
<th>Isteri</th> |
|||
<td> |
|||
@if ($user->wifes->isEmpty() == false) |
|||
<ul class="list-unstyled"> |
|||
@foreach($user->wifes as $wife) |
|||
<li>{{ $wife->profileLink() }}</li> |
|||
@endforeach |
|||
</ul> |
|||
@else |
|||
{{ Form::open(['route' => ['family-actions.add-wife', $user->id]]) }} |
|||
{!! FormField::select('set_wife_id', $femalePersonList, ['label' => false]) !!} |
|||
<div class="input-group"> |
|||
{{ Form::text('set_wife', null, ['class' => 'form-control input-sm']) }} |
|||
<span class="input-group-btn"> |
|||
{{ Form::submit('update', ['class' => 'btn btn-info btn-sm', 'id' => 'set_wife_button']) }} |
|||
</span> |
|||
</div> |
|||
{{ Form::close() }} |
|||
@endif |
|||
</td> |
|||
</tr> |
|||
@else |
|||
<tr> |
|||
<th>Suami</th> |
|||
<td> |
|||
@if ($user->husbands->isEmpty() == false) |
|||
<ul class="list-unstyled"> |
|||
@foreach($user->husbands as $husband) |
|||
<li>{{ $husband->profileLink() }}</li> |
|||
@endforeach |
|||
</ul> |
|||
@else |
|||
{{ Form::open(['route' => ['family-actions.add-husband', $user->id]]) }} |
|||
{!! FormField::select('set_husband_id', $malePersonList, ['label' => false]) !!} |
|||
<div class="input-group"> |
|||
{{ Form::text('set_husband', null, ['class' => 'form-control input-sm']) }} |
|||
<span class="input-group-btn"> |
|||
{{ Form::submit('update', ['class' => 'btn btn-info btn-sm', 'id' => 'set_husband_button']) }} |
|||
</span> |
|||
</div> |
|||
{{ Form::close() }} |
|||
@endif |
|||
</td> |
|||
</tr> |
|||
@endif |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
@ -0,0 +1,45 @@ |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"><h3 class="panel-title">Profil</h3></div> |
|||
<table class="table"> |
|||
<tbody> |
|||
<tr> |
|||
<th class="col-sm-4">Nama</th> |
|||
<td class="col-sm-8"> |
|||
{{ $user->profileLink() }} |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<th>Nama Panggilan</th> |
|||
<td>{{ $user->nickname }}</td> |
|||
</tr> |
|||
<tr> |
|||
<th>Jenis Kelamin</th> |
|||
<td>{{ $user->gender }}</td> |
|||
</tr> |
|||
<tr> |
|||
<th>Tanggal Lahir</th> |
|||
<td>{{ $user->dob }}</td> |
|||
</tr> |
|||
@if ($user->dod) |
|||
<tr> |
|||
<th>Meninggal</th> |
|||
<td>{{ $user->dod }}</td> |
|||
</tr> |
|||
@endif |
|||
@if ($user->email) |
|||
<tr> |
|||
<th>Email</th> |
|||
<td>{{ $user->email }}</td> |
|||
</tr> |
|||
@endif |
|||
<tr> |
|||
<th>Telp</th> |
|||
<td>{{ $user->phone }}</td> |
|||
</tr> |
|||
<tr> |
|||
<th>Alamat</th> |
|||
<td>{!! nl2br($user->address) !!}</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
@ -0,0 +1,16 @@ |
|||
@extends('layouts.app') |
|||
|
|||
@section('content') |
|||
<div class="container"> |
|||
<h3 class="page-header text-center">{{ $currentUser->profileLink() }}</h3> |
|||
<div class="row"> |
|||
<div class="col-md-6"> |
|||
@include('users.partials.profile', ['user' => $currentUser]) |
|||
</div> |
|||
<div class="col-md-6"> |
|||
@include('users.partials.parent-spouse', ['user' => $currentUser]) |
|||
@include('users.partials.childs', ['user' => $currentUser]) |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@endsection |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue