@extends('layouts.app')
@section('title', __('nav.search'))
@section('content')
<h1 class="h4 mb-3">{{ __('nav.search') }}</h1>
<form class="mb-4"><input class="form-control" name="q" value="{{ $q }}" placeholder="{{ __('messages.search') }}"></form>
@if($results)
@foreach($results as $group => $items)
<h2 class="h6">{{ $group }}</h2>
<ul>
@foreach($items as $item)
    @if($group==='customers')<li><a href="{{ route('customers.show',$item) }}">{{ $item->name }} — {{ $item->phone }}</a></li>
    @elseif($group==='lines')<li><a href="{{ route('lines.show',$item) }}">{{ $item->phone_number }}</a></li>
    @elseif($group==='invoices')<li><a href="{{ route('invoices.show',$item) }}">{{ $item->invoice_number }}</a></li>
    @elseif($group==='main_accounts')<li><a href="{{ route('main-accounts.show',$item) }}">{{ $item->name }}</a></li>
    @else<li><a href="{{ route('sub-accounts.show',$item) }}">{{ $item->name }}</a></li>
    @endif
@endforeach
</ul>
@endforeach
@endif
@endsection
