<!DOCTYPE html>
<html ng-app="app" ng-cloak>

	<head>
		<meta charset="utf-8" />
		
		<link rel='stylesheet' href='ext/bootstrap3/css/bootstrap.min.css'>
		<link rel='stylesheet' href='ext/bootstrap3/css/bootstrap-theme.min.css'>
		<!-- link rel='stylesheet' href='/main.css' -->

		<script src='ext/jquery/jquery.js'></script>
		<script src='ext/angular/angular.min.js'></script>
		
		<script src='green_tiger.js'></script>
		<script src='navbar.js'></script>
		<script src='index.js'></script>
		
		<title>Состояние</title>
	</head>

	<body ng-controller="indexController">
		
		<div class='container'>
			<div class='row'>
				<div class='col-md-12'>
				
					<ul class="nav nav-pills">
						<li>Control <span class="badge">{{$ctrl.DATA.webCtrlEnabled ? "ON" : "OFF"}}</span></li>
					</ul>
					<hr>
					
					<ol class="breadcrumb">
						<li 	ng-repeat="ITEM in $ctrl.DATA.path"
								ng-class="{'active': ITEM==$ctrl.DATA.path[$ctrl.DATA.path.length-1]}"
								>
							<a 	href="index.html?tag={{ITEM.href}}">{{ITEM.title}}</a>
						</li>
					</ol>				
				
					<table 	class="table table-striped table-condensed table-bordered"
							style="font-family: courier new;"
							>
						<tr>
							<th style="width: 100px;">Name</th>
							<th style="width: 150px;">Value</th>
							<th style="width: 150px;">Title</th>
							<th style="width: 100px;">Time (Local)</th>
							<th style="width: 50px;">Type</th>
						</tr>
						
						<tr ng-repeat="TAG in $ctrl.DATA.nodes">
							<!-- Name -->
							<td ng-if="TAG.hasNodes" >
								<a href="index.html?tag={{TAG.fullName}}">/{{TAG.name}} </a>
							</td>
							<td ng-if="!TAG.hasNodes">
								{{TAG.name}} 
							</td>
							
							<!-- Value -->
							<td>
								<span ng-if="TAG.type!='void'">
									<a 		href="#"
											ng-if="$ctrl.DATA.webCtrlEnabled"
											ng-click="$ctrl.onValueClick(TAG)"
											>
										<span class="glyphicon glyphicon-pencil"></span>
									</a>
									
									<span ng-if="TAG.quality_int">
										? [ {{TAG.quality_str}} ]
									</span>
									<span ng-if="!TAG.quality_int">
										<strong 	
												ng-if="TAG.type=='bool'"
												ng-class="{'text-danger': TAG.value, 'text-muted': !TAG.value}">
											{{TAG.value ? 'ON' : 'OFF'}}
										</strong>
										
										<span 	ng-if="TAG.type!='bool'"
												>
											{{TAG.value}}
										</span>
									</span>
								</span>
							</td>
							<!-- Title -->
							<td>{{TAG.title}}</td>
							
							<td>{{TAG.timeStamp}}</td>
							
							<td>{{TAG.type=='void' ? '' : TAG.type}}</td>
						</tr>
					</table>
				
				</div>
			</div>
		</div>

	</body>

</html>
