@extends('layouts.app')

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

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

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

    <div class="row">
        <div class="col-md-6">
            <div class="box box-primary">
                <div class="box-header with-border"><h3 class="box-title">Worklist Entry</h3></div>
                <form method="POST" action="{{ route('lab.worklist.store') }}">
                    @csrf
                    <div class="box-body">
                        <div class="form-group">
                            <label>Vendor</label>
                            <select name="vendor" class="form-control" required>
                                <option value="">— select —</option>
                                @foreach($vendors as $key => $driver)
                                    <option value="{{ $key }}" {{ old('vendor') === $key ? 'selected' : '' }}>{{ $driver->label() }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Device</label>
                            <select name="device_id" class="form-control">
                                <option value="">— any —</option>
                                @foreach($devices as $device)
                                    <option value="{{ $device->id }}" {{ (string) old('device_id') === (string) $device->id ? 'selected' : '' }}>{{ $device->name }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Sample No</label>
                            <input type="text" name="sample_no" class="form-control" value="{{ old('sample_no') }}" required>
                        </div>
                        <div class="row">
                            <div class="col-xs-6 form-group">
                                <label>Patient ID</label>
                                <input type="text" name="patient_id" class="form-control" value="{{ old('patient_id') }}">
                            </div>
                            <div class="col-xs-6 form-group">
                                <label>Patient Name</label>
                                <input type="text" name="patient_name" class="form-control" value="{{ old('patient_name') }}">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xs-5 form-group">
                                <label>Species</label>
                                <input type="text" name="species" class="form-control" value="{{ old('species') }}">
                            </div>
                            <div class="col-xs-4 form-group">
                                <label>Sex</label>
                                <input type="text" name="sex" class="form-control" value="{{ old('sex') }}">
                            </div>
                            <div class="col-xs-3 form-group">
                                <label>Age</label>
                                <input type="number" name="age" class="form-control" value="{{ old('age') }}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label>Tests <small class="text-muted">(comma-separated analyte codes)</small></label>
                            <input type="text" name="tests" class="form-control" placeholder="GLU, BUN, CRE" value="{{ old('tests') }}">
                        </div>
                    </div>
                    <div class="box-footer">
                        <button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> Save Entry</button>
                        <a href="{{ route('lab.worklist.index') }}" class="btn btn-default">Cancel</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
@endsection
