Jul 8 - Update issue assignment separation

This commit is contained in:
2026-07-08 14:05:57 -04:00
parent b06d939ac0
commit f08ca997d7
4 changed files with 100 additions and 2 deletions
+14
View File
@@ -732,6 +732,20 @@ def create():
reported_at = now_eastern(),
reported_by = current_user.id,
)
# "Handled By" — staff only; customer-created issues stay internal.
if current_user.role != 'customer':
handler = form.handler_type.data or 'internal'
if handler not in ('internal', 'facility', 'vendor'):
handler = 'internal'
issue.handler_type = handler
issue.facility_handler_name = (form.facility_handler_name.data or '').strip() or None
issue.facility_handler_contact = (form.facility_handler_contact.data or '').strip() or None
issue.facility_handler_notes = (form.facility_handler_notes.data or '').strip() or None
issue.vendor_name = (form.vendor_name.data or '').strip() or None
issue.vendor_contact = (form.vendor_contact.data or '').strip() or None
issue.vendor_notes = (form.vendor_notes.data or '').strip() or None
db.session.add(issue)
db.session.commit()
current_app.logger.info(
+69 -1
View File
@@ -39,10 +39,55 @@
{% endfor %}
{% if current_user.role != 'customer' %}
<div class="mb-3">
{{ form.assigned_to.label(class="form-label fw-semibold") }}
{{ form.handler_type.label(class="form-label fw-semibold") }}
{{ form.handler_type(class="form-select", id="handler_type_select") }}
</div>
<div class="mb-3">
<label class="form-label fw-semibold" id="assigned_to_label">Assign To</label>
{{ form.assigned_to(class="form-select") }}
<div class="form-text" id="assigned_to_help" style="display:none;">
The facility/vendor does the work; this is our follow-up owner.
</div>
{% for e in form.assigned_to.errors %}<div class="text-danger small">{{ e }}</div>{% endfor %}
</div>
{# Facility-staff handler — shown when Handled By = Facility Staff #}
<div id="facility_handler_block" 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="Facility staff / point of contact") }}
</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="What the facility staff are handling…") }}
</div>
</div>
{# External vendor — shown when Handled By = External Vendor #}
<div id="vendor_block" 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="Notes about what the contractor is handling…") }}
</div>
</div>
{% endif %}
<div class="d-flex gap-2">
@@ -109,6 +154,29 @@
} else {
setPlaceholder();
}
// ── "Handled By" — reveal the facility/vendor sub-block + relabel assignee ──
var handlerSelect = document.getElementById('handler_type_select');
function syncHandlerUI() {
if (!handlerSelect) { return; }
var v = handlerSelect.value;
var facBlock = document.getElementById('facility_handler_block');
var venBlock = document.getElementById('vendor_block');
if (facBlock) { facBlock.style.display = (v === 'facility') ? '' : 'none'; }
if (venBlock) { venBlock.style.display = (v === 'vendor') ? '' : 'none'; }
var label = document.getElementById('assigned_to_label');
var help = document.getElementById('assigned_to_help');
if (label) {
label.textContent = (v === 'facility' || v === 'vendor') ? 'Follow-up Owner' : 'Assign To';
}
if (help) {
help.style.display = (v === 'facility' || v === 'vendor') ? '' : 'none';
}
}
if (handlerSelect) {
handlerSelect.addEventListener('change', syncHandlerUI);
syncHandlerUI();
}
}());
</script>
{% endblock %}
+12
View File
@@ -171,6 +171,18 @@ class IssueForm(FlaskForm):
FileAllowed(['jpg','jpeg','png','gif'], 'Images only.')
])
assigned_to = SelectField('Assign To', coerce=int, validators=[Optional()])
# Who handles the issue (phase35) — set at creation by staff
handler_type = SelectField('Handled By', choices=[
('internal', 'Our Staff'),
('facility', 'Facility Staff'),
('vendor', 'External Vendor'),
], validators=[Optional()])
facility_handler_name = StringField('Facility Contact Name', validators=[Optional(), Length(max=100)])
facility_handler_contact = StringField('Facility Contact', validators=[Optional(), Length(max=200)])
facility_handler_notes = TextAreaField('Facility Handling Notes', validators=[Optional(), Length(max=1000)])
vendor_name = StringField('Contractor Name', validators=[Optional(), Length(max=100)])
vendor_contact = StringField('Contractor Contact', validators=[Optional(), Length(max=200)])
vendor_notes = TextAreaField('Contractor Notes', validators=[Optional(), Length(max=1000)])
class IssueUpdateForm(FlaskForm):