04/07 updated timezone, report via email, etc

This commit is contained in:
2026-04-07 11:24:08 -04:00
parent 56c65bfe4c
commit fed51f8c28
14 changed files with 1022 additions and 29 deletions
+131
View File
@@ -18,6 +18,45 @@
{% endfor %}
{% endwith %}
<!-- Timezone -->
<div class="card mb-4" style="max-width:680px;">
<div class="card-header" style="padding:16px 20px;border-bottom:1px solid var(--border);">
<h5 class="mb-0" style="font-size:15px;font-weight:600;">
<i class="bi bi-clock me-2"></i>Date &amp; Time
</h5>
</div>
<div class="card-body" style="padding:20px;">
<p style="font-size:13px;color:var(--muted);margin-bottom:20px;">
All timestamps are stored in UTC internally. This setting controls how they are
displayed throughout the application — tickets, comments, history, and logs.
</p>
<form method="POST" action="{{ url_for('admin.settings') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="hidden" name="form_type" value="timezone">
<div class="mb-3">
<label class="form-label">Display Timezone</label>
<select class="form-select" name="app_timezone" style="max-width:400px;">
{% for tz_value, tz_label in common_timezones %}
<option value="{{ tz_value }}" {% if tz_value == current_tz %}selected{% endif %}>
{{ tz_label }}
</option>
{% endfor %}
{% if current_tz not in common_timezones|map(attribute=0)|list %}
<option value="{{ current_tz }}" selected>{{ current_tz }}</option>
{% endif %}
</select>
<div class="form-text">
Current setting: <strong>{{ current_tz }}</strong>
local time is <strong>{{ now_local.strftime('%b %d, %Y %H:%M %Z') }}</strong>
</div>
</div>
<button type="submit" class="btn btn-primary">
<i class="bi bi-check2 me-2"></i>Save Timezone
</button>
</form>
</div>
</div>
<!-- Branding -->
<div class="card mb-4" style="max-width:680px;">
<div class="card-header" style="padding:16px 20px;border-bottom:1px solid var(--border);">
@@ -113,6 +152,98 @@
</div>
</div>
<!-- Email Ingestion -->
<div class="card mb-4" style="max-width:680px;">
<div class="card-header" style="padding:16px 20px;border-bottom:1px solid var(--border);">
<h5 class="mb-0" style="font-size:15px;font-weight:600;">
<i class="bi bi-envelope-arrow-down me-2"></i>Email-to-Ticket Ingestion
</h5>
</div>
<div class="card-body" style="padding:20px;">
<p style="font-size:13px;color:var(--muted);margin-bottom:20px;">
When enabled, TechDesk polls a dedicated IMAP mailbox and automatically converts
inbound emails into tickets. Use a dedicated support inbox with an app-specific password.
</p>
<form method="POST" action="{{ url_for('admin.settings') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="hidden" name="form_type" value="email_ingestion">
<!-- Enable toggle -->
<div class="d-flex align-items-center gap-3 mb-4 p-3"
style="border:1px solid var(--border);border-radius:10px;background:var(--surface);">
<div style="flex:1;">
<div style="font-weight:600;font-size:14px;">
<i class="bi bi-power me-2"></i>Enable Email Ingestion
</div>
<div style="font-size:12px;color:var(--muted);margin-top:3px;">
Start polling the mailbox below for new tickets.
</div>
</div>
<div class="form-check form-switch mb-0">
<input class="form-check-input" type="checkbox" role="switch"
id="email-ingestion-toggle" name="email_ingestion_enabled" value="1"
{% if email_settings.enabled %}checked{% endif %}
style="width:40px;height:22px;cursor:pointer;"/>
</div>
</div>
<div class="row g-3">
<div class="col-md-8">
<label class="form-label">IMAP Host</label>
<input type="text" class="form-control" name="email_ingestion_host"
value="{{ email_settings.host }}" placeholder="e.g. imap.gmail.com"/>
</div>
<div class="col-md-4">
<label class="form-label">Port</label>
<input type="number" class="form-control" name="email_ingestion_port"
value="{{ email_settings.port }}" placeholder="993"/>
</div>
<div class="col-md-6">
<label class="form-label">Mailbox Username / Email</label>
<input type="text" class="form-control" name="email_ingestion_user"
value="{{ email_settings.user }}" placeholder="support@yourcompany.com"/>
</div>
<div class="col-md-6">
<label class="form-label">Password
<span style="font-size:11px;color:var(--muted);font-weight:400;">
— use an app-specific password
</span>
</label>
<input type="password" class="form-control" name="email_ingestion_password"
value="{{ email_settings.password }}" placeholder="Leave blank to keep current"/>
</div>
<div class="col-md-4">
<label class="form-label">Watch Folder</label>
<input type="text" class="form-control" name="email_ingestion_folder"
value="{{ email_settings.folder }}" placeholder="INBOX"/>
</div>
<div class="col-md-4">
<label class="form-label">Processed Folder</label>
<input type="text" class="form-control" name="email_ingestion_move_to"
value="{{ email_settings.move_to }}" placeholder="Processed"/>
</div>
<div class="col-md-4">
<label class="form-label">Poll Interval (minutes)</label>
<input type="number" class="form-control" name="email_ingestion_interval"
value="{{ email_settings.interval }}" min="1" max="60" placeholder="5"/>
</div>
</div>
<div class="alert alert-info mt-3 mb-0" style="font-size:12px;">
<i class="bi bi-info-circle me-2"></i>
<strong>Note:</strong> For Gmail, enable IMAP in Settings → Forwarding and POP/IMAP,
and use an App Password (Google Account → Security → 2-Step Verification → App passwords).
For other providers, ensure IMAP is enabled and check their specific settings.
</div>
<button type="submit" class="btn btn-primary mt-3">
<i class="bi bi-check2 me-2"></i>Save Email Settings
</button>
</form>
</div>
</div>
<!-- Registration -->
<div class="card" style="max-width:680px;">
<div class="card-header" style="padding:16px 20px;border-bottom:1px solid var(--border);">