Serve level_kinds from server, use for both validation and UI

This commit is contained in:
Ian Gulliver
2026-02-16 10:15:18 -08:00
parent 4c487a251b
commit d225a8c5d0
2 changed files with 14 additions and 22 deletions

View File

@@ -411,11 +411,7 @@ async function loadStudents() {
const addRow = document.createElement('div');
addRow.className = 'constraint-add';
const levelKinds = {
student: ['prefer', 'prefer_not'],
parent: ['must_not'],
admin: ['must', 'prefer', 'prefer_not', 'must_not']
};
const levelKinds = me.level_kinds;
const levelSelect = document.createElement('wa-select');
levelSelect.size = 'small';
for (const level of ['student', 'parent', 'admin']) {
@@ -618,9 +614,7 @@ async function renderMemberView(me) {
? { '': 'OK to room with', prefer: 'Would like to room with', prefer_not: 'Would prefer not to room with' }
: { '': 'OK to room with', must_not: 'Not OK to room with' };
const kindOptions = me.role === 'student'
? ['', 'prefer', 'prefer_not']
: ['', 'must_not'];
const kindOptions = ['', ...me.level_kinds[me.role]];
const pendingSelects = [];