@extends('layout.main')
@section('title') @if( ! empty($title)) {{ $title }} | @endif @parent @endsection
@section('page-css')
<style type="text/css">
    .message-list:hover{
        pointer:cursor;
    }
</style>
@endsection
@section('main')
        
        <div id="wrapper">
            @include('admin.sidebar_menu')

            <div id="page-wrapper">
                @if( ! empty($title))
                    <div class="row">
                        <div class="col-lg-12">
                            <h1 class="page-header"> {{ $title }}  </h1>
                        </div> <!-- /.col-lg-12 -->
                    </div> <!-- /.row -->
                @endif

                @include('admin.flash_msg')

                <div class="row">
                    <div class="col-xs-12">

                        <table class="table table-bordered table-striped table-fixed" id="msg_table">
                            <thead>
                                <tr>
                                    <th>@lang('app.name')</th>
                                    <th>@lang('app.email')</th>
                                    <th>@lang('app.message')</th>
                                    <th>@lang('app.phone')</th>
                                    <th>For Ad</th>
                                    <th style="width: 100%;">@lang('app.created_at')</th>
                                </tr>
                            </thead>
                            
                            
                            @foreach($contact_messages as $message)
                                <tr class="message-list" data-toggle="modal" data-target="#ticket-modal-{!! $loop->index !!}">
                                    <td>{!! $message->name !!} {{ $message->id }}</td>
                                    <td>{!! $message->email !!}</td>
                                    <td><a href="#">{!! nl2br($message->message) !!}</a></td>
                                    <td>{!! $message->phone!!}</td>
                                    <td><a href= 'https://kupeza.co.zm/ad/{!! $message->ad_id!!}' >{!! $message->ad_id!!}</a></td>
                                    <td>{!! $message->created_at_datetime(); !!}</td>
                                </tr>
                                <div class="modal fade" id="ticket-modal-{!! $loop->index !!}" tabindex="-1" role="dialog">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                                <h4 class="modal-title">Message</h4>
                                            </div>
                                            <div class="modal-body">
                            
                                                <p>Sender: {!! $message->name !!}</p>
                                                <p>Email: {!! $message->email !!}</p>
                                                <p>Phone: {!! $message->phone !!}</p>
                                                <p>Ad: <a href= 'https://kupeza.co.zm/ad/{!! $message->ad_id!!}' >{!! $message->ad_id !!}</a></p>
                                                <p>Message</p>
                                                <p>{!! $message->message !!}</p>
                            
                                                
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">@lang('app.close')</button>
                                                <button type="button" class="btn btn-primary" id="report_ad">@lang('app.report_ad')</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                               
                            @endforeach
                            
                            
                        </table>

                    </div>
                </div>


            </div>   <!-- /#page-wrapper -->

        </div>   <!-- /#wrapper -->
@endsection