Jun 26 - Update - Shift new/edit modal has separate website list by daily/weekly

This commit is contained in:
2026-06-26 14:32:05 -04:00
parent 2106fd60a4
commit 26ae7c0cb7
+42 -4
View File
@@ -129,10 +129,28 @@
</div>
<div class="form-group">
<label class="form-label">Assign Websites</label>
{% 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 %}
<div class="checkbox-list">
{% for w in all_sites %}
{% if daily_sites %}
<div class="site-type-header">Daily</div>
{% for w in daily_sites %}
<label><input type="checkbox" name="website_ids[]" value="{{ w.id }}"> {{ w.name }}</label>
{% endfor %}
{% endif %}
{% if weekly_sites %}
<div class="site-type-header">Weekly</div>
{% for w in weekly_sites %}
<label><input type="checkbox" name="website_ids[]" value="{{ w.id }}"> {{ w.name }}</label>
{% endfor %}
{% endif %}
{% if other_sites %}
<div class="site-type-header">Other</div>
{% for w in other_sites %}
<label><input type="checkbox" name="website_ids[]" value="{{ w.id }}"> {{ w.name }}</label>
{% endfor %}
{% endif %}
</div>
</div>
<div class="form-group">
@@ -192,9 +210,18 @@ function buildShiftForm(s) {
<label><input type="checkbox" name="user_ids[]" value="${u.id}"
${s.user_ids.includes(u.id)?'checked':''}> ${u.username}</label>`).join('');
const sites = ALL_SITES.map(w => `
<label><input type="checkbox" name="website_ids[]" value="${w.id}"
${s.website_ids.includes(w.id)?'checked':''}> ${w.name}</label>`).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 =>
`<div class="site-type-header">${g.label}</div>` +
g.items.map(w =>
`<label><input type="checkbox" name="website_ids[]" value="${w.id}"
${s.website_ids.includes(w.id)?'checked':''}> ${esc(w.name)}</label>`
).join('')
).join('');
return `
<div class="form-group"><label class="form-label">Shift Name *</label>
@@ -238,6 +265,17 @@ function esc(s) { return (s||'').replace(/&/g,'&amp;').replace(/"/g,'&quot;').re
</script>
<style>
.site-type-header {
font-size: .7rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: .06em;
color: var(--text-muted);
padding: .55rem .1rem .2rem;
margin-top: .25rem;
border-top: 1px solid var(--border);
}
.site-type-header:first-child { border-top: none; margin-top: 0; padding-top: .1rem; }
.cal-today { background: #eff6ff !important; }
.cal-today th, thead .cal-today {
background: #dbeafe !important;