<!DOCTYPE html>
<html lang="en" dir="ltr" id="main_html">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8" />
        <title id="title"></title>
        <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
        <!-- Material Icons -->
        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
        <!-- Material Symbols - Outlined Set -->
        <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
        <!-- Material Symbols - Rounded Set -->
        <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded" rel="stylesheet" />
        <!-- Material Symbols - Sharp Set -->
        <link rel="stylesheet" href="{{ url_for('static', filename='css/uikit.min.css') }}"/>
        <link rel="stylesheet" href="{{ url_for('static', filename='css/pantry.css') }}"/>
        {% if session['user']['flags']['darkmode'] %}
        <link id="dark-mode" rel="stylesheet" href="{{ url_for('static', filename='css/dark-mode.css') }}"/>
        {% endif %}
    </head>
    <style>
    :root {
        --primary-color: {{ session['user']['flags']['styles']['primary_color']}};
    }
    </style>
    {% if session['user']['flags']['darkmode'] %}
    <body class="uk-light">
    {% else %}
    <body>
    {% endif %}
        <nav class="uk-navbar-container">
            <div class="uk-container uk-container-expand">
                <div class="uk-navbar uk-navbar-primary">
                    <!-- Application Navigation-->
                    <div class="uk-navbar-left">
                        <ul class="uk-navbar-nav">
                            <li>
                                <a href>Apps</a>
                                <div class="uk-navbar-dropdown" uk-drop="mode: click; multi:false">
                                    <ul class="uk-nav uk-navbar-dropdown-nav">
                                        <li><a href="/recipes">Recipes</a></li>
                                        <li><a href="/shopping-lists">Shopping Lists</a></li>
                                        <li class="uk-nav-header">Logistics</li>
                                        <li><a href="/items">Items</a></li>
                                        <li><a href="/items/transaction">Transaction</a></li>
                                        <li><a href="/receipts">Receipts</a></li>
                                        <li class="uk-nav-header">Points of Ease</li>
                                        <li><a href="/poe/scanner">Transaction Scanner</a></li>
                                        <li><a href="/poe/receipts">Receipts Scanner</a></li>
                                    </ul>
                                </div>
                            </li>
                        </ul>

                    </div>
                    <!-- Breadcrumbs Navigation -->
                    <div class="uk-navbar-center uk-visible@m">
                        <ul class="uk-breadcrumb uk-margin-remove">
                            <li style="cursor: pointer;"><span><strong>{{current_site}}</strong></span>
                                <div uk-dropdown="mode: hover">
                                    <ul class="uk-nav uk-dropdown-nav">
                                        <li class="uk-nav-header">Select Site</li>
                                        <li class="uk-nav-divider"></li>
                                        {% for site in sites %}
                                        {% if site == current_site %}
                                        <li><a class="uk-disabled" href="#">{{site}}</a></li>
                                        {% else %}
                                        <li><a onclick="changeSite('{{site}}')">{{site}}</a></li>
                                        {% endif %}
                                        {% endfor %}
                                    </ul>
                                </div>
                            </li>
                            <li class="uk-disabled"><span>Site Management</span></li>
                        </ul>
                    </div>
                    <!-- Profile/Management Navigation-->
                    <div class="uk-navbar-right">
                        <ul class="uk-navbar-nav">
                            <li>
                                <a href="#">
                                    <img src="{{session['user']['profile_pic_url']}}" alt="Profile Picture" class="profile-pic uk-visible@m" style="width: 40px; height: 40px; border-radius: 50%; margin-right: 5px;">
                                            {{username}}
                                </a>
                                <div class="uk-navbar-dropdown" uk-drop="mode: click; multi:false">
                                    <ul class="uk-nav uk-navbar-dropdown-nav">
                                        <li><a href="/profile">Profile</a></li>
                                        <li><a onclick="toggleDarkMode()">Dark Mode</a></li>
                                        <li class="uk-active"><a href="/site-management">Site Management</a></li>
                                        <li><a href="/administration">System Management</a></li>
                                        <li><a href="/access/logout">Logout</a></li>
                                    </ul>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </nav>
        <div class="uk-section uk-margin-left">
            <div class="uk-child-width-1-1" uk-grid>
                <div>
                    <div uk-grid>
                        <div class="uk-width-auto">
                            <ul class="uk-tab-left" uk-tab="connect: #component-tab-left; animation: uk-animation-fade">
                                <li><a href="#">Zones</a></li>
                                <li><a href="#">Locations</a></li>
                                <li><a href="#">Vendors</a></li>
                                <li><a href="#">Brands</a></li>
                                <li><a href="#">Prefixes</a></li>
                            </ul>
                        </div>
                        <div class="uk-width-expand">
                            <div id="component-tab-left" class="uk-switcher">
                                <!-- Zones -->
                                <div class="uk-container">
                                    <div uk-grid>
                                        <div class="uk-width-1-1 uk-flex uk-flex-center">
                                            <nav aria-label="Pagination">
                                                <ul id="zonesPagination" class="uk-pagination" uk-margin>
                                                    <li><a href="#"><span uk-pagination-previous></span></a></li>
                                                    <li><a href="#">1</a></li>
                                                    <li class="uk-disabled"><span>…</span></li>
                                                    <li><a href="#">5</a></li>
                                                    <li><a href="#">6</a></li>
                                                    <li class="uk-active"><span aria-current="page">7</span></li>
                                                    <li><a href="#">8</a></li>
                                                    <li><a href="#"><span uk-pagination-next></span></a></li>
                                                </ul>
                                            </nav>
                                        </div>
                                        <div class="uk-width-1-1">
                                            <caption class="uk-text-meta">Here are all the Zones that have been set up for the site <strong>{{current_site}}</strong></caption>
                                            <table style="margin-bottom: 0px;" class="uk-table uk-table-striped">
                                                <thead>
                                                    <tr>
                                                        <th>ID</th>
                                                        <th>Zone Name</th>
                                                        <th>Description</th>
                                                        <th>Operations</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="zonesTableBody">
                                                </tbody>
                                            </table>
                                            <button onclick="openAddZoneModal()" class="uk-button add-button"><i class="uk-flex-middle material-symbols-outlined" style="">add_circle</i></button>
                                        </div>
                                    </div>
                                </div>
                                <!-- Locations -->
                                <div class="uk-container">
                                    <div uk-grid>
                                        <div class="uk-width-1-1 uk-flex uk-flex-center">
                                            <nav aria-label="Pagination">
                                                <ul id="locationsPagination" class="uk-pagination" uk-margin>
                                                    <li><a href="#"><span uk-pagination-previous></span></a></li>
                                                    <li><a href="#">1</a></li>
                                                    <li class="uk-disabled"><span>…</span></li>
                                                    <li><a href="#">5</a></li>
                                                    <li><a href="#">6</a></li>
                                                    <li class="uk-active"><span aria-current="page">7</span></li>
                                                    <li><a href="#">8</a></li>
                                                    <li><a href="#"><span uk-pagination-next></span></a></li>
                                                </ul>
                                            </nav>
                                        </div>
                                        <div class="uk-width-1-1">
                                            <caption class="uk-text-meta">Here are all the locations that have been set up for the site <strong>{{current_site}}</strong></caption>
                                            <table style="margin-bottom: 0px;" class="uk-table uk-table-striped">
                                                <thead>
                                                    <tr>
                                                        <th>ID</th>
                                                        <th>UUID</th>
                                                        <th>Location Name</th>
                                                        <th>Description</th>
                                                        <th>Operations</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="locationsTableBody">
                                                </tbody>
                                            </table>
                                            <button onclick="openAddLocationModal()" class="uk-button add-button"><i class="uk-flex-middle material-symbols-outlined" style="">add_circle</i></button>
                                        </div>
                                    </div>
                                </div>
                                <!-- Vendors -->
                                <div class="uk-container">
                                    <div uk-grid>
                                        <div class="uk-width-1-1 uk-flex uk-flex-center">
                                            <nav aria-label="Pagination">
                                                <ul id="vendorsPagination" class="uk-pagination" uk-margin>
                                                    <li><a href="#"><span uk-pagination-previous></span></a></li>
                                                    <li><a href="#">1</a></li>
                                                    <li class="uk-disabled"><span>…</span></li>
                                                    <li><a href="#">5</a></li>
                                                    <li><a href="#">6</a></li>
                                                    <li class="uk-active"><span aria-current="page">7</span></li>
                                                    <li><a href="#">8</a></li>
                                                    <li><a href="#"><span uk-pagination-next></span></a></li>
                                                </ul>
                                            </nav>
                                        </div>
                                        <div class="uk-width-1-1">
                                            <caption class="uk-text-meta">Here are all the locations that have been set up for the site <strong>{{current_site}}</strong></caption>
                                            <table style="margin-bottom: 0px;" class="uk-table uk-table-striped">
                                                <thead>
                                                    <tr>
                                                        <th>ID</th>
                                                        <th>Vendor Name</th>
                                                        <th>Created By</th>
                                                        <th>Operations</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="vendorsTableBody">
                                                </tbody>
                                            </table>
                                            <button onclick="openAddVendorsModal()" class="uk-button add-button"><i class="uk-flex-middle material-symbols-outlined" style="">add_circle</i></button>
                                        </div>
                                    </div>
                                </div>
                                <!-- Brands -->                                
                                <div class="uk-container">
                                    <div uk-grid>
                                        <div class="uk-width-1-1 uk-flex uk-flex-center">
                                            <nav aria-label="Pagination">
                                                <ul id="brandsPagination" class="uk-pagination" uk-margin>
                                                    <li><a href="#"><span uk-pagination-previous></span></a></li>
                                                    <li><a href="#">1</a></li>
                                                    <li class="uk-disabled"><span>…</span></li>
                                                    <li><a href="#">5</a></li>
                                                    <li><a href="#">6</a></li>
                                                    <li class="uk-active"><span aria-current="page">7</span></li>
                                                    <li><a href="#">8</a></li>
                                                    <li><a href="#"><span uk-pagination-next></span></a></li>
                                                </ul>
                                            </nav>
                                        </div>
                                        <div class="uk-width-1-1">
                                            <caption class="uk-text-meta">Here are all the locations that have been set up for the site <strong>{{current_site}}</strong></caption>
                                            <table style="margin-bottom: 0px;" class="uk-table uk-table-striped">
                                                <thead>
                                                    <tr>
                                                        <th>ID</th>
                                                        <th>Brand Name</th>
                                                        <th>Operations</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="brandsTableBody">
                                                </tbody>
                                            </table>
                                            <button onclick="openAddBrandsModal()" class="uk-button add-button"><i class="uk-flex-middle material-symbols-outlined" style="">add_circle</i></button>
                                        </div>
                                    </div>
                                </div>
                                <!-- Prefixes -->                                
                                <div class="uk-container">
                                    <div uk-grid>
                                        <div class="uk-width-1-1 uk-flex uk-flex-center">
                                            <nav aria-label="Pagination">
                                                <ul id="prefixesPagination" class="uk-pagination" uk-margin>
                                                    <li><a href="#"><span uk-pagination-previous></span></a></li>
                                                    <li><a href="#">1</a></li>
                                                    <li class="uk-disabled"><span>…</span></li>
                                                    <li><a href="#">5</a></li>
                                                    <li><a href="#">6</a></li>
                                                    <li class="uk-active"><span aria-current="page">7</span></li>
                                                    <li><a href="#">8</a></li>
                                                    <li><a href="#"><span uk-pagination-next></span></a></li>
                                                </ul>
                                            </nav>
                                        </div>
                                        <div class="uk-width-1-1">
                                            <caption class="uk-text-meta">Here are all the locations that have been set up for the site <strong>{{current_site}}</strong></caption>
                                            <table style="margin-bottom: 0px;" class="uk-table uk-table-striped">
                                                <thead>
                                                    <tr>
                                                        <th>ID</th>
                                                        <th>UUID</th>
                                                        <th>Name</th>
                                                        <th>Description</th>
                                                        <th>Operations</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="prefixesTableBody">
                                                </tbody>
                                            </table>
                                            <button onclick="openAddPrefixModal()" class="uk-button add-button"><i class="uk-flex-middle material-symbols-outlined" style="">add_circle</i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Modals -->
        <!-- Zones ADD/EDIT -->
        <div id="ZonesModal" uk-modal>
            <div class="uk-modal-dialog">
                <button class="uk-modal-close-default" type="button" uk-close></button>
                <div class="uk-modal-header">
                    <h2 id="ZonesModalHeader" class="uk-modal-title"></h2>
                </div>
                <div class="uk-modal-body">
                    <div class="uk-grid-small" uk-grid>
                        <div class="uk-width-1-1">
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="ZoneName">Zone Name</label>
                                <input class="uk-input" id="ZoneName" type="text" placeholder="">
                                
                            </div>
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="ZoneDescription">Text</label>
                                <textarea id="ZoneDescription" class="uk-textarea" rows="5" placeholder="" aria-label="Textarea"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-modal-footer uk-text-right">
                    <button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
                    <button id="ZonesModalSubmitButton" class="uk-button uk-button-primary" type="button"></button>
                </div>
            </div>
        </div>
        <!-- Locations ADD/EDIT -->
        <div id="LocationsModal" uk-modal>
            <div class="uk-modal-dialog">
                <button class="uk-modal-close-default" type="button" uk-close></button>
                <div class="uk-modal-header">
                    <h2 id="LocationsModalHeader" class="uk-modal-title"></h2>
                </div>
                <div class="uk-modal-body">
                    <div class="uk-grid-small" uk-grid>
                        <div class="uk-width-1-1">
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="LocationZoneId">Location Zone</label>
                                <select id="LocationZoneId" class="uk-select" aria-label="Select">
                                    {% for zone in zones %}
                                        <option id="locationzone_{{zone[0]}}" value="{{zone[0]}}">{{zone[1]}}</option>
                                    {% endfor %}
                                </select>
                            </div>
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="LocationName">Location Name</label>
                                <input id="LocationName" class="uk-input" type="text">
                            </div>
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="LocationUUID">Location UUID</label>
                                <input class="uk-input uk-disabled" id="LocationUUID" type="text" placeholder="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-modal-footer uk-text-right">
                    <button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
                    <button id="LocationsModalSubmitButton" class="uk-button uk-button-primary" type="button"></button>
                </div>
            </div>
        </div>
        <!-- Vendors ADD/EDIT -->
        <div id="VendorsModal" uk-modal>
            <div class="uk-modal-dialog">
                <button class="uk-modal-close-default" type="button" uk-close></button>
                <div class="uk-modal-header">
                    <h2 id="VendorsModalHeader" class="uk-modal-title"></h2>
                </div>
                <div class="uk-modal-body">
                    <div class="uk-grid-small" uk-grid>
                        <div class="uk-width-1-1">
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="VendorName">Vendor Name</label>
                                <input id="VendorName" class="uk-input" type="text">
                            </div>
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="VendorPhoneNumber">Vendor Phone Number</label>
                                <input class="uk-input" id="VendorPhoneNumber" type="text" placeholder="">
                            </div>
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="VendorAddress">Vendor Address</label>
                                <textarea id="VendorAddress" class="uk-textarea" rows="5" placeholder="" aria-label="Textarea"></textarea>
                            </div>
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="vendor_created">Vendor Created</label>
                                <input class="uk-input uk-disabled" id="vendor_created" type="text" placeholder="">
                            </div>
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="vendor_created_by">Vendor Created By</label>
                                <input class="uk-input uk-disabled" id="vendor_created_by" type="text" placeholder="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-modal-footer uk-text-right">
                    <button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
                    <button id="VendorsModalSubmitButton" class="uk-button uk-button-primary" type="button"></button>
                </div>
            </div>
        </div>
        <!-- Brands ADD/EDIT -->
        <div id="BrandsModal" uk-modal>
            <div class="uk-modal-dialog">
                <button class="uk-modal-close-default" type="button" uk-close></button>
                <div class="uk-modal-header">
                    <h2 id="BrandsModalHeader" class="uk-modal-title"></h2>
                </div>
                <div class="uk-modal-body">
                    <div class="uk-grid-small" uk-grid>
                        <div class="uk-width-1-1">
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="BrandName">Brand Name</label>
                                <input id="BrandName" class="uk-input" type="text">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-modal-footer uk-text-right">
                    <button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
                    <button id="BrandsModalSubmitButton" class="uk-button uk-button-primary" type="button"></button>
                </div>
            </div>
        </div>
        <!-- Prefixes ADD/EDIT -->
        <div id="PrefixModal" uk-modal>
            <div class="uk-modal-dialog">
                <button class="uk-modal-close-default" type="button" uk-close></button>
                <div class="uk-modal-header">
                    <h2 id="PrefixModalHeader" class="uk-modal-title"></h2>
                </div>
                <div class="uk-modal-body">
                    <div class="uk-grid-small" uk-grid>
                        <div class="uk-width-1-1">
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="PrefixUUID">Prefix UUID</label>
                                <input id="PrefixUUID" class="uk-input" type="text">
                            </div>
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="PrefixName">Prefix Name</label>
                                <input id="PrefixName" class="uk-input" type="text">
                            </div>
                        </div>
                        <div class="uk-width-1-1">
                            <div class="uk-margin">
                                <label class="uk-form-label" for="PrefixDescription">Prefix Description</label>
                                <textarea id="PrefixDescription" class="uk-textarea" rows="5" placeholder="" aria-label="Textarea"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-modal-footer uk-text-right">
                    <button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
                    <button id="PrefixModalSubmitButton" class="uk-button uk-button-primary" type="button"></button>
                </div>
            </div>
        </div>

    </body>
    {% assets "js_all" %}
    <script type="text/javascript" src="{{ ASSET_URL }}"></script>
    {% endassets %}
    <script>const session = {{session|tojson}}</script>
    <script src="{{ url_for('site_management_api.static', filename='js/site_management_handler.js') }}"></script>
</html>