

<div class="pageTitle">
    <h1>
        <span>Report builder</span>
        <button ng-show="loadedSearch==false" class="btn btn-large pull-right" ng-disabled="isObjEmpty(SQL.fields) && SQL.filters.length ==0 && SQL.SQLSTRING ==''" ng-click="clearAllFields()">Clear all fields</button>
        <button ng-if="loadedSearch==true && readonly!=1 && can_delete==1"    class="btn btn-large btn-danger pull-right" ng-click="modalWindow.open('deleteSearchModal', this)">Delete report</button>
    </h1>
</div>

<div class="" id="filterTree" ng-init="showFilter=false" ng-class="{'open':showFilter}">
    <div class="accordion-group">
        <div class="accordion-toggle accordion-heading" data-parent="#filterTree" data-toggle="collapse">
            <span ng-click="showFilter=!showFilter">
                <i class="icon-chevron-right" ng-show="!showFilter" style="padding: 0px 5px;"></i>
                <i class="icon-chevron-down" ng-show="showFilter" style="padding: 0px 5px;"></i>
                Filters</span>
        </div>
    </div>

    <div class="margin-left-small">
        <?php $this->load->view('/partials/_environmentFilter'); ?>

    </div>
</div>

<div style="margin-top:80px">
    <h3 ng-if="reportLabel != ''">{{reportLabel}}</h3>
    <h3 ng-if="reportLabel == ''">Create your query</h3>
</div>

<span class="muted">{{SQL.hostcontexts.name}}</span>
<?php
//******************************* M O D A L *******************************************************


$this->load->view('/partials/_saveSearchModal');
$this->load->view('/partials/_deleteSearchModal');
$this->load->view('/partials/_selectTableModal');
//******************************* M O D A L *******************************************************
?>
<?php
$this->load->view('/partials/_sqlWizardForm');
?>

<div ng-show="showQuery" class="resultQueryWrapper_SE" style="width: 100%; padding-bottom: 10px; position: relative; clear: both">
      <textarea ng-model="SQL.SQLSTRING" class="result_Query_SE" style="width: 99%;height:120px;"  autocorrect="off" autocapitalize="off">{{SQLSTRING}}</textarea>
      <div class="clearfix"></div>
</div>

<div class="clearfix"></div><br />
<div id="resultScrollTo"></div>
<?php //do not delete id=resultScrollTo it is used to scroll window after user click on runQery ?>

<?php
    $data['buttonPosition'] = "bottom";
    $this->load->view('/partials/elements/_editPageBtn', $data);
?>

<?php
$this->load->view('/partials/_notification');
?>
