Browse Source

Add user profile view layout

Make user pages extends user profile layout
Add show user marriages button
pull/3/head
Nafies Luthfi 8 years ago
parent
commit
92ae69deb4
  1. 2
      app/Http/Controllers/HomeController.php
  2. 7
      app/Http/Controllers/UsersController.php
  3. 1
      resources/lang/en/app.php
  4. 1
      resources/lang/id/app.php
  5. 11
      resources/views/layouts/user-profile-wide.blade.php
  6. 9
      resources/views/layouts/user-profile.blade.php
  7. 11
      resources/views/users/chart.blade.php
  8. 9
      resources/views/users/marriages.blade.php
  9. 1
      resources/views/users/partials/action-buttons.blade.php
  10. 4
      resources/views/users/partials/childs.blade.php
  11. 16
      resources/views/users/partials/parent-spouse.blade.php
  12. 18
      resources/views/users/show.blade.php
  13. 13
      resources/views/users/tree.blade.php
  14. 14
      resources/views/users/tree2.blade.php

2
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

7
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'));

1
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',

1
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',

11
resources/views/layouts/user-profile-wide.blade.php

@ -0,0 +1,11 @@
@extends('layouts.app')
@section('content')
</div>
<div class="container-fluid">
<h1 class="page-header">
@include('users.partials.action-buttons', ['user' => $user])
{{ $user->name }} <small>@yield('subtitle')</small>
</h1>
@yield('user-content')
@endsection

9
resources/views/layouts/user-profile.blade.php

@ -0,0 +1,9 @@
@extends('layouts.app')
@section('content')
<h1 class="page-header">
@include('users.partials.action-buttons', ['user' => $user])
{{ $user->name }} <small>@yield('subtitle')</small>
</h1>
@yield('user-content')
@endsection

11
resources/views/users/chart.blade.php

@ -1,13 +1,8 @@
@extends('layouts.app')
@extends('layouts.user-profile-wide')
@section('content')
</div>
<div class="container-fluid">
<h1 class="page-header">
@include('users.partials.action-buttons')
{{ $user->name }} <small>{{ trans('app.family_chart') }}</small>
</h1>
@section('subtitle', trans('app.family_chart'))
@section('user-content')
<div class="panel panel-default table-responsive">
<table class="table table-bordered table-striped">
<tbody>

9
resources/views/users/marriages.blade.php

@ -1,9 +1,8 @@
@extends('layouts.app')
@extends('layouts.user-profile')
@section('content')
<h1 class="page-header">
{{ $user->name }} <small>{{ trans('user.marriages') }}</small>
</h1>
@section('subtitle', trans('user.marriages'))
@section('user-content')
<div class="row">
@foreach ($marriages as $marriage)

1
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']) }}
</div>

4
resources/views/users/partials/childs.blade.php

@ -1,6 +1,6 @@
<div class="panel panel-default">
<div class="panel-heading">
@can ('edit', $currentUser)
@can ('edit', $user)
<div class="pull-right" style="margin: -3px -6px">
{{ link_to_route('users.show', trans('user.add_child'), [$user->id, 'action' => 'add_child'], ['class' => 'btn btn-success btn-xs']) }}
</div>
@ -14,7 +14,7 @@
{{ $child->profileLink() }} ({{ $child->gender }})
</li>
@endforeach
@can('edit', $currentUser)
@can('edit', $user)
@if (request('action') == 'add_child')
<li class="list-group-item">
{{ Form::open(['route' => ['family-actions.add-child', $user->id]]) }}

16
resources/views/users/partials/parent-spouse.blade.php

@ -6,7 +6,7 @@
<tr>
<th class="col-sm-4">{{ trans('user.father') }}</th>
<td class="col-sm-8">
@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 @@
<tr>
<th>{{ trans('user.mother') }}</th>
<td>
@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 @@
<th class="col-sm-4">{{ trans('user.parent') }}</th>
<td class="col-sm-8">
@can ('edit', $currentUser)
@can ('edit', $user)
<div class="pull-right">
@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 @@
<tr>
<th>{{ trans('user.wife') }}</th>
<td>
@can ('edit', $currentUser)
@can ('edit', $user)
<div class="pull-right">
@if (request('action') == 'add_spouse')
{{ link_to_route('users.show', 'Batal', [$user->id], ['class' => 'btn btn-default btn-xs']) }}
@ -104,7 +104,7 @@
@endforeach
</ul>
@endif
@can('edit', $currentUser)
@can('edit', $user)
@if (request('action') == 'add_spouse')
<div>
{{ Form::open(['route' => ['family-actions.add-wife', $user->id]]) }}
@ -125,7 +125,7 @@
<tr>
<th>{{ trans('user.husband') }}</th>
<td>
@can ('edit', $currentUser)
@can ('edit', $user)
<div class="pull-right">
@if (request('action') == 'add_spouse')
{{ link_to_route('users.show', 'Batal', [$user->id], ['class' => 'btn btn-default btn-xs']) }}
@ -141,7 +141,7 @@
@endforeach
</ul>
@endif
@can('edit', $currentUser)
@can('edit', $user)
@if (request('action') == 'add_spouse')
<div>
{{ Form::open(['route' => ['family-actions.add-husband', $user->id]]) }}

18
resources/views/users/show.blade.php

@ -1,18 +1,16 @@
@extends('layouts.app')
@extends('layouts.user-profile')
@section('content')
<h1 class="page-header">
@include('users.partials.action-buttons', ['user' => $currentUser])
{{ $currentUser->name }} <small>{{ trans('user.profile') }}</small>
</h1>
@section('subtitle', trans('user.profile'))
@section('user-content')
<div class="row">
<div class="col-md-6">
@include('users.partials.profile', ['user' => $currentUser])
@include('users.partials.siblings', ['user' => $currentUser])
@include('users.partials.profile')
@include('users.partials.siblings')
</div>
<div class="col-md-6">
@include('users.partials.parent-spouse', ['user' => $currentUser])
@include('users.partials.childs', ['user' => $currentUser])
@include('users.partials.parent-spouse')
@include('users.partials.childs')
</div>
</div>
@endsection

13
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')
</div>
<div class="container-fluid">
<h1 class="page-header">
@include('users.partials.action-buttons')
{{ $user->name }} <small>{{ trans('app.family_tree') }}</small>
</h1>
<?php
$childsTotal = 0;
$grandChildsTotal = 0;

14
resources/views/users/tree2.blade.php

@ -1,14 +1,8 @@
@extends('layouts.app')
@extends('layouts.user-profile-wide')
@section('content')
</div>
<div class="container-fluid">
<h1 class="page-header">
<div class="pull-right">
{{ link_to_route('users.show', 'Lihat Profil '.$user->name, [$user->id], ['class' => 'btn btn-default']) }}
</div>
{{ $user->name }} <small>Pohon Keluarga</small>
</h1>
@section('subtitle', trans('app.family_tree'))
@section('user-content')
<div class="tree">
<ul>

Loading…
Cancel
Save