|
102 | 102 |
|
103 | 103 | @if ($tool->hasReportStatuses($post->id)) |
104 | 104 | <ol class="mb-3"> |
| 105 | + @php |
| 106 | + $previous_report_submission_id = null; |
| 107 | + @endphp |
105 | 108 | @foreach($tool->getReportStatuses($post->id) as $report_status) |
| 109 | + @php |
| 110 | + // $report_statusに関する修正履歴を取得する |
| 111 | + // 直前の提出と現在の提出の間にある削除されたレコードを修正履歴とする |
| 112 | + $submission_revisions = $deleted_submissions->where('id', '>', $previous_report_submission_id)->where('id', '<', $report_status->id); |
| 113 | + @endphp |
106 | 114 | @if (!$loop->last) |
107 | 115 | <div class="collapse multi-collapse" id="multiCollapseReport{{$loop->iteration}}"> |
108 | 116 | @endif |
109 | 117 |
|
110 | 118 | <li value="{{$loop->iteration}}">{{$report_status->getStstusName($tool->getStudentId())}} |
111 | | - <table class="table table-bordered table-sm report_table"> |
112 | | - <tbody> |
113 | | - <tr> |
114 | | - <th>{{$report_status->getStstusPostTimeName()}}</th> |
115 | | - <td>{{$report_status->created_at}}</td> |
116 | | - </tr> |
117 | | - @if ($tool->isUseFunction($report_status->task_status, 'file')) |
118 | | - <tr> |
119 | | - <th>{{$report_status->getUploadFileName()}}</th> |
120 | | - @if (empty($report_status->upload_id)) |
121 | | - <td>なし</td> |
122 | | - @else |
123 | | - <td><a href="{{url('/')}}/file/{{$report_status->upload_id}}" target="_blank">{{$report_status->upload->client_original_name}}</a></td> |
124 | | - @endif |
125 | | - </tr> |
126 | | - @endif |
127 | | - @if ($report_status->hasGrade()) |
128 | | - <tr> |
129 | | - <th>評価</th> |
130 | | - <td><span class="text-danger font-weight-bold">{{$report_status->grade}}</span></td> |
131 | | - </tr> |
132 | | - @endif |
133 | | - @if ($tool->isUseFunction($report_status->task_status, 'comment')) |
134 | | - <tr> |
135 | | - <th>コメント</th> |
136 | | - <td>{!!nl2br(e($report_status->comment))!!}</td> |
137 | | - </tr> |
138 | | - @endif |
139 | | - </tbody> |
140 | | - </table> |
| 119 | + {{-- 修正履歴 --}} |
| 120 | + @if ($report_status->task_status == 1 && $submission_revisions->count() > 0) |
| 121 | + <small class="text text-muted">(修正済み)</small> |
| 122 | + @if ($tool->isTeacher()) |
| 123 | + <button type="button" class="btn btn-link p-0" data-toggle="modal" data-target="#submissionRevisionsModal{{$loop->iteration}}"> |
| 124 | + 修正履歴を表示 |
| 125 | + </button> |
| 126 | + {{-- Modal --}} |
| 127 | + <div class="modal fade" id="submissionRevisionsModal{{$loop->iteration}}" tabindex="-1" role="dialog" aria-labelledby="submissionRevisionsModalLabel{{$loop->iteration}}" aria-hidden="true"> |
| 128 | + <div class="modal-dialog modal-lg" role="document"> |
| 129 | + <div class="modal-content"> |
| 130 | + <div class="modal-header"> |
| 131 | + <h5 class="modal-title" id="submissionRevisionsModalLabel{{$loop->iteration}}">修正履歴</h5> |
| 132 | + <button type="button" class="close" data-dismiss="modal" aria-label="閉じる"> |
| 133 | + <span aria-hidden="true">×</span> |
| 134 | + </button> |
| 135 | + </div> |
| 136 | + <div class="modal-body"> |
| 137 | + <ul> |
| 138 | + @foreach ($submission_revisions as $revision) |
| 139 | + {{-- 履歴 --}} |
| 140 | + @include('plugins.user.learningtasks.default.learningtasks_show_report_status', ['user_status' => $revision]) |
| 141 | + <p class="mb-2"> |
| 142 | + <span class="text-info">{{$revision->deleted_at}} {{$revision->deleted_name}}が修正</span> |
| 143 | + </p> |
| 144 | + @endforeach |
| 145 | + </ul> |
| 146 | + </div> |
| 147 | + <div class="modal-footer"> |
| 148 | + <button type="button" class="btn btn-secondary" data-dismiss="modal">閉じる</button> |
| 149 | + </div> |
| 150 | + </div> |
| 151 | + </div> |
| 152 | + </div> |
| 153 | + @endif |
| 154 | + @endif |
| 155 | + |
| 156 | + {{-- 履歴 --}} |
| 157 | + @include('plugins.user.learningtasks.default.learningtasks_show_report_status', ['user_status' => $report_status]) |
141 | 158 |
|
142 | 159 | @if ($loop->last) |
143 | 160 | {{-- 履歴削除ボタン:課題管理者機能 --}} |
|
147 | 164 | @if (!$loop->last) |
148 | 165 | </div> |
149 | 166 | @endif |
| 167 | + |
| 168 | + @php |
| 169 | + // 修正履歴を取得するため、直前のレポート提出IDを保持 |
| 170 | + if ($report_status->task_status == 1) { |
| 171 | + $previous_report_submission_id = $report_status->id; |
| 172 | + } |
| 173 | + @endphp |
150 | 174 | @endforeach |
151 | 175 | </ol> |
152 | 176 | @else |
|
0 commit comments