@extends('layouts.master') @section('page_title', 'User Profile - '.$user->name) @section('content')
photo

{{ $user->name }}

{{--Basic Info--}}
@if($user->email) @endif @if($user->username) @endif @if($user->phone) @endif @if($user->bg_id) @endif @if($user->nal_id) @endif @if($user->state_id) @endif @if($user->lga_id) @endif @if($user->user_type == 'parent') @endif @if($user->user_type == 'teacher') @endif
Name {{ $user->name }}
Gender {{ $user->gender }}
Address {{ $user->address }}
Email {{$user->email }}
Username {{$user->username }}
Phone {{$user->phone.' '.$user->phone2 }}
Birthday {{$user->dob }}
Blood Group {{$user->blood_group->name }}
Nationality {{$user->nationality->name }}
State {{$user->state->name }}
LGA {{$user->lga->name }}
Children/Ward @foreach(Qs::findMyChildren($user->id) as $sr) - {{ $sr->user->name.' - '.$sr->my_class->name. ' '.$sr->section->name }}
@endforeach
Class Teacher Of {{ !empty($class_teacher_of) && $class_teacher_of->count() ? $class_teacher_of->implode(', ') : '-' }}
My Subjects @foreach(Qs::findTeacherSubjects($user->id) as $sub) - {{ $sub->name.' ('.$sub->my_class->name.')' }}
@endforeach
@if($user->user_type == 'teacher' && isset($teach_classes) && (Qs::userIsTeamSA() || Auth::user()->id == $user->id))
Teaching Assignment
@if(Qs::userIsTeamSA()) @php $with_subjects = $teach_classes->filter(function ($c) { return $c->subjects->count(); }); $mine_by_class = $with_subjects->map(function ($c) use ($user) { return [$c, $c->subjects->where('teacher_id', $user->id)]; })->filter(function ($x) { return $x[1]->count(); }); $addable = $with_subjects->filter(function ($c) use ($user) { return $c->subjects->where('teacher_id', '!=', $user->id)->count(); }); @endphp
@csrf @method('PUT')
Currently teaching
@forelse($mine_by_class as [$c, $subs])
{{ $c->name }}
@foreach($subs as $sb)
@endforeach
@empty

No subjects assigned yet.

@endforelse

Un-tick a subject to take it off {{ $user->name }}.


Add / change: pick a class, then tick the subjects
@if($addable->count())
@foreach($addable as $c) @endforeach

Ticking a subject that already has another teacher moves it to {{ $user->name }}. You can pick another class and tick more before saving.

@else

No other subjects available. Create more under Manage Subjects.

@endif
@else @php $mine = Qs::findTeacherSubjects($user->id)->groupBy(function ($x) { return $x->my_class->name; }); @endphp @forelse($mine as $cn => $subs)

{{ $cn }}: {{ $subs->pluck('name')->implode(', ') }}

@empty

No subjects assigned yet.

@endforelse @endif
@endif {{--User Profile Ends--}} @endsection @section('scripts') @endsection