student-management.blade.php 8.9 KB

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