@extends('layouts.app')

@section('title', __('labCore::lang.lab_core') . ' — ' . __('labCore::lang.results'))

@section('content')
<section class="content-header">
    <h1><i class="fas fa-vials"></i> {{ __('labCore::lang.lab_core') }} <small>{{ __('labCore::lang.results') }}</small></h1>
</section>

<section class="content">
    @include('labCore::partials._nav')

    <div class="box box-solid">
        <div class="box-header with-border"><h3 class="box-title">Test Sessions</h3></div>
        <div class="box-body no-padding">
            <table class="table table-striped">
                <thead>
                    <tr><th>Sample No</th><th>Patient</th><th>Vendor</th><th>Date</th><th>Analytes</th><th>Flag</th><th></th></tr>
                </thead>
                <tbody>
                @forelse($sessions as $session)
                    <tr>
                        <td><strong>{{ $session->sample_no }}</strong></td>
                        <td>{{ $session->patient_name ?: '—' }}<br><small class="text-muted">{{ $session->species }}</small></td>
                        <td>{{ ucfirst($session->vendor) }}</td>
                        <td>{{ optional($session->test_date)->format('Y-m-d') }} {{ $session->test_time }}</td>
                        <td>{{ $session->results_count }}</td>
                        <td>
                            @if($session->is_abnormal)
                                <span class="label label-danger">Abnormal</span>
                            @else
                                <span class="label label-success">Normal</span>
                            @endif
                        </td>
                        <td><a href="{{ route('lab.results.show', $session->id) }}" class="btn btn-xs btn-primary"><i class="fa fa-eye"></i> View</a></td>
                    </tr>
                @empty
                    <tr><td colspan="7" class="text-muted">{{ __('labCore::lang.no_data') }}</td></tr>
                @endforelse
                </tbody>
            </table>
        </div>
        @if($sessions->hasPages())
            <div class="box-footer">{{ $sessions->links() }}</div>
        @endif
    </div>
</section>
@endsection
