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

<div class="container">
    <div class="row">
        <div class="col-6 offset-3">
            <div class="card mt-4">
                <div class="row">
                    <div class="col-6 offset-3 mt-2 mb-2">
                        <%if(alert.length!=0) {%>
                            <div class="alert alert-info text-center" role="alert">
                                <%= alert %>
                            </div>
                        <%}%>
                    </div>
                </div>
                <div class="card-header text-center">
                    <h3><%= sender.username %> claims to have found your item</h3>
                </div>
                <% let type=message.img.content; %>
                <% let data=message.img.data; %>
                <div class="row">
                    <div class="col-12 text-center">
                        <h3>Image sent by finder</h3>
                        <hr>
                    </div>
                </div>
                <div class="row mt-2 mb-2">
                    <div class="col-6 offset-3">
                        <img src="data:image/<%=type %>;base64,<%= data.toString('base64') %>" class="card-img-top img-thumbnail">
                    </div>
                </div>
                <hr>
                <div class="row">
                    <div class="col-12 text-center">
                        <h3>Message</h3>
                        <hr>
                    </div>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-12">
                            <p><%= message.description %></p>
                        </div>
                    </div>
                    <hr>
                    <div class="row mb-2">
                        <div class="col-12 text-center">
                            <button class="btn" data-bs-toggle="modal" data-bs-target="#Verify">Verify</button>
                        </div>
                    </div>
                    <div class="row mt-4">
                        <div class="col-12 text-center">
                            <button class="btn" data-bs-toggle="modal" data-bs-target="#Modal">Invalid</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="Modal" tabindex="-1" aria-hidden="true" aria-labelledby="title">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="title">Invalid</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="close"></button>
            </div>
            <div class="modal-body">
                <div class="container">
                    <div class="row">
                        <div class="col-12">
                            <p>Do you want to delete the finders claim?</p>
                        </div>
                    </div>
                    <form action="/users/dashboard/report/<%= message._id %>/invalid" method="POST">
                        <div class="row mt-4">
                            <div class="col-12 text-center">
                                <button class="btn btn-primary" type="submit" name="button" value="<%= message._id %>">Confirm</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="Verify" tabindex="-1" aria-hidden="true" aria-labelledby="title">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="title">Verify</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="close"></button>
            </div>
            <div class="modal-body">
                <div class="container">
                    <div class="row">
                        <div class="col-12">
                            <p>Do you want to verify the finders claim?</p>
                        </div>
                    </div>
                    <form action="/users/dashboard/report/<%= message._id %>/verify" method="POST">
                        <div class="row mt-4">
                            <div class="col-12 text-center">
                                <button class="btn btn-primary" type="submit" name="verify" value="<%= message.item_id %>">Verify</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

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