@extends('layouts.masteruser')
@section('title', 'Detail History')
@section('content')
    <div class="page-content">
        <div class="row">
            <div class="col-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <h4 class="card-title">Detail History</h4>
                        <div class="row">
                            <div class="col-md-12 col-lg-6">
                                <div class="mb-3">
                                    <label class="form-label">Addiction</label>
                                    <input type="text" class="form-control" value="{{ $history->addiction->name }}" disabled placeholder="Enter addiction">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Result (%)</label>
                                    <input type="text" class="form-control" value="{{ $history->result }}" disabled placeholder="Enter result"/>
                                </div>
                            </div>
                            <div class="col-md-12 col-lg-6">
                                <div class="mb-3">
                                    <label class="form-label">Date Time</label>
                                    <input type="text" class="form-control" value="{{ $history->created_at->format('d-m-Y H:i:s') }}" disabled placeholder="Enter date time">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Solution</label>
                                    <textarea class="form-control" disabled placeholder="Enter solution">{{ $history->addiction->solution ?? '' }}</textarea>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-12">
                                <h4 class="card-title">Addiction Test Result</h4>
                                <table class="table table-bordered w-100 text-wrap align-middle">
                                    <thead>
                                        <tr>
                                            <th width="10px" class="text-center">#</th>
                                            <th>Item Content</th>
                                            <th class="text-center">Answer</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach ($history->details as $detail)
                                            <tr>
                                                <td class="text-center">{{ $loop->iteration }}</td>
                                                <td class="text-wrap">{{ $detail->item->content }}</td>
                                                <td class="text-center">{{ $detail->likert->name }}</td>
                                            </tr>
                                        @endforeach
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
