120 lines
No EOL
3.3 KiB
HTML
120 lines
No EOL
3.3 KiB
HTML
<!-- FILEPATH: index.html -->
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Create DNH Label</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #f2f2f2;
|
|
margin: 0;
|
|
padding: 20px;
|
|
}
|
|
|
|
h1 {
|
|
color: #333;
|
|
text-align: center;
|
|
}
|
|
|
|
form {
|
|
max-width: 400px;
|
|
margin: 0 auto;
|
|
background-color: #fff;
|
|
padding: 20px;
|
|
border-radius: 5px;
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
margin-bottom: 10px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
input[type="text"] {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
input[type="submit"] {
|
|
background-color: #4CAF50;
|
|
color: white;
|
|
padding: 10px 20px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
}
|
|
|
|
input[type="submit"]:hover {
|
|
background-color: #45a049;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Create DNH Label</h1>
|
|
<form id="labelForm" action="http://10.209.10.3:8080/create_dnh_label" method="POST">
|
|
<label for="name">Name:</label>
|
|
<input type="text" id="name" name="name" required>
|
|
<br><br>
|
|
<input type="submit" value="Create Label">
|
|
</form>
|
|
|
|
<h1>Create Generic Label</h1>
|
|
<form id="genericLabelForm" action="http://10.209.10.3:8080/create_generic_label" method="POST">
|
|
<label for="text">Text:</label>
|
|
<input type="text" id="text" name="text" required>
|
|
<br><br>
|
|
<input type="submit" value="Create Label">
|
|
</form>
|
|
|
|
<script>
|
|
document.getElementById("labelForm").addEventListener("submit", function(event) {
|
|
event.preventDefault();
|
|
var form = event.target;
|
|
var formData = new FormData(form);
|
|
|
|
fetch(form.action, {
|
|
method: form.method,
|
|
body: formData
|
|
})
|
|
.then(function(response) {
|
|
if (response.ok) {
|
|
alert("Label created successfully!");
|
|
} else {
|
|
console.log(response);
|
|
alert("Failed to create label. Please try again.");
|
|
}
|
|
})
|
|
.catch(function(error) {
|
|
console.log(error);
|
|
});
|
|
});
|
|
|
|
document.getElementById("genericLabelForm").addEventListener("submit", function(event) {
|
|
event.preventDefault();
|
|
var form = event.target;
|
|
var formData = new FormData(form);
|
|
|
|
fetch(form.action, {
|
|
method: form.method,
|
|
body: formData
|
|
})
|
|
.then(function(response) {
|
|
if (response.ok) {
|
|
alert("Generic label created successfully!");
|
|
} else {
|
|
console.log(response);
|
|
alert("Failed to create generic label. Please try again.");
|
|
}
|
|
})
|
|
.catch(function(error) {
|
|
console.log(error);
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |