<!--

    Copyright © 2016-2017 The Thingsboard Authors

    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.

-->
  <md-sidenav class="tb-site-sidenav md-sidenav-left md-whiteframe-z2"
			  ng-show="!forceFullscreen"
			  hide-print=""
      		  md-component-id="left"
			  aria-label="Toggle Nav"
			  ng-click="vm.sidenavClicked()"
      		  md-is-open="vm.isShowSidenav"
			  md-is-locked-open="vm.isLockSidenav"
			  layout="column">
      <header class="tb-nav-header">
          <md-toolbar md-scroll-shrink class="tb-nav-header-toolbar">
          	 <div flex layout="row" layout-align="start center" class="md-toolbar-tools inset">
				<md-icon md-svg-src="{{vm.logoSvg}}" aria-label="logo" class="tb-logo-title"></md-icon>
          	 </div>
          </md-toolbar>
      </header>
      <md-content flex layout="column" role="navigation">
      	 <md-toolbar flex>
         	<tb-side-menu></tb-side-menu>
         </md-toolbar> 
      </md-content>      	
  </md-sidenav>

  <div flex layout="column" tabIndex="-1" role="main">
    <md-toolbar class="md-whiteframe-z1 tb-primary-toolbar" ng-class="{'md-hue-1': vm.displaySearchMode()}">
    	<div layout="row" flex class="md-toolbar-tools">
		      <md-button id="main" hide-gt-sm ng-show="!forceFullscreen"
		      		class="md-icon-button" ng-click="vm.openSidenav()" aria-label="{{ 'home.menu' | translate }}" ng-class="{'tb-invisible': vm.displaySearchMode()}">
		      		<md-icon aria-label="{{ 'home.menu' | translate }}" class="material-icons">menu</md-icon>
		      </md-button>
	          <md-button class="md-icon-button" aria-label="{{ 'action.back' | translate }}" ng-click="searchConfig.showSearch = !searchConfig.showSearch" ng-class="{'tb-invisible': !vm.displaySearchMode()}" >
		      	  <md-icon aria-label="{{ 'action.back' | translate }}" class="material-icons">arrow_back</md-icon>
	          </md-button>		    
			  <div flex layout="row" ng-show="!vm.displaySearchMode()" tb-no-animate class="md-toolbar-tools">
				  <span ng-cloak ncy-breadcrumb></span>
			  </div>
			  <md-input-container ng-show="vm.displaySearchMode()" md-theme="tb-search-input" flex>
	              <label>&nbsp;</label>
	              <input ng-model="searchConfig.searchText" ng-change="vm.searchTextUpdated()" placeholder="{{ 'common.enter-search' | translate }}"/>
	          </md-input-container>		      
		      <md-button class="md-icon-button" aria-label="{{ 'action.search' | translate }}" ng-show="searchConfig.searchEnabled" ng-click="searchConfig.showSearch = !searchConfig.showSearch">
		      	  <md-icon aria-label="{{ 'action.search' | translate }}" class="material-icons">search</md-icon>
          	  </md-button>
		      <md-button ng-show="!vm.displaySearchMode()" hide-xs hide-sm class="md-icon-button" ng-click="vm.toggleFullscreen()" aria-label="{{ 'fullscreen.toggle' | translate }}">
	    			<ng-md-icon icon="{{vm.Fullscreen.isEnabled() ? 'fullscreen_exit' : 'fullscreen'}}" options='{"easing": "circ-in-out", "duration": 375, "rotation": "none"}'></ng-md-icon>
		      </md-button>
			  <tb-user-menu
					  display-user-info="!vm.displaySearchMode()">
			  </tb-user-menu>
      	</div>
    </md-toolbar>
   	<md-progress-linear class="md-warn" style="z-index: 10; max-height: 0px; width: 100%;" md-mode="indeterminate" ng-disabled="!loading" ng-show="loading"></md-progress-linear>
    
    <div flex layout="column" id="toast-parent" style="position: relative;">
    	<md-content ng-cloak flex layout="column" class="page-content" ui-view name="content"></md-content>
    </div>
  </div>
