datasaur/site/surveyapp/templates/surveys/home.html
2026-01-25 15:56:01 +00:00

122 lines
6.3 KiB
HTML

{% extends "layout.html" %} {% block content %}
<main class="container">
<div class="row mt-3">
<section class="col-md-8">
<h2 class="pb-2 mt-2 mb-2 border-bottom primary-colour">
Your surveys
</h2>
{% if not surveys %}
<section class="p-4 rounded bg-white shadow-sm text-center pointer" data-toggle="modal" data-target="#new-column-modal">
<p class="lead m-0 text-muted">No surveys yet! Click here to add your first survey.</p>
<div class="mt-2">
<i class="fa fa-plus-circle fa-lg text-primary" aria-hidden="true"></i>
</div>
</section>
{% else %}
{% for survey in surveys %}
<article class="bg-white shadow-sm rounded p-3 mb-3 survey" data-name="{{ survey['title'] }}">
<div class="border-bottom d-flex justify-content-between">
<a class="h4 align-bottom mb-0 text-decoration-none" href="{{ url_for('surveys.dashboard', survey_id=survey['_id'] )}}"
title="Go to the dashboard page for this survey">{{ survey["title"] }}</a>
<div class="dropdown">
<button class="btn btn-info dropdown-toggle mb-1 float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Manage survey
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="{{ url_for('surveys.run_tests', survey_id=survey['_id'] )}}"
title="This will run a series of statistical tests on your data and give you notifications of any significant findings."
>Run automatic tests on this data</a>
<a class="dropdown-item" href="{{ url_for('surveys.input', survey_id=survey['_id'] )}}"
title="Edit the data in tabular form for this survey"
>Edit data</a>
<form class="dropdown-item" action="{{ url_for('surveys.delete_survey', survey_id=survey['_id'] )}}" method="post" onsubmit="return confirm('Are you sure? All associated graphs/tests will be deleted?');">
<button class="no-btn z-index-high" type="submit">Delete survey</button>
</form>
<a class="dropdown-item" href="{{ url_for('surveys.export_survey', survey_id=survey['_id'] )}}"
title="Export the survey, with all associated graphs and statistical tests"
>Export to Excel</a>
</div>
</div>
</div>
<div class="row mt-3 text-muted">
<div class="col-md-3">
<p>Number of graphs: {{ survey["numGraphs"] }}</p>
<p>Number of tests: {{ survey["numTests"] }}</p>
</div>
<div class="col-md-3">
</div>
<div class="col-md-6 d-flex flex-column">
<a class="btn btn-secondary mb-1" href="{{ url_for('analysis.quick_stats', survey_id=survey['_id']) }}"
title="View some automatically generated statistics of your data, such as mean, median and standard deviations"
>Generate quick stats</a>
<a class="btn btn-primary" href="{{ url_for('surveys.dashboard', survey_id=survey['_id'] )}}"
title="Go to this survey dashboard page, where you can create graphs and statistical tests"
>Graphs and statistical tests</a>
</div>
</div>
</article>
{% endfor %}
<div class="my-1 text-center d-flex flex-column text-primary pointer" data-toggle="modal" data-target="#new-column-modal">
<p class="mb-1">Add new survey</p>
<i class="fa fa-plus-circle fa-lg text-primary" title="Add survey" aria-hidden="true"></i>
</div>
{% endif %}
</section>
<section class="col-md-4">
<div class="bg-white shadow-sm rounded p-4">
<h3 class="h4 primary-colour">Welcome, {{ current_user.first_name }}</h3>
<p class='text-muted'>Add new surveys or click on a survey to start analysing your data.</p>
<ul class="list-group">
<li class="list-group-item list-group-item-light bg-light">Total surveys:
{% if surveys %}
{{ surveys | length }}
{% else %}
0
{% endif %}</li>
{% if notifications > 0 %}
<li class="list-group-item list-group-item-light bg-light" data-toggle='tooltip'
title='We have found some signficant findings in a recently uploaded file!'>
Notifications:
<a href="{{ url_for('surveys.findings') }}" class="badge badge-danger wobble"
title="View some automatically generated statistical tests for your data"
>{{ notifications }}</a>
</li>
{% else %}
<li class="list-group-item list-group-item-light bg-light">Notifications: 0</li>
{% endif %}
</ul>
<div class="form-group my-2">
<label class="text-muted" for="search"> Search for a survey:</label>
<input class="form-control" id="search" type="text" placeholder="Enter title">
</div>
</div>
</section>
</div>
</main>
<!-- Modal for prompting user to choose how to input/upload their data - Bootstrap -->
<div class="modal fade" id="new-column-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Please choose an option</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body d-flex flex-column">
<a class="btn btn-primary my-2 mx-4" href="{{ url_for('surveys.import_file') }}" title="Upload a new CSV or Excel file">Upload a file</a>
<a class="btn btn-primary my-2 mx-4" href="{{ url_for('surveys.input') }}" title="Start a survey from scratch">Input data manually</a>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script src="{{ url_for('static', filename='home.js') }}" defer></script>
{% endblock content %}