<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="Created" content="2025-09-16">
    <meta name="Author" content="Kārlis Grīnvalds">
    <meta name="Last edited" content="2026-05-13">
    <meta name="Edited by" content="Kārlis Grīnvalds">
    <meta name="csrf-token" content="<?= csrf_hash() ?>">
    <meta name="csrf-name" content="<?= csrf_token() ?>">
    <title><?php echo $Title ?></title>
    <script src="../js/jquery/jquery-3.7.1.min.js"></script>
    <script src="../js/admin_panel.js"></script>
    <script src="../js/script.js"></script>
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../css/elements.css">
    <link rel="stylesheet" href="../css/admin_panel.css">
</head>
<body>
    <?php echo $BodyParts ?>
    <!-- Shows create account and log in links or log out link and welcome message for the user -->
    <div id="UserProfile" class="user-profile"></div>
    <!-- Page layout -->
    <div class="container">
        <header>
            <!-- Search bar -->
            <div id="SearchBarDiv" class="search-bar">
                <input type="text" id="SearchField" placeholder="Search through the wiki">
                <button id="SearchBtn">Search</button>
            </div>
            <!-- Displays all the action that the user can do -->
            <div id="UserActionBar" class="action-bar"></div>
        </header>
        <div class="main">
            <!-- Main body -->
            <h1>Admin panel</h1><hr>
            <p>View all <a id="ViewEntriesBtn">entries</a>.</p>
            <p>View all <a id="ViewFilesBtn">uploaded files</a>.</p>
            <h2>Permissions</h2><hr>
            <div id="TopicStuff">
                <p>Edit <a id="TopicLink">topic page</a>.</p>
                <p>Topic's visibility: <button id="TopicVisibility">private</button></p>
                <p><b>Topic permissions:</b></p>
                <table id="TopicPermission" class="borders">
                    <tr>
                        <th>Can view the topic</th>
                        <th>Can create new entries</th>
                        <th>Can upload files</th>
                        <th>Can edit entries</th>
                        <th>Can edit uploaded files</th>
                        <th>Can edit topic content page</th>
                        <th>Can delete entries</th>
                        <th>Can delete uploaded files</th>
                    </tr>
                    <tr id="TProw">
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                    </tr>
                </table><br>
                <button id="SaveTopicBtn" disabled>Save changes</button>
                <span id="TopicMessage" class="error-text">Unsaved changes detected</span>
            </div>
            <h2>Permissions</h2><hr>
            <details id="UserPermissionContainer">
                <summary data-open="Close permission form" data-close="Open permission form"></summary>
                <br><hr>
                <h4>User permissions form</h4>
                <input id="PermID" type="hidden" readonly>
                <p><b>User: </b><input id="UserNameInput" type="text" placeholder="Username"></p>
                <table id="UserPermission" class="borders">
                    <tr>
                        <th>Can view the topic</th>
                        <th>Can create new entries</th>
                        <th>Can upload files</th>
                        <th>Can edit entries</th>
                        <th>Can edit uploaded files</th>
                        <th>Can edit topic content page</th>
                        <th>Can delete entries</th>
                        <th>Can delete uploaded files</th>
                    </tr>
                    <tr id="UProw">
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                        <td><div><input type="checkbox"></div></td>
                    </tr>
                </table>
                <br><button id="SavePermissionsBtn">Save changes</button>
                <button id="CancelPermissionsBtn">Cancel</button>
                <span id="UserMessage" class="error-text"></span>
            </details>
            <table id="TableOfEntries" class="table borders">
                <tr class="yippee">
                    <th style="width: 20%">Username</th>
                    <th>Permissions</th>
                    <th style="width: 20%">Actions</th>
                </tr>
                <tr class="yippee">
                    <td colspan="3">
                        <div class="search-item-field"><input id="UserSearchInput" type="text" placeholder="Find user"></div>
                    </td>
                </tr>
            </table><br>
        </div>
        <footer>Page: admin panel<br></footer>
    </div>
</body>
</html>