Added date picker and time setup input boxes

Added two start and stop timers - No code attached - Simply UI at this stage
This commit is contained in:
Jimmy C 2018-12-23 02:27:17 +11:00
parent 5d2f42acba
commit d378d902ac

View file

@ -25,13 +25,13 @@
const char* MAIN_PAGE PROGMEM = R"=====( const char* MAIN_PAGE PROGMEM = R"=====(
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<link rel="icon" href="data;,"> <link rel="icon" href="data;,">
<script> <script>
var Socket; var Socket;
function init() { function init() {
Socket = new WebSocket('ws://' + window.location.hostname + ':81/'); Socket = new WebSocket('ws://' + window.location.hostname + ':81/');
Socket.onmessage = function(event){ Socket.onmessage = function(event){
@ -106,12 +106,19 @@ const char* MAIN_PAGE PROGMEM = R"=====(
} }
} }
} }
} }
function setSchedule(){ function setSchedule(){
//clearly need to add some code here to send the Json formatted data to the esp //clearly need to add some code here to send the Json formatted data to the esp
console.log("Set Schedule Button Press") console.log("Set Schedule Button Press")
} }
Date.prototype.toDateInputValue = (function() {
var local = new Date(this);
local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
return local.toJSON().slice(0,10);
});
function sendJSONobject(obj){ function sendJSONobject(obj){
var str = JSON.stringify(obj); var str = JSON.stringify(obj);
console.log("JSON Tx:", str); console.log("JSON Tx:", str);
@ -151,11 +158,11 @@ function funcNavLinks() {
function checkTime(i) function checkTime(i)
{ {
if (i<10) if (i<10)
{ {
i="0" + i; i="0" + i;
} }
return i; return i;
} }
function funcdispSettings() { function funcdispSettings() {
@ -177,6 +184,9 @@ function funcdispSettings() {
document.getElementById("Home").style.display = "none"; document.getElementById("Home").style.display = "none";
document.getElementById("Advanced").style.display = "none"; document.getElementById("Advanced").style.display = "none";
document.getElementById("myLinks").style.display ="none"; document.getElementById("myLinks").style.display ="none";
document.getElementById('curdate').valueAsDate = new Date();
} }
function funcdispHome(){ function funcdispHome(){
@ -225,7 +235,7 @@ function OnOffCheck(){
} }
function onSlide(newVal, JSONKey) { function onSlide(newVal, JSONKey) {
//elementid must equal the JSON name for each setting //elementid must equal the JSON name for each setting
document.getElementById(JSONKey).innerHTML = newVal; document.getElementById(JSONKey).innerHTML = newVal;
@ -239,191 +249,191 @@ function onSlide(newVal, JSONKey) {
</script> </script>
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1"> <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1">
<style> <style>
.throb_me { .throb_me {
animation: throbber 1s linear infinite; animation: throbber 1s linear infinite;
} }
@keyframes throbber { @keyframes throbber {
50% { 50% {
opacity: 0; opacity: 0;
} }
} }
.slider { .slider {
position: absolute; position: absolute;
cursor: pointer; cursor: pointer;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: #ccc; background-color: #ccc;
-webkit-transition: .4s; -webkit-transition: .4s;
transition: .4s; transition: .4s;
} }
.slider:before { .slider:before {
position: absolute; position: absolute;
content: ""; content: "";
height: 26px; height: 26px;
width: 26px; width: 26px;
left: 4px; left: 4px;
bottom: 4px; bottom: 4px;
background-color: white; background-color: white;
-webkit-transition: .4s; -webkit-transition: .4s;
transition: .4s; transition: .4s;
} }
body { body {
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
} }
.onoffswitch { .onoffswitch {
position: relative; width: 90px; position: relative; width: 90px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
} }
.onoffswitch-checkbox { .onoffswitch-checkbox {
display: none; display: none;
} }
.onoffswitch-label { .onoffswitch-label {
display: block; overflow: hidden; cursor: pointer; display: block; overflow: hidden; cursor: pointer;
border: 2px solid #999999; border-radius: 20px; border: 2px solid #999999; border-radius: 20px;
} }
.onoffswitch-inner { .onoffswitch-inner {
display: block; width: 200%; margin-left: -100%; display: block; width: 200%; margin-left: -100%;
transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s;
} }
.onoffswitch-inner:before, .onoffswitch-inner:after { .onoffswitch-inner:before, .onoffswitch-inner:after {
display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px; display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px;
font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold; font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
box-sizing: border-box; box-sizing: border-box;
} }
.onoffswitch-inner:before { .onoffswitch-inner:before {
content: "ON"; content: "ON";
padding-left: 10px; padding-left: 10px;
background-color: #34A7C1; color: #FFFFFF; background-color: #34A7C1; color: #FFFFFF;
} }
.onoffswitch-inner:after { .onoffswitch-inner:after {
content: "OFF"; content: "OFF";
padding-right: 10px; padding-right: 10px;
background-color: #EEEEEE; color: #999999; background-color: #EEEEEE; color: #999999;
text-align: right; text-align: right;
} }
.onoffswitch-switch { .onoffswitch-switch {
display: block; width: 18px; margin: 6px; display: block; width: 18px; margin: 6px;
background: #FFFFFF; background: #FFFFFF;
position: absolute; top: 0; bottom: 0; position: absolute; top: 0; bottom: 0;
right: 56px; right: 56px;
border: 2px solid #999999; border-radius: 20px; border: 2px solid #999999; border-radius: 20px;
transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s;
} }
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner { .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0; margin-left: 0;
} }
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch { .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px; right: 0px;
} }
.mobile-container { .mobile-container {
margin: auto; margin: auto;
background-color: #555; background-color: #555;
height: 500px; height: 500px;
color: white; color: white;
border-radius: 10px; border-radius: 10px;
} }
.topnav { .topnav {
overflow: hidden; overflow: hidden;
background-color: #333; background-color: #333;
position: relative; position: relative;
} }
.topnav #myLinks { .topnav #myLinks {
display: none; display: none;
} }
.topnav a { .topnav a {
color: white; color: white;
padding: 14px 16px; padding: 14px 16px;
text-decoration: none; text-decoration: none;
font-size: 17px; font-size: 17px;
display: block; display: block;
} }
.topnav a.icon { .topnav a.icon {
background: black; background: black;
display: block; display: block;
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
} }
.topnav a:hover { .topnav a:hover {
background-color: #ddd; background-color: #ddd;
color: black; color: black;
} }
.active0 { .active0 {
background-color: #40ffff; background-color: #40ffff;
color: #000000; color: #000000;
} }
.active21 { .active21 {
background-color: #5f9ea0; background-color: #5f9ea0;
color: #ffffff; color: #ffffff;
} }
.active41 { .active41 {
background-color: #4CAF50; background-color: #4CAF50;
color: #ffffff; color: #ffffff;
} }
.active61 { .active61 {
background-color: #eeee00; background-color: #eeee00;
color: #000000; color: #000000;
} }
.active81 { .active81 {
background-color: #8b0000; background-color: #8b0000;
color: #ffffff; color: #ffffff;
} }
.active101 { .active101 {
background-color: #cd0000; background-color: #cd0000;
color: #ffffff; color: #ffffff;
} }
.active121 { .active121 {
background-color: #ff0000; background-color: #ff0000;
color: #ffffff; color: #ffffff;
} }
input:checked + .slider { input:checked + .slider {
background-color: #2196F3; background-color: #2196F3;
} }
input:focus + .slider { input:focus + .slider {
box-shadow: 0 0 1px #2196F3; box-shadow: 0 0 1px #2196F3;
} }
input:checked + .slider:before { input:checked + .slider:before {
-webkit-transform: translateX(26px); -webkit-transform: translateX(26px);
-ms-transform: translateX(26px); -ms-transform: translateX(26px);
transform: translateX(26px); transform: translateX(26px);
} }
.slider.round { .slider.round {
border-radius: 34px; border-radius: 34px;
} }
.slider.round:before { .slider.round:before {
border-radius: 50%; border-radius: 50%;
} }
MainPage { MainPage {
display: block display: block
} }
#Advanced { #Advanced {
display: none display: none
} }
#Settings { #Settings {
display: none display: none
} }
} }
@ -437,26 +447,26 @@ MainPage {
<!-- Top Navigation Menu --> <!-- Top Navigation Menu -->
<div class="topnav"> <div class="topnav">
<div id="TopBar" style="padding-left:30px"><a href="javascript:void(0);" onclick="funcdispHome()" >Chinese Diesel Heater Web Control</a></div> <div id="TopBar" style="padding-left:30px"><a href="javascript:void(0);" onclick="funcdispHome()" >Chinese Diesel Heater Web Control</a></div>
<div id="myLinks"> <div id="myLinks">
<a href="javascript:void(0);" onclick="funcdispHome()">Home</a> <a href="javascript:void(0);" onclick="funcdispHome()">Home</a>
<a href="javascript:void(0);" onclick="funcdispSettings()">Settings</a> <a href="javascript:void(0);" onclick="funcdispSettings()">Settings</a>
<a href="javascript:void(0);" onclick="funcdispAdvanced()">Advanced Settings</a> <a href="javascript:void(0);" onclick="funcdispAdvanced()">Advanced Settings</a>
</div> </div>
<a href="javascript:void(0);" class="icon" onclick="funcNavLinks()"> <a href="javascript:void(0);" class="icon" onclick="funcNavLinks()">
</i>= </i>=
</a> </a>
</div> </div>
<div style="padding-left:16px"> <div style="padding-left:16px">
<span class="MaingPage" id="Home"> <span class="MaingPage" id="Home">
<div><H2>Power Control</H2></div> <div><H2>Power Control</H2></div>
<div class="onoffswitch" id="onoffswitch"> <div class="onoffswitch" id="onoffswitch">
<input type="checkbox" onclick="OnOffCheck()" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" clicked> <input type="checkbox" onclick="OnOffCheck()" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" clicked>
<label class="onoffswitch-label" for="myonoffswitch"> <label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span> <span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span> <span class="onoffswitch-switch"></span>
</label> </label>
</div> </div>
<span class="throb_me" id="RunString" style="visibility:hidden"></span> <span class="throb_me" id="RunString" style="visibility:hidden"></span>
@ -500,22 +510,17 @@ Advanced Settings
<Div id="Settings"> <Div id="Settings">
Current Date:<br> Current Date:<br>
<input type="text" id="curdate"><input type="button" Value="Set Date" onclick="setcurrentdate()"> <input type="date" id="curdate"><input type="button" Value="Set Date" onclick="setcurrentdate()">
<br> <br>
Current Time (24 Hour Format):<br> Current Time (24 Hour Format):<br>
<input type="text" id="curtime"> <input type="button" Value="Set Time" onclick="setcurrenttime()"> <input type="time" id="curtime"> <input type="button" Value="Set Time" onclick="setcurrenttime()">
<hr></hr> <hr></hr>
<br><br> <br><br>
Mon:<input type="checkbox" border-radius="4px" name="Mon" value="Mon"> <input type="text" class="schedule" id="Mon"> <input type="text" id="curtime"> <br> Timer1: <input type="checkbox" border-radius="4px" name="Timer1" id="Timer1onoff"> <input type="text" class="schedule" id="Timer1Start"> <input type="text" id="Timer1End"> <br>
Tue:<input type="checkbox" border-radius="4px" name="Tue" value="Tue"> <input type="text" class="schedule" id="Tue"> <input type="text" id="curtime"><br> Timer2: <input type="checkbox" border-radius="4px" name="Tue"> <input type="text" class="schedule" id="Timer2Start"> <input type="text" id="Timer2End"><br>
Wed:<input type="checkbox" border-radius="4px" name="Wed" value="Wed"> <input type="text" class="schedule" id="Wed"> <input type="text" id="curtime"><br>
Thu:<input type="checkbox" border-radius="4px" name="Thu" value="Thu"> <input type="text" class="schedule" id="Thu" <input type="text" id="curtime"><br>
Fri:<input type="checkbox" border-radius="4px" name="Fri" value="Fri"> <input type="text" class="schedule" id="Fri"> <input type="text" id="curtime"><br>
Sat:<input type="checkbox" border-radius="4px" name="Sat" value="Sat"> <input type="text" class="schedule" id="Sat"> <input type="text" id="curtime"><br>
Sun:<input type="checkbox" border-radius="4px" name="Sun" value="Sun"> <input type="text" class="schedule" id="Sun"> <input type="text" id="curtime"><br>
<input type="button" Value="Save Schedule" onclick="setSchedule()"> <input type="button" Value="Save Schedule" onclick="setSchedule()">
</Div> </Div>
</body> </body>