<!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>
        .custom_row:hover{
            background-color: rgb(230, 230, 230) !important;
            cursor: pointer;
        }
        html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        }
        body {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        }
        .page-content {
        flex: 1 0 auto;
        }
        footer {
        flex-shrink: 0;
        }

    </style>
    <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="/planner">Planner</a></li>
                                        <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 class="uk-active"><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 style="cursor: default; user-select: none;" class="uk-disabled"><span>Point of Ease</span></li>
                            <li class="uk-disabled"><span>Scan to Receipt</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><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-container uk-section">
            <div class="uk-grid-small" uk-grid>
                    <div class="uk-width-1-1">
                        <p class="uk-text-meta">Using this method of entering receipts does so by adding each barcode to a list and once the receipt has been built the 
                            the system will then add the receipt to the system. Its important that you have the Barcode input focused and use a scanner that places the 
                            characters into the field before it finishes up with a press of the ENTER key.
                        </p>
                    </div>
                    <div class="uk-width-1-1" uk-grid>
                        <div>
                            <button id="receiptStart" onclick="startReceipt()" class="uk-button uk-button-primary">Start Receipt</button>
                        </div>
                        <div>
                            <button id="receiptComplete" onclick="completeReceipt()" class="uk-button uk-button-default uk-disabled">Complete Receipt</button>
                        </div>
                        <div>
                            <button id="receiptClose" onclick="closeReceipt()" class="uk-button uk-button-default uk-disabled">Cancel Receipt</button>
                        </div>
                        <div>
                            <button onclick="openPLUModal()" class="uk-button uk-button-default">PLU Dash</button>
                        </div>
                    </div>
                    <div class="uk-width-1-1">
                        <hr class="uk-divider-icon">
                    </div>
                    <div id="barcode-input" class="uk-width-1-1 uk-flex uk-flex-left uk-disabled" uk-grid>
                        <div class="uk-width-1-3@m">
                            <label class="uk-form-label" for="barcode-scan-receipt">Barcode</label>
                            <input onkeydown="addToReceipt(event)" id="barcode-scan-receipt" class="uk-input uk-flex uk-flex-bottom" type="text">
                        </div>
                    </div>
                    <div id="barcode-table" class="uk-width-1-1 uk-disabled">
                        <table class="uk-table uk-table-striped uk-table-hover">
                            <thead>
                                <tr>
                                    <th class="uk-table-shrink">Type</th>
                                    <th class="uk-table-shrink">Barcode</th>
                                    <th>Name</th>                                    
                                </tr>
                            </thead>
                            <tbody id="scanReceiptTableBody">
                            </tbody>
                        </table>
                    </div>
                </div>
        </div>
        <!-- Line Edit Modal USED FOR RECEIPTS-->
        <div id="lineEditModal" uk-modal>
            <div class="uk-modal-dialog uk-modal-body">
                <h2 class="uk-modal-title">Edit Line...</h2>
                <p class="uk-text-meta">Edit any fields here for the selected Line and then save them.</p>
                <table class="uk-table uk-table-responsive uk-table-striped">
                    <thead>
                        <tr>
                            <th></th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Item Name</td>
                            <td><input id="lineName" class="uk-input" type="text"></td>
                        </tr>
                        <tr>
                            <td>QTY</td>
                            <td><input id="lineQty" class="uk-input" type="text"></td>
                        </tr>
                        <tr>
                            <td>UOM</td>
                            <td>
                                <select id="lineUOM" class="uk-select" type="text">
                                    {% for unit in units %}
                                    <option value="{{unit['id']}}">{{unit['fullname']}}</option>
                                    {% endfor %}
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>COST</td>
                            <td><input id="lineCost" class="uk-input" type="text"></td>
                        </tr>
                        <tr>
                            <td>EXPIRES</td>
                            <td><input id="lineExpires" class="uk-input" type="date"></td>
                        </tr>
                    </tbody>
                </table>
                <p class="uk-text-right">
                    <button class="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
                    <button id="saveLineButton" class="uk-button uk-button-primary" type="button">Save</button>
                </p>
            </div>
        </div>
        <!-- PLU Modal USED FOR RECEIPTS-->
        <div id="PLUDASHModal" class="uk-modal-full" uk-modal>
            <div class="uk-modal-dialog uk-modal-body">
                <h2 class="uk-modal-title">Add PLU Line...</h2>
                <div id="PLUCardsBody" class="uk-grid-small uk-child-width-1-3@s uk-child-width-1-5@m uk-child-width-1-6@l" uk-grid="masonry: pack">
                        <!-- need to be built in javascript -->
                        <div>
                            <div class="uk-card uk-card-default uk-card-small uk-card-hover uk-text-center">
                                <div class="uk-card-media-top uk-flex uk-flex-center uk-padding-small">
                                    <img src="https://upload.wikimedia.org/wikipedia/commons/1/15/Red_Apple.jpg" alt="Apple" width="60">
                                </div>
                                <div class="uk-card-body uk-padding-small">
                                    <h5 class="uk-card-title" style="margin-bottom: 4px;">Apple</h5>
                                    <div style="font-size: 0.8em; margin-bottom: 7px;">PLU: 4017</div>
                                    <button class="uk-button uk-button-primary uk-button-small" onclick="addToReceipt('Apple', '4017')">Add</button>
                                </div>
                            </div>
                        </div>
                        <div>
                            <div class="uk-card uk-card-default uk-card-small uk-card-body">
                                <h3 class="uk-card-title">Small</h3>
                                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                            </div>
                        </div>
                        <div>
                            <div class="uk-card uk-card-default uk-card-small uk-card-body">
                                <h3 class="uk-card-title">Small</h3>
                                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                            </div>
                        </div>
                        <div>
                            <div class="uk-card uk-card-default uk-card-small uk-card-body">
                                <h3 class="uk-card-title">Small</h3>
                                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                            </div>
                        </div>
                        <div>
                            <div class="uk-card uk-card-default uk-card-small uk-card-body">
                                <h3 class="uk-card-title">Small</h3>
                                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                            </div>
                        </div>
                        <div>
                            <div class="uk-card uk-card-default uk-card-small uk-card-body">
                                <h3 class="uk-card-title">Small</h3>
                                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                            </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>
            </div>
        </div>
    </body>
    {% assets "js_all" %}
    <script type="text/javascript" src="{{ ASSET_URL }}"></script>
    {% endassets %}
    <script src="{{ url_for('poe.static', filename='js/receiptsHandler.js') }}"></script>
</html>