<div class='row'>
        <div class='col-xs-12'>
            <div style="height:300px"
                id="chart-overview"
                data-chart="chart"
                data-nodename1="multisensor.an6val"
                data-datalabel1="Analog 6 Value"
                data-nodename2="multisensor.an7val"
                data-datalabel2="Analog 7 Value"
                <% if (channels["multisensor.an6ispond"].value === "true"){ %>
                    data-nodename3="multisensor.pond6volume"
                    data-datalabel3="Pond 6 Volume"
                <% } %>
                <% if (channels["multisensor.an7ispond"].value === "true"){ %>
                    data-nodename4="multisensor.pond7volume"
                    data-datalabel4="Pond 7 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 6</h2>
            <% if (channels["multisensor.an6ispond"].value === "true"){ %>
                <a href="#"
                    data-confirm-message="Are you sure you want to do this?"
                    data-refreshpause="1"
                    data-command=""
                    data-staticsend="{'tag': 'input6_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': 'input6_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-6">Min Value</label>
                    <input class="form-control setpoint"
                        id="min-scaling-6"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an6min"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input6_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.an6min"].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-6">Max Value</label>
                    <input class="form-control setpoint"
                        id="max-scaling-6"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an6max"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input6_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.an6max"].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-6">Name</label>
                    <input class="form-control setpoint"
                        id="name-6"
                        type="text"
                        value="<%= channels["multisensor.an6name"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an6name"].value %>"
                        data-channelId="<%= channels["multisensor.an6name"].channelId %>"
                        data-techname="<%=channels["multisensor.an6name"].techName %>"
                        data-name="<%= channels["multisensor.an6name"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an6name"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an6name"].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-6">Units</label>
                    <input class="form-control setpoint"
                        id="units-6"
                        type="text"
                        value="<%= channels["multisensor.an6units"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an6units"].value %>"
                        data-channelId="<%= channels["multisensor.an6units"].channelId %>"
                        data-techname="<%=channels["multisensor.an6units"].techName %>"
                        data-name="<%= channels["multisensor.an6units"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an6units"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an6units"].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 7</h2>
            <% if (channels["multisensor.an7ispond"].value === "true"){ %>
                <a href="#"
                    data-confirm-message="Are you sure you want to do this?"
                    data-refreshpause="1"
                    data-command=""
                    data-staticsend="{'tag': 'input7_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': 'input7_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-7">Min Value</label>
                    <input class="form-control setpoint"
                        id="min-scaling-7"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an7min"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input7_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.an7min"].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-7">Max Value</label>
                    <input class="form-control setpoint"
                        id="max-scaling-7"
                        type="number"
                        step="0.1"
                        value="<%= channels["multisensor.an7max"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="{'tag': 'input7_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.an7max"].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-7">Name</label>
                    <input class="form-control setpoint"
                        id="name-7"
                        type="text"
                        value="<%= channels["multisensor.an7name"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an7name"].value %>"
                        data-channelId="<%= channels["multisensor.an7name"].channelId %>"
                        data-techname="<%=channels["multisensor.an7name"].techName %>"
                        data-name="<%= channels["multisensor.an7name"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an7name"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an7name"].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-7">Units</label>
                    <input class="form-control setpoint"
                        id="units-7"
                        type="text"
                        value="<%= channels["multisensor.an7units"].value %>" />
                    <a href="#"
                        data-confirm-message="Are you sure you want to do this?"
                        data-refreshpause="1"
                        data-command=""
                        data-staticsend="<%= channels["multisensor.an7units"].value %>"
                        data-channelId="<%= channels["multisensor.an7units"].channelId %>"
                        data-techname="<%=channels["multisensor.an7units"].techName %>"
                        data-name="<%= channels["multisensor.an7units"].name%>"
                        data-nodechannelcurrentId="<%= channels["multisensor.an7units"].nodechannelcurrentId %>"
                        id="<%= channels["multisensor.an7units"].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.an6ispond"].value === "true") { %>
            <div class="col-xs-6">
                <h2>Pond 6 Calibration</h2>
                <table id="calibration-data-table-6" class="table">
                    <thead>
                        <tr>
                            <th>Level (Ft.)</th>
                            <th>Volume</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        <% } %>
    
        <% if (channels["multisensor.an7ispond"].value === "true") { %>
            <div class="col-xs-6">
                <h2>Pond 7 Calibration</h2>
                <table id="calibration-data-table-7" class="table">
                    <thead>
                        <tr>
                            <th>Level (Ft.)</th>
                            <th>Volume</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        <% } %>
    </div>
    
    <hr />
    
    <% if (channels["multisensor.an6ispond"].value === "true" || channels["multisensor.an7ispond"].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=6 >6</option>
                            <option value=7 >7</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 config6raw = "<%= channels["multisensor.pond6calibration"].value %>";
        var config7raw = "<%= channels["multisensor.pond7calibration"].value %>";
    
        var config6 = JSON.parse(config6raw.replaceAll("'", '"'));
        var config7 = JSON.parse(config7raw.replaceAll("'", '"'));
    
        var table6Rows = [];
        var table7Rows = [];
    
        for (var i = 0; i < config6.length; i++){
            var ptIndex = i + 1;
            var thisHtml = "<tr><td>" + config6[i].height + "</td><td>" + config6[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\': 6, \'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>';
            table6Rows.push(thisHtml);
        }
        $("#calibration-data-table-6 > tbody").html(table6Rows);
    
        for (var i = 0; i < config7.length; i++){
            var ptIndex = i + 1;
            var thisHtml = "<tr><td>" + config7[i].height + "</td><td>" + config7[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\': 7, \'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>';
            table7Rows.push(thisHtml);
        }
        $("#calibration-data-table-7 > tbody").html(table7Rows);
    
    
        $("#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-6").change(function(){
            $("#<%= channels["multisensor.an6min"].channelId %>").attr('data-staticsend', "{'tag': 'input6_cfg.scalingConfig.euMin', 'value': "+ $("#min-scaling-6").val() +"}");
        })
    
        $("#max-scaling-6").change(function(){
            $("#<%= channels["multisensor.an6max"].channelId %>").attr('data-staticsend', "{'tag': 'input6_cfg.scalingConfig.euMax', 'value': "+ $("#max-scaling-6").val() +"}");
        })
    
        $("#name-6").change(function(){
            $("#<%= channels["multisensor.an6name"].channelId %>").attr('data-staticsend', $("#name-6").val());
        })
    
        $("#units-6").change(function(){
            $("#<%= channels["multisensor.an6units"].channelId %>").attr('data-staticsend', $("#units-6").val());
        })
    
        $("#min-scaling-7").change(function(){
            $("#<%= channels["multisensor.an7min"].channelId %>").attr('data-staticsend', "{'tag': 'input7_cfg.scalingConfig.euMin', 'value': "+ $("#min-scaling-7").val() +"}");
        })
    
        $("#max-scaling-7").change(function(){
            $("#<%= channels["multisensor.an7max"].channelId %>").attr('data-staticsend', "{'tag': 'input7_cfg.scalingConfig.euMax', 'value': "+ $("#max-scaling-7").val() +"}");
        })
    
        $("#name-7").change(function(){
            $("#<%= channels["multisensor.an7name"].channelId %>").attr('data-staticsend', $("#name-7").val());
        })
    
        $("#units-7").change(function(){
            $("#<%= channels["multisensor.an7units"].channelId %>").attr('data-staticsend', $("#units-7").val());
        })
    
    </script>
    
    
    
    <style>
    
    .align-center {
        text-align: center;
    }
    </style>
        