{{!
  Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.

  WSO2 Inc. licenses this file to you under the Apache License,
  Version 2.0 (the "License"); you may not use this file except
  in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied. See the License for the
  specific language governing permissions and limitations
  under the License.
}}
<span id="operation-details" data-endpoint="{{operationEndpoint}}" data-deviceid="{{device.deviceIdentifier}}">
{{#if control_operations}}
    <div class="wr-operations" style="height: 87px; display: block;">
        <style>
            ::-webkit-input-placeholder {
                color: #B8B8B8;
            }

            ::-moz-placeholder {
                color: #B8B8B8;
            }

            :-ms-input-placeholder {
                color: #B8B8B8;
            }

            input:-moz-placeholder {
                color: #B8B8B8;
            }
        </style>
        {{#each control_operations}}
            <a class='operation-tile' href="javascript:operationSelect('{{operation}}')">
                <i class="fw fw-service"></i>
                <span>{{name}}</span>
            </a>

            <div class="operation" data-operation-code="{{operation}}">
                <div class="content">
                    <div class="row">
                        <div class="col-lg-5 col-md-6 col-centered">
                            <h3>
                        <span class="fw-stack">
                            <i class="fw fw-circle-outline fw-stack-2x"></i>
                            <i class="fw fw-service fw-stack-1x"></i>
                        </span>
                                {{name}}
                                <br>
                            </h3>
                            <h4>
                                {{description}}
                                <br>
                            </h4>

                            <form id="form-{{operation}}" style="padding-bottom: 20px;"-->
                                <select id="operation-type" class="form-control" onChange="operationTypeChage(this)" style="display:none">
                                    <option value="PROFILE">Profile</option>
                                    <option value="COMMAND">Command</option>
                                </select>
                                <br />
                                <input type="hidden" id="operation-code" value="{{operation}}" />
                                <textarea id="operation-payload" placeholder="payload" class="form-control" rows="10" cols="70"></textarea>
                                <br />

                                <button id="btnSend" type="button" onclick="submitForm('form-{{operation}}')" class="btn btn-default">&nbsp;&nbsp;&nbsp;&nbsp;Send
                                                       to Device&nbsp;&nbsp;&nbsp;&nbsp;</button>
                                <label id="lblSending" class="wr-input-label hidden"><i
                                        class="fw fw-lifecycle fw-spin fw-2x"></i> Sending..</label>
                                <label id="lblSent" class="wr-input-label hidden"><i
                                        class="fw fw-check fw-2x"></i> Sent</label>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        {{/each}}
    </div>
{{else}}
    <div align="center">
        <h4 style="color: #D8000C"><i class="icon fw fw-error" style="color: #D8000C"></i>
            Operations Loading Failed!</h4>
    </div>
{{/if}}

<div id="operation-response-template" style="display: none">
    <div class="content">
        <div class="row">
            <div class="col-lg-5 col-md-6 col-centered">
                <h3>
                    <span class="fw-stack center-block">
                        <i class="fw fw-circle-outline fw-stack-2x"></i>
                        <i id="status-icon" class="fw fw-error fw-stack-1x"></i>
                    </span>
                    <br>
                </h3>
                <h4>
                    <span id="title"></span>
                    <br>
                </h4>
                <span id="description"></span>
            </div>
        </div>
    </div>
</div>

{{#zone "bottomJs"}}
    {{js "js/operation-bar.js"}}
{{/zone}}
