<?php
/**
 * Copyright 2015 Zendesk
 *
 * Licensed 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.
 */
?>
<div style='margin-top: 10px;' class="entry-edit">
    <div class="entry-edit-head">
        <div class="fright"><?php echo $this->getButtonsHtml() ?></div>
        <h4 class="fieldset-legend <?php echo ($this->getHeaderCssClass()) ? $this->getHeaderCssClass().' icon-head' : '' ?>"><?php echo $this->getHeaderText() ?></h4>
    </div>
    <div class="fieldset">
        <?php echo $this->getChildHtml('', true, true) ?>
    </div>
</div>
<script>
document.getElementById('zendesk_create_order_search_grid').parentNode.className = 'no-display';
function insertOrder(id) {
    var request = new Ajax.Request('<?php echo $this->getUrl('adminhtml/zendesk/getOrder'); ?>'+'id/'+id, {
        method: 'get',
        onSuccess: function(transport) {
            if (transport.responseJSON.success === true) {
                document.getElementById('order').value = transport.responseJSON.order.number;
                document.getElementById('zendesk_create_order_search_grid').parentNode.className = 'no-display';
                document.getElementById('show-orders').className = '';
            }
        }
    });
}
function showOrders() {
    document.getElementById('zendesk_create_order_search_grid').parentNode.className = '';
    document.getElementById('show-orders').className = 'no-display';
}
</script>
