
    <div class="card mb-2">
        <!-- Header -->
        <div class="media px-4 pt-4 pb-2">
            <a href="javascript:void(0)" class="messages-sidebox-toggler d-lg-none d-block align-self-center text-muted text-large pr-3 mr-3"><i class="ion ion-md-more"></i></a>

            <!-- Sender photo -->
            <div class="media-body">
                <!-- Sender & date -->
                <div class="mb-1">
                    @if($lead_mail->is_answer)
                        Antwort von:<br>
                    @else
                        Gesendet an:<br>
                        @endif
                    &lt;<a href="mailto:{{$lead_mail->email}}">{{$lead_mail->email}}</a>&gt; {{$lead_mail->sent_at }}
                    @if($lead_mail->recipient)
                        <div>TO: {{\App\Services\Util::_implodeLines($lead_mail->recipient, ', ')}}</div>
                    @endif
                    @if($lead_mail->cc)
                        <div>CC: {{\App\Services\Util::_implodeLines($lead_mail->cc, ', ')}}</div>
                    @endif
                    @if($lead_mail->bcc)
                        <div>BCC: {{\App\Services\Util::_implodeLines($lead_mail->bcc, ', ')}}</div>
                    @endif
                </div>

                <!-- Subject -->
                <h5 class="line-height-inherit m-0">{{$lead_mail->subject}}</h5>
            </div>
        </div>
        <hr class="border-light m-0">

        <div class="p-4">
            {!! nl2br($lead_mail->message) !!}
        </div>
        <hr class="border-light m-0">

        <!-- Message infos -->
        <div class="px-4 pt-4 pb-2">
            @if($lead_mail->customer)
                <p><strong>Kunde: </strong>
                    {{ $lead_mail->customer->getSalutation() }} {{ $lead_mail->customer->title }} {{ $lead_mail->customer->firstname }}  {{ $lead_mail->customer->name }}
                    @if($lead_mail->lead)
                        ({{$lead_mail->lead->id}})
                    @endif
                </p>
            @endif

            @if($lead_mail->lead)
                <p><strong>Anfrage: </strong>
                    ({{ $lead_mail->lead_id }})
                </p>
            @endif

            @if($lead_mail->send)
                <span class="badge badge-success">Mail gesendet</span>
                <p>Datum: {{$lead_mail->sent_at}}</p>
            @endif
            @if($lead_mail->fail)
                <span class="badge badge-danger">Mail Fehler</span>
                <p>{{$lead_mail->error }}</p>
            @endif
        </div>
        <!-- Message attachments -->
        @if($lead_mail->lead_files)
            <hr class="border-light m-0">
            <div class="px-4 pt-4 pb-2">
                <h6 class="small font-weight-semibold mb-4">Datei-Anhänge</h6>
                <div class="row">
                    @foreach($lead_mail->lead_files as $file)
                        <div class="col-sm-12 col-md-6 col-xl-4">
                            <div class="message-attachment ui-bordered p-2 mr-3 mb-3">
                                <div class="message-attachment-file display-4"><i class="{{$file->getIconExt()}}"></i></div>
                                <div class="media-body ml-3">
                                    <strong class="message-attachment-filename">{{$file->original_name}}</strong>
                                    <div class="text-muted small">{{$file->formatBytes()}}</div>
                                    <div>
                                        <a href="{{$file->getURL()}}" target="_blank" class="mail-att-show">Vorschau</a> &nbsp;
                                    </div>
                                </div>
                            </div>
                        </div>
                    @endforeach
                </div>
            </div>
        @endif
        @if(isset($show_move_dirs) && $show_move_dirs)
        <hr class="border-light m-0">
        <div class="px-4 pt-4 pb-2">
            {!! Form::open(['url' => route('lead_mail_detail', [$lead_mail->id, 'move-mail-lead']), 'class' => 'move-mail-form']) !!}
            <div class="form-row">
                <div class="col-sm-6">
                    <label for="lead_mail_dir" class="form-label">Ablegen unter:</label>
                    <select class="custom-select lead_mail_dir" name="dir" id="lead_mail_dir">
                        @foreach(\App\Services\Lead::getCustomerMailDirs() as $lead_mail_dir)
                            <option value="{{$lead_mail_dir->pos}}" @if($lead_mail->dir == $lead_mail_dir->pos) selected @endif>{{$lead_mail_dir->name}}</option>
                        @endforeach
                    </select>
                </div>
                <div class="col-sm-6">
                    <button type="submit" class="btn btn-xs btn-default float-right mt-1"><i class="ion ion-ios-redo"></i>&nbsp; verschieben</button>

                    <label for="subdir" class="form-label">&nbsp;</label>
                    {{-- TODO load subdirs by pos id
                    @if($lead_mail->booking->travel_country)
                        @foreach(\App\Services\Booking::getCustomerMailDirs() as $lead_mail_dir)
                            @if($lead_mail_dir->pos > 0)
                                <select class="custom-select lead_mail_subdir" name="subdir" id="lead_mail_subdir_{{$lead_mail_dir->pos}}">
                                    <option value="0">keinen Unterordner</option>
                                    @foreach($lead_mail->booking->travel_country->getMailDirs($lead_mail_dir->pos) as $mail_dir_id)
                                        @php ($mail_dir_name = \App\Services\Booking::getCustomerMailName($lead_mail_dir, $mail_dir_id))
                                        <option value="{{$mail_dir_id}}" @if($lead_mail->subdir == $mail_dir_id) selected @endif>{{$mail_dir_name}}</option>
                                    @endforeach
                                </select>
                            @endif
                        @endforeach
                    @endif
                    --}}
                </div>
            </div>
            {!! Form::close() !!}
            <hr>
            {!! Form::open(['url' => route('lead_mail_detail', [$lead_mail->id, 'forward-mail-lead']), 'class' => 'forward-mail-form']) !!}
            <div class="form-row">
                <div class="col-sm-6">
                    <label for="lead_mail_forward_email" class="form-label">E-Mail weiterleiten:</label>
                    {{ Form::text('lead_mail_forward_email', $lead_mail->email,  array('placeholder'=>'E-Mail', 'id'=>'lead_mail_forward_email', 'class'=>'form-control', 'required')) }}
                </div>
                <div class="col-sm-6">
                    <button type="submit" class="btn btn-xs btn-default float-right mt-1" onclick="return confirm('{{__('Wirklich weiterleiten? E-Mail wird erneut gesendet!')}}');"><i class="ion ion-ios-send"></i>&nbsp; weiterleiten</button>
                </div>
            </div>
            {!! Form::close() !!}
        </div>
        @endif
    </div>

    @if(isset($lead_mail->lead_mail))
    <hr>
    @include('lead.modal-show-mail-inner', ['lead_mail' => $lead_mail->lead_mail, 'show_move_dirs' => false])
    @endif