{%- macro active(f) -%}
 {% if request.endpoint == f %}
  active
 {% endif %}
{%- endmacro -%}

<html>
 <head>
  <!-- Standard Meta -->
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <title>{{config["PROJECT"].project_name}}</title>
  <link href="../../static/css/img-modal.css" />
  <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">


  <!-- Include Assets -->
  {%- assets "css_libs" %}
  <link rel='stylesheet' href='{{ ASSET_URL }}'>
  {%- endassets %}
  {%- assets "css_main" %}
  <link rel='stylesheet' href='{{ ASSET_URL }}'>
  {%- endassets %}
 </head>
 <body>
  <!-- Header Logo -->
  <div class="ui menu">
   {% if menuInfo["chain"]["id"] == "6b6b5f0ce7a36d323768e534f3edb41c6d6332a541a95725b98e28d140850134" %}
   <a class="ui red left corner label" href="{{ url_for('mainnet') }}"></a>
   {% endif %}
  	
   <div class="ui container">
    <a href="/" class="header">
     <img class="logo" src="{{ url_for('static', filename='img/logo.png') }}" />
    </a> 
    <div class="item"></div>
    <div class="item">
		<h3 class="ui header">
    	{{config["PROJECT"].project_name}}
    	<div class="sub header">{{config["PROJECT"].project_sub_name}}</div>
    	</h3>
    </div>
	<a title="Lists all votable proposals" class="item" href="{{ url_for('votable_proposals') }}"><i class="thumbs up icon"></i><i class="thumbs down icon"></i> {{ menuInfo["numberOfVotableProposals"] }}</a>
	<a title="Show incoming dataproxy incidents" class="item" href="{{ url_for('show_incidents') + '?matching_today' }}"><i class="angle double right icon"></i>
		Incidents
		{% if menuInfo['incidents'] %}
			<br />
			{% for provider_hash, provider in menuInfo['incidents']['dataproxy_link'].items() %}
				{% if provider["status"] == "ok" %}
					<i class="tiny green circle icon"></i>
				{% else %}
					<i class="tiny red circle icon"></i>			
				{% endif %}
			{% endfor %}
		{% endif %}
	</a>
	<!-- Header Menu -->
	<div class="right menu">
	 	<div class="ui dropdown right item"><!-- <table><tr><td>Account</td></tr><tr><td> -->{{menuInfo['account']['toString']}}<!-- </td></tr></table> --> 
		 	<i class="dropdown icon"></i>
		 	<div class="menu">
	   			<!-- <a class="item" href="{{ url_for('pending_operations') }}">Pending Operations</a>
	   			<div class="ui divider"></div> -->
			    <a class="item" href="{{ url_for('account_info') }}">Account information</a>
	   			<div class="ui dropdown item">Switch Account <i class="dropdown icon"></i>
				 	<div class="menu">
				 		{% for account in menuInfo['allAccounts'] %}
				        <a class="item" href="{{ url_for('account_select', accountId=account['id'], next=request.url) }}">{{account['toString']}}</a>
		    			{% endfor %}
		    			<a class="item" href="{{ url_for('account_add') }}"><i class="small plus icon"></i>Add new</a>
		   			</div>
				 </div>
				 {% if menuInfo["advanced_features"] %}
				 	<div class="ui divider"></div>
  				 	<a class="item" href="{{ url_for('bookiesports_sync') }}">Synchronize bookiesports</a>
  				 	<a class="item" href="{{ url_for('witnesses') }}">Ping witnesses</a>
  				 	<a class="item" href="{{ url_for('cancel') }}">Cancel legacy events</a>
  				 	<a class="item" href="{{ url_for('replay') }}">Replay events</a>
  				 {% endif %}
  			</div>
		 </div>
		 <a title="Lists all operations to be proposed" class="item" href="{{ url_for('pending_operations') }}"><i class="large in cart icon"></i> {{ menuInfo["numberOfOpenTransactions"] }}</a>
		 {% if menuInfo["walletLocked"] %}
		 	<a title="Local wallet is locked. Click to unlock" class="item" href="{{ url_for('unlock') }}"><i class="lock icon"></i></a>
		 {% else %}
		 	<a title="Local wallet is unlocked. Click to lock" class="item" href="{{ url_for('lock') }}"><i class="unlock icon"></i></a>
		 {% endif %}
		 <div title="Connected chain" class="item">
		 	{{menuInfo["chain"]["name"]}}
		 	{% if menuInfo["chain"]["out_of_sync"] %}
		 		<br /><i class="tiny red circle icon"></i>
	 		{% endif %}
	 	 </div>			 
  	</div>
   </div>
   <span style="font-size: 10px; float: right; line-height: 14px; margin-right: 10px">
    bos-mint: <strong>{{menuInfo["version"]}}</strong><br />
    {%- for k, v in menuInfo["versions"].items() -%}
    {{k}}: <strong>{{v}}</strong><br />
    {%- endfor -%}
	</span>
  </div>
  
  <!-- Notification Area -->
  <div class="ui container">
  	{%- include "_messages.html" %}
  </div>

  <!-- Block Content Wrapper -->
  <div class="ui main container">
   <div class="ui grid">
    <div class="column">
     <!-- Block Content Begin -->
     {% block content -%}
     {%- endblock content %}
     <!-- Block Content End -->
    </div>
   </div>
  </div>

  <!-- Assets Scripts -->
  {%- assets "js_libs" %}
  <script type="text/javascript" src="{{ ASSET_URL }}"></script>
  {%- endassets %}
  {%- assets "js_main" %}
  <script type="text/javascript" src="{{ ASSET_URL }}"></script>
  {%- endassets %}
 </body>
<footer>
 <div class="ui vertical footer segment">
  <div class="ui container">
   <span style="font-size: 10px; float: right">
    {{menuInfo["chain"]["name"]}}:{{menuInfo["chain"]["id"]}}
    block:{{menuInfo["chain"]["block"]}}
 	time:{{menuInfo["chain"]["time"]}}
    {% if menuInfo["chain"]["out_of_sync"] %}
	   (out of sync)<i class="small red circle icon"></i>
	{% endif %}
  </span>
 </div>
 </div>
</footer>
</html>
