student-management.blade.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <div>
  2. <div class="space-y-6">
  3. <!-- 顶部操作条 -->
  4. <div class="flex flex-wrap items-center justify-between gap-3">
  5. <div class="flex items-center gap-2">
  6. <a href="{{ route('filament.admin.resources.students.create') }}"
  7. class="btn btn-primary">
  8. <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  9. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
  10. </svg>
  11. 添加新学生
  12. </a>
  13. @if(!$this->isTeacher)
  14. <a href="{{ route('filament.admin.resources.teachers.create') }}"
  15. class="btn btn-success">
  16. <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  17. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path>
  18. </svg>
  19. 添加新老师
  20. </a>
  21. @endif
  22. </div>
  23. <div class="flex items-center gap-2">
  24. <a href="{{ route('filament.admin.pages.student-dashboard') }}"
  25. class="btn btn-ghost">
  26. <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  27. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2z"></path>
  28. </svg>
  29. 学生仪表板
  30. </a>
  31. @if($this->selectedTeacherId)
  32. <span class="rounded-lg bg-primary-50 px-3 py-1 text-sm text-primary-700">
  33. 当前筛选:{{ $this->selectedTeacherName ?? '指定老师' }}
  34. </span>
  35. <button
  36. wire:click="resetTeacherFilter"
  37. class="btn btn-xs btn-ghost text-slate-500">
  38. 重置筛选
  39. </button>
  40. @endif
  41. </div>
  42. </div>
  43. <!-- 老师概览 -->
  44. <div class="space-y-4">
  45. <div class="flex flex-wrap items-center justify-between gap-3">
  46. <div>
  47. <h3 class="text-lg font-semibold text-gray-900 dark:text-white">老师概览</h3>
  48. <p class="text-sm text-gray-500 dark:text-gray-400">以老师为核心查看所带学生与近期动态</p>
  49. </div>
  50. <div class="flex gap-2">
  51. @if(!$this->isTeacher)
  52. <a href="{{ route('filament.admin.resources.teachers.index') }}"
  53. class="inline-flex items-center gap-2 rounded-lg border border-gray-200 px-3 py-1.5 text-xs font-medium text-gray-600 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800"
  54. >
  55. 查看全部老师
  56. </a>
  57. @endif
  58. </div>
  59. </div>
  60. <div class="grid gap-4 md:grid-cols-2 xl:grid-cols-3">
  61. @forelse($this->teacherOverview as $teacher)
  62. <div class="rounded-2xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-700 dark:bg-gray-900/70">
  63. <div class="flex items-start justify-between gap-3">
  64. <div>
  65. <p class="text-lg font-semibold text-gray-900 dark:text-gray-100">
  66. {{ $teacher['teacher_name'] ?? '未命名老师' }}
  67. </p>
  68. <p class="text-xs text-gray-500 dark:text-gray-400">
  69. {{ $teacher['teacher_email'] ?? '未配置邮箱' }}
  70. </p>
  71. <p class="mt-2 text-sm text-gray-600 dark:text-gray-300">
  72. 负责学生:
  73. <span class="font-semibold text-gray-900 dark:text-white">
  74. {{ $teacher['students_count'] ?? 0 }}
  75. </span>
  76. </p>
  77. <p class="text-xs text-gray-400 dark:text-gray-500">
  78. 最近动态:
  79. {{ $teacher['latest_student_activity']
  80. ? \Illuminate\Support\Carbon::parse($teacher['latest_student_activity'])->diffForHumans()
  81. : '暂无' }}
  82. </p>
  83. </div>
  84. <button
  85. onclick="window.location.href='/admin/students?tableFilters[teacher_id][value]={{ $teacher['teacher_id'] }}'"
  86. class="inline-flex items-center gap-1 rounded-lg border border-primary-200 bg-primary-50 px-3 py-1 text-xs font-semibold text-primary-700 transition hover:bg-primary-100 dark:border-primary-500/40 dark:bg-primary-500/10 dark:text-primary-300"
  87. >
  88. 查看学生
  89. <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  90. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
  91. </svg>
  92. </button>
  93. </div>
  94. <div class="mt-4">
  95. <p class="text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500">所带学生</p>
  96. <div class="mt-2 space-y-2">
  97. @forelse($teacher['students'] as $student)
  98. <div class="flex items-center justify-between rounded-lg border border-gray-100 px-3 py-2 text-sm dark:border-gray-700">
  99. <div>
  100. <p class="font-medium text-gray-900 dark:text-gray-100">{{ $student['name'] ?? '未命名学生' }}</p>
  101. <p class="text-xs text-gray-500 dark:text-gray-400">
  102. {{ $student['grade'] ?? '未知年级' }} · {{ $student['class_name'] ?? '未知班级' }}
  103. </p>
  104. </div>
  105. <a
  106. href="{{ route('filament.admin.resources.students.view', $student['student_id']) }}"
  107. target="_blank"
  108. class="text-xs font-semibold text-primary-600 hover:text-primary-700 dark:text-primary-400"
  109. >
  110. 详情
  111. </a>
  112. </div>
  113. @empty
  114. <p class="text-xs text-gray-500 dark:text-gray-400">尚无学生</p>
  115. @endforelse
  116. </div>
  117. </div>
  118. </div>
  119. @empty
  120. <div class="rounded-xl border border-dashed border-gray-300 px-4 py-6 text-center text-sm text-gray-500 dark:border-gray-700 dark:text-gray-400">
  121. 暂无老师数据
  122. </div>
  123. @endforelse
  124. </div>
  125. </div>
  126. <!-- 数据表格 -->
  127. <div class="bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700">
  128. {{ $this->table }}
  129. </div>
  130. <!-- 页面说明 -->
  131. <div class="bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800 p-4">
  132. <div class="flex items-start gap-3">
  133. <svg class="h-5 w-5 text-blue-600 dark:text-blue-400 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  134. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  135. </svg>
  136. <div class="text-sm text-blue-800 dark:text-blue-200">
  137. <p class="font-medium mb-1">使用说明</p>
  138. <ul class="list-disc list-inside space-y-1 text-blue-700 dark:text-blue-300">
  139. @if(!$this->isTeacher)
  140. <li>可以点击按钮添加新学生或新老师</li>
  141. <li>查看老师概览了解各老师所带学生情况</li>
  142. <li>支持按年级、班级、指导老师筛选学生数据</li>
  143. @else
  144. <li>您只能查看和管理自己指导的学生</li>
  145. <li>可以点击"添加新学生"为您的班级添加学生</li>
  146. <li>在老师概览中查看您的学生信息和近期动态</li>
  147. <li>支持按年级、班级筛选您的学生数据</li>
  148. @endif
  149. <li>表格会自动刷新显示最新数据</li>
  150. </ul>
  151. </div>
  152. </div>
  153. </div>
  154. </div>
  155. </div>