@extends('task/layout') @section('content')
@if($rubric->description)
説明: {{ $rubric->description }}
@endif
{{-- ルーブリック評価表 --}}
ルーブリック評価表
@php // レベル数を取得(ルーブリックのlevelフィールドから判定) $levelCount = 3; // デフォルト if ($rubric->criteria->isNotEmpty()) { $firstCriteria = $rubric->criteria->first(); if ($firstCriteria->performance->isNotEmpty()) { $levelCount = $firstCriteria->performance->max('level') ?? 3; } } // レベルラベルを取得(カンマ区切り) $levelLabels = []; if (!empty($rubric->level)) { $levelLabels = array_map('trim', explode(',', $rubric->level)); } @endphp @for($i = 1; $i <= $levelCount; $i++) @php // このレベルの点数を取得(最初の評価項目から) $levelPoint = 0; if ($rubric->criteria->isNotEmpty()) { $firstPerf = $rubric->criteria->first()->performance->where('level', $i)->first(); $levelPoint = $firstPerf ? $firstPerf->point : $i; } // カスタムラベルがあればそれを使用、なければデフォルト // empty()は"0"をtrueと判定するため、!== ''で比較 $levelLabel = isset($levelLabels[$i - 1]) && $levelLabels[$i - 1] !== '' ? $levelLabels[$i - 1] : 'レベル ' . $i; @endphp @endfor @foreach($rubric->criteria as $criteria) @for($level = 1; $level <= $levelCount; $level++) @php // このレベルに対応するパフォーマンスを取得 $performance = $criteria->performance->where('level', $level)->first(); @endphp @endfor @endforeach
評価項目{{ $levelLabel }}@if($rubric->show_points)
({{ $levelPoint }}点)@endif
@if($criteria->category)
📁 {{ $criteria->category->title }}

@endif {{ $criteria->item }}
@if($performance)
{{ $performance->descriptor }}
@if($rubric->show_points)
{{ $performance->point }}点
@endif
@else
未設定
@endif
{{-- 戻るボタン --}}
@push('scripts') @endpush @endsection