<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>
        All Enquiries
    </title>

    {% include 'admin/includes/imports.top.html' %}

</head>

<body class="g-sidenav-show  bg-gray-100">
    {% include 'admin/includes/part.menu.html' %}
    <main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
        <!-- Navbar -->
        {% include 'admin/includes/part.header.html' %}
        <!-- End Navbar -->
        <div class="container-fluid py-4">
            <div class="row g-1">
                <div class="col-md-12">
                    <div class="card">
                        <div class="card-header pb-0 px-3">
                            <h6 class="mb-0">All Enquiries</h6>
                        </div>
                        <div class="card-body p-3" style="overflow: visible !important;">
                            <div class="table-responsive p-0" style="overflow: visible !important;">
                                <table class="table table-responsive align-items-center justify-content-center mb-0"
                                    style="overflow: visible !important;">
                                    <thead>
                                        <tr>
                                            <th
                                                class="text-uppercase text-secondary text-xxs text-black font-weight-bolder opacity-7 ps-2">
                                                Customer</th>
                                            <th
                                                class="text-uppercase text-secondary text-xxs text-black font-weight-bolder opacity-7 ps-2">
                                                Email</th>
                                            <th
                                                class="text-uppercase text-secondary text-xxs text-black font-weight-bolder opacity-7 ps-2">
                                                Phone</th>
                                            <th
                                                class="text-uppercase text-secondary text-xxs text-black font-weight-bolder opacity-7 ps-2">
                                                Action</th>

                                        </tr>
                                    </thead>
                                    <tbody>
                                        {% for enquiry in enquiries %}
                                        <tr>
                                            <td>
                                                <span
                                                    class="mt-0 pt-0 text-dark ps-1 text-sm rounded-0 border-2 p-0 border-start border-success">
                                                    {{enquiry.surname}}, {{enquiry.firstname}}
                                                </span>
                                            </td>

                                            <td>
                                                <div>
                                                    <a href="tel:{{enquiry.phone}}"
                                                        class="mt-0 pt-0 text-dark ps-1 text-sm rounded-0 border-2 p-0 border-start border-success">
                                                        {{enquiry.phone}}
                                                    </a>
                                                </div>
                                            </td>
                                            <td>
                                                <div>
                                                    <a href="mailto:{{enquiry.email}}"
                                                        class=" mt-0 pt-0 text-dark ps-1 text-sm rounded-0 border-2 p-0 border-start border-info">
                                                        {{enquiry.email}}
                                                    </a>
                                                </div>
                                            </td>
                                            <td>
                                                <div class="btn-group my-auto">
                                                    <button id="menu-1" type="button"
                                                        class="py-1 border-secondary badge badge-sm bg-secondary dropdown-toggle"
                                                        data-bs-toggle="dropdown" aria-haspopup="true"
                                                        aria-expanded="false">
                                                        Action
                                                    </button>
                                                    <div class="dropdown-menu dropdown-menu-dark border shadow-3"
                                                        style="z-index: 2500 !important;" aria-labelledby="menu-1">
                                                        <a class="dropdown-item"
                                                            href="{{url_for('view_contact_request', id = enquiry.id)}}">View</a>
                                                        <a class="dropdown-item text-danger" data-bs-toggle="modal"
                                                            data-bs-target="#delete" href="#delete"
                                                            onclick="Delete('{{url_for('delete_contact_request', id=enquiry.id)}}')">Delete</a>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                        {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                            <div class="modal fade" id="delete" data-bs-backdrop="static" data-bs-keyboard="false"
                                tabindex="-1" aria-labelledby="deleteLabel" aria-hidden="true">
                                <div class="modal-dialog modal-dialog-centered">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <h1 class="modal-title fs-5" id="deleteLabel">Delete Item</h1>
                                            <button type="button" class="btn-close" data-bs-dismiss="modal"
                                                aria-label="Close"></button>
                                        </div>
                                        <div class="modal-body">
                                            Are you sure you want to proceed with this operation?
                                        </div>
                                        <div class="modal-footer py-2 d-flex justify-content-between">
                                            <button type="button" class="btn btn-sm btn-secondary"
                                                data-bs-dismiss="modal">Cancel</button>
                                            <a title="Proceed with Change" href="" id="delete_it_button"
                                                class="btn btn-sm btn-danger">Proceed</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="card-footer">
                                <div class="d-flex justify-content-center">
                                    {% set current_page = request.args.get('page', none) | int%}

                                    {% set pvis = '' %}
                                    {% set nvis = '' %}

                                    {% if last_page %}
                                    {% set nvis = 'disabled' %}
                                    {% endif %}

                                    {% if current_page == 0 or current_page == 1 %}
                                    {% set current_page = 1 %}
                                    {% set pvis = 'disabled' %}
                                    {% endif %}

                                    {% set next = current_page + 1%}
                                    {% set prev = current_page - 1%}

                                    {% set prev_url = url_for('all_listing', page=prev)%}
                                    {% set next_url = url_for('all_listing', page=next)%}


                                    <div class="pagination-area">
                                        <div aria-label="Page navigation example">
                                            <ul class="pagination my-3">
                                                <li class="page-item">
                                                    <a class="{{pvis}} page-link bg-info text-white border-black"
                                                        href="{{prev_url}}" aria-label="Previous">
                                                        <span aria-hidden="true"><i
                                                                class="fa text-white fa-angle-double-left"></i></span>
                                                    </a>
                                                </li>
                                                <li class="page-item">
                                                    <a class="{{nvis}}  page-link bg-info text-white border-black"
                                                        href="{{next_url}}" aria-label="Next">
                                                        <span aria-hidden="true"><i
                                                                class="fa text-white fa-angle-double-right"></i></span>
                                                    </a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            {% include 'admin/includes/part.footer.html' %}
        </div>
    </main>

    <!--   Core JS Files   -->
    {% include 'admin/includes/imports.bottom.html' %}
    <script>
        var win = navigator.platform.indexOf('Win') > -1;
        if (win && document.querySelector('#sidenav-scrollbar')) {
            var options = {
                damping: '0.5'
            }
            Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
        }
        function MarkFeature(link) {
            $('#feature_it_button').attr('href', link);
        }
        function status_change(link) {
            $('#status_change_it_button').attr('action', link);
        }
    </script>
</body>

</html>