
    <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($customer_mail->is_answer)
                        Antwort von:<br>
                    @else
                        Gesendet an:<br>
                        @endif
                    &lt;<a href="mailto:{{$customer_mail->email}}">{{$customer_mail->email}}</a>&gt; {{$customer_mail->sent_at }}
                    @if($customer_mail->recipient)
                        <div>TO: {{\App\Services\Util::_implodeLines($customer_mail->recipient, ', ')}}</div>
                    @endif
                    @if($customer_mail->cc)
                        <div>CC: {{\App\Services\Util::_implodeLines($customer_mail->cc, ', ')}}</div>
                    @endif
                    @if($customer_mail->bcc)
                        <div>BCC: {{\App\Services\Util::_implodeLines($customer_mail->bcc, ', ')}}</div>
                    @endif
                </div>

                <!-- Subject -->
                <h5 class="line-height-inherit m-0">{{$customer_mail->subject}}</h5>
            </div>
        </div>
        <hr class="border-light m-0">
            <!-- / Header -->
            {{--   <!-- Controls -->
              <div class="media flex-wrap align-items-center p-2">
                  <div class="media-body d-flex flex-wrap flex-basis-100 flex-basis-sm-auto">
                      <button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted mr-3" title="Back"><i class="ion ion-md-arrow-back"></i></button>
                      <button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted" title="Mark as unread"><i class="ion ion-md-mail-unread"></i></button>
                      <button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted" title="Mark as important"><i class="ion ion-md-alert"></i></button>
                      <button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted" title="Move to spam"><i class="ion ion-md-folder-open"></i></button>
                      <button type="button" class="btn btn-default borderless md-btn-flat icon-btn messages-tooltip text-muted" title="Move to trash"><i class="ion ion-md-trash"></i></button>
                  </div>

                  <div class="d-flex flex-wrap align-items-center ml-auto">
                      <button type="button" class="btn btn-default borderless md-btn-flat text-muted px-3"><i class="ion ion-ios-undo"></i>&nbsp; Reply</button>
                      <div class="text-lighter">|</div>
                      <button type="button" class="btn btn-default borderless md-btn-flat text-muted px-3">Forward &nbsp;<i class="ion ion-ios-redo"></i></button>
                  </div>
              </div>
              <hr class="border-light m-0">
              <!-- / Controls -->
              --}}
        <div class="p-4">
            {!! nl2br($customer_mail->message) !!}
        </div>
        <hr class="border-light m-0">

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

            @if($customer_mail->booking)
                <p><strong>Buchung: </strong>
                    @if($customer_mail->booking->travel_country_id)
                        {{ " | ".$customer_mail->booking->travel_country->name }}
                    @endif
                    @if($customer_mail->booking->travelagenda_id)
                        {{ " | ".$customer_mail->booking->travel_agenda->name }}
                    @endif
                    ({{ $customer_mail->booking_id }})
                </p>
            @endif

            @if($customer_mail->send)
                <span class="badge badge-success">Mail gesendet</span>
                <p>Datum: {{$customer_mail->sent_at}}</p>
            @endif
            @if($customer_mail->fail)
                <span class="badge badge-danger">Mail Fehler</span>
                <p>{{$customer_mail->error }}</p>
            @endif
        </div>
        <!-- Message attachments -->
        @if($customer_mail->customer_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($customer_mail->customer_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))
        <hr class="border-light m-0">
        <div class="px-4 pt-4 pb-2">
            {!! Form::open(['url' => route('customer_mail_detail', [$customer_mail->id, 'move-mail']), 'class' => 'move-mail-form']) !!}
            <div class="form-row">
                <div class="col-sm-6">
                    <label for="customer_mail_dir" class="form-label">Ablegen unter:</label>
                    <select class="custom-select customer_mail_dir" name="dir" id="customer_mail_dir">
                        @foreach(\App\Services\Booking::getCustomerMailDirs() as $customer_mail_dir)
                            <option value="{{$customer_mail_dir->pos}}" @if($customer_mail->dir == $customer_mail_dir->pos) selected @endif>{{$customer_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($customer_mail->booking->travel_country)
                        @foreach(\App\Services\Booking::getCustomerMailDirs() as $customer_mail_dir)
                            @if($customer_mail_dir->pos > 0)
                                <select class="custom-select customer_mail_subdir" name="subdir" id="customer_mail_subdir_{{$customer_mail_dir->pos}}">
                                    <option value="0">keinen Unterordner</option>
                                    @foreach($customer_mail->booking->travel_country->getMailDirs($customer_mail_dir->pos) as $mail_dir_id)
                                        @php ($mail_dir_name = \App\Services\Booking::getCustomerMailName($customer_mail_dir, $mail_dir_id))
                                        <option value="{{$mail_dir_id}}" @if($customer_mail->subdir == $mail_dir_id) selected @endif>{{$mail_dir_name}}</option>
                                    @endforeach
                                </select>
                            @endif
                        @endforeach
                    @endif
                </div>
            </div>
            {!! Form::close() !!}
        </div>
        @endif
    </div>