@extends('layouts.app')

@section('title', __('vrc::lang.vehicle'))

@section('content')
<section class="content-header">
    <h1>{{ $vehicle->label }}</h1>
</section>

<section class="content">
    <div class="row">
        <div class="col-md-6">
            @component('components.widget', ['class' => 'box-primary', 'title' => __('vrc::lang.vehicle')])
                <table class="table table-condensed">
                    <tr><th>@lang('vrc::lang.customer')</th><td>{{ optional($customer)->name ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.make_model')</th><td>{{ trim((optional($vehicle->make)->name ?? '') . ' ' . (optional($vehicle->model)->name ?? '')) ?: '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.year')</th><td>{{ $vehicle->year ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.plate_number')</th><td>{{ $vehicle->plate_number ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.vin')</th><td>{{ $vehicle->vin ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.engine_number')</th><td>{{ $vehicle->engine_number ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.color')</th><td>{{ $vehicle->color ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.transmission')</th><td>{{ $vehicle->transmission ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.fuel_type')</th><td>{{ $vehicle->fuel_type ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.odometer')</th><td>{{ $vehicle->odometer ? ($vehicle->odometer . ' ' . $vehicle->odometer_unit) : '—' }}</td></tr>
                </table>
            @endcomponent
        </div>
        <div class="col-md-6">
            @component('components.widget', ['class' => 'box-primary', 'title' => __('vrc::lang.insurance')])
                <table class="table table-condensed">
                    <tr><th>@lang('vrc::lang.insurance_policy_no')</th><td>{{ $vehicle->insurance_policy_no ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.insurance_expiry')</th><td>{{ optional($vehicle->insurance_expiry)->format('Y-m-d') ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.registration_expiry')</th><td>{{ optional($vehicle->registration_expiry)->format('Y-m-d') ?? '—' }}</td></tr>
                    <tr><th>@lang('vrc::lang.notes')</th><td>{{ $vehicle->notes ?? '—' }}</td></tr>
                </table>
                <a href="{{ route('vrc.vehicles.history', $vehicle->id) }}" class="btn btn-default btn-sm">
                    <i class="fa fa-history"></i> @lang('vrc::lang.service_history')
                </a>
            @endcomponent
        </div>
    </div>
</section>
@endsection
