{%- set route = app.request.get('_route') -%}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Liveboards {% if page_title is defined and page_title %} - {{ page_title }}{%- endif -%}{% endblock %}</title>
<link rel="stylesheet" href="{{ asset('build/app.css') }}" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.9/css/all.css" integrity="sha384-5SOiIsAziJl6AWe0HWRKTXlfcSHKmYV4RBF18PPJ173Kzn7jzMyFuTtk8JA7QQG1" crossorigin="anonymous" media="none" onload="if(media!='all')media='all'">
<noscript><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.9/css/all.css" integrity="sha384-5SOiIsAziJl6AWe0HWRKTXlfcSHKmYV4RBF18PPJ173Kzn7jzMyFuTtk8JA7QQG1" crossorigin="anonymous"></noscript>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% if is_granted('ROLE_PREVIOUS_ADMIN') %}
<div class="app-level-alert">
<div class="container">
You are currently impersonating {{ app.user.username }} <a href="{{ path('identity_read', {identity: app.user.id}) }}?_switch_user=_exit" class="float-right">Exit impersonation</a>
</div>
</div>
{% endif %}
{% block navbar %} {# Figure out menu active flag etc: {{ dump(app.request) }} #}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="/"><img src="{{ asset('build/images/swplogo.png') }}" height="50" width="210" alt="SafeWorkPro Logo"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
{% if is_granted('ROLE_BROWSER') %}
<li class="nav-item{% if route != 'browser_staff' and (route starts with 'browser' or route == 'index') %} active{% endif %}">
<a class="nav-link" href="
{%- if dbname is defined and dbname -%}
{{ path('browser_documents', {dbname: dbname}) }}
{%- else -%}
{{ path('index') }}
{%- endif -%}
">Documents</a>
</li>
{% endif %}
{% if is_granted('ROLE_BROWSER') or is_granted('ROLE_LIVEBOARD') %}
<li class="nav-item{% if route starts with 'liveboard' %} active{% endif %}">
<a class="nav-link" href="
{%- if dbname is defined and dbname -%}
{{ path('liveboard_index', {dbname: dbname}) }}
{%- else -%}
{{ path('liveboard_index') }}
{%- endif -%}
">Liveboards</a>
</li>
{% endif %}
{% if is_granted('ROLE_BROWSER') or is_granted('ROLE_LIVEBOARD') %}
<li class="nav-item{% if route starts with 'alert_unresolved_alerts' %} active{% endif %}">
<a class="nav-link" href="
{%- if dbname is defined and dbname -%}
{{ path('alert_unresolved_alerts', {dbname: dbname}) }}
{%- else -%}
{{ path('alert_unresolved_alerts') }}
{%- endif -%}
">Alerts</a>
</li>
{% endif %}
{% if is_granted('ROLE_GRID') %}
<li class="nav-item{% if route starts with 'grid' %} active{% endif %}">
<a class="nav-link" href="
{%- if dbname is defined and dbname -%}
{{ path('grid_index', {dbname: dbname}) }}
{%- else -%}
{{ path('grid_index') }}
{%- endif -%}
">Grids</a>
</li>
{% endif %}
{% if is_granted('ROLE_LIVEBOARD') %}
<li class="nav-item{% if route == 'staff_activity' %} active{% endif %}">
{%- if dbname is defined and dbname -%}
<a href="{{ path('staff_activity', {dbname: dbname}) }}" class="nav-link">SWP Activity</a>
{%- else -%}
{# Need a database selected first cant go scanning every DB #}
<a href="{{ path('index') }}" class="nav-link">SWP Activity</a>
{%- endif -%}
</li>
{% endif %}
{% if is_granted('ROLE_LIVEBOARD') %}
<li class="nav-item{% if route == 'staff_jobs' %} active{% endif %}">
{%- if dbname is defined and dbname -%}
<a href="{{ path('staff_jobs', {dbname: dbname}) }}" class="nav-link">Jobs</a>
{%- else -%}
{# Need a database selected first cant go scanning every DB #}
<a href="{{ path('index') }}" class="nav-link">Jobs</a>
{%- endif -%}
</li>
{% endif %}
{% if is_granted('ROLE_COMMUNICATION') or is_granted('ROLE_ADMIN') %}
<li class="nav-item{% if route == 'staff_communication' %} active{% endif %}">
{# This lets managers contact their SWP users by sms/email. Must have access to at least one database.
Even if you are a SWP Admin - to stop any accidents / people seeing entire swp user list.
If you dont have a SWP database selected, you will see users for all databases your account is
set to have specifically set 'access to' #}
{%- if dbname is defined and dbname -%}
<a href="{{ path('staff_communication', {dbname: dbname}) }}" class="nav-link">Communication</a>
{%- else -%}
<a href="{{ path('index') }}" title="Select a data source first" class="disabled nav-link">Communication<small> select data source</small></a>
{%- endif -%}
</li>
{% endif %}
{# Removed 25-02-2020
{% if is_granted('ROLE_ADMIN') %}
<li class="nav-item{% if route starts with 'identity' %} active{% endif %}">
<a href="{{ path('identity') }}" class="nav-link">Users</a>
</li>
{% endif %}#}
</ul>
{% if dbname is defined and dbname %}
<form class="form-inline my-2 my-lg-0 ml-auto" method="get" action="{{ path('browser_search', {dbname: dbname}) }}">
<div class="input-group">
<input class="form-control input-lg" type="search" name="q" placeholder="Doc name / submission #" aria-label="Search" value="{{ app.session.get('query') }}">
<div class="input-group-append">
<button class="btn btn-outline-success" type="submit">
<i class="fa fa-search"></i>
</button>
</div>
</div>
</form>
{% endif %}
{# is being real difficult to style - wont follow normal bootstrap colours?? #}
<div class="dropdown ml-5">
<button class="btn AAAbtn-outline-secondary NiceColourWithNothingbtn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ app.user.username }}
</button>
<div class="dropdown-menu">
{% if is_granted('ROLE_ADMIN') %}
<a class="dropdown-item" href="{{ path('identity') }}">Manage Users</a>
{%- if dbname is defined and dbname -%}
<a class="dropdown-item" href="{{ path('browser_research', {dbname: dbname}) }}">SWP Research</a>
{%- else -%}
<a class="dropdown-item" href="{{ path('index') }}">SWP Research</a>
{%- endif -%}
{% endif %}
<a class="dropdown-item" href="https://safeworkpro.zendesk.com" target="_blank">Support</a>
<a class="dropdown-item" href="{{ path('logout') }}">Log out</a>
</div>
</div>
{# Removed 25-02-2020
<ul class="navbar-nav ml-auto mb-2 mt-lg-0">
<li class="nav-item">
{{ app.user.username }} | <a href="{{ path('logout') }}">Log out</a>
</li>
</ul>#}
</div>
{% endif %}
</div>
</nav>
{% endblock %}
{%- block main -%}
<div class="container">
{%- block body %}{% endblock -%}
</div>
{%- endblock -%}
<script type="text/javascript" src="{{ asset('build/manifest.js') }}"></script>
<script type="text/javascript" src="{{ asset('build/vendor.js') }}"></script>
<script type="text/javascript" src="{{ asset('build/app.js') }}"></script>
<script type="text/javascript" src="{{ asset('build/font-awesome.js') }}"></script>
<script type="text/javascript" src="{{ asset('build/datatables-bs4.js') }}"></script>
<link rel="stylesheet" href="{{ asset('build/datatables-bs4-css.css') }}"/>
<link rel="stylesheet" href="{{ asset('build/datatables-css.css') }}"/>
{#pointless not helpful <script type="text/javascript" src="{{ asset('build/datatables-bs4.js') }}"></script>
<link rel="stylesheet" href="{{ asset('build/datatables-bs4-css.css') }}"/>#}
<script type="text/javascript" src="{{ asset('build/datatables-buttons-html5.js') }}"></script>
<link rel="stylesheet" href="{{ asset('build/datatables-buttons-html5-css.css') }}"/>
<!-- <link rel="stylesheet" href="https://cdn.datatables.net/1.10.18/css/dataTables.bootstrap4.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.18/js/dataTables.bootstrap4.min.js"></script>
-->
<!-- <link rel="stylesheet" href="https://cdn.datatables.net/1.10.18/css/jquery.dataTables.min.css" />
<script type="text/javascript" src="https://cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>-->
{% block javascripts %}{% endblock %}
</body>
</html>