04/06 adding some additional functions

This commit is contained in:
2026-04-06 18:02:16 -04:00
parent bc236a3d19
commit 299bf2ca05
12 changed files with 1142 additions and 9 deletions
@@ -0,0 +1,71 @@
{% extends "base.html" %}
{% block title %}{{ 'Edit' if item else 'New' }} Quick Reply{% endblock %}
{% block page_title %}{{ 'Edit' if item else 'New' }} Quick Reply{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-lg-7">
<div class="card">
<div class="card-header">
<i class="bi bi-chat-square-text me-2"></i>
{{ 'Edit Quick Reply' if item else 'Create Quick Reply' }}
</div>
<div class="card-body">
<form method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<div class="mb-3">
<label class="form-label">Title *
<span class="text-muted fw-normal" style="font-size:12px;">
— shown in the dropdown menu on ticket comments
</span>
</label>
<input type="text" class="form-control" name="title" required maxlength="120"
value="{{ item.title if item else '' }}"
placeholder="e.g. Please restart and confirm"/>
</div>
<div class="mb-3">
<label class="form-label">Category
<span class="text-muted fw-normal" style="font-size:12px;">— optional grouping label</span>
</label>
<input type="text" class="form-control" name="category" maxlength="50"
value="{{ item.category if item and item.category else '' }}"
placeholder="e.g. Hardware, Software, Escalation"/>
</div>
<div class="mb-3">
<label class="form-label">Response Body *
<span class="text-muted fw-normal" style="font-size:12px;">— Markdown supported</span>
</label>
<textarea class="form-control" name="body" rows="8" required
placeholder="Please restart your device and let us know if the issue persists.">{{ item.body if item else '' }}</textarea>
<div class="form-text">
Use **bold**, _italic_, `code`, and - lists. This text will be inserted
directly into the comment box when selected.
</div>
</div>
{% if item %}
<div class="mb-4 d-flex align-items-center gap-2">
<input type="checkbox" id="is_active" name="is_active"
{% if item.is_active %}checked{% endif %}
style="accent-color:var(--accent);width:16px;height:16px;"/>
<label for="is_active" style="font-size:14px;margin:0;cursor:pointer;">
Active (visible to IT staff in the quick replies dropdown)
</label>
</div>
{% endif %}
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">
<i class="bi bi-check2 me-2"></i>{{ 'Save Changes' if item else 'Create Quick Reply' }}
</button>
<a href="{{ url_for('admin.canned_responses') }}" class="btn btn-secondary">Cancel</a>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
+63
View File
@@ -0,0 +1,63 @@
{% extends "base.html" %}
{% block title %}Quick Replies{% endblock %}
{% block page_title %}Quick Replies{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<p style="color:var(--muted);font-size:13px;margin:0;">
Pre-written responses that IT staff can insert into ticket comments with one click.
</p>
<a href="{{ url_for('admin.canned_response_new') }}" class="btn btn-primary">
<i class="bi bi-plus-circle me-1"></i>New Quick Reply
</a>
</div>
{% if items %}
{% set ns = namespace(last_cat='') %}
{% for item in items %}
{% if item.category and item.category != ns.last_cat %}
<h6 style="font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.8px;
color:var(--muted);margin:20px 0 8px;">{{ item.category }}</h6>
{% set ns.last_cat = item.category %}
{% elif not item.category and ns.last_cat %}
<h6 style="font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.8px;
color:var(--muted);margin:20px 0 8px;">Uncategorised</h6>
{% set ns.last_cat = '' %}
{% endif %}
<div class="card mb-2 {% if not item.is_active %}opacity-50{% endif %}">
<div class="card-body py-3 px-4 d-flex align-items-start gap-3">
<div style="flex:1;min-width:0;">
<div class="d-flex align-items-center gap-2 mb-1">
<span style="font-size:14px;font-weight:600;">{{ item.title }}</span>
{% if not item.is_active %}
<span class="badge bg-secondary" style="font-size:10px;">Inactive</span>
{% endif %}
</div>
<div style="font-size:13px;color:var(--muted);white-space:pre-wrap;max-height:60px;overflow:hidden;text-overflow:ellipsis;">{{ item.body }}</div>
<div style="font-size:11px;color:var(--muted2);margin-top:4px;">
Added by {{ item.creator.full_name }} · {{ item.created_at.strftime('%b %d, %Y') }}
</div>
</div>
<div class="d-flex gap-2 flex-shrink-0">
<a href="{{ url_for('admin.canned_response_edit', item_id=item.id) }}"
class="btn btn-secondary btn-sm"><i class="bi bi-pencil"></i></a>
<form method="POST"
action="{{ url_for('admin.canned_response_delete', item_id=item.id) }}"
onsubmit="return confirm('Delete this quick reply?')">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button>
</form>
</div>
</div>
</div>
{% endfor %}
{% else %}
<div class="card">
<div class="p-5 text-center" style="color:var(--muted);">
<i class="bi bi-chat-square-text" style="font-size:40px;display:block;margin-bottom:12px;"></i>
No quick replies yet. Create one to speed up IT responses.
</div>
</div>
{% endif %}
{% endblock %}