39 lines
8.5 KiB
HTML
39 lines
8.5 KiB
HTML
{% extends 'inventory/base.html' %}{% load inventory_tags %}{% block title %}Gerät #{{ device.number }}{% endblock %}{% block content %}
|
|
<section class="narrow-page wide-form"><div class="page-head device-detail-head"><div><a class="back" href="{{ list_url }}">← Zur Geräteliste</a><h1>Gerät #{{ device.number }}</h1><p>Zuletzt geändert {{ device.updated_at|date:'d.m.Y H:i' }}</p></div><nav class="record-navigation" aria-label="Zwischen Geräten wechseln"><a class="btn icon{% if not previous_device_id %} disabled{% endif %}" {% if previous_device_id %}href="{% url 'inventory:device-detail' previous_device_id %}{% if navigation_query %}?{{ navigation_query }}{% endif %}"{% else %}aria-disabled="true"{% endif %} title="Vorheriges Gerät" aria-label="Vorheriges Gerät">←</a><span>{% if navigation_position %}{{ navigation_position }} / {{ navigation_total }}{% endif %}</span><a class="btn icon{% if not next_device_id %} disabled{% endif %}" {% if next_device_id %}href="{% url 'inventory:device-detail' next_device_id %}{% if navigation_query %}?{{ navigation_query }}{% endif %}"{% else %}aria-disabled="true"{% endif %} title="Nächstes Gerät" aria-label="Nächstes Gerät">→</a></nav></div>
|
|
<div class="device-workbench">
|
|
<section><h2>Ablauf: {{ device.get_stage_display }}</h2>
|
|
<p>Eingang → Inspektion → bei Bedarf Reparatur → Lagerung → Ausgabe</p>
|
|
{% if can_edit_devices and not device.archived_at and next_stages %}
|
|
<form method="post" action="{% url 'inventory:device-advance' device.pk %}" class="app-form">
|
|
{% csrf_token %}<input type="hidden" name="expected_revision" value="{{ device.revision }}">
|
|
<label>Nächster Schritt<select name="stage" required>{% for value, label in next_stages %}<option value="{{ value }}">{{ label }}</option>{% endfor %}</select></label>
|
|
<label>Notiz<input name="note" maxlength="500"></label><button class="btn primary">Schritt übernehmen</button>
|
|
</form>{% endif %}
|
|
<div class="mini-history">{% for event in workflow_events %}<div><span>{{ event.created_at|date:'d.m.Y H:i' }}</span><strong>{{ event.get_from_stage_display }} → {{ event.get_to_stage_display }}</strong><small>{{ event.note }}{% if event.user %} · {{ event.user.username }}{% endif %}</small></div>{% empty %}<p>Noch keine Schritte erfasst.</p>{% endfor %}</div>
|
|
{% if inspections %}<h3>Inspektionsbefunde</h3><div class="mini-history">{% for record in inspections %}<div><span>{{ record.created_at|date:'d.m.Y H:i' }}</span><strong>{{ record.defects|linebreaksbr }}</strong><small>{% if record.recorded_by %}{{ record.recorded_by.username }}{% endif %}</small></div>{% endfor %}</div>{% endif %}
|
|
{% if repairs %}<h3>Reparaturen</h3><div class="mini-history">{% for record in repairs %}<div><span>{{ record.created_at|date:'d.m.Y H:i' }}</span><strong>{{ record.work_done|linebreaksbr }}</strong><small>{% if record.recorded_by %}{{ record.recorded_by.username }}{% endif %}</small></div>{% endfor %}</div>{% endif %}
|
|
</section>
|
|
<section><h2>Aufgaben</h2>
|
|
{% for task in tasks %}<div class="form-card"><strong>{{ task.title }}</strong> · {{ task.get_state_display }}{% if task.due_date %} · fällig {{ task.due_date|date:'d.m.Y' }}{% endif %}{% if task.assigned_to %} · {{ task.assigned_to.username }}{% endif %}{% if task.description %}<p>{{ task.description|linebreaksbr }}</p>{% endif %}
|
|
{% if can_edit_devices and task.state == 'OPEN' %}<form method="post" action="{% url 'inventory:device-task-complete' device.pk task.pk %}">{% csrf_token %}<button class="btn">Erledigt</button></form>{% endif %}</div>{% empty %}<p>Keine Aufgaben vorhanden.</p>{% endfor %}
|
|
{% if can_edit_devices and not device.archived_at and device.stage != 'ISSUED' %}<form method="post" action="{% url 'inventory:device-task-add' device.pk %}" class="app-form">
|
|
{% csrf_token %}<label>Neue Aufgabe<input name="title" maxlength="200" required></label>
|
|
<label>Beschreibung<textarea name="description" rows="2"></textarea></label>
|
|
<label>Zuständig<select name="assigned_to"><option value="">Noch offen</option>{% for assignee in task_assignees %}<option value="{{ assignee.pk }}">{{ assignee.username }}</option>{% endfor %}</select></label>
|
|
<label>Fällig am<input name="due_date" type="date"></label><button class="btn primary">Aufgabe anlegen</button>
|
|
</form>{% endif %}
|
|
</section>
|
|
</div>
|
|
<form method="post" class="detail-form" data-device-type-form data-readonly="{{ can_edit_devices|yesno:'false,true' }}">{% csrf_token %}<input type="hidden" name="expected_revision" value="{{ device.revision }}">{{ form.non_field_errors }}
|
|
<datalist id="suggestions-ram_gb">{% for item in ram_suggestions %}<option value="{{ item.numeric_value|floatformat:'-2' }}">{% endfor %}</datalist><datalist id="suggestions-ssd_gb">{% for item in ssd_suggestions %}<option value="{{ item.numeric_value|floatformat:'-2' }}">{% endfor %}</datalist><datalist id="suggestions-hdd_gb">{% for item in hdd_suggestions %}<option value="{{ item.numeric_value|floatformat:'-2' }}">{% endfor %}</datalist><datalist id="suggestions-display_inches">{% for item in display_suggestions %}<option value="{{ item.numeric_value|floatformat:'-2' }}">{% endfor %}</datalist>
|
|
<section><h2>Allgemein</h2><div class="form-grid">{% for field in form %}{% if field.name == 'shelf' or field.name == 'status' or field.name == 'date' or field.name == 'device_type' or field.name == 'model' %}<label>{{ field.label }}{{ field }}{{ field.errors }}</label>{% endif %}{% endfor %}</div></section>
|
|
<section data-hardware-section><h2>Hardware <small data-selected-type-label></small></h2><div class="form-grid">{% for field in form %}{% if field.name in all_hardware_fields %}<label data-hardware-field="{{ field.name }}"{% if field.name not in hardware_fields %} hidden{% endif %}>{{ field.label }}{{ field }}{{ field.errors }}</label>{% endif %}{% endfor %}</div></section>
|
|
<section><h2>Verwaltung</h2><div class="form-grid">{% for field in form %}{% if field.name == 'ticket' or field.name == 'employee' or field.name == 'recipient' or field.name == 'location' or field.name == 'donor' or field.name == 'price' %}<label>{{ field.label }}{{ field }}{{ field.errors }}</label>{% endif %}{% endfor %}</div></section>
|
|
<section><h2>Notizen</h2>{% for field in form %}{% if field.name == 'comment' %}<label>{{ field.label }}{{ field }}{{ field.errors }}</label>{% endif %}{% endfor %}</section>
|
|
{% if definitions %}<section><h2>Zusatzfelder</h2><div class="form-grid">{% for field in definitions %}<label>{{ field.name }}{% if field.field_type == 'select' %}<select name="custom_{{ field.key }}"><option value="">—</option>{% for option in field.options.all %}{% if option.active %}<option {% if device.custom_values|get_item:field.key == option.label %}selected{% endif %}>{{ option.label }}</option>{% endif %}{% endfor %}</select>{% elif field.field_type == 'multi_select' %}<select name="custom_{{ field.key }}" multiple>{% for option in field.options.all %}{% if option.active %}<option {% if device.custom_values|get_item:field.key|contains_value:option.label %}selected{% endif %}>{{ option.label }}</option>{% endif %}{% endfor %}</select>{% elif field.field_type == 'long_text' %}<textarea name="custom_{{ field.key }}">{{ device.custom_values|get_item:field.key }}</textarea>{% elif field.field_type == 'boolean' %}<select name="custom_{{ field.key }}"><option value="">—</option><option value="true">JA</option><option value="false">NEIN</option></select>{% elif field.field_type == 'date' %}<input name="custom_{{ field.key }}" value="{{ device.custom_values|get_item:field.key|german_date }}" type="text" placeholder="TT.MM.JJJJ" inputmode="numeric" data-german-date>{% else %}<input name="custom_{{ field.key }}" value="{{ device.custom_values|get_item:field.key }}" type="{% if field.field_type == 'integer' or field.field_type == 'decimal' %}number{% else %}text{% endif %}">{% endif %}{% if field.unit %}<small>{{ field.unit }}</small>{% endif %}</label>{% endfor %}</div></section>{% endif %}
|
|
<div class="sticky-actions"><a class="btn" href="{{ list_url }}">Abbrechen</a>{% if can_edit_devices %}<button class="btn primary">Änderungen speichern</button>{% endif %}</div>
|
|
</form>
|
|
{% if can_edit_devices and not device.archived_at %}<form method="post" action="{% url 'inventory:archive-device' device.pk %}" data-confirm="Gerät #{{ device.number }} wirklich archivieren?" data-confirm-action="Archivieren" class="archive-action">{% csrf_token %}<button class="btn danger" type="submit">Gerät archivieren</button></form>{% endif %}
|
|
{{ type_field_map|json_script:'device-type-fields' }}
|
|
</section>{% endblock %}
|