/
home
/
maktab
/
server
/
resources
/
views
/
File Upload :
llllll
Current File: /home/maktab/server/resources/views/reportattend.blade.php
@php $studentsGrouped = []; $totalPresenceCount = []; // تشخیص نوع گروهبندی $groupKey = $send['mode'] === 'teacher' ? 'teacher_name' : 'maktab_name'; foreach ($send['students'] as $student) { $presentCount = 0; foreach ($student['dates'] as $date) { $studentsGrouped[$student[$groupKey]][$date['date']][] = [ 'student_id' => $student['student_id'], 'student_name' => $student['student_name'], 'time' => $date['time'], 'present' => $date['present'], 'total_sessions' => $student['total_sessions'] // اضافه کردن تعداد جلسات دانشآموز ]; if ($date['present'] === 'حاضر') { $presentCount++; } } $totalPresenceCount[$student['student_id']] = $presentCount; } @endphp <!DOCTYPE html> <html dir="rtl" lang="fa"> <head> <meta charset="UTF-8"> <style> body { font-family: 'fa' !important; font-size: 12px; direction: rtl; line-height: 1.6; } h1, h2, h3 { text-align: center; color: #333; margin-bottom: 5px; } .summary { font-size: 20px; margin-top: 10px; text-align: center; background: #f5f5f5; border: 1px solid #ccc; border-radius: 6px; padding: 8px; display: inline-block; } .maktab-header { background: #f0f0f0; padding: 8px; border-radius: 6px; margin: 20px 0 10px 0; font-size: 17px; text-align: right; } .maktab-span { font-weight: bold !important; font-size: 20px; } .page-break { page-break-before: always; } table { width: 100%; border-collapse: collapse; margin-top: 10px; margin-bottom: 20px; } td { border: 1px solid #444; padding: 8px; text-align: center; font-size: 13px; background: #f9f9f9; border-radius: 4px; width: 16.66%; } </style> </head> <body> <h1 style="font-size: 40px"> گزارش حضور و غیاب بر اساس {{ $send['mode'] === 'teacher' ? 'مربی' : 'مکتب' }} </h1> <div style="text-align: center; margin-bottom: 20px;"> <p class="summary"> از تاریخ: <strong>{{ $send['from_date'] }}</strong> تا تاریخ: <strong>{{ $send['to_date'] }}</strong> </p> </div> @php $index = 0; @endphp @foreach ($studentsGrouped as $groupName => $dates) @php $groupId = null; if ($send['mode'] === 'teacher') { $groupId = collect($send['students'])->firstWhere('teacher_name', $groupName)['teacher_id'] ?? null; } else { $groupId = collect($send['students'])->firstWhere('maktab_name', $groupName)['maktab_id'] ?? null; } $statsKey = $send['mode'] === 'teacher' ? 'teacher_stats' : 'maktab_stats'; $averageKey = $send['mode'] === 'teacher' ? 'average_presence_by_teacher' : 'average_presence_by_maktab'; @endphp <div class="maktab-header {{ $index > 0 ? 'page-break' : '' }}"> <strong>نام {{ $send['mode'] === 'teacher' ? 'مربی' : 'مکتب' }}:</strong> <span class="maktab-span">{{ $groupName ?: 'نامشخص' }}</span> <br> <strong>تعداد دانشآموزان:</strong> <span class="maktab-span">{{ $send[$statsKey][$groupName] ?? 0 }}</span> <br> <strong>تعداد جلسات مدیر مکتب :</strong> <span class="maktab-span">{{ $send['total_type3_teacher_presence'][$groupId] ?? 0 }}</span> <br> {{-- <strong>تعداد جلسات مربیان :</strong>--}} {{-- <span class="maktab-span">{{ $send['total_present'][$groupId] ?? 0 }}</span>--}} {{-- <br>--}} <strong>میانگین حضور کل دانشآموزان:</strong> <span class="maktab-span"> {{ ($send[$averageKey][$groupName] ?? 0) . ' از ' . ($send[$statsKey][$groupName] ?? 0) . ' دانشآموز' }} </span> </div> @foreach ($dates as $date => $records) @php $studentShown = []; $uniqueStudents = []; foreach ($records as $record) { if (!in_array($record['student_id'], $studentShown)) { $studentShown[] = $record['student_id']; $uniqueStudents[] = $record; } } $chunks = array_chunk($uniqueStudents, 6); @endphp <table> @foreach ($chunks as $chunk) <tr> @foreach ($chunk as $record) @php $presenceCount = $totalPresenceCount[$record['student_id']] ?? 0; $studentTotalSessions = $record['total_sessions'] ?? 0; $textColor = $presenceCount < ($studentTotalSessions / 2) ? '#b02a37' : '#2c7a2c'; @endphp <td> <strong>{{ $record['student_name'] }}</strong><br> <span style="color: {{ $textColor }}; font-weight: 400;"> {{ $presenceCount . ' از ' . $studentTotalSessions . ' جلسه' }} </span> </td> @endforeach @if (count($chunk) < 6) @for ($i = 0; $i < 6 - count($chunk); $i++) <td></td> @endfor @endif </tr> @endforeach </table> @endforeach @php $index++; @endphp @endforeach </body> </html>
Copyright ©2k19 -
Hexid
|
Tex7ure