@extends('admin.admin_dashboard') @section('admin') @php <<<<<<< HEAD $recent = $child->childUpdates->first(); $childrenCount = $recent?->num_children ?? 0; $adultCount = $recent?->num_adults ?? 0; @endphp
{{-- Breadcrumb --}}
{{-- Profile Card --}}
Child Photo {{ \Carbon\Carbon::parse($child->dob)->age }} yrs {{ $child->status }}
{{ $child->child_fname }} {{ $child->child_lname }}
ID #{{ $child->child_number }}
@isset($child->cluster)
Cluster: {{ $child->cluster->cluster_name }} ({{ $child->cluster->code }})
@endisset
{{-- Tabs Section --}}
{{-- Nav Pills --}} {{-- Tab Content --}}
{{-- Background --}}
{{-- tighten gutters --}}
@php $dob = \Carbon\Carbon::parse($child->dob); @endphp

{{-- mb-1 instead of default mb-3 --}} {!! $dob->format('j') !!}{{ $dob->format('S') }} {{ $dob->format('M, Y') }}

{{ $recent?->hobby ?: 'No child hobby record' }}

{{ $recent?->dream ?: 'No child dream record' }}

{{ ucfirst($child->sex) }}

{{ $recent?->village ?? $child->child_village ?? 'No village record' }}

{{ $recent?->school?->school_name ?? 'No school record' }}

{{ optional($recent)->class ?? 'No class record' }}

{{ $child->cluster->pastors ->map(fn($p)=> "{$p->title} {$p->first_name} {$p->last_name}" . (Auth::user()->can('pastor_contact.view')?" (+{$p->contact})":'') . " - {$p->position}" )->join(', ') }}

@foreach($child->cluster->pastors as $p)

{{ $p->church->church_name ?? 'No church' }}

@endforeach

{{ optional($child->guardianModel)->guardian ?? '—' }}:{{ $child->guardian_name }} @if(Auth::user()->can('guardian_contact.view')) (+{{ $child->guardian_contact }}) @endif

{{ $child->mother_name }} ({{ $child->mother_status }})

{{ $child->father_name }} ({{ $child->father_status }})

@if($childrenCount||$adultCount) {{ $childrenCount }} {{ \Illuminate\Support\Str::plural('child',$childrenCount) }} {{ $adultCount }} {{ \Illuminate\Support\Str::plural('adult',$adultCount) }} @else No record @endif

{{ $recent?->house_type ? ucfirst(str_replace('_',' ',$recent->house_type)) : 'No record' }}

{{ $recent?->received_coffee ? ucfirst($recent->received_coffee) : 'No record' }}

{{ $recent?->coffee_plants_count ?? 'No record' }}

@if(is_null($recent?->harvesting_coffee)) No record @elseif($recent->harvesting_coffee==='yes') Yes @else No ({{ ucfirst(str_replace('_',' ',$recent->harvest_no_reason)) }} @if($recent->harvest_no_reason==='other')– {{ $recent->harvest_other_reason }}@endif) @endif

{{ $recent?->social_worker_remarks ?: 'No record' }}

{{-- Sponsorship --}}

{{ $child->sponsor ? $child->sponsor->sponsor_fname.' '.$child->sponsor->sponsor_lname : '—' }}

Sponsor No: {{ optional($child->sponsor)->sponsor_number ?: '—' }}
@if($child->sponsorship) @php $fmt = fn($d)=> $d ? $d->format('j').''.$d->format('S').' '.$d->format('M, Y') : '—'; $start = $child->sponsorship->start_date ? \Carbon\Carbon::parse($child->sponsorship->start_date) : null; $mid = $child->sponsorship->mid_term_date ? \Carbon\Carbon::parse($child->sponsorship->mid_term_date) : null; $grad = $child->sponsorship->graduation_date ? \Carbon\Carbon::parse($child->sponsorship->graduation_date) : null; @endphp
Start
{!! $fmt($start) !!}
Mid
{!! $fmt($mid) !!}
Graduation
{!! $fmt($grad) !!}
@else

No sponsorship data available.

@endif
{{-- Progress --}}
@php $activities = $child->cStatusLogs->map(fn($l)=>['type'=>'status','item'=>$l]) ->concat($child->childUpdates->map(fn($u)=>['type'=>'update','item'=>$u])) ->sortByDesc(fn($a)=>$a['item']->created_at->timestamp)->values(); @endphp @if($activities->isEmpty())

No progress updates yet.

@else
@foreach($activities as $act) @if($act['type']=='status') @php $log=$act['item']; @endphp
{{ $log->created_at->format('d M, Y') }}
@if($log->reason_of_death)

Death: {{ $log->reason_of_death }}

@elseif($log->reason_of_termination)

Terminated: {{ $log->reason_of_termination }}

@elseif($log->reason_of_registration_cancel)

Cancelled: {{ $log->reason_of_registration_cancel }}

@else

Status changed to: {{ $log->status->status_name }}

