diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 73e05e3..a100cb3 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -35,7 +35,7 @@ class HomeController extends Controller $femalePersonList = User::where('gender_id', 2)->pluck('nickname', 'id'); return view('users.show', [ - 'currentUser' => $user, + 'user' => $user, 'usersMariageList' => $usersMariageList, 'malePersonList' => $malePersonList, 'femalePersonList' => $femalePersonList diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index 02c5d51..fe72886 100644 --- a/app/Http/Controllers/UsersController.php +++ b/app/Http/Controllers/UsersController.php @@ -52,7 +52,7 @@ class UsersController extends Controller $femalePersonList = User::where('gender_id', 2)->pluck('nickname', 'id'); return view('users.show', [ - 'currentUser' => $user, + 'user' => $user, 'usersMariageList' => $usersMariageList, 'malePersonList' => $malePersonList, 'femalePersonList' => $femalePersonList, @@ -85,6 +85,11 @@ class UsersController extends Controller return view('users.chart', compact('user', 'childs', 'father', 'mother', 'fatherGrandpa', 'fatherGrandma', 'motherGrandpa', 'motherGrandma', 'siblings', 'colspan')); } + /** + * Show user family tree + * @param User $user + * @return \Illuminate\Http\Response + */ public function tree(User $user) { return view('users.tree', compact('user')); diff --git a/resources/lang/en/app.php b/resources/lang/en/app.php index 3781f95..6d729ab 100644 --- a/resources/lang/en/app.php +++ b/resources/lang/en/app.php @@ -29,6 +29,7 @@ return [ 'show_profile' => 'Show Profile', 'show_family_chart' => 'Show Family Chart', 'show_family_tree' => 'Show Family Tree', + 'show_marriages' => 'Show Marriages', 'enter_new_name' => 'Enter new Name...', 'select_from_existing_males' => 'Select from Existing Males', 'select_from_existing_females' => 'Select from Existing Females', diff --git a/resources/lang/id/app.php b/resources/lang/id/app.php index fadf826..1f5a2f2 100644 --- a/resources/lang/id/app.php +++ b/resources/lang/id/app.php @@ -29,6 +29,7 @@ return [ 'show_profile' => 'Lihat Profil', 'show_family_chart' => 'Lihat Bagan Keluarga', 'show_family_tree' => 'Lihat Pohon Keluarga', + 'show_marriages' => 'Lihat Pernikahan', 'enter_new_name' => 'Input Nama Baru...', 'select_from_existing_males' => 'Pilih dari Pria terdaftar', 'select_from_existing_females' => 'Pilih dari Wanita terdaftar', diff --git a/resources/views/layouts/user-profile-wide.blade.php b/resources/views/layouts/user-profile-wide.blade.php new file mode 100644 index 0000000..dbc6a87 --- /dev/null +++ b/resources/views/layouts/user-profile-wide.blade.php @@ -0,0 +1,11 @@ +@extends('layouts.app') + +@section('content') + +
+

+ @include('users.partials.action-buttons', ['user' => $user]) + {{ $user->name }} @yield('subtitle') +

+ @yield('user-content') +@endsection diff --git a/resources/views/layouts/user-profile.blade.php b/resources/views/layouts/user-profile.blade.php new file mode 100644 index 0000000..c4894b1 --- /dev/null +++ b/resources/views/layouts/user-profile.blade.php @@ -0,0 +1,9 @@ +@extends('layouts.app') + +@section('content') +

+ @include('users.partials.action-buttons', ['user' => $user]) + {{ $user->name }} @yield('subtitle') +

+ @yield('user-content') +@endsection diff --git a/resources/views/users/chart.blade.php b/resources/views/users/chart.blade.php index 2be3ab3..fc4036c 100644 --- a/resources/views/users/chart.blade.php +++ b/resources/views/users/chart.blade.php @@ -1,13 +1,8 @@ -@extends('layouts.app') +@extends('layouts.user-profile-wide') -@section('content') -
-
-

- @include('users.partials.action-buttons') - {{ $user->name }} {{ trans('app.family_chart') }} -

+@section('subtitle', trans('app.family_chart')) +@section('user-content')
diff --git a/resources/views/users/marriages.blade.php b/resources/views/users/marriages.blade.php index 755ef60..e4efb24 100644 --- a/resources/views/users/marriages.blade.php +++ b/resources/views/users/marriages.blade.php @@ -1,9 +1,8 @@ -@extends('layouts.app') +@extends('layouts.user-profile') -@section('content') -

- {{ $user->name }} {{ trans('user.marriages') }} -

+@section('subtitle', trans('user.marriages')) + +@section('user-content')
@foreach ($marriages as $marriage) diff --git a/resources/views/users/partials/action-buttons.blade.php b/resources/views/users/partials/action-buttons.blade.php index bd52df3..4b78ac1 100644 --- a/resources/views/users/partials/action-buttons.blade.php +++ b/resources/views/users/partials/action-buttons.blade.php @@ -5,4 +5,5 @@ {{ link_to_route('users.show', trans('app.show_profile').' '.$user->name, [$user->id], ['class' => Request::segment(3) == null ? 'btn btn-default active' : 'btn btn-default']) }} {{ link_to_route('users.chart', trans('app.show_family_chart'), [$user->id], ['class' => Request::segment(3) == 'chart' ? 'btn btn-default active' : 'btn btn-default']) }} {{ link_to_route('users.tree', trans('app.show_family_tree'), [$user->id], ['class' => Request::segment(3) == 'tree' ? 'btn btn-default active' : 'btn btn-default']) }} + {{ link_to_route('users.marriages', trans('app.show_marriages'), [$user->id], ['class' => Request::segment(3) == 'marriages' ? 'btn btn-default active' : 'btn btn-default']) }}
\ No newline at end of file diff --git a/resources/views/users/partials/childs.blade.php b/resources/views/users/partials/childs.blade.php index 6bae26e..48bd2fe 100644 --- a/resources/views/users/partials/childs.blade.php +++ b/resources/views/users/partials/childs.blade.php @@ -1,6 +1,6 @@
- @can ('edit', $currentUser) + @can ('edit', $user)
{{ link_to_route('users.show', trans('user.add_child'), [$user->id, 'action' => 'add_child'], ['class' => 'btn btn-success btn-xs']) }}
@@ -14,7 +14,7 @@ {{ $child->profileLink() }} ({{ $child->gender }}) @endforeach - @can('edit', $currentUser) + @can('edit', $user) @if (request('action') == 'add_child')
  • {{ Form::open(['route' => ['family-actions.add-child', $user->id]]) }} diff --git a/resources/views/users/partials/parent-spouse.blade.php b/resources/views/users/partials/parent-spouse.blade.php index 2e0c8f9..3ac43d9 100644 --- a/resources/views/users/partials/parent-spouse.blade.php +++ b/resources/views/users/partials/parent-spouse.blade.php @@ -6,7 +6,7 @@
  • {{ trans('user.father') }} - @can ('edit', $currentUser) + @can ('edit', $user) @if (request('action') == 'set_father') {{ Form::open(['route' => ['family-actions.set-father', $user->id]]) }} {!! FormField::select('set_father_id', $malePersonList, ['label' => false, 'value' => $user->father_id, 'placeholder' => trans('app.select_from_existing_males')]) !!} @@ -32,7 +32,7 @@
    {{ trans('user.mother') }} - @can ('edit', $currentUser) + @can ('edit', $user) @if (request('action') == 'set_mother') {{ Form::open(['route' => ['family-actions.set-mother', $user->id]]) }} {!! FormField::select('set_mother_id', $femalePersonList, ['label' => false, 'value' => $user->mother_id, 'placeholder' => trans('app.select_from_existing_females')]) !!} @@ -59,7 +59,7 @@ {{ trans('user.parent') }} - @can ('edit', $currentUser) + @can ('edit', $user)
    @if (request('action') == 'set_parent') {{ link_to_route('users.show', 'Batal', [$user->id], ['class' => 'btn btn-default btn-xs']) }} @@ -73,7 +73,7 @@ {{ $user->parent->husband->name }} & {{ $user->parent->wife->name }} @endif - @can('edit', $currentUser) + @can('edit', $user) @if (request('action') == 'set_parent') {{ Form::open(['route' => ['family-actions.set-parent', $user->id]]) }} {!! FormField::select('set_parent_id', $allMariageList, ['label' => false, 'value' => $user->parent_id, 'placeholder' => trans('app.select_from_existing_couples')]) !!} @@ -87,7 +87,7 @@
    {{ trans('user.wife') }} - @can ('edit', $currentUser) + @can ('edit', $user)
    @if (request('action') == 'add_spouse') {{ link_to_route('users.show', 'Batal', [$user->id], ['class' => 'btn btn-default btn-xs']) }} @@ -104,7 +104,7 @@ @endforeach @endif - @can('edit', $currentUser) + @can('edit', $user) @if (request('action') == 'add_spouse')
    {{ Form::open(['route' => ['family-actions.add-wife', $user->id]]) }} @@ -125,7 +125,7 @@
    {{ trans('user.husband') }} - @can ('edit', $currentUser) + @can ('edit', $user)
    @if (request('action') == 'add_spouse') {{ link_to_route('users.show', 'Batal', [$user->id], ['class' => 'btn btn-default btn-xs']) }} @@ -141,7 +141,7 @@ @endforeach @endif - @can('edit', $currentUser) + @can('edit', $user) @if (request('action') == 'add_spouse')
    {{ Form::open(['route' => ['family-actions.add-husband', $user->id]]) }} diff --git a/resources/views/users/show.blade.php b/resources/views/users/show.blade.php index 967f420..2e3a0f3 100644 --- a/resources/views/users/show.blade.php +++ b/resources/views/users/show.blade.php @@ -1,18 +1,16 @@ -@extends('layouts.app') +@extends('layouts.user-profile') -@section('content') -

    - @include('users.partials.action-buttons', ['user' => $currentUser]) - {{ $currentUser->name }} {{ trans('user.profile') }} -

    +@section('subtitle', trans('user.profile')) + +@section('user-content')
    - @include('users.partials.profile', ['user' => $currentUser]) - @include('users.partials.siblings', ['user' => $currentUser]) + @include('users.partials.profile') + @include('users.partials.siblings')
    - @include('users.partials.parent-spouse', ['user' => $currentUser]) - @include('users.partials.childs', ['user' => $currentUser]) + @include('users.partials.parent-spouse') + @include('users.partials.childs')
    @endsection diff --git a/resources/views/users/tree.blade.php b/resources/views/users/tree.blade.php index 358ff1e..76ee14a 100644 --- a/resources/views/users/tree.blade.php +++ b/resources/views/users/tree.blade.php @@ -1,12 +1,9 @@ -@extends('layouts.app') +@extends('layouts.user-profile-wide') + +@section('subtitle', trans('app.family_tree')) + +@section('user-content') -@section('content') -
    -
    -

    - @include('users.partials.action-buttons') - {{ $user->name }} {{ trans('app.family_tree') }} -

    -
    -

    -
    - {{ link_to_route('users.show', 'Lihat Profil '.$user->name, [$user->id], ['class' => 'btn btn-default']) }} -
    - {{ $user->name }} Pohon Keluarga -

    +@section('subtitle', trans('app.family_tree')) + +@section('user-content')