Replace tree navigation with touch UI
This commit is contained in:
@@ -5,10 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<title>Workbench</title>
|
||||
|
||||
<!-- JSTree default style -->
|
||||
<link rel="stylesheet" href="/backend/jstree/dist/themes/default/style.min.css" />
|
||||
|
||||
<style>
|
||||
<style>
|
||||
h1 {
|
||||
color: rgb(7, 9, 121); /* Changes text color to blue */
|
||||
font-size: 2rem; /* Example: increase font size */
|
||||
@@ -126,10 +123,54 @@
|
||||
<img src="logo.png" alt="Logo" style="height: 50px;">
|
||||
</header>
|
||||
|
||||
<div id="container">
|
||||
<nav>
|
||||
<div id="tree"></div>
|
||||
</nav>
|
||||
<div id="container">
|
||||
<nav class="touch-nav" aria-label="Workbench Navigation">
|
||||
<section class="nav-section">
|
||||
<h2>TR</h2>
|
||||
<button type="button" class="nav-item active" data-page="Workorder.html">
|
||||
<span>Workorder</span>
|
||||
<small>Aktivierung</small>
|
||||
</button>
|
||||
<button type="button" class="nav-item" data-page="Station.html">
|
||||
<span>Station</span>
|
||||
<small>Fertigungsbaum</small>
|
||||
</button>
|
||||
</section>
|
||||
<section class="nav-section">
|
||||
<h2>PM</h2>
|
||||
<button type="button" class="nav-item" data-page="pm_seite1.html">
|
||||
<span>Seite 1</span>
|
||||
<small>PM</small>
|
||||
</button>
|
||||
<button type="button" class="nav-item" data-page="pm_seite2.html">
|
||||
<span>Seite 2</span>
|
||||
<small>PM</small>
|
||||
</button>
|
||||
</section>
|
||||
<section class="nav-section">
|
||||
<h2>Import</h2>
|
||||
<button type="button" class="nav-item" data-page="PARTImport.html">
|
||||
<span>PART</span>
|
||||
<small>Material</small>
|
||||
</button>
|
||||
<button type="button" class="nav-item" data-page="BOMImport.html">
|
||||
<span>BOM</span>
|
||||
<small>Stueckliste</small>
|
||||
</button>
|
||||
<button type="button" class="nav-item" data-page="ErpAdd.html">
|
||||
<span>ERPGroup</span>
|
||||
<small>ERP Gruppen</small>
|
||||
</button>
|
||||
<button type="button" class="nav-item" data-page="Contacts.html">
|
||||
<span>Contacts</span>
|
||||
<small>Kontakte</small>
|
||||
</button>
|
||||
<button type="button" class="nav-item" data-page="Useradd.html">
|
||||
<span>UserImport</span>
|
||||
<small>Benutzer</small>
|
||||
</button>
|
||||
</section>
|
||||
</nav>
|
||||
<!-- Use an IFRAME instead of a <div id="content"> -->
|
||||
<iframe id="contentFrame" name="contentFrame" width="100%" height="100%"></iframe>
|
||||
</div>
|
||||
@@ -156,11 +197,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- jQuery and jsTree scripts -->
|
||||
<script src="/backend/jquery/jquery-3.7.1.min.js"></script>
|
||||
<script src="/backend/jstree/dist/jstree.min.js"></script>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
// ---------------------- SESSION CHECK ----------------------
|
||||
// Example: Let's say sessionContext or "globallogin" is initially null
|
||||
let globallogin = null; // or read from sessionStorage if desired
|
||||
@@ -177,55 +214,25 @@
|
||||
document.getElementById('loginModal').style.display = 'none';
|
||||
});
|
||||
|
||||
// --------------- JSTree Initialization ---------------
|
||||
$(function () {
|
||||
$('#tree').jstree({
|
||||
'core': {
|
||||
'data': [
|
||||
{
|
||||
"text": "TR",
|
||||
"icon": "tr.png",
|
||||
"children": [
|
||||
{ "text": "Workorder", "a_attr": { "data-page": "Workorder.html" } },
|
||||
{ "text": "Station", "a_attr": { "data-page": "Station.html" } }
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "PM",
|
||||
"icon": "pm.png",
|
||||
"children": [
|
||||
{ "text": "Seite 1", "a_attr": { "data-page": "pm_seite1.html" } },
|
||||
{ "text": "Seite 2", "a_attr": { "data-page": "pm_seite2.html" } }
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "Import",
|
||||
"children": [
|
||||
{ "text": "PART", "a_attr": { "data-page": "PARTImport.html" } },
|
||||
{ "text": "BOM", "a_attr": { "data-page": "BOMImport.html" } },
|
||||
{ "text": "ERPGroup", "a_attr": { "data-page": "ErpAdd.html" } },
|
||||
{ "text": "Contacts", "a_attr": { "data-page": "Contacts.html" } },
|
||||
{ "text": "UserImport", "a_attr": { "data-page": "Useradd.html" } }
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
'html': true
|
||||
}
|
||||
});
|
||||
|
||||
// Larger variant if you want bigger icons
|
||||
$.jstree.defaults.core.themes.variant = "large";
|
||||
|
||||
// When the user clicks a node
|
||||
$('#tree').on('select_node.jstree', function (e, data) {
|
||||
if (data.node.a_attr && data.node.a_attr['data-page']) {
|
||||
const page = data.node.a_attr['data-page'];
|
||||
// Instead of fetch/parse, we set the iframe's src:
|
||||
document.getElementById('contentFrame').src = page;
|
||||
}
|
||||
});
|
||||
});
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const frame = document.getElementById("contentFrame");
|
||||
const navItems = document.querySelectorAll(".nav-item[data-page]");
|
||||
|
||||
function openPage(button) {
|
||||
navItems.forEach(item => item.classList.remove("active"));
|
||||
button.classList.add("active");
|
||||
frame.src = button.dataset.page;
|
||||
}
|
||||
|
||||
navItems.forEach(button => {
|
||||
button.addEventListener("click", () => openPage(button));
|
||||
});
|
||||
|
||||
const firstPage = document.querySelector(".nav-item.active") || navItems[0];
|
||||
if (firstPage) {
|
||||
openPage(firstPage);
|
||||
}
|
||||
});
|
||||
|
||||
// ============== LOGIN FUNCTION (REST CALL) ==============
|
||||
const protocol = window.location.protocol;
|
||||
|
||||
Reference in New Issue
Block a user