cmsmanage/tasks/templates/tasks/taskDetail.dj.html

131 lines
4.2 KiB
HTML

{% extends "base.dj.html" %}
{% load widget_tweaks %}
{% block title %}{{ tool.name }} - {{ task.name }} | {{ block.super }}{% endblock %}
{% block admin_link %}
{% url 'admin:tasks_task_change' task.id %}
{% endblock %}
{% block nav_extra %}
{% if user.is_authenticated %}
{% if task_subs or tool_subs %}
<span class="nav-item dropdown">
<button class="btn nav-link dropdown-toggle"
data-bs-toggle="dropdown"
aria-expanded="false">🔔</button>
<ul class="dropdown-menu">
<li>
<h6 class="dropdown-header">Group Task Subscriptions</h6>
</li>
{% for task_sub in task_subs %}
<li class="dropdown-item disabled text-reset">{{ task_sub.group }} - {{ task_sub.days_before }} days</li>
{% endfor %}
<li>
<hr class="dropdown-divider">
</li>
<li>
<h6 class="dropdown-header">Group Tool Subscriptions</h6>
</li>
{% for tool_sub in tool_subs %}
<li class="dropdown-item disabled text-reset">
{{ tool_sub.tool }} - {{ tool_sub.group }} - {{ tool_sub.days_before }} days
</li>
{% endfor %}
</ul>
</span>
{% else %}
<span class="navbar-text">🔕</span>
{% endif %}
{% endif %}
{% endblock %}
{% block content %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="{% url 'root' %}">Manage</a>
</li>
<li class="breadcrumb-item">
<a href="{% url 'tasks:index' %}">Tasks</a>
</li>
<li class="breadcrumb-item">
<a href="{{ tool.get_absolute_url }}">{{ tool.name }}</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ task.name }}</li>
</ol>
</nav>
<section>
<h2>Recurrence</h2>
<ul>
{% for rule in task.recurrence.rrules %}<li>{{ rule.to_text }}</li>{% endfor %}
</ul>
<p>Next scheduled time: {{ task.next_recurrence|date|default:"never" }}</p>
{% if task.is_overdue %}<div class="alert alert-danger">Task is overdue!</div>{% endif %}
</section>
<section>
<h2>Description</h2>
{{ task.description_html|safe }}
</section>
{% if form.errors %}
<div class="alert alert-warning">
<h3>Error:</h3>
{{ form.errors }}
</div>
{% endif %}
{% if user.is_authenticated %}
<div class="d-md-none">
<h2>Log a Maintenance Event</h2>
<form class="form-group" method="post">
{% csrf_token %}
<fieldset class="form-group">
{{ form.date.label_tag }}
{% render_field form.date type="date" class="form-control" %}
</fieldset>
<fieldset class="form-group">
{{ form.user.label_tag }}
{% render_field form.user class="form-control" %}
</fieldset>
<fieldset class="form-group">
{{ form.notes.label_tag }}
{% render_field form.notes class="form-control form-control-sm" rows="2" %}
</fieldset>
<input type="submit" class="btn btn-primary" value="Submit">
</form>
{{ form.media }}
</div>
{% endif %}
<h2>Event Log</h2>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Date</th>
<th>User</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{% if user.is_authenticated %}
<tr class="d-none d-md-table-row">
<form method="post">
{% csrf_token %}
<td>{% render_field form.date type="date" class="form-control" %}</td>
<td>{% render_field form.user class="form-control" style="width: initial;" %}</td>
<td>{% render_field form.notes class="form-control form-control-sm" %}</td>
<td>
<input type="submit" class="btn btn-primary" value="Submit">
</td>
</form>
</tr>
{% endif %}
{% for event in events|dictsortreversed:"date" %}
<tr>
<td class="text-nowrap">{{ event.date }}</td>
<td>{{ event.user }}</td>
<td>
{{ event.notes_html|safe }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}