{% load i18n static rules octicons %}
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<meta name="description" content="">

		<title>[admin] {{ request.app.name }}</title>

		<!--konva js for arrows -->
		<script type="text/javascript" src="{% static 'localcosmos_server/konva/konva.min.js' %}"></script>

		<!-- Bootstrap core CSS -->
		<link href="{% static 'localcosmos_server/bootstrap-4.3.1-dist/css/bootstrap.min.css' %}" rel="stylesheet">

		<link href="{% static 'app_admin/css/app_admin.css' %}" rel="stylesheet">
		<link href="{% static 'localcosmos_server/css/localcosmos_server.css' %}" rel="stylesheet">
		<link href="{% static 'fonts/fonts.css' %}" rel="stylesheet">

		<script src="{% static 'localcosmos_server/jquery-3.3.1.min.js' %}"></script>
		<script src="{% static 'localcosmos_server/js/popper.min.js' %}"></script>
		<script src="{% static 'localcosmos_server/bootstrap-4.3.1-dist/js/bootstrap.bundle.min.js' %}"></script>
		<script type="text/javascript" src="{% static 'localcosmos_server/js/bootstrap3-typeahead.js' %}"></script>
		<script type="text/javascript" src="{% static 'localcosmos_server/js/jquery-taxon-autocomplete.js' %}"></script>
		<script type="text/javascript" src="{% static 'localcosmos_server/js/localcosmos_server.js' %}"></script>

		<script type="text/javascript" src="{% static 'localcosmos_server/js/jquery-user-autocomplete.js' %}"></script>

		{% block extra_head_script %}{% endblock %}
		{% block extra_style %}{% endblock %}

	</head>
	<body>
		
		<div class="container-fluid d-none d-md-block">
			<div class="row bg-primary text-white">
				<div class="col-12 text-center">
					{{ request.app.name }}
				</div>
			</div>
		</div>

		<nav class="navbar navbar-expand-md navbar-dark bg-dark sticky-top">
			<a class="navbar-brand" href="{% url 'appadmin:home' request.app.uid %}">App Admin</a>
			<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#appAdminNavbar" aria-controls="appAdminNavbar" aria-expanded="false" aria-label="Toggle navigation">
				<span class="navbar-toggler-icon"></span>
			</button>

			<div class="collapse navbar-collapse" id="appAdminNavbar">
				<ul class="navbar-nav mr-auto">
					{% has_perm 'app.is_admin' request.user request.app as is_app_admin %}
					{% if is_app_admin %}
						<li class="nav-item">
							<a class="nav-link" href="{% url 'appadmin:user_list' request.app.uid %}">{% trans 'Users' %}</a>
						</li>
					{% endif %}
					<li class="nav-item">
						<a class="nav-link" href="{% url 'template_content_home' request.app.uid %}">{% trans 'Template content' %}</a>
					</li>
					<li class="nav-item dropdown">
						<a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{% trans 'Observations' %}</a>
						<div class="dropdown-menu" aria-labelledby="dropdown01">
							<a class="dropdown-item" href="{% url 'datasets:list_datasets' request.app.uid %}">{% trans 'Manage observations' %}</a>
							<a class="dropdown-item" href="{% url 'datasets:dataset_validation_routine' request.app.uid %}">{% trans 'Manage validation routine' %}</a>
						</div>
					</li>
				</ul>

				<ul class="navbar-nav flex-row ml-md-auto d-md-flex">
					<li class="nav-item dropdown">
						<a class="nav-link dropdown-toggle" href="#" id="accountDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
							{% octicon "person" width="20" height="auto" class="octicon-white" style="vertical-align:middle" %} <span class="pl-2">{{ user.username }}</span>
						</a>
						<div class="dropdown-menu dropdown-menu-right" aria-labelledby="accountDropdown">
							<a href="{% url 'log_out' %}" class="dropdown-item" >{% trans 'Sign out' %}</a>
						</div>
					</li>
				</ul>
			</div>
		</nav>

		<div id="mainContent" class="mt-3 mb-5">
			{% block content %}{% endblock %}
		</div>


		<div id="Modal" class="modal fade">
			<div class="modal-dialog">
				<div id="ModalContent" class="modal-content"></div>
			</div>
		</div>

		<div id="LargeModal" class="modal fade">
			<div class="modal-dialog modal-lg">
				<div id="LargeModalContent" class="modal-content"></div>
			</div>
		</div>

		<script type="text/javascript" src="{% static 'localcosmos_server/js/manage_object_order.js' %}"></script>

		<script type="text/javascript" src="{% static 'localcosmos_server/js/django-ajax.js' %}"></script>
		<script type="text/javascript" src="{% static 'localcosmos_server/js/django-ajax-csrf.js' %}"></script>
		<script>
			ajaxify("mainContent");

			$('form').submit(function() {
				$(this).find('button[type="submit"]').attr('disabled', true);
			});
		</script>
		{% block extra_script %}{% endblock %}
	</body>
</html>

