diff --git a/templates/admin/shifts.html b/templates/admin/shifts.html index 6ecf436..664dc8b 100644 --- a/templates/admin/shifts.html +++ b/templates/admin/shifts.html @@ -129,10 +129,28 @@
+ {% set daily_sites = all_sites | selectattr('check_type', 'equalto', 'daily') | list %} + {% set weekly_sites = all_sites | selectattr('check_type', 'equalto', 'weekly') | list %} + {% set other_sites = all_sites | rejectattr('check_type', 'in', ['daily','weekly']) | list %}
- {% for w in all_sites %} + {% if daily_sites %} +
Daily
+ {% for w in daily_sites %} {% endfor %} + {% endif %} + {% if weekly_sites %} +
Weekly
+ {% for w in weekly_sites %} + + {% endfor %} + {% endif %} + {% if other_sites %} +
Other
+ {% for w in other_sites %} + + {% endfor %} + {% endif %}
@@ -192,9 +210,18 @@ function buildShiftForm(s) { `).join(''); - const sites = ALL_SITES.map(w => ` - `).join(''); + const siteGroups = [ + { label: 'Daily', items: ALL_SITES.filter(w => w.check_type === 'daily') }, + { label: 'Weekly', items: ALL_SITES.filter(w => w.check_type === 'weekly') }, + { label: 'Other', items: ALL_SITES.filter(w => w.check_type !== 'daily' && w.check_type !== 'weekly') }, + ]; + const sites = siteGroups.filter(g => g.items.length).map(g => + `
${g.label}
` + + g.items.map(w => + `` + ).join('') + ).join(''); return `
@@ -238,6 +265,17 @@ function esc(s) { return (s||'').replace(/&/g,'&').replace(/"/g,'"').re