<div class='row'>
        <div class='col-xs-12'>
            <div style="height:300px"
                id="chart-overview"
                data-chart="chart"
                data-nodename1="multisensor.an4val"
                data-datalabel1="Analog 4 Value"
                data-nodename2="multisensor.an5val"
                data-datalabel2="Analog 5 Value"
                <% if (channels["multisensor.an4ispond"].value === "true"){ %>
                    data-nodename3="multisensor.pond4volume"
                    data-datalabel3="Pond 4 Volume"
                <% } %>
                <% if (channels["multisensor.an5ispond"].value === "true"){ %>
                    data-nodename4="multisensor.pond5volume"
                    data-datalabel4="Pond 5 Volume"
                <% } %>
    
                data-daysofhistory="2"
                data-chartlabel="Last 48 Hours"
                data-ylabel=""
                data-xlabel="Date"
                data-units="">
            </div>
        </div>
    </div>
    
    
    <div class="row" style="margin-bottom: 10px">
        <div class="col-md-6 align-center">
            <h2>Input 4</h2>
            <% if (channels["multisensor.an4ispond"].value === "true"){ %>
                <a href="#"
                    data-confirm-message="Are you sure you want to do this?"
                    data-refreshpause="1"
                    data-command=""
                    data-staticsend="{'tag': 'input4_cfg.isPondLevel', 'value': 0}"
                    data-channelId="<%= channels["multisensor.writeplctag"].channelId %>"
                    data-techname="<%=channels["multisensor.writeplctag"].techName %>"
                    data-name="<%= channels["multisensor.writeplctag"].name%>"
                    data-nodechannelcurrentId="<%= channels["multisensor.writeplctag"].nodechannelcurrentId %>"
                    id="<%= channels["multisensor.writeplctag"].channelId %>"
                    class="btn btn-large btn-danger animated setstatic">Disable Pond Volume</a>
            <% } else { %>
    
                <a href="#"
                    data-confirm-message="Are you sure you want to do this?"
                    data-refreshpause="1"
                    data-command=""
                    data-staticsend="{'tag': 'input4_cfg.isPondLevel', 'value': 1}"
                    data-channelId="<%= channels["multisensor.writeplctag"].channelId %>"
                    data-techname="<%=channels["multisensor.writeplctag"].techName %>"
                    data-name="<%= channels["multisensor.writeplctag"].name%>"
                    data-nodechannelcurrentId="<%= channels["multisensor.writeplctag"].nodechannelcurrentId %>"
                    id="<%= channels["multisensor.writeplctag"].channelId %>"
                    class="btn btn-large btn-success animated setstatic">Enable Pond Volume</a>
            <% } %>
    
            <hr style="margin-top: 10px; margin-bottom:10px;" />
            <h2>Scaling</h2>
    
            <form class="form-inline">
                <div class="form-group">
                    <label for="min-scaling-4">Min Value</label>
                    <input class="form-control setpoint"
                        id="min-scaling-4"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an4min"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input4_cfg.scalingConfig.euMin', 'value': 4.0}"
                        data-channelId="<%= channels["multisensor.writeplctag"].channelId %>"
                        data-techname="<%=channels["multisensor.writeplctag"].techName %>"
                        data-name="<%= channels["multisensor.writeplctag"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.writeplctag"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an4min"].channelId %>"
                        class="btn btn-large btn-theme animated setstatic material-icons">send</a>
                </div>
            </form>
    
            <form class="form-inline">
                <div class="form-group">
                    <label for="max-scaling-4">Max Value</label>
                    <input class="form-control setpoint"
                        id="max-scaling-4"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an4max"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input4_cfg.scalingConfig.euMax', 'value': 20.0}"
                        data-channelId="<%= channels["multisensor.writeplctag"].channelId %>"
                        data-techname="<%=channels["multisensor.writeplctag"].techName %>"
                        data-name="<%= channels["multisensor.writeplctag"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.writeplctag"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an4max"].channelId %>"
                        class="btn btn-large btn-theme animated setstatic material-icons">send</a>
                </div>
            </form>
    
            <hr style="margin-top: 10px; margin-bottom:10px;" />
    
            <form class="form-inline">
                <div class="form-group">
                    <label for="name-4">Name</label>
                    <input class="form-control setpoint"
                        id="name-4"
                        type="text"
                        value="<%= channels["multisensor.an4name"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an4name"].value %>"
                        data-channelId="<%= channels["multisensor.an4name"].channelId %>"
                        data-techname="<%=channels["multisensor.an4name"].techName %>"
                        data-name="<%= channels["multisensor.an4name"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an4name"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an4name"].channelId %>"
                        class="btn btn-large btn-theme animated setstatic material-icons">send</a>
                </div>
            </form>
    
            <hr style="margin-top: 10px; margin-bottom:10px;" />
    
            <form class="form-inline">
                <div class="form-group">
                    <label for="units-4">Units</label>
                    <input class="form-control setpoint"
                        id="units-4"
                        type="text"
                        value="<%= channels["multisensor.an4units"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an4units"].value %>"
                        data-channelId="<%= channels["multisensor.an4units"].channelId %>"
                        data-techname="<%=channels["multisensor.an4units"].techName %>"
                        data-name="<%= channels["multisensor.an4units"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an4units"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an4units"].channelId %>"
                        class="btn btn-large btn-theme animated setstatic material-icons">send</a>
                </div>
            </form>
    
        </div>
    
        <div class="col-md-6 align-center">
            <h2>Input 5</h2>
            <% if (channels["multisensor.an5ispond"].value === "true"){ %>
                <a href="#"
                    data-confirm-message="Are you sure you want to do this?"
                    data-refreshpause="1"
                    data-command=""
                    data-staticsend="{'tag': 'input5_cfg.isPondLevel', 'value': 0}"
                    data-channelId="<%= channels["multisensor.writeplctag"].channelId %>"
                    data-techname="<%=channels["multisensor.writeplctag"].techName %>"
                    data-name="<%= channels["multisensor.writeplctag"].name%>"
                    data-nodechannelcurrentId="<%= channels["multisensor.writeplctag"].nodechannelcurrentId %>"
                    id="<%= channels["multisensor.writeplctag"].channelId %>"
                    class="btn btn-large btn-danger animated setstatic">Disable Pond Volume</a>
            <% } else { %>
    
                <a href="#"
                    data-confirm-message="Are you sure you want to do this?"
                    data-refreshpause="1"
                    data-command=""
                    data-staticsend="{'tag': 'input5_cfg.isPondLevel', 'value': 1}"
                    data-channelId="<%= channels["multisensor.writeplctag"].channelId %>"
                    data-techname="<%=channels["multisensor.writeplctag"].techName %>"
                    data-name="<%= channels["multisensor.writeplctag"].name%>"
                    data-nodechannelcurrentId="<%= channels["multisensor.writeplctag"].nodechannelcurrentId %>"
                    id="<%= channels["multisensor.writeplctag"].channelId %>"
                    class="btn btn-large btn-success animated setstatic">Enable Pond Volume</a>
            <% } %>
    
            <hr style="margin-top: 10px; margin-bottom:10px;" />
            <h2>Scaling</h2>
    
            <form class="form-inline">
                <div class="form-group">
                    <label for="min-scaling-5">Min Value</label>
                    <input class="form-control setpoint"
                        id="min-scaling-5"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an5min"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input5_cfg.scalingConfig.euMin', 'value': 4.0}"
                        data-channelId="<%= channels["multisensor.writeplctag"].channelId %>"
                        data-techname="<%=channels["multisensor.writeplctag"].techName %>"
                        data-name="<%= channels["multisensor.writeplctag"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.writeplctag"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an5min"].channelId %>"
                        class="btn btn-large btn-theme animated setstatic material-icons">send</a>
                </div>
            </form>
    
            <form class="form-inline">
                <div class="form-group">
                    <label for="max-scaling-5">Max Value</label>
                    <input class="form-control setpoint"
                        id="max-scaling-5"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an5max"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input5_cfg.scalingConfig.euMax', 'value': 20.0}"
                        data-channelId="<%= channels["multisensor.writeplctag"].channelId %>"
                        data-techname="<%=channels["multisensor.writeplctag"].techName %>"
                        data-name="<%= channels["multisensor.writeplctag"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.writeplctag"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an5max"].channelId %>"
                        class="btn btn-large btn-theme animated setstatic material-icons">send</a>
                </div>
            </form>
    
            <hr style="margin-top: 10px; margin-bottom:10px;" />
    
            <form class="form-inline">
                <div class="form-group">
                    <label for="name-5">Name</label>
                    <input class="form-control setpoint"
                        id="name-5"
                        type="text"
                        value="<%= channels["multisensor.an5name"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an5name"].value %>"
                        data-channelId="<%= channels["multisensor.an5name"].channelId %>"
                        data-techname="<%=channels["multisensor.an5name"].techName %>"
                        data-name="<%= channels["multisensor.an5name"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an5name"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an5name"].channelId %>"
                        class="btn btn-large btn-theme animated setstatic material-icons">send</a>
                </div>
            </form>
    
            <hr style="margin-top: 10px; margin-bottom:10px;" />
    
            <form class="form-inline">
                <div class="form-group">
                    <label for="units-5">Units</label>
                    <input class="form-control setpoint"
                        id="units-5"
                        type="text"
                        value="<%= channels["multisensor.an5units"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an5units"].value %>"
                        data-channelId="<%= channels["multisensor.an5units"].channelId %>"
                        data-techname="<%=channels["multisensor.an5units"].techName %>"
                        data-name="<%= channels["multisensor.an5units"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an5units"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an5units"].channelId %>"
                        class="btn btn-large btn-theme animated setstatic material-icons">send</a>
                </div>
            </form>
        </div>
    </div>
    
    <hr />
        
    <div class="row row-flex">
        <% if (channels["multisensor.an4ispond"].value === "true") { %>
            <div class="col-xs-6">
                <h2>Pond 4 Calibration</h2>
                <table id="calibration-data-table-4" class="table">
                    <thead>
                        <tr>
                            <th>Level (Ft.)</th>
                            <th>Volume</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        <% } %>
    
        <% if (channels["multisensor.an5ispond"].value === "true") { %>
            <div class="col-xs-6">
                <h2>Pond 5 Calibration</h2>
                <table id="calibration-data-table-5" class="table">
                    <thead>
                        <tr>
                            <th>Level (Ft.)</th>
                            <th>Volume</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        <% } %>
    </div>
    
    <hr />
    
    <% if (channels["multisensor.an4ispond"].value === "true" || channels["multisensor.an5ispond"].value === "true") { %>
        <div class="row pad15">
            <div class="col-md-12 entry-top-level" id="new-entry">
                <h2>Add a new Calibration Point</h2>
                <form>
                    <div class="form-group">
                        <label for="input-select">Pond Number</label>
                        <select class="form-control" id="input-select">
                            <option value=4 >4</option>
                            <option value=5 >5</option>
                        </select>
                    </div>
                    <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="{'input':0, 'height':0.0, 'volume':0.0}"
                    data-channelId="<%= channels["multisensor.addcalibrationpoint"].channelId %>"
                    data-techname="<%=channels["multisensor.addcalibrationpoint"].techName %>"
                    data-name="<%= channels["multisensor.addcalibrationpoint"].name%>"
                    data-nodechannelcurrentId="<%= channels["multisensor.addcalibrationpoint"].nodechannelcurrentId %>"
                    id="<%= channels["multisensor.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 config4raw = "<%= channels["multisensor.pond4calibration"].value %>";
        var config5raw = "<%= channels["multisensor.pond5calibration"].value %>";
    
        var config4 = JSON.parse(config4raw.replaceAll("'", '"'));
        var config5 = JSON.parse(config5raw.replaceAll("'", '"'));
    
        var table4Rows = [];
        var table5Rows = [];
    
        for (var i = 0; i < config4.length; i++){
            var ptIndex = i + 1;
            var thisHtml = "<tr><td>" + config4[i].height + "</td><td>" + config4[i].volume + '</td><td><a href="#" data-confirm-message="Are you sure you want to do this?" data-refreshpause="1" data-command="" data-staticsend="{\'input\': 4, \'point\': '+ ptIndex +'}" data-channelId="<%= channels["multisensor.deletecalibrationpoint"].channelId %>" data-techname="<%=channels["multisensor.deletecalibrationpoint"].techName %>" data-name="<%= channels["multisensor.deletecalibrationpoint"].name%>" data-nodechannelcurrentId="<%= channels["multisensor.deletecalibrationpoint"].nodechannelcurrentId %>" id="<%= channels["multisensor.deletecalibrationpoint"].channelId %>" class="btn btn-large btn-theme animated setstatic">Delete</a></tr>';
            table4Rows.push(thisHtml);
        }
        $("#calibration-data-table-4 > tbody").html(table4Rows);
    
        for (var i = 0; i < config5.length; i++){
            var ptIndex = i + 1;
            var thisHtml = "<tr><td>" + config5[i].height + "</td><td>" + config5[i].volume + '</td><td><a href="#" data-confirm-message="Are you sure you want to do this?" data-refreshpause="1" data-command="" data-staticsend="{\'input\': 5, \'point\': '+ ptIndex +'}" data-channelId="<%= channels["multisensor.deletecalibrationpoint"].channelId %>" data-techname="<%=channels["multisensor.deletecalibrationpoint"].techName %>" data-name="<%= channels["multisensor.deletecalibrationpoint"].name%>" data-nodechannelcurrentId="<%= channels["multisensor.deletecalibrationpoint"].nodechannelcurrentId %>" id="<%= channels["multisensor.deletecalibrationpoint"].channelId %>" class="btn btn-large btn-theme animated setstatic">Delete</a></tr>';
            table5Rows.push(thisHtml);
        }
        $("#calibration-data-table-5 > tbody").html(table5Rows);
    
    
        $("#height-box").change(function(){
            var currentNewPoint = JSON.parse($("#<%= channels["multisensor.addcalibrationpoint"].channelId %>").attr('data-staticsend').replaceAll("'", '"'));
            currentNewPoint['height'] = $("#height-box").val();
            $("#<%= channels["multisensor.addcalibrationpoint"].channelId %>").attr('data-staticsend', JSON.stringify(currentNewPoint).replaceAll('"', "'"));
        })
    
        $("#volume-box").change(function(){
            var currentNewPoint = JSON.parse($("#<%= channels["multisensor.addcalibrationpoint"].channelId %>").attr('data-staticsend').replaceAll("'", '"'));
            currentNewPoint['volume'] = $("#volume-box").val();
            $("#<%= channels["multisensor.addcalibrationpoint"].channelId %>").attr('data-staticsend', JSON.stringify(currentNewPoint).replaceAll('"', "'"));
        })
    
        $("#input-select").change(function(){
            var currentNewPoint = JSON.parse($("#<%= channels["multisensor.addcalibrationpoint"].channelId %>").attr('data-staticsend').replaceAll("'", '"'));
            currentNewPoint['input'] = $("#input-select").val();
            $("#<%= channels["multisensor.addcalibrationpoint"].channelId %>").attr('data-staticsend', JSON.stringify(currentNewPoint).replaceAll('"', "'"));
        })
    
        $("#min-scaling-4").change(function(){
            $("#<%= channels["multisensor.an4min"].channelId %>").attr('data-staticsend', "{'tag': 'input4_cfg.scalingConfig.euMin', 'value': "+ $("#min-scaling-4").val() +"}");
        })
    
        $("#max-scaling-4").change(function(){
            $("#<%= channels["multisensor.an4max"].channelId %>").attr('data-staticsend', "{'tag': 'input4_cfg.scalingConfig.euMax', 'value': "+ $("#max-scaling-4").val() +"}");
        })
    
        $("#name-4").change(function(){
            $("#<%= channels["multisensor.an4name"].channelId %>").attr('data-staticsend', $("#name-4").val());
        })
    
        $("#units-4").change(function(){
            $("#<%= channels["multisensor.an4units"].channelId %>").attr('data-staticsend', $("#units-4").val());
        })
    
        $("#min-scaling-5").change(function(){
            $("#<%= channels["multisensor.an5min"].channelId %>").attr('data-staticsend', "{'tag': 'input5_cfg.scalingConfig.euMin', 'value': "+ $("#min-scaling-5").val() +"}");
        })
    
        $("#max-scaling-5").change(function(){
            $("#<%= channels["multisensor.an5max"].channelId %>").attr('data-staticsend', "{'tag': 'input5_cfg.scalingConfig.euMax', 'value': "+ $("#max-scaling-5").val() +"}");
        })
    
        $("#name-5").change(function(){
            $("#<%= channels["multisensor.an5name"].channelId %>").attr('data-staticsend', $("#name-5").val());
        })
    
        $("#units-5").change(function(){
            $("#<%= channels["multisensor.an5units"].channelId %>").attr('data-staticsend', $("#units-5").val());
        })
    
    </script>
    
    
    
    <style>
    
    .align-center {
        text-align: center;
    }
    </style>
        