Files
BellScheduler/app/templates/events.html

45 lines
2.0 KiB
HTML

{% extends 'base.html' %}
{% set currDay = datetime.now() %}
{% set currDay = currDay.astimezone(ZoneInfo(current_user.timezone)) %}
{% set currTime = currDay.strftime('%I:%M %p') %}
{% set currDay = currDay.strftime('%m-%d-%Y') %}
{% block content %}
<span><h1>{% block title %} Events {% endblock %}</h1></span>
<b>Current Date: {{ currDay }} </b> <br> <b>Current Time: {{ currTime }}</b> <br> <br>
<div>
{% for period in periods %}
<div>
<p><b>Period {{ period.period }}</b> <br> Time: {{ period.periodTime.strftime("%I:%M %p") }} </p>
{% for event in events if event.scheduled_date == currDay and event.period == period %}
<div class="float-right"><a type="button" class="btn btn-primary" href="/event/edit/{{ event.id }}">Edit</a></div>
{% if event.task_id != None %}
<b>
<a href="/task/{{ event.tasks.id }}">
{{ event.tasks.title }}
</a>
</b>
<div>
{% if event.tasks.description != None %}
{% set description = event.tasks.description %}
{% set url_regex = '(https?://[^\s]+)' %}
{% set match = re.search(url_regex, description) %}
{% if match %}
{% set url = match.group(0) %}
{% set rest = description[match.end(0):] %}
<p>{{ description[:match.start(0)] }}<a href="{{ url }}">{{ url }}</a>{{ rest }}</p>
{% else %}
<p>{{ description }}</p>
{% endif %}
{% endif %}
</div>
{% else %}
<div><p>(no task assigned... yet)</p></div>
{% endif %}
{% endfor %}
<hr>
</div>
{% endfor %}
</div>
{% endblock %}