@extends('layouts.app')
@section('title', 'Message · ' . $message->name)

@section('content')
<section class="content-header">
    <h1><i class="fas fa-envelope-open"></i> Message <small>from {{ $message->name }}</small></h1>
</section>

<section class="content">
    @include('vetSite::admin._flash')
    <div class="row"><div class="col-md-8">
        @component('components.widget', ['class' => 'box-primary'])
            <dl class="dl-horizontal">
                <dt>Name</dt><dd>{{ $message->name }}</dd>
                <dt>Email</dt><dd>@if($message->email)<a href="mailto:{{ $message->email }}">{{ $message->email }}</a>@else — @endif</dd>
                <dt>Phone</dt><dd>{{ $message->phone ?: '—' }}</dd>
                <dt>Subject</dt><dd>{{ $message->subject ?: '—' }}</dd>
                <dt>Received</dt><dd>{{ $message->created_at->format('M j, Y g:i A') }}</dd>
            </dl>
            <hr>
            <p style="white-space:pre-wrap;">{{ $message->message }}</p>
            <hr>
            <a href="{{ route('vs.messages') }}" class="btn btn-default">← Back</a>
            @if($message->email)
                <a href="mailto:{{ $message->email }}?subject=Re: {{ $message->subject }}" class="btn btn-primary"><i class="fa fa-reply"></i> Reply</a>
            @endif
            <form method="POST" action="{{ route('vs.messages.read', $message->id) }}" style="display:inline">@csrf
                <button class="btn btn-default">Mark as {{ $message->is_read ? 'unread' : 'read' }}</button></form>
        @endcomponent
    </div></div>
</section>
@endsection
