remove column in addiction test
This commit is contained in:
parent
3b8990d6a3
commit
49caec88af
|
@ -37,9 +37,7 @@ public function history()
|
|||
|
||||
public function addiction()
|
||||
{
|
||||
$items = Item::with('factor')
|
||||
->get()
|
||||
->groupBy('factor.name');
|
||||
$items = Item::where('status', 'active')->get();
|
||||
|
||||
$likerts = Likert::orderBy('score')->get();
|
||||
return view('user.addiction', compact('items', 'likerts'));
|
||||
|
|
|
@ -20,34 +20,26 @@
|
|||
<table class="table table-bordered w-100 text-wrap align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Factor</th>
|
||||
<th class="text-center">Item</th>
|
||||
<th>Item Content</th>
|
||||
<th class="text-center">Select Answer</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($items as $factorName => $groupedItems)
|
||||
@foreach ($groupedItems as $item)
|
||||
<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-center">
|
||||
<input type="hidden" name="values[]" value="{{ $item->value }}">
|
||||
<select name="answers[]" class="form-select" required>
|
||||
<option value="" hidden>Select Answer</option>
|
||||
@foreach ($likerts as $likert)
|
||||
<option value="{{ $likert->score }}" {{ in_array($likert->score, old('answers', [])) ? 'selected' : '' }}>
|
||||
{{ $likert->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@foreach ($items as $item)
|
||||
<tr>
|
||||
<td class="text-wrap">{{ $item->content }}</td>
|
||||
<td class="text-center">
|
||||
<input type="hidden" name="values[]" value="{{ $item->value }}">
|
||||
<select name="answers[]" class="form-select" required>
|
||||
<option value="" hidden>Select Answer</option>
|
||||
@foreach ($likerts as $likert)
|
||||
<option value="{{ $likert->score }}" {{ in_array($likert->score, old('answers', [])) ? 'selected' : '' }}>
|
||||
{{ $likert->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue