Jun 26 - Update - Shift new/edit modal has separate website list by daily/weekly
This commit is contained in:
@@ -129,10 +129,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">Assign Websites</label>
|
<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">
|
<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>
|
<label><input type="checkbox" name="website_ids[]" value="{{ w.id }}"> {{ w.name }}</label>
|
||||||
{% endfor %}
|
{% 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>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -192,9 +210,18 @@ function buildShiftForm(s) {
|
|||||||
<label><input type="checkbox" name="user_ids[]" value="${u.id}"
|
<label><input type="checkbox" name="user_ids[]" value="${u.id}"
|
||||||
${s.user_ids.includes(u.id)?'checked':''}> ${u.username}</label>`).join('');
|
${s.user_ids.includes(u.id)?'checked':''}> ${u.username}</label>`).join('');
|
||||||
|
|
||||||
const sites = ALL_SITES.map(w => `
|
const siteGroups = [
|
||||||
<label><input type="checkbox" name="website_ids[]" value="${w.id}"
|
{ label: 'Daily', items: ALL_SITES.filter(w => w.check_type === 'daily') },
|
||||||
${s.website_ids.includes(w.id)?'checked':''}> ${w.name}</label>`).join('');
|
{ 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 `
|
return `
|
||||||
<div class="form-group"><label class="form-label">Shift Name *</label>
|
<div class="form-group"><label class="form-label">Shift Name *</label>
|
||||||
@@ -238,6 +265,17 @@ function esc(s) { return (s||'').replace(/&/g,'&').replace(/"/g,'"').re
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<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 { background: #eff6ff !important; }
|
||||||
.cal-today th, thead .cal-today {
|
.cal-today th, thead .cal-today {
|
||||||
background: #dbeafe !important;
|
background: #dbeafe !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user