feat: enhance shift cancellation process and update templates

Improved the shift cancellation functionality to ensure that selected shifts are properly marked as cancelled, with corresponding emails queued for affected signups. Updated the admin interface to reflect these changes, including clearer messaging for cancelled shifts. Enhanced the handling of weekly templates to ensure that shifts are accurately updated or removed based on their status. Adjusted related tests to verify the new behavior and ensure consistency across the application.
This commit is contained in:
blake committed 2026-10-29 18:02:08 -05:00
1 parent e363cdaef9
commit 1b78a06f72
10 files changed
+956 -352

No files matched your search

+92 -7
View File
@@ -2715,6 +2715,32 @@ button.btn-quiet::before {
color: #6a5314;
}
.need-day-count.is-full {
color: #1f7a43;
}
.event-page .need-pick {
display: grid;
grid-template-columns: auto minmax(0, 1fr);
align-items: center;
gap: 0.35rem;
}
.event-page .need-pick .desk-row {
min-width: 0;
}
.event-page .desk-row.is-ended {
background: #eef1f4;
color: #6b7784;
}
.event-page .desk-row.is-ended:hover,
.event-page .desk-row.is-ended:focus-visible {
background: #e4e9ee;
color: #6b7784;
}
.need-day .desk-rows {
gap: 0.35rem;
}
@@ -2847,13 +2873,10 @@ button.btn-quiet::before {
color: #1f7a43;
}
.need-day .desk-row.is-covered {
background: #f3faf5;
}
.need-day .desk-row.is-covered:hover,
.need-day .desk-row.is-covered:focus-visible {
background: #e5f6eb;
.desk-row .need-pill,
.fill-pill {
justify-content: center;
min-width: 8.75rem;
}
.desk-full {
@@ -4383,6 +4406,68 @@ main > .crumb,
color: #7d8b99;
}
.event-panel-actions {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 0.35rem;
}
/* Cancel and Remove sit in the heading row. Showing them stays inside that line, so the shift list does not move down. */
.event-page .event-panel-head:has(> .event-panel-actions) {
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
}
.event-page .event-panel-head:has(> .event-panel-actions) > :first-child {
min-width: 0;
}
.event-page .event-panel-head > .event-panel-actions {
flex: none;
flex-wrap: nowrap;
align-items: center;
margin-left: auto;
}
.event-page .event-panel-head > .event-panel-tools {
flex: none;
}
.event-page .event-panel-actions .btn {
min-height: 2.2rem;
padding: 0.2rem 0.9rem;
box-shadow: none;
font-size: 0.92rem;
line-height: 1.2;
width: auto;
flex: 0 0 auto;
}
.event-page .event-panel-actions .btn:hover,
.event-page .event-panel-actions .btn:active {
transform: none;
}
@media (max-width: 42em) {
.event-page .event-panel-head:has(> .event-panel-actions) {
flex-wrap: wrap;
}
.event-page .event-panel-head:has(> .event-panel-actions) > :first-child {
flex: 1 1 auto;
}
.event-page .event-panel-head > .event-panel-actions {
flex: 1 1 100%;
order: 3;
justify-content: flex-end;
margin-left: 0;
min-height: 2.2rem;
}
}
.event-panel-note {
margin: 0.15rem 0 0;
color: #7d8b99;
+9 -4
View File
@@ -47,12 +47,17 @@
}
var pick = link.getAttribute('data-confirm-pick');
if (!pick) return;
var gate = text(link, 'data-confirm-gate') || 'removable';
var flag = gate === 'open' ? 'data-open' : 'data-removable';
var verb = text(link, 'data-confirm-verb') || 'removed';
var blockedBody = text(link, 'data-confirm-blocked') || 'Cancel this shift, or wait until it has ended, before removing it.';
var partialNote = text(link, 'data-confirm-partial') || 'The others stay until they are cancelled or have ended.';
var chosen = chosenFor(pick);
var kept = [];
var blocked = 0;
var weekly = false;
chosen.forEach(function (box) {
if (box.getAttribute('data-removable') === 'false') {
if (box.getAttribute(flag) === 'false') {
blocked += 1;
return;
}
@@ -62,7 +67,7 @@
var weeklyNote = text(link, 'data-confirm-note-weekly');
var notes = [];
if (kept.length === 0 && blocked > 0) {
body.textContent = 'Cancel this shift, or wait until it has ended, before removing it.';
body.textContent = blockedBody;
submit.hidden = true;
submit.disabled = true;
cancel.textContent = 'Close';
@@ -78,10 +83,10 @@
input.setAttribute('data-picked', '');
form.appendChild(input);
});
if (blocked > 0) notes.push('The others stay until they are cancelled or have ended.');
if (blocked > 0) notes.push(partialNote);
}
if (blocked > 0 && kept.length > 0) {
detail.textContent = kept.length + ' of ' + chosen.length + ' can be removed';
detail.textContent = kept.length + ' of ' + chosen.length + ' can be ' + verb;
} else {
detail.textContent = chosen.length === 1 ? '1 selected' : chosen.length + ' selected';
}