remove column in addiction test

This commit is contained in:
misbahsurur 2024-12-20 18:35:35 +07:00
parent 3b8990d6a3
commit 49caec88af
2 changed files with 16 additions and 26 deletions

View File

@ -37,9 +37,7 @@ public function history()
public function addiction() public function addiction()
{ {
$items = Item::with('factor') $items = Item::where('status', 'active')->get();
->get()
->groupBy('factor.name');
$likerts = Likert::orderBy('score')->get(); $likerts = Likert::orderBy('score')->get();
return view('user.addiction', compact('items', 'likerts')); return view('user.addiction', compact('items', 'likerts'));

View File

@ -20,20 +20,13 @@
<table class="table table-bordered w-100 text-wrap align-middle"> <table class="table table-bordered w-100 text-wrap align-middle">
<thead> <thead>
<tr> <tr>
<th>Factor</th>
<th class="text-center">Item</th>
<th>Item Content</th> <th>Item Content</th>
<th class="text-center">Select Answer</th> <th class="text-center">Select Answer</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach ($items as $factorName => $groupedItems) @foreach ($items as $item)
@foreach ($groupedItems as $item)
<tr> <tr>
@if ($loop->first)
<td rowspan="{{ $groupedItems->count() }}">{{ $factorName }}</td>
@endif
<td class="text-center">{{ $item->code }}</td>
<td class="text-wrap">{{ $item->content }}</td> <td class="text-wrap">{{ $item->content }}</td>
<td class="text-center"> <td class="text-center">
<input type="hidden" name="values[]" value="{{ $item->value }}"> <input type="hidden" name="values[]" value="{{ $item->value }}">
@ -48,7 +41,6 @@
</td> </td>
</tr> </tr>
@endforeach @endforeach
@endforeach
</tbody> </tbody>
</table> </table>
</form> </form>