@extends('layouts.app')
@section('title', __('medemergency::lang.new_arrival'))
@section('content')
<section class="content-header">
    <h1><i class="fa fas fa-truck-medical"></i> @lang('medemergency::lang.new_arrival')</h1>
    <p>@lang('medemergency::lang.arrivals_help')</p>
</section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        @if(! $hasClinic)
            <div class="callout callout-warning">@lang('medemergency::lang.clinic_missing')</div>
        @endif
        <form action="{{ route('mder.arrivals.store') }}" method="POST">
            {{ csrf_field() }}
            <div class="row">
                <div class="col-md-6 form-group">
                    <label>@lang('medemergency::lang.patient_name') *</label>
                    <input type="text" name="patient_name" class="form-control" required autofocus
                           value="{{ old('patient_name') }}">
                </div>
                <div class="col-md-3 form-group">
                    <label>@lang('medemergency::lang.phone') <small class="text-muted">(@lang('medemergency::lang.optional'))</small></label>
                    <input type="text" name="phone" class="form-control" value="{{ old('phone') }}">
                </div>
                <div class="col-md-3 form-group">
                    <label>@lang('medemergency::lang.arrival_mode')</label>
                    <select name="arrival_mode" class="form-control">
                        @foreach($arrivalModes as $mode)
                            <option value="{{ $mode }}" @selected(old('arrival_mode', 'walk_in') === $mode)>@lang('medemergency::lang.mode_' . $mode)</option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12 form-group">
                    <label>@lang('medemergency::lang.chief_complaint')</label>
                    <textarea name="chief_complaint" class="form-control" rows="2">{{ old('chief_complaint') }}</textarea>
                </div>
            </div>
            @if($hasClinic)
            <div class="row">
                <div class="col-md-12 form-group">
                    <label class="checkbox-inline">
                        <input type="checkbox" name="link_patient" value="1" @checked(old('link_patient'))>
                        @lang('medemergency::lang.link_patient')
                    </label>
                    <p class="help-block" style="margin-top:2px;">@lang('medemergency::lang.link_patient_hint')</p>
                </div>
            </div>
            @endif
            <div class="text-right">
                <a href="{{ route('mder.board.index') }}" class="btn btn-default">@lang('medemergency::lang.cancel')</a>
                <button type="submit" class="btn btn-primary">
                    <i class="fa fa-plus"></i> @lang('medemergency::lang.register_arrival')
                </button>
            </div>
        </form>
    @endcomponent
</section>
@endsection
