knowledge-relation-management.blade.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <x-filament-panels::page>
  2. <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
  3. <div class="stats shadow bg-base-100">
  4. <div class="stat">
  5. <div class="stat-figure text-secondary">
  6. <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="inline-block w-8 h-8 stroke-current"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"></path></svg>
  7. </div>
  8. <div class="stat-title">关联关系总数</div>
  9. <div class="stat-value text-secondary">{{ count($relations) }}</div>
  10. <div class="stat-desc">图谱中的边</div>
  11. </div>
  12. </div>
  13. <div class="stats shadow bg-base-100">
  14. <div class="stat">
  15. <div class="stat-figure text-primary">
  16. <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="inline-block w-8 h-8 stroke-current"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
  17. </div>
  18. <div class="stat-title">前置依赖</div>
  19. <div class="stat-value text-primary">{{ collect($relations)->where('relation_type', 'PREREQUISITE')->count() }}</div>
  20. <div class="stat-desc">学习依赖关系</div>
  21. </div>
  22. </div>
  23. <div class="stats shadow bg-base-100">
  24. <div class="stat">
  25. <div class="stat-figure text-accent">
  26. <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="inline-block w-8 h-8 stroke-current"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"></path></svg>
  27. </div>
  28. <div class="stat-title">相关关系</div>
  29. <div class="stat-value text-accent">{{ collect($relations)->where('relation_type', 'RELATED')->count() }}</div>
  30. <div class="stat-desc">概念关联</div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="overflow-x-auto bg-base-100 rounded-box shadow-lg">
  35. <table class="table table-zebra w-full">
  36. <thead class="bg-base-200 text-base-content/70">
  37. <tr>
  38. <th>源知识点</th>
  39. <th class="text-center">关系类型</th>
  40. <th>目标知识点</th>
  41. <th>权重</th>
  42. <th>描述</th>
  43. </tr>
  44. </thead>
  45. <tbody>
  46. @forelse($relations as $relation)
  47. <tr class="hover">
  48. <td>
  49. <div class="font-bold">{{ $relation['source_kp'] }}</div>
  50. </td>
  51. <td class="text-center">
  52. <div class="flex flex-col items-center gap-1">
  53. @php
  54. $badgeClass = match($relation['relation_type']) {
  55. 'PREREQUISITE' => 'badge-primary',
  56. 'RELATED' => 'badge-accent',
  57. 'TRANSFER' => 'badge-secondary',
  58. default => 'badge-ghost'
  59. };
  60. @endphp
  61. <span class="badge {{ $badgeClass }} badge-sm">{{ $relation['relation_type'] }}</span>
  62. <span class="text-[10px] uppercase tracking-wider opacity-50">{{ $relation['relation_direction'] }}</span>
  63. <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 opacity-50">
  64. <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 13.5L12 21m0 0l-7.5-7.5M12 21V3" />
  65. </svg>
  66. </div>
  67. </td>
  68. <td>
  69. <div class="font-bold">{{ $relation['target_kp'] }}</div>
  70. </td>
  71. <td>
  72. <div class="radial-progress text-primary text-xs" style="--value:{{ $relation['weight'] * 100 }}; --size:2rem;">{{ $relation['weight'] }}</div>
  73. </td>
  74. <td class="text-sm opacity-70 max-w-xs truncate">
  75. {{ $relation['description'] ?: '-' }}
  76. </td>
  77. </tr>
  78. @empty
  79. <tr>
  80. <td colspan="5" class="text-center py-10">
  81. <div class="flex flex-col items-center justify-center gap-2 text-base-content/50">
  82. <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-10 h-10">
  83. <path stroke-linecap="round" stroke-linejoin="round" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" />
  84. </svg>
  85. <span>暂无关联关系。</span>
  86. </div>
  87. </td>
  88. </tr>
  89. @endforelse
  90. </tbody>
  91. </table>
  92. </div>
  93. </x-filament-panels::page>