Jul 30 - Internal handler files

This commit is contained in:
2026-07-30 12:14:04 -04:00
parent d9bf4be709
commit ceb0b806af
7 changed files with 323 additions and 20 deletions
+87
View File
@@ -46,6 +46,93 @@
</div>
{% endif %}
{# ── Handled By (phase44) — staff only; customers stay internal ── #}
{% if current_user.role != 'customer' %}
<hr class="my-3">
<p class="fw-semibold mb-2">
<i class="bi bi-person-check me-1 text-secondary"></i>Handled By
</p>
<div class="mb-3">
{{ form.handler_type(class="form-select", id="handlerTypeSelect") }}
<div class="form-text" id="handlerTypeHelp"></div>
</div>
<div id="internalHandlerFields">
<div class="mb-2">
{{ form.internal_handler_name.label(class="form-label small fw-semibold mb-1") }}
{{ form.internal_handler_name(class="form-control form-control-sm",
placeholder="Crew member handling this") }}
</div>
<div class="mb-3">
{{ form.internal_handler_contact.label(class="form-label small fw-semibold mb-1") }}
{{ form.internal_handler_contact(class="form-control form-control-sm",
placeholder="Phone or email") }}
</div>
</div>
<div id="facilityHandlerFields" style="display:none;">
<div class="mb-2">
{{ form.facility_handler_name.label(class="form-label small fw-semibold mb-1") }}
{{ form.facility_handler_name(class="form-control form-control-sm",
placeholder="Contact name at the facility") }}
</div>
<div class="mb-2">
{{ form.facility_handler_contact.label(class="form-label small fw-semibold mb-1") }}
{{ form.facility_handler_contact(class="form-control form-control-sm",
placeholder="Phone or email") }}
</div>
<div class="mb-3">
{{ form.facility_handler_notes.label(class="form-label small fw-semibold mb-1") }}
{{ form.facility_handler_notes(class="form-control form-control-sm", rows=2,
placeholder="Notes about what they are handling…") }}
</div>
</div>
<div id="vendorHandlerFields" style="display:none;">
<div class="mb-2">
{{ form.vendor_name.label(class="form-label small fw-semibold mb-1") }}
{{ form.vendor_name(class="form-control form-control-sm",
placeholder="Contractor or vendor name") }}
</div>
<div class="mb-2">
{{ form.vendor_contact.label(class="form-label small fw-semibold mb-1") }}
{{ form.vendor_contact(class="form-control form-control-sm",
placeholder="Phone or email") }}
</div>
<div class="mb-3">
{{ form.vendor_notes.label(class="form-label small fw-semibold mb-1") }}
{{ form.vendor_notes(class="form-control form-control-sm", rows=2,
placeholder="Scope, quote reference, etc.") }}
</div>
</div>
<script>
(function(){
var sel = document.getElementById('handlerTypeSelect');
var help = document.getElementById('handlerTypeHelp');
var boxes = {
internal: document.getElementById('internalHandlerFields'),
facility: document.getElementById('facilityHandlerFields'),
vendor: document.getElementById('vendorHandlerFields')
};
var notes = {
internal: {{ (issue_handler_descriptions or {}).get('internal', '')|tojson }},
facility: {{ (issue_handler_descriptions or {}).get('facility', '')|tojson }},
vendor: {{ (issue_handler_descriptions or {}).get('vendor', '')|tojson }}
};
function sync(){
var v = sel ? sel.value : 'internal';
for (var k in boxes){
if (boxes[k]) { boxes[k].style.display = (k === v) ? '' : 'none'; }
}
if (help) { help.textContent = notes[v] || ''; }
}
if (sel){ sel.addEventListener('change', sync); }
sync();
})();
</script>
{% endif %}
<div class="d-flex gap-2">
<button type="submit" class="btn btn-danger">Log Issue</button>
<a href="{{ url_for('issues.index') }}" class="btn btn-outline-secondary">Cancel</a>
+33 -5
View File
@@ -76,10 +76,11 @@
<dt class="col-sm-3">Assigned To</dt>
<dd class="col-sm-9">{{ issue.assigned_user.display_name if issue.assigned_user else '— Unassigned —' }}</dd>
{% if issue.handler_type and issue.handler_type != 'internal' %}
{% set _ht = issue.handler_type or 'internal' %}
{% if _ht != 'internal' or issue.internal_handler_name or issue.internal_handler_contact %}
<dt class="col-sm-3">Handled By</dt>
<dd class="col-sm-9">
{% if issue.handler_type == 'facility' %}
{% if _ht == 'facility' %}
<span class="badge bg-secondary">
<i class="bi bi-building me-1"></i>Facility Staff
</span>
@@ -92,8 +93,18 @@
{% if issue.facility_handler_notes %}
<div class="text-muted small mt-1" style="white-space:pre-wrap;">{{ issue.facility_handler_notes }}</div>
{% endif %}
{% elif issue.handler_type == 'vendor' %}
{% elif _ht == 'vendor' %}
<span class="badge bg-dark"><i class="bi bi-person-gear me-1"></i>External Vendor</span>
{% else %}
<span class="badge bg-light text-dark border">
<i class="bi bi-people me-1"></i>Janitorial Staff
</span>
{% if issue.internal_handler_name %}
<span class="ms-2 fw-semibold">{{ issue.internal_handler_name }}</span>
{% endif %}
{% if issue.internal_handler_contact %}
<span class="text-muted ms-2">{{ issue.internal_handler_contact }}</span>
{% endif %}
{% endif %}
</dd>
{% endif %}
@@ -416,13 +427,30 @@
placeholder="Notes about what they are handling…") }}
</div>
</div>
<div id="internalHandlerFields"
style="{{ '' if (issue.handler_type or 'internal') == 'internal' else 'display:none;' }}">
<div class="mb-2">
{{ form.internal_handler_name.label(class="form-label small fw-semibold mb-1") }}
{{ form.internal_handler_name(class="form-control form-control-sm",
placeholder="Crew member handling this",
value=issue.internal_handler_name or '') }}
</div>
<div class="mb-3">
{{ form.internal_handler_contact.label(class="form-label small fw-semibold mb-1") }}
{{ form.internal_handler_contact(class="form-control form-control-sm",
placeholder="Phone or email",
value=issue.internal_handler_contact or '') }}
</div>
</div>
<script>
(function(){
var sel = document.getElementById('handlerTypeSelect');
var box = document.getElementById('facilityHandlerFields');
if(sel && box){
var inv = document.getElementById('internalHandlerFields');
if(sel){
sel.addEventListener('change', function(){
box.style.display = (this.value === 'facility') ? '' : 'none';
if(box){ box.style.display = (this.value === 'facility') ? '' : 'none'; }
if(inv){ inv.style.display = (this.value === 'internal') ? '' : 'none'; }
});
}
})();