@extends('layouts.app')
@section('title', __('vrc::lang.warranties'))
@section('content')
<section class="content-header"><h1>@lang('vrc::lang.warranties') — {{ $vehicle->label }}</h1></section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        <table class="table table-bordered table-striped">
            <thead><tr><th>@lang('vrc::lang.description')</th><th>@lang('vrc::lang.kind')</th><th>@lang('vrc::lang.start')</th><th>@lang('vrc::lang.end')</th><th>@lang('vrc::lang.status')</th></tr></thead>
            <tbody>
            @forelse ($warranties as $w)
                @php $active = $w->end_date && $w->end_date->isFuture(); @endphp
                <tr><td>{{ $w->description }}</td><td>{{ __('vrc::lang.'.$w->kind) }}</td><td>{{ optional($w->start_date)->format('Y-m-d') }}</td><td>{{ optional($w->end_date)->format('Y-m-d') }}</td>
                    <td><span class="label label-{{ $active ? 'success' : 'default' }}">{{ $active ? __('vrc::lang.warranty_active') : __('vrc::lang.warranty_expired') }}</span></td></tr>
            @empty
                <tr><td colspan="5" class="text-muted text-center">@lang('vrc::lang.no_warranties')</td></tr>
            @endforelse
            </tbody>
        </table>
    @endcomponent
</section>
@endsection
