<vn>
<h1 id="title">
	_Connections
</h1>
<div id="actions">
	<htk-bar-button
		icon="refresh"
		tip="_Refresh"
		on-click="onRefreshClick"/>
	<div class="connections-sum">
		<htk-text>
			<db-calc-sum
				property="param"
				model="sessions"
				func="sessionsFunc"/>
		</htk-text> 
		_connections
	</div>
</div>
<div id="main" class="connections">
	<div class="card list">
		<htk-repeater>
			<db-model property="model" id="sessions" on-status-changed="onModelStatusChange">
				SELECT vu.user userId, vu.stamp, c.Cliente, s.lastUpdate, 
						a.platform, a.browser, a.version, u.name user
					FROM userSession s
						JOIN visitUser vu ON vu.id = s.userVisit
						JOIN visitAccess ac ON ac.id = vu.access
						JOIN visitAgent a ON a.id = ac.agent
						JOIN visit v ON v.id = a.visit
						JOIN account.user u ON u.id = vu.user
						JOIN vn2008.Clientes c ON c.Id_cliente = vu.user
					ORDER BY lastUpdate DESC
			</db-model>
			<custom>
				<a href="#!form=admin/access-log&amp;user={{userId}}"
					class="list-row"
					title="_Access log">
					<div class="actions">
						<htk-button
							lot="iter"
							name="id"
							tip="_Supplant user"
							icon="incognito"
							on-click="onChangeUserClick"/>
					</div>
					<p class="important">
						{{Cliente}}
					</p>
					<p>
						<htk-text lot="iter" name="stamp" format="%a, %T"/> - 
						<htk-text lot="iter" name="lastUpdate" format="%T"/>
					</p>
					<p>
						{{platform}} - {{browser}} {{version}}
					</p>
				</a>
			</custom>
		</htk-repeater>
	</div>
</div>
</vn>
