2021-05-14 14:44:48 -04:00

66 lines
2.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>Protocol Builder Mock</title>
<base href="/">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://use.typekit.net/kwp6dli.css">
{% assets 'app_scss' %}
<link href="{{ base_href + ASSET_URL }}" rel="stylesheet" type="text/css">
{% endassets %}
<link rel="shortcut icon" href="{{ base_href + url_for('static', filename='favicon.ico') }}">
</head>
<body>
<h2>Protocol Builder Mock</h2>
<p>
<a class="btn btn-primary" href="{{ url_for('.new_study') }}"> New Study </a>
</p>
<p>
<label>Only Show Studies for: </label>
<select name="uva_id" id="uva_id" onchange="selectStudies()">
<option value="">Select User</option>
<option value="all" {% if selected_user=='all' %}selected{% endif %}>All Users</option>
{% if users %}
{% for user in users %}
<option value="{{ user }}" {% if selected_user==user %}selected{% endif %}>{{ user }}</option>
{% endfor %}
{% endif %}
</select>
</p>
{% with messages = get_flashed_messages(with_categories=True) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert {{ category }}">
<span class="btn-close" onclick="hideElement(this.parentElement);">&times;</span>
{{ message|safe }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<h3>Current Studies</h3>
{{ table }}
<script>
const hideElement = (el) => {
el.classList.add('fade-out');
setTimeout(() => el.classList.add('shrink'), 250);
};
const alerts = document.getElementsByClassName('alert');
for (const alert of alerts) {
setTimeout(() => hideElement(alert), 3000);
}
</script>
<script>
function selectStudies() {
let uva_id = document.getElementById('uva_id').value;
window.location.href = "{{base_href}}/user_studies/" + uva_id;
}
</script>
</body>
</html>