@extends('template.app') @section('content')

{{ $title }}

@if (count($attendance) > 0) @if ($attendance[0]->mutasi_teacher != null) @php $tgl_mutasi = $attendance[0]->tgl_mutasi; $teacher = \App\Models\Teacher::where('id', $attendance[0]->mutasi_teacher)->first(); @endphp @if ($teacher != null)
Previous Teacher was {{ $teacher->name }} stopped at {{ $tgl_mutasi }}
@else
Stopped at {{ $tgl_mutasi }}
@endif @endif @endif
@if (session('status')) @endif
@foreach ($attendance as $key => $item) @endforeach @foreach ($student as $item) @if (Request::segment(2) == 'edit') @foreach ($attendance as $i) @php $cek = App\Models\AttendanceDetail::where( 'attendance_id', $i->id, )->where('student_id', $item->id); $count = $cek->count(); if ($count == 1 && $cek->first()->is_absent == '1') { $absen = true; } else { $absen = false; } @endphp @if ($count == 1 && $cek->first()->is_absent == '1') @elseif ($count == 1 && $cek->first()->is_permission == true) @elseif ($count == 1 && $cek->first()->is_alpha == true) @else @endif @endforeach @else @foreach ($attendance as $i) @php $cek = App\Models\AttendanceDetail::where( 'attendance_id', $i->id, )->where('student_id', $item->id); $count = $cek->count(); if ($count == 1 && $cek->first()->is_absent == '1') { $absen = true; } else { $absen = false; } @endphp @if ($count == 1 && $cek->first()->is_absent == '1') @elseif ($count == 1 && $cek->first()->is_permission == true) @elseif ($count == 1 && $cek->first()->is_alpha == true) @else @endif @endforeach @endif @endforeach
Nama{{ date('d/m', strtotime($item->date)) }} @if ($key < 2) @if (Request::segment(2) != 'edit')
Edit
@endif @endif
{{ $item->name }}
@if (Request::segment(2) == 'edit')
@csrf @else @csrf @endif

{{ $data->type == 'create' ? 'Presence' : 'Edit Presence' }}

{{-- --}} @php $agenda = App\Models\AttendanceDetail::join( 'attendances', 'attendance_details.attendance_id', 'attendances.id', )->where('price_id', $priceId); $no = 1; $whereRaw = ''; $countAgenda = 0; @endphp @foreach ($student as $keyIt => $it) @php $or = $keyIt + 1 != $loop->count ? ' or ' : ''; $whereRaw .= 'student_id = ' . $it->id . $or; $countAgenda++; // if ($keyIt == 0) { // $agenda = $agenda->where('student_id', $it->id); // } else { // $agenda = $agenda->orWhereRaw('(' . $whereRaw . ')'); // $agenda = $agenda->orWhere('student_id', $it->id); // } $birthDayPoint = 0; if ($it->birthday == date('M d')) { $birthDayPoint = 30; } @endphp {{-- --}} @php $no++; @endphp @endforeach
No Name Presence Absent In-Point CategoryIn Point Category Total
{{ $no }} {{ ucwords($it->name) }} @php $cekAbsen = \DB::table('attendance_details') ->where('attendance_id', $data->attendanceId) ->where('student_id', $it->id) ->where('is_absent', '1') ->count(); $studentPointCategory = []; $getStudentPointCategory = \DB::table( 'attendance_detail_points', ) ->join( 'attendance_details', 'attendance_detail_points.attendance_detail_id', 'attendance_details.id', ) ->where('student_id', $it->id) ->where('attendance_id', $data->attendanceId) ->get(); foreach ($getStudentPointCategory as $k => $v) { array_push( $studentPointCategory, $v->point_category_id, ); } $isChecked = false; if ($data->type == 'create') { $isChecked = false; } else { // if ($data->students[$no - 1]->student_id == $it->id && $data->students[$no - 1]->is_absent == '1') { // $isChecked = true; // } if ($cekAbsen == 0) { $isChecked = false; } else { $isChecked = true; } } @endphp @php $isCekPermission = false; $isCekAlpha = false; $cekPermission = \DB::table('attendance_details') ->where('attendance_id', $data->attendanceId) ->where('student_id', $it->id) ->where('is_permission', true) ->count(); $cekAlpha = \DB::table('attendance_details') ->where('attendance_id', $data->attendanceId) ->where('student_id', $it->id) ->where('is_alpha', true) ->count(); if ($data->type == 'create') { $isCekAlpha = false; $isCekPermission = false; } else { if ($cekPermission == 1) { if ($cekAbsen == 0) { $isCekPermission = true; } else { $isCekPermission = false; } } else { $isCekPermission = false; } if ($cekAlpha == 1) { $isCekAlpha = true; } else { $isCekAlpha = false; } } @endphp
@php $isAbsent = false; if ($data->type == 'create') { $isAbsent = false; } else { if ($cekAbsen == 1) { $isAbsent = true; } } @endphp @php $totalPoint = 0; @endphp
@if ($isAbsent) @php $pointDay = 0; $pointHour = 0; if ( Request::get('day1') == 5 || Request::get('day1') == 6 || Request::get('day2') == 5 || Request::get('day2') == 6 || Request::get('day1') == Request::get('day2') ) { $pointDay = 20; } else { $pointDay = 10; } if ( $it->course_hour != null || $it->priceid == 42 || $it->priceid == 39 ) { // $totalPoint = $it->course_hour . '0'; $totalPoint = $pointDay; } else { $totalPoint = $pointDay; } @endphp {{ $totalPoint }} @else 0 @endif
{{-- {{ $isAbsent ? '10' : '0' }} --}}
{{-- @if ($birthDayPoint != 0) + Extra Birthday @endif --}} {{-- --}} @php $totalPoint = 0; if ($data->type == 'create') { $totalPoint = 0; } else { $cekTotalPoint = \DB::table('attendance_details') ->where('attendance_id', $data->attendanceId) ->where('student_id', $it->id); if ($cekTotalPoint->count() == 1) { $getTotalPoint = $cekTotalPoint->first(); $totalPoint = $getTotalPoint->total_point; } } @endphp {{-- --}}
{{ $totalPoint }}

Agenda

{{--
--}} {{--
--}}
@php $tests = DB::table('tests')->get(); @endphp {{-- type == 'update' ? ($cekOrder ? 'checked' : '') : '' }}>
@endforeach
{{-- --}}
{{--
--}} {{--
--}}
@if (Request::segment(2) == 'edit' ) Update @else Submit @endif
{{-- @endif --}}
@php $agenda = $agenda ->where('day1', $reqDay1) ->where('day2', $reqDay2) ->where('teacher_id', $reqTeacher) ->where('course_time', $reqTime); // ->where('is_class_new', Request::get('new')); if ($countAgenda != 0) { $agenda = $agenda->whereRaw('(' . $whereRaw . ')'); } $agenda = $agenda->orderBy('attendances.id', 'DESC')->groupBy('attendances.id')->get(); @endphp {{-- @if (Auth::guard('teacher')->check() == true) --}}

Last Agenda

{{-- {{ dd($agenda) }} --}} @foreach ($agenda as $item)

{{ $item->date }}
{{ $item->activity }}
Text Book : {{ $item->text_book }}
Excercise Book : {{ $item->excercise_book != null ? $item->excercise_book : '-' }}

@endforeach
{{-- @endif --}}
@endsection