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(): 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 = Flask(__name__)
app.config['SECRET_KEY'] = 'secret_key' 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['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', 'mysql+mysqlconnector://sarbaseuser:password@localhost/sarbaseapp')
app.config['BABEL_DEFAULT_LOCALE'] = 'en' app.config['BABEL_DEFAULT_LOCALE'] = 'en'
babel= Babel(app) babel= Babel(app)
@ -56,6 +54,5 @@ def set_language(lang_code):
if __name__ == '__main__': if __name__ == '__main__':
app.run() app.run()

View File

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

View File

@ -28,17 +28,42 @@
</style> </style>
<div class="container mt-4"> <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 mb-4">
<div class="card-body"> <div class="card-body">
<p><strong>ID:</strong> {{ sar.id }}</p> <table>
<div> <tr>
<p>Created at: {{ sar.created }}</p> <td>
<p>Last updated: {{ sar.updated }}</p> <div class="card-mb5">
</div> <div class="card-body">
<p><strong>Start Date:</strong> {{ sar.start_date }}</p> <div>
<p><strong>Manager:</strong> {{ sar.manager }}</p> <p>Created at: {{ sar.created }}</p>
<!-- Other SAR details --> <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>
</div> </div>
@ -55,10 +80,12 @@
<div class="comment"> <div class="comment">
<div class="card mb-4"> <div class="card mb-4">
<div class="card-body"> <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 mb-5">
<div class="card-body"> <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>
</div> </div>
{% for gpx_track in comments_with_gpx %} {% for gpx_track in comments_with_gpx %}