Initial commit: update
This commit is contained in:
324
backend/target/backend-1/index.html
Normal file
324
backend/target/backend-1/index.html
Normal file
@@ -0,0 +1,324 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<title>Workbench</title>
|
||||
|
||||
<link rel="stylesheet" href="/backend/hmi-theme/ios.css">
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
color: rgb(7, 9, 121); /* Changes text color to blue */
|
||||
font-size: 2rem; /* Example: increase font size */
|
||||
text-align: center; /* Example: center the text */
|
||||
margin-top: 30px; /* Example: adjust margin */
|
||||
margin-left: 50px;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
header {
|
||||
height: 80px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
background-color: hsl(231, 73%, 61%);
|
||||
border-top-left-radius: 100px;
|
||||
}
|
||||
|
||||
#container {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
nav {
|
||||
width: 200px;
|
||||
background-color: hsl(231, 73%, 61%);
|
||||
padding: 10px;
|
||||
overflow-y: auto; /* Scrollbar if needed */
|
||||
}
|
||||
|
||||
/* The iframe replaces the old #content <div> */
|
||||
#contentFrame {
|
||||
flex-grow: 1;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* ======================== MODAL STYLES ======================== */
|
||||
.modal {
|
||||
display: none; /* Hidden by default */
|
||||
position: fixed;
|
||||
z-index: 9999; /* On top of other elements */
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto; /* Enable scroll if needed */
|
||||
background-color: rgba(0,0,0,0.4); /* Black/gray overlay */
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: #fff;
|
||||
margin: 10% auto; /* 10% from top, center horizontally */
|
||||
padding: 20px;
|
||||
width: 300px; /* Adjust as needed */
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 10px;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.modal h2 {
|
||||
margin: 0 0 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.modal label {
|
||||
display: block;
|
||||
margin: 10px 0 5px;
|
||||
}
|
||||
|
||||
.modal input[type="text"],
|
||||
.modal input[type="password"] {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.modal button {
|
||||
margin-top: 15px;
|
||||
padding: 10px 20px;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
background-color: hsl(231, 73%, 61%);
|
||||
color: #fff;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.modal button:hover {
|
||||
background-color: hsl(231, 73%, 70%);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Workbench</h1>
|
||||
<img src="logo.png" alt="Logo" style="height: 50px;">
|
||||
</header>
|
||||
|
||||
<div id="container">
|
||||
<nav class="touch-nav" aria-label="Workbench Navigation">
|
||||
<details class="nav-section" open>
|
||||
<summary>TR</summary>
|
||||
<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>
|
||||
<button type="button" class="nav-item" data-page="HistoryBooking.html">
|
||||
<span>HistoryData</span>
|
||||
<small>Historydata</small>
|
||||
</button>
|
||||
<button type="button" class="nav-item" data-page="Activities_rest.html">
|
||||
<span>Manuelle Fertigung</span>
|
||||
<small>Activities</small>
|
||||
</button>
|
||||
<button type="button" class="nav-item" data-page="Activity_designer_rest.html">
|
||||
<span>Manuelle Fertigung, definition</span>
|
||||
<small>Activities def</small>
|
||||
</button>
|
||||
</details>
|
||||
<details class="nav-section">
|
||||
<summary>PM</summary>
|
||||
<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>
|
||||
</details>
|
||||
<details class="nav-section">
|
||||
<summary>Import</summary>
|
||||
<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>
|
||||
</details>
|
||||
<details class="nav-section" open>
|
||||
<summary>HMI Framework</summary>
|
||||
<button type="button" class="nav-item" data-page="hmi/index.html">
|
||||
<span>HMI Designer / Runtime</span>
|
||||
<small>GridStack · Benutzerlayouts</small>
|
||||
</button>
|
||||
</details>
|
||||
</nav>
|
||||
<!-- Use an IFRAME instead of a <div id="content"> -->
|
||||
<iframe id="contentFrame" name="contentFrame" width="100%" height="100%"></iframe>
|
||||
</div>
|
||||
|
||||
<!-- ================ MODAL HTML ================ -->
|
||||
<div id="loginModal" class="modal">
|
||||
<div class="modal-content">
|
||||
<span class="close" id="closeModal">×</span>
|
||||
<h2>Login </h2>
|
||||
<form id="loginForm" onsubmit="regLogin(); return false;">
|
||||
<label for="stationNumber">Station Number:</label>
|
||||
<input type="text" id="stationNumber" />
|
||||
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" id="username" />
|
||||
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" />
|
||||
|
||||
<!-- Add more fields if needed (e.g. Client ID) -->
|
||||
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// ---------------------- SESSION CHECK ----------------------
|
||||
// Example: Let's say sessionContext or "globallogin" is initially null
|
||||
let globallogin = null; // or read from sessionStorage if desired
|
||||
|
||||
// If no session context, show the modal
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
if (!globallogin) {
|
||||
document.getElementById('loginModal').style.display = 'block';
|
||||
}
|
||||
});
|
||||
|
||||
// Close button for the modal
|
||||
document.getElementById('closeModal').addEventListener('click', () => {
|
||||
document.getElementById('loginModal').style.display = 'none';
|
||||
});
|
||||
|
||||
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");
|
||||
const section = button.closest(".nav-section");
|
||||
if (section) {
|
||||
section.open = true;
|
||||
}
|
||||
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;
|
||||
const host = window.location.host;
|
||||
const url = protocol + "//" + host;
|
||||
|
||||
|
||||
|
||||
function regLogin() {
|
||||
const stationNumber = document.getElementById("stationNumber").value.trim();
|
||||
const username = document.getElementById("username").value.trim();
|
||||
const password = document.getElementById("password").value;
|
||||
|
||||
if (!stationNumber) {
|
||||
stationNumber = "00000001";
|
||||
}
|
||||
|
||||
|
||||
// Example body structure (adjust to your exact API requirements)
|
||||
const bodyData = {
|
||||
"sessionValidationStruct": {
|
||||
"stationNumber": stationNumber,
|
||||
"stationPassword": "",
|
||||
"user": username,
|
||||
"password": password,
|
||||
"client": "01",
|
||||
"registrationType": "U",
|
||||
"systemIdentifier": "Webclient"
|
||||
}
|
||||
};
|
||||
|
||||
fetch(url + '/mes/imsapi/rest/actions/regLogin', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(bodyData)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(login => {
|
||||
console.log("Login response:", login);
|
||||
globallogin = login; // store globally
|
||||
sessionStorage.setItem("globallogin", JSON.stringify(login));
|
||||
sessionStorage.setItem("stationNumber", stationNumber);
|
||||
sessionStorage.setItem("url", url);
|
||||
sessionStorage.setItem("persID", globallogin.result.sessionContext.persId);
|
||||
|
||||
if (login.result.return_value != 0) {
|
||||
// If login fails, show error
|
||||
alert("Login fehlgeschlagen. Error code: " + login.result.return_value);
|
||||
} else {
|
||||
// If login succeeds, hide modal
|
||||
document.getElementById('loginModal').style.display = 'none';
|
||||
// You may then load an initial page in the iframe, etc.
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Login error:', error);
|
||||
alert('Fehler bei der Anmeldung. Bitte prüfen Sie die Konsole.');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user