75 lines
3.6 KiB
HTML
75 lines
3.6 KiB
HTML
<table id="calibration-data-table" class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Level (Ft.)</th>
|
|
<th>Volume</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="row pad15">
|
|
<div class="col-md-12 entry-top-level" id="new-entry">
|
|
<h2>Add a new Calibration Point</h2>
|
|
<form class="form-inline">
|
|
<div class="form-group">
|
|
<label for="height-box">Height</label>
|
|
<input class="form-control height_box"
|
|
id="height-box"
|
|
type="number"
|
|
step="any"
|
|
value="0">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="volume-box">Volume</label>
|
|
<input class="form-control volume_box"
|
|
id="volume-box"
|
|
type="number"
|
|
step="any"
|
|
value="0">
|
|
</div>
|
|
|
|
<a href="#"
|
|
data-confirm-message="Are you sure you want to do this?"
|
|
data-refreshpause="1"
|
|
data-command=""
|
|
data-staticsend="{'height':0.0, 'volume':0.0}"
|
|
data-channelId="<%= channels["pondlevel.addcalibrationpoint"].channelId %>"
|
|
data-techname="<%=channels["pondlevel.addcalibrationpoint"].techName %>"
|
|
data-name="<%= channels["pondlevel.addcalibrationpoint"].name%>"
|
|
data-nodechannelcurrentId="<%= channels["pondlevel.addcalibrationpoint"].nodechannelcurrentId %>"
|
|
id="<%= channels["pondlevel.addcalibrationpoint"].channelId %>"
|
|
class="btn btn-large btn-theme animated setstatic material-icons">send</a>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
String.prototype.replaceAll = function(search, replacement) {
|
|
var target = this;
|
|
return target.replace(new RegExp(search, 'g'), replacement);
|
|
};
|
|
|
|
var configData = JSON.parse("<%= channels['pondlevel.calibration_data'].value %>");
|
|
var tableRows = [];
|
|
for (var i = 0; i < configData.length; i++){
|
|
var thisHtml = "<tr><td>" + configData[i][0] + "</td><td>" + configData[i][1] + '</td><td><a href="#" data-confirm-message="Are you sure you want to do this?" data-refreshpause="1" data-command="" data-staticsend=' + configData[i][0] + ' data-channelId="<%= channels["pondlevel.deletecalibrationpoint"].channelId %>" data-techname="<%=channels["pondlevel.deletecalibrationpoint"].techName %>" data-name="<%= channels["pondlevel.deletecalibrationpoint"].name%>" data-nodechannelcurrentId="<%= channels["pondlevel.deletecalibrationpoint"].nodechannelcurrentId %>" id="<%= channels["pondlevel.deletecalibrationpoint"].channelId %>" class="btn btn-large btn-theme animated setstatic">Delete</a></tr>';
|
|
tableRows.push(thisHtml);
|
|
}
|
|
$("#calibration-data-table > tbody").html(tableRows);
|
|
|
|
$("#height-box").change(function(){
|
|
var currentNewPoint = JSON.parse($("#<%= channels["pondlevel.addcalibrationpoint"].channelId %>").attr('data-staticsend').replaceAll("'", '"'));
|
|
currentNewPoint['height'] = $("#height-box").val();
|
|
$("#<%= channels["pondlevel.addcalibrationpoint"].channelId %>").attr('data-staticsend', JSON.stringify(currentNewPoint).replaceAll('"', "'"));
|
|
})
|
|
|
|
$("#volume-box").change(function(){
|
|
var currentNewPoint = JSON.parse($("#<%= channels["pondlevel.addcalibrationpoint"].channelId %>").attr('data-staticsend').replaceAll("'", '"'));
|
|
currentNewPoint['volume'] = $("#volume-box").val();
|
|
$("#<%= channels["pondlevel.addcalibrationpoint"].channelId %>").attr('data-staticsend', JSON.stringify(currentNewPoint).replaceAll('"', "'"));
|
|
})
|
|
</script>
|