html design file form web config
This commit is contained in:
parent
fa088db00f
commit
d0f2c82ee5
|
@ -0,0 +1,221 @@
|
|||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<form enctype="multipart/form-data" id="config_form" onsubmit="send_config()" action="/save_config">
|
||||
<h1>ESPMega PRO</h1>
|
||||
<h3>Device Configurations</h3>
|
||||
<p class="config_title">IP Address</p>
|
||||
<input type="text" id="dev_ip" name="dev_ip" class="conf_txt" value="0.0.0.0"><br>
|
||||
<p class="config_title">Network Mask</p>
|
||||
<input type="text" id="netmask" name="netmask" class="conf_txt" value="0.0.0.0"><br>
|
||||
<p class="config_title">Gateway</p>
|
||||
<input type="text" id="gateway" name="gateway" class="conf_txt" value="0.0.0.0"><br>
|
||||
<p class="config_title">DNS Server</p>
|
||||
<input type="text" id="dns" name="dns" class="conf_txt" value="0.0.0.0"><br>
|
||||
<p class="config_title">Hostname</p>
|
||||
<input type="text" id="hostname" name="hostname" class="conf_txt" value="ESPMegaPRO"><br>
|
||||
<p class="config_title">BMS Server - IP Address</p>
|
||||
<input type="text" id="bms_ip" name="bms_ip" class="conf_txt" value="0.0.0.0"><br>
|
||||
<p class="config_title">BMS Server - Port</p>
|
||||
<input type="text" id="bms_port" name="bms_port" class="conf_txt" value="1883"><br>
|
||||
<label class="container">Authentication
|
||||
<input type="checkbox" id="bms_useauth" checked="checked">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<p class="config_title">BMS Server - Username</p>
|
||||
<input type="text" id="bms_username" name="bms_username" class="conf_txt" value="user"><br>
|
||||
<p class="config_title">BMS Server - Password</p>
|
||||
<input type="password" id="bms_password" name="bms_password" class="conf_txt" value="password"><br>
|
||||
<p class="config_title">BMS Server - Endpoint</p>
|
||||
<input type="text" id="bms_endpoint" name="bms_endpoint" class="conf_txt" value="/espmegapro"><br>
|
||||
<input type="submit" class="btn" value="Save">
|
||||
<b>SIWAT SYSTEM 2023</b>
|
||||
</form>
|
||||
<script>
|
||||
function send_config() {
|
||||
var form = $("#config_form")[0];
|
||||
var data = new FormData(form);
|
||||
var dev_ip = data.get("dev_ip")
|
||||
var netmask = data.get("netmask")
|
||||
var gateway = data.get("gateway")
|
||||
var dns = data.get("dns")
|
||||
var bms_ip = data.get("bms_ip")
|
||||
var bms_port = data.get("bms_port")
|
||||
var bms_useauth = data.get("bms_useauth")
|
||||
var bms_username = data.get("bms_username")
|
||||
var bms_password = data.get("bms_password")
|
||||
var bms_endpoint = data.get("bms_endpoint")
|
||||
|
||||
}
|
||||
// $("form").submit(function (e) {
|
||||
// e.preventDefault();
|
||||
// var form = $("#config_form")[0];
|
||||
// var data = new FormData(form);
|
||||
// console.log(data)
|
||||
// $.ajax({
|
||||
// //Insert Configuration Upload Code
|
||||
// });
|
||||
// });
|
||||
</script>
|
||||
<style>
|
||||
p.config_title {
|
||||
font-size: 12;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
align-self: left;
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
hr {
|
||||
display: block;
|
||||
color: #aaaaaa;
|
||||
background-color: #aaaaaa;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
border-style: inset;
|
||||
border-width: 0px;
|
||||
height: 3px;
|
||||
}
|
||||
|
||||
#file-input,
|
||||
input {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
border-radius: 4px;
|
||||
margin: 10px auto;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
input {
|
||||
background: #f1f1f1;
|
||||
border: 0;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
body {
|
||||
background-image: url("https://fs.siwatsystem.com/arona_bg.png");
|
||||
background-size: cover;
|
||||
font-family: sans-serif;
|
||||
font-size: 14px;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
#file-input {
|
||||
background-color: #CCCCCC;
|
||||
color: #5E5E5E;
|
||||
padding: 0;
|
||||
border: 1px solid #ddd;
|
||||
line-height: 44px;
|
||||
text-align: center;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#bar,
|
||||
#prgbar {
|
||||
background-color: #D9D9D9;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#bar {
|
||||
background-color: #29CD1F;
|
||||
width: 0%;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
form {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
max-width: 258px;
|
||||
margin: 75px auto;
|
||||
padding: 30px;
|
||||
border-radius: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: #CA3D3D;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.conf {
|
||||
background: #417df3;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
.conf_txt {
|
||||
background-color: #e2e2e2;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
size: 4;
|
||||
display: inline-block;
|
||||
}
|
||||
.container {
|
||||
display: block;
|
||||
position: relative;
|
||||
padding-left: 0px;
|
||||
margin-bottom: 12px;
|
||||
cursor: pointer;
|
||||
font-size: 20px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* Hide the browser's default checkbox */
|
||||
.container input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
height: 0;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
/* Create a custom checkbox */
|
||||
.checkmark {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 25px;
|
||||
width: 25px;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
/* On mouse-over, add a grey background color */
|
||||
.container:hover input ~ .checkmark {
|
||||
background-color: #ccc;
|
||||
}
|
||||
|
||||
/* When the checkbox is checked, add a blue background */
|
||||
.container input:checked ~ .checkmark {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
/* Create the checkmark/indicator (hidden when not checked) */
|
||||
.checkmark:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Show the checkmark when checked */
|
||||
.container input:checked ~ .checkmark:after {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Style the checkmark/indicator */
|
||||
.container .checkmark:after {
|
||||
left: 9px;
|
||||
top: 5px;
|
||||
width: 5px;
|
||||
height: 10px;
|
||||
border: solid white;
|
||||
border-width: 0 3px 3px 0;
|
||||
-webkit-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,176 @@
|
|||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<form method="POST" action="#" enctype="multipart/form-data" id="upload_form">
|
||||
<h1>ESPMega PRO</h1>
|
||||
<h3>Device Information</h3>
|
||||
<p style="text-align: left">
|
||||
Hostname
|
||||
<span style="float: right">ESPMegaDemo0</span>
|
||||
</p>
|
||||
<p style="text-align: left">
|
||||
IP Address
|
||||
<span style="float: right">192.168.0.243</span>
|
||||
</p>
|
||||
<p style="text-align: left">
|
||||
MAC Address
|
||||
<span style="float: right">B0:A7:32:07:FC:B3</span>
|
||||
</p>
|
||||
<p style="text-align: left">
|
||||
Device
|
||||
<span style="float: right">ESPMega PRO R3.3b</span>
|
||||
</p>
|
||||
<p style="text-align: left">
|
||||
API Server
|
||||
<span style="float: right">192.168.0.26</span>
|
||||
</p>
|
||||
<p style="text-align: left">
|
||||
API Endpoint
|
||||
<span style="float: right">/facescan</span>
|
||||
</p>
|
||||
<p style="text-align: left">
|
||||
Centrally Managed
|
||||
<span style="float: right">Yes</span>
|
||||
</p>
|
||||
<button type="button" class="conf" onclick="window.location.href='config.html'">Settings</button><br /><br />
|
||||
<hr>
|
||||
<h3>Upload Software Package</h3>
|
||||
<input type="file" name="update" id="file" onchange="sub(this)" style="display: none" />
|
||||
<label id="file-input" for="file">Choose file...</label>
|
||||
<input type="submit" class="btn" value="Program" /><br /><br />
|
||||
<div id="prg"></div>
|
||||
<br />
|
||||
<div id="prgbar">
|
||||
<div id="bar"></div>
|
||||
</div>
|
||||
<br />
|
||||
<b>SIWAT SYSTEM 2023</b>
|
||||
</form>
|
||||
<script>
|
||||
function sub(obj) {
|
||||
var fileName = obj.value.split("\\");
|
||||
document.getElementById("file-input").innerHTML =
|
||||
" " + fileName[fileName.length - 1];
|
||||
}
|
||||
$("form").submit(function (e) {
|
||||
e.preventDefault();
|
||||
var form = $("#upload_form")[0];
|
||||
var data = new FormData(form);
|
||||
$.ajax({
|
||||
url: "/update",
|
||||
type: "POST",
|
||||
data: data,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
xhr: function () {
|
||||
var xhr = new window.XMLHttpRequest();
|
||||
xhr.upload.addEventListener(
|
||||
"progress",
|
||||
function (evt) {
|
||||
if (evt.lengthComputable) {
|
||||
var per = evt.loaded / evt.total;
|
||||
if (Math.round(per * 100) < 100) {
|
||||
$("#prg").html("Updating . . . (" + Math.round(per * 100) + "%)");
|
||||
}
|
||||
else {
|
||||
$("#prg").html("Update Completed, Rebooting . . .");
|
||||
}
|
||||
$("#bar").css("width", Math.round(per * 100) + "%");
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
return xhr;
|
||||
},
|
||||
success: function (d, s) {
|
||||
console.log("success!");
|
||||
},
|
||||
error: function (a, b, c) { },
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
hr {
|
||||
display: block;
|
||||
color: #aaaaaa;
|
||||
background-color: #aaaaaa;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
border-style: inset;
|
||||
border-width: 0px;
|
||||
height: 3px;
|
||||
}
|
||||
|
||||
#file-input,
|
||||
input {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
border-radius: 4px;
|
||||
margin: 10px auto;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
input {
|
||||
background: #f1f1f1;
|
||||
border: 0;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
body {
|
||||
background-image: url("https://fs.siwatsystem.com/arona_bg.png");
|
||||
background-size: cover;
|
||||
font-family: sans-serif;
|
||||
font-size: 14px;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
#file-input {
|
||||
background-color: #CCCCCC;
|
||||
color: #5E5E5E;
|
||||
padding: 0;
|
||||
border: 1px solid #ddd;
|
||||
line-height: 44px;
|
||||
text-align: center;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#bar,
|
||||
#prgbar {
|
||||
background-color: #D9D9D9;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#bar {
|
||||
background-color: #29CD1F;
|
||||
width: 0%;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
form {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
max-width: 258px;
|
||||
margin: 75px auto;
|
||||
padding: 30px;
|
||||
border-radius: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: #CA3D3D;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.conf {
|
||||
background: #417df3;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
border-radius: 4px;
|
||||
margin: 10px auto;
|
||||
font-size: 15px;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue