Added the rest of the data display to sar_details.html

This commit is contained in:
Vadim Likholetov 2023-11-17 08:50:24 +02:00
parent 602f9fc885
commit a7a9f47756
3 changed files with 58 additions and 30 deletions

5
app.py
View File

@ -19,14 +19,12 @@ metadata = MetaData(naming_convention=convention)
def get_locale():
return session.get('language', request.accept_languages.best_match(['en', 'ru', 'et', 'lv', 'fi']))
return session.get('language', request.accept_languages.best_match(['en', 'ru', 'ee', 'lv', 'fi','se','lt']))
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret_key'
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3'
#app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqlconnector://sarbaseuser:password@localhost/sarbaseapp'
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', 'mysql+mysqlconnector://sarbaseuser:password@localhost/sarbaseapp')
app.config['BABEL_DEFAULT_LOCALE'] = 'en'
babel= Babel(app)
@ -56,6 +54,5 @@ def set_language(lang_code):
if __name__ == '__main__':
app.run()

View File

@ -2,14 +2,8 @@
<html lang="en">
<head>
<!-- ... meta tags, styles, etc. ... -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<script>
$(document).ready(function () {
$(".dropdown-toggle").dropdown();
});
</script>
<title>{% block title %}Default Title{% endblock %}</title>
</head>
<body>
@ -38,13 +32,13 @@
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button"
data-bs-toggle="dropdown-menu" aria-expanded="false">
Language
{{ _('Language') }}
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="{{ url_for('set_language', lang_code='en') }}">English</a></li>
<li><a class="dropdown-item" href="{{ url_for('set_language', lang_code='ru') }}">Русский</a></li>
<li><a class="dropdown-item" href="{{ url_for('set_language', lang_code='ee') }}">Eesti</a></li>
<li><a class="dropdown-item" href="{{ url_for('set_language', lang_code='ee') }}">Suomi</a></li>
<li><a class="dropdown-item" href="{{ url_for('set_language', lang_code='fi') }}">Suomi</a></li>
<!-- Add other languages here -->
</ul>
</li>
@ -59,7 +53,7 @@
{% else %}
<!-- Display login link if user is not authenticated -->
<li class="nav-item">
<a class="nav-link" href="{{ url_for('login') }}">_(Login)</a>
<a class="nav-link" href="{{ url_for('login') }}">{{ _('Login') }}</a>
</li>
{% endif %}
</ul>
@ -88,10 +82,20 @@
<!-- ... footer content ... -->
</footer>
<!-- Scripts -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<!-- Scripts -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
$(".dropdown-toggle").dropdown();
});
</script>
</body>
</html>

View File

@ -28,17 +28,42 @@
</style>
<div class="container mt-4">
<h1 class="mb-4">SAR Job Details</h1>
<h2 class="mb-4">#{{ sar.id }} : {{ sar.title }}</h2>
<div class="card mb-4">
<div class="card-body">
<p><strong>ID:</strong> {{ sar.id }}</p>
<div>
<p>Created at: {{ sar.created }}</p>
<p>Last updated: {{ sar.updated }}</p>
</div>
<p><strong>Start Date:</strong> {{ sar.start_date }}</p>
<p><strong>Manager:</strong> {{ sar.manager }}</p>
<!-- Other SAR details -->
<table>
<tr>
<td>
<div class="card-mb5">
<div class="card-body">
<div>
<p>Created at: {{ sar.created }}</p>
<p>Last updated: {{ sar.updated }}</p>
</div>
<p>Status: {{ sar.status }}</p>
<p>Category: {{ sar.category }}</p>
<p><strong>Start Date:</strong> {{ sar.start_date }}</p>
<p><strong>Finish Date:</strong> {{ sar.finish_date }}</p>
<p>Result: {{ sar.result }}</p>
<p><strong>Manager:</strong> {{ sar.manager_id }}</p>
</div>
</div>
</td>
<td>
<div class="card-mb5">
<div class="card-body">
<p>IPP longitude: {{ sar.longitude }} </p>
<p>IPP latitude: {{ sar.latitude }}</p>
<p>Longitude found: {{ sar.longitude_found }}</p>
<p>Latitude found: {{ sar.latitude_found }}</p>
<p>Description: {{ sar.description }}</p>
<p>Description private: {{ sar.description_hidden }}</p>
</div>
</div>
</td>
<!-- Other SAR details -->
</tr>
</table>
</div>
</div>
@ -55,10 +80,12 @@
<div class="comment">
<div class="card mb-4">
<div class="card-body">
<strong>{{ comment.user.full_name }}</strong>: at {{ comment.created }} , updated {{ comment.updated }}
<strong>{{ comment.user.full_name }}</strong>: at {{ comment.created }} ,
updated {{ comment.updated }}
<div class="card mb-5">
<div class="card-body">
<div class="comment-text"><p id="comment-text-{{ comment.id }}">{{ comment.text }}</p></div>
<div class="comment-text"><p id="comment-text-{{ comment.id }}">{{ comment.text }}</p>
</div>
</div>
</div>
{% for gpx_track in comments_with_gpx %}