Skip to content

Commit

Permalink
Continue Bugfix #1
Browse files Browse the repository at this point in the history
Fix making the form script generation for multiple Dimmers.
  • Loading branch information
The009 committed Jan 18, 2020
1 parent 606715c commit ea1bee7
Showing 1 changed file with 47 additions and 18 deletions.
65 changes: 47 additions & 18 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,33 @@
<link rel="icon" type="image/png" href="vendor/icon/48px-System-shutdown.svg.png"/>
<!-- Java Script Load of JQuery -->
<script src="vendor/jquery/jquery.min.js"></script>

<?php
function displayDeviceList($csv){
?>
<!-- JavaScript for sending of data -->
<script type="text/javascript">
$( document ).ready(function() {
$("#dimmverValue{$i}").change(function() {
$.ajax({
url: 'send.php',
type: 'get',
data: $("#form{$i}").serialize(),
success: function(response){
console.log("Enable debug in send.php for response");
console.log( response );
}
});
});
});
<?php

foreach($csv as $i => $item) {
if($item['deviceType'] == "HS220"){
echo <<<EOD
$( document ).ready(function() {
$("#dimmverValue{$i}").change(function() {
$.ajax({
url: 'send.php',
type: 'get',
data: $("#form{$i}").serialize(),
success: function(response){
console.log("Enable debug in send.php for response");
console.log( response );
}
});
});
});
EOD;
}
}
?>
function SingleSend( givenIp, givenPort, reqAction, devTyp){
var ip = givenIp;
var port = givenPort;
Expand Down Expand Up @@ -97,9 +107,6 @@ function GroupSend( groupName, reqAction){

<!-- Page Features -->
<div class="row text-center my-3">
<?php
function displayDeviceList($csv){
?>
<div class='col-lg-3 col-md-6 mb-4'>
<div class='card'>
<div class='card-body'>
Expand Down Expand Up @@ -186,7 +193,29 @@ function displayDeviceList($csv){
if(!$devicesDisplayed){
$devicesDisplayed = true;
displayDeviceList(getDevices());
}
}else{
?>
</head>

<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="?">Smart Switch PHP Controller</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
</div>
</div>
</nav>

<!-- Page Content -->
<div class="container">


<?php
}
?>
</div>
<!-- /.row -->
Expand Down

0 comments on commit ea1bee7

Please sign in to comment.