@endif
@else @php $upd=$act['item']; @endphp
{{ $upd->created_at->format('d M, Y') }}
@can('child_update.edit') @endcan
{{-- Photo --}} @if($upd->update_photo) Update Photo @endif
    {{-- Location --}}
  • Location: {{ $upd->still_at_home==='no' ? "Not at home ({$upd->where_is_child})" : 'Still at home' }}
  • {{-- Guardian --}} @if($upd->id_guardian || $upd->guardian_name)
  • Guardian: {{ optional($upd->guardian)->guardian ?? '—' }}: {{ $upd->guardian_name }} @can('guardian_contact.view') @if($upd->guardian_contact) (+{{ $upd->guardian_contact }}) @endif @endcan
  • @endif {{-- School --}}
  • School: @if($upd->is_schooling==='yes') {{ optional($upd->school)->school_name ?? '—' }} (Class {{ $upd->class }}) @else Not schooling ({{ $upd->school_reason }}) @endif
  • {{-- Church --}}
  • Church Attendance: {{ ucfirst($upd->church_attendance) }} @if($upd->church_attendance==='no') ({{ $upd->church_reason }}) @endif
  • {{-- Appearance --}}
  • Appearance: {{ ucfirst($upd->appearance) }}
  • {{-- Hobby & Dream --}} @if($upd->hobby)
  • Hobby: {{ $upd->hobby }}
  • @endif @if($upd->dream)
  • Dream: {{ $upd->dream }}
  • @endif {{-- Village --}} @if($upd->village)
  • Village: {{ $upd->village }}
  • @endif {{-- Family size --}}
  • Family size: {{ $upd->num_children }} {{ Str::plural('child',$upd->num_children) }}, {{ $upd->num_adults }} {{ Str::plural('adult',$upd->num_adults) }}
  • {{-- House type --}} @if($upd->house_type)
  • House type: {{ ucfirst(str_replace('_',' ',$upd->house_type)) }}
  • @endif {{-- Facilities --}} @foreach(['kitchen','utensils_rack','bathroom','latrine'] as $fac) @if($upd->{"has_{$fac}"})
  • {{ ucwords(str_replace('_',' ',$fac)) }}: Yes
  • @endif @endforeach {{-- Recent death --}} @if($upd->recent_death==='yes')
  • Recent death: {{ $upd->death_reason }}
  • @endif {{-- Coffee --}} @if($upd->received_coffee)
  • Received coffee: {{ ucfirst($upd->received_coffee) }}
  • @endif @if($upd->coffee_plants_count)
  • Coffee plants: {{ $upd->coffee_plants_count }}
  • @endif {{-- Harvesting --}} @if($upd->harvesting_coffee==='yes')
  • Harvesting: Yes
  • @elseif($upd->harvesting_coffee==='no')
  • Harvesting: No ({{ ucfirst(str_replace('_',' ',$upd->harvest_no_reason)) }} @if($upd->harvest_no_reason==='other') – {{ $upd->harvest_other_reason }} @endif)
  • @endif {{-- Remarks --}} @if($upd->social_worker_remarks)
  • Remarks: {{ $upd->social_worker_remarks }}
  • @endif
@endif @endforeach
@endif
{{-- Photos --}}
======= $summary = $insights['summary']; $photos = $insights['photos']; $progressCount = (int) ($summary['updates'] ?? 0) + (int) ($summary['status_events'] ?? 0); $photoUrl = $child->photo ? url('upload/cfdp_child/'.$child->photo) : url('upload/no_image.jpg'); $statusName = $child->child_status->status_name ?? $child->status ?? 'Unknown'; $statusTone = match (true) { (int) ($child->id_status ?? 0) === 1, str_contains(strtolower($statusName), 'sponsor') && ! str_contains(strtolower($statusName), 'non') => 'success', (int) ($child->id_status ?? 0) === 3, str_contains(strtolower($statusName), 'graduat') => 'warning', default => 'danger', }; $fullName = trim($child->child_fname.' '.$child->child_lname); @endphp
Home All Children {{ $child->child_number }} @can('child.edit') Edit child @endcan @can('child_update.add') Add update @endcan @can('change_child_status.view') Change status @endcan @if(session('message')) @endif {{-- Primary stats --}}
{{-- Secondary stats --}}
@if(!empty($insights['cluster'])) @endif
{{-- Sidebar --}}
{{ $fullName }} {{ $summary['age'] }} yrs
@if($summary['sponsored_days']) {{ number_format($summary['sponsored_days']) }} days sponsored @endif

{{ $fullName }}

ID #{{ $child->child_number }}

@if($child->cluster)

{{ $child->cluster->cluster_name }} ({{ $child->cluster->code }})

@endif
Record facts
    @foreach($insights['facts'] as $fact)
  • {{ $fact['label'] }}{{ $fact['value'] }}
  • @endforeach
Quick actions
@can('child.edit') Edit child record @endcan @can('child_update.add') Record field update @endcan @can('change_child_status.view') Change status @endcan Back to all children
{{-- Main tabs --}}
@include('admin.cfdp.children.partials.child-profile-background')
@include('admin.cfdp.children.partials.child-profile-analytics')
@include('admin.cfdp.children.partials.child-profile-sponsorship')
@include('admin.cfdp.children.partials.child-profile-progress')
@push('scripts') @endpush >>>>>>> origin/main @endsection