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

<div class="container">
     
    <div class="row">
        <div class="col-6 offset-3 mt-2 mb-2">
            <%if(message.length!=0) {%>
                <div class="alert alert-info text-center" role="alert">
                    <%= message %>
                </div>
            <%}%>
        </div>
    </div>

    <div class="row">
        <div class="col-6 offset-3">
            <div class="card mt-5 mb-2">
                <div class="card-header text-center">
                    <h3><%=user.username %>'s Profile</h3>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-sm-3"><p class="mb-0">Username</p></div>
                        <div class="col-sm-9"><p class="mb-0"><%= user.username %></p></div>
                    </div>
                    <hr>
                    <div class="row">
                        <div class="col-sm-3"><p class="mb-0">Email</p></div>
                        <div class="col-sm-9"><p class="mb-0"><%= user.email %></p></div>
                    </div>
                    <hr>
                    <div class="row">
                        <div class="col-sm-3"><p class="mb-0">Contact</p></div>
                        <div class="col-sm-9"><p class="mb-0"><%= user.contact %></p></div>
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
    <% if(items.length!=0) { %>
        <div class="row">
            <div class="col-6 offset-3">
                <div class="card mt-2 mb-2">
                    <div class="card-header text-center">
                        <h3>List of Lost Items</h3>
                    </div>
                    <div class="card-body">
                        <% items.forEach(function(item){%>
                            <form action="/users/dashboard/profile" method="POST">
                                <div class="row">
                                    <div class="col-4">
                                        <%=item.name %>
                                    </div>
                                    <div class="col-4">
                                        <a  class="btn btn-primary" href="/users/dashboard/item/<%= item._id %>">Details</a>
                                    </div>
                                    <div class="col-4">
                                        <button class="btn btn-primary" type="submit" name="button" value="<%=item.id %>">Delete</button>
                                    </div>
                                </div>
                            </form>         
                            <hr>
                        <%})%>
                    </div>
                </div>
            </div>
      </div>
    <%}%>
</div>

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