<div class='row'>
        <div class='col-xs-12'>
            <div style="height:300px"
                id="chart-overview"
                data-chart="chart"
                data-nodename1="multisensor.an2val"
                data-datalabel1="Analog 2 Value"
                data-nodename2="multisensor.an3val"
                data-datalabel2="Analog 3 Value"
                <% if (channels["multisensor.an2ispond"].value === "true"){ %>
                    data-nodename3="multisensor.pond2volume"
                    data-datalabel3="Pond 2 Volume"
                <% } %>
                <% if (channels["multisensor.an3ispond"].value === "true"){ %>
                    data-nodename4="multisensor.pond3volume"
                    data-datalabel4="Pond 3 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 2</h2>
            <% if (channels["multisensor.an2ispond"].value === "true"){ %>
                <a href="#"
                    data-confirm-message="Are you sure you want to do this?"
                    data-refreshpause="1"
                    data-command=""
                    data-staticsend="{'tag': 'input2_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': 'input2_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-2">Min Value</label>
                    <input class="form-control setpoint"
                        id="min-scaling-2"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an2min"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input2_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.an2min"].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-2">Max Value</label>
                    <input class="form-control setpoint"
                        id="max-scaling-2"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an2max"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input2_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.an2max"].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-2">Name</label>
                    <input class="form-control setpoint"
                        id="name-2"
                        type="text"
                        value="<%= channels["multisensor.an2name"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an2name"].value %>"
                        data-channelId="<%= channels["multisensor.an2name"].channelId %>"
                        data-techname="<%=channels["multisensor.an2name"].techName %>"
                        data-name="<%= channels["multisensor.an2name"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an2name"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an2name"].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-2">Units</label>
                    <input class="form-control setpoint"
                        id="units-2"
                        type="text"
                        value="<%= channels["multisensor.an2units"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an2units"].value %>"
                        data-channelId="<%= channels["multisensor.an2units"].channelId %>"
                        data-techname="<%=channels["multisensor.an2units"].techName %>"
                        data-name="<%= channels["multisensor.an2units"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an2units"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an2units"].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 3</h2>
            <% if (channels["multisensor.an3ispond"].value === "true"){ %>
                <a href="#"
                    data-confirm-message="Are you sure you want to do this?"
                    data-refreshpause="1"
                    data-command=""
                    data-staticsend="{'tag': 'input3_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': 'input3_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-3">Min Value</label>
                    <input class="form-control setpoint"
                        id="min-scaling-3"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an3min"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input3_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.an3min"].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-3">Max Value</label>
                    <input class="form-control setpoint"
                        id="max-scaling-3"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an3max"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input3_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.an3max"].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-3">Name</label>
                    <input class="form-control setpoint"
                        id="name-3"
                        type="text"
                        value="<%= channels["multisensor.an3name"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an3name"].value %>"
                        data-channelId="<%= channels["multisensor.an3name"].channelId %>"
                        data-techname="<%=channels["multisensor.an3name"].techName %>"
                        data-name="<%= channels["multisensor.an3name"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an3name"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an3name"].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-3">Units</label>
                    <input class="form-control setpoint"
                        id="units-3"
                        type="text"
                        value="<%= channels["multisensor.an3units"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an3units"].value %>"
                        data-channelId="<%= channels["multisensor.an3units"].channelId %>"
                        data-techname="<%=channels["multisensor.an3units"].techName %>"
                        data-name="<%= channels["multisensor.an3units"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an3units"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an3units"].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.an2ispond"].value === "true") { %>
            <div class="col-xs-6">
                <h2>Pond 2 Calibration</h2>
                <table id="calibration-data-table-2" class="table">
                    <thead>
                        <tr>
                            <th>Level (Ft.)</th>
                            <th>Volume</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        <% } %>
    
        <% if (channels["multisensor.an3ispond"].value === "true") { %>
            <div class="col-xs-6">
                <h2>Pond 3 Calibration</h2>
                <table id="calibration-data-table-3" class="table">
                    <thead>
                        <tr>
                            <th>Level (Ft.)</th>
                            <th>Volume</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        <% } %>
    </div>
    
    <hr />
    
    <% if (channels["multisensor.an2ispond"].value === "true" || channels["multisensor.an3ispond"].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=2 >2</option>
                            <option value=3 >3</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 config2raw = "<%= channels["multisensor.pond2calibration"].value %>";
        var config3raw = "<%= channels["multisensor.pond3calibration"].value %>";
    
        var config2 = JSON.parse(config2raw.replaceAll("'", '"'));
        var config3 = JSON.parse(config3raw.replaceAll("'", '"'));
    
        var table2Rows = [];
        var table3Rows = [];
    
        for (var i = 0; i < config2.length; i++){
            var ptIndex = i + 1;
            var thisHtml = "<tr><td>" + config2[i].height + "</td><td>" + config2[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\': 2, \'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>';
            table2Rows.push(thisHtml);
        }
        $("#calibration-data-table-2 > tbody").html(table2Rows);
    
        for (var i = 0; i < config3.length; i++){
            var ptIndex = i + 1;
            var thisHtml = "<tr><td>" + config3[i].height + "</td><td>" + config3[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\': 3, \'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>';
            table3Rows.push(thisHtml);
        }
        $("#calibration-data-table-3 > tbody").html(table3Rows);
    
    
        $("#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-2").change(function(){
            $("#<%= channels["multisensor.an2min"].channelId %>").attr('data-staticsend', "{'tag': 'input2_cfg.scalingConfig.euMin', 'value': "+ $("#min-scaling-2").val() +"}");
        })
    
        $("#max-scaling-2").change(function(){
            $("#<%= channels["multisensor.an2max"].channelId %>").attr('data-staticsend', "{'tag': 'input2_cfg.scalingConfig.euMax', 'value': "+ $("#max-scaling-2").val() +"}");
        })
    
        $("#name-2").change(function(){
            $("#<%= channels["multisensor.an2name"].channelId %>").attr('data-staticsend', $("#name-2").val());
        })
    
        $("#units-2").change(function(){
            $("#<%= channels["multisensor.an2units"].channelId %>").attr('data-staticsend', $("#units-2").val());
        })
    
        $("#min-scaling-3").change(function(){
            $("#<%= channels["multisensor.an3min"].channelId %>").attr('data-staticsend', "{'tag': 'input3_cfg.scalingConfig.euMin', 'value': "+ $("#min-scaling-3").val() +"}");
        })
    
        $("#max-scaling-3").change(function(){
            $("#<%= channels["multisensor.an3max"].channelId %>").attr('data-staticsend', "{'tag': 'input3_cfg.scalingConfig.euMax', 'value': "+ $("#max-scaling-3").val() +"}");
        })
    
        $("#name-3").change(function(){
            $("#<%= channels["multisensor.an3name"].channelId %>").attr('data-staticsend', $("#name-3").val());
        })
    
        $("#units-3").change(function(){
            $("#<%= channels["multisensor.an3units"].channelId %>").attr('data-staticsend', $("#units-3").val());
        })
    
    </script>
    
    
    
    <style>
    
    .align-center {
        text-align: center;
    }
    </style>
        