|
|
@@ -19,76 +19,53 @@
|
|
|
{{-- 选择器区域 --}}
|
|
|
<div class="bg-gray-50 rounded-lg p-4 border border-gray-200">
|
|
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
|
- <div>
|
|
|
- <label for="teacher" class="block text-sm font-medium text-gray-700 mb-2">选择老师</label>
|
|
|
- <div class="dropdown w-full">
|
|
|
- <label tabindex="0" class="btn btn-bordered w-full justify-between">
|
|
|
- @if(!empty($teacherId))
|
|
|
- @php
|
|
|
- $selectedTeacher = collect($this->teachers)->firstWhere('teacher_id', $teacherId);
|
|
|
- @endphp
|
|
|
- {{ $selectedTeacher ? trim($selectedTeacher->name ?? $selectedTeacher->teacher_id) . ($selectedTeacher->subject ? " ({$selectedTeacher->subject})" : '') : '请选择老师...' }}
|
|
|
- @else
|
|
|
- 请选择老师...
|
|
|
- @endif
|
|
|
- <svg class="w-4 h-4 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
|
|
- </svg>
|
|
|
- </label>
|
|
|
- <ul tabindex="0" class="dropdown-content menu p-2 shadow bg-base-100 rounded-box w-full max-h-64 overflow-y-auto">
|
|
|
- <li>
|
|
|
- <a wire:click="$set('teacherId', '')" class="{{ empty($teacherId) ? 'active' : '' }}">
|
|
|
- 请选择老师...
|
|
|
- </a>
|
|
|
- </li>
|
|
|
- @foreach($this->teachers as $teacher)
|
|
|
- <li>
|
|
|
- <a wire:click="$set('teacherId', '{{ $teacher->teacher_id }}')" class="{{ $teacherId === $teacher->teacher_id ? 'active' : '' }}">
|
|
|
- {{ trim($teacher->name ?? $teacher->teacher_id) . ($teacher->subject ? " ({$teacher->subject})" : '') }}
|
|
|
- </a>
|
|
|
- </li>
|
|
|
- @endforeach
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- <p class="mt-1 text-xs text-gray-500">选择要查看的老师</p>
|
|
|
+ {{-- 选择老师 --}}
|
|
|
+ <div class="form-control w-full">
|
|
|
+ <label class="label">
|
|
|
+ <span class="label-text font-medium">选择老师</span>
|
|
|
+ </label>
|
|
|
+ <select
|
|
|
+ wire:model.live="teacherId"
|
|
|
+ class="select select-bordered w-full"
|
|
|
+ >
|
|
|
+ <option value="">请选择老师...</option>
|
|
|
+ @foreach($this->teachers as $teacher)
|
|
|
+ <option value="{{ $teacher->teacher_id }}">
|
|
|
+ {{ trim($teacher->name ?? $teacher->teacher_id) . ($teacher->subject ? " ({$teacher->subject})" : '') }}
|
|
|
+ </option>
|
|
|
+ @endforeach
|
|
|
+ </select>
|
|
|
+ <label class="label">
|
|
|
+ <span class="label-text text-xs text-gray-500">选择要查看的老师</span>
|
|
|
+ </label>
|
|
|
</div>
|
|
|
|
|
|
- <div>
|
|
|
- <label for="student" class="block text-sm font-medium text-gray-700 mb-2">选择学生</label>
|
|
|
- <div class="dropdown w-full">
|
|
|
- <label tabindex="0" class="btn btn-bordered w-full justify-between {{ empty($teacherId) ? 'btn-disabled' : '' }}">
|
|
|
+ {{-- 选择学生 --}}
|
|
|
+ <div class="form-control w-full">
|
|
|
+ <label class="label">
|
|
|
+ <span class="label-text font-medium">选择学生</span>
|
|
|
+ </label>
|
|
|
+ <select
|
|
|
+ wire:model.live="studentId"
|
|
|
+ class="select select-bordered w-full"
|
|
|
+ @if(empty($teacherId)) disabled @endif
|
|
|
+ >
|
|
|
+ <option value="">
|
|
|
@if(empty($teacherId))
|
|
|
请先选择老师
|
|
|
- @elseif(!empty($studentId))
|
|
|
- @php
|
|
|
- $selectedStudent = collect($this->students)->firstWhere('student_id', $studentId);
|
|
|
- @endphp
|
|
|
- {{ $selectedStudent ? trim($selectedStudent->name ?? $selectedStudent->student_id) . " ({$selectedStudent->grade} - {$selectedStudent->class_name})" : '请选择学生...' }}
|
|
|
@else
|
|
|
请选择学生...
|
|
|
@endif
|
|
|
- <svg class="w-4 h-4 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
|
|
- </svg>
|
|
|
- </label>
|
|
|
- @if(!empty($teacherId))
|
|
|
- <ul tabindex="0" class="dropdown-content menu p-2 shadow bg-base-100 rounded-box w-full max-h-64 overflow-y-auto">
|
|
|
- <li>
|
|
|
- <a wire:click="$set('studentId', '')" class="{{ empty($studentId) ? 'active' : '' }}">
|
|
|
- 请选择学生...
|
|
|
- </a>
|
|
|
- </li>
|
|
|
- @foreach($this->students as $student)
|
|
|
- <li>
|
|
|
- <a wire:click="$set('studentId', '{{ $student->student_id }}')" class="{{ $studentId === $student->student_id ? 'active' : '' }}">
|
|
|
- {{ trim($student->name ?? $student->student_id) . " ({$student->grade} - {$student->class_name})" }}
|
|
|
- </a>
|
|
|
- </li>
|
|
|
- @endforeach
|
|
|
- </ul>
|
|
|
- @endif
|
|
|
- </div>
|
|
|
- <p class="mt-1 text-xs text-gray-500">选择要查看的学生</p>
|
|
|
+ </option>
|
|
|
+ @foreach($this->students as $student)
|
|
|
+ <option value="{{ $student->student_id }}">
|
|
|
+ {{ trim($student->name ?? $student->student_id) . " ({$student->grade} - {$student->class_name})" }}
|
|
|
+ </option>
|
|
|
+ @endforeach
|
|
|
+ </select>
|
|
|
+ <label class="label">
|
|
|
+ <span class="label-text text-xs text-gray-500">选择要查看的学生</span>
|
|
|
+ </label>
|
|
|
</div>
|
|
|
</div>
|
|
|
|