<%- include("partials/app_header"); -%>

<div class="container">
    <div class="row">
        <div class="col-6 offset-3">
            <div class="card mt-4">
                <% if(messages.length===0){ %>
                    <div class="card-header text-center">
                        <h3>No messages currently</h3>
                    </div>
                <% }else{ %>
                    <div class="card-header text-center">
                        <h3>Inbox</h3>
                    </div>
                    <div class="card-body">
                        <% let i=0 %>
                        <% messages.forEach(function(message){ %>
                            <div class="row">
                                <div class="col-12">
                                    <p><b><%= senders[i] %> claims to have found your <%=items[i] %></b></p>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-12">
                                    <p><%=(message.description).substring(0,30)+"...." %></p>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-12 text-center">
                                    <a class="btn btn-primary" role="button" href="/users/dashboard/report/<%= message._id %>">Go to</a>
                                </div>
                            </div>
                            <hr>
                            <% i++ %>
                        <% }) %>
                    </div>
                <% } %>
            </div>
        </div>
    </div>
</div>

<%- include("partials/footer") -%>