Add sticky header styles and improve visibility for timetable display
This commit is contained in:
+17
-16
@@ -49,8 +49,8 @@ def main(
|
||||
time_to_run: int = 60 * 60 * 8,
|
||||
ratio: float = 0.001,
|
||||
start_date: datetime.datetime = "2026-03-02",
|
||||
weeks: int = 26,
|
||||
bom: float = 1.5,
|
||||
weeks: int = 27,
|
||||
bom: float = 1,
|
||||
):
|
||||
rota_start_date = start_date.date()
|
||||
suspend_on_finish = suspend
|
||||
@@ -59,7 +59,7 @@ def main(
|
||||
rota_start_date,
|
||||
weeks_to_rota=weeks,
|
||||
balance_offset_modifier=bom,
|
||||
name="proc_rota1",
|
||||
name="proc_rota2",
|
||||
)
|
||||
# Rota = RotaBuilder(start_date, weeks_to_rota=20, balance_offset_modifier=1)
|
||||
Rota.constraint_options["balance_shifts"] = False
|
||||
@@ -95,7 +95,7 @@ def main(
|
||||
length=12.5,
|
||||
days=days[:5],
|
||||
balance_offset=2,
|
||||
constraints=[MaxShiftsPerWeekConstraint(max_shifts=2)],
|
||||
constraints=[MaxShiftsPerWeekConstraint(max_shifts=1)],
|
||||
),
|
||||
SingleShift(
|
||||
sites=(
|
||||
@@ -110,6 +110,7 @@ def main(
|
||||
length=12.5,
|
||||
days=days[:4],
|
||||
balance_offset=4,
|
||||
constraints=[MaxShiftsPerWeekConstraint(max_shifts=1)],
|
||||
),
|
||||
SingleShift(
|
||||
sites=("torbay", "torbay twilights", "torbay twilights and weekends"),
|
||||
@@ -131,7 +132,7 @@ def main(
|
||||
days=days[:5],
|
||||
balance_offset=2,
|
||||
workers_required=1,
|
||||
constraints=[MaxShiftsPerWeekConstraint(max_shifts=2)],
|
||||
constraints=[MaxShiftsPerWeekConstraint(max_shifts=1)],
|
||||
),
|
||||
SingleShift(
|
||||
sites=(
|
||||
@@ -139,12 +140,12 @@ def main(
|
||||
"exeter twilights and weekends",
|
||||
"exeter no nights",
|
||||
"exeter weekends",
|
||||
"exeter twilights",
|
||||
#"exeter twilights",
|
||||
),
|
||||
name="weekend_exeter",
|
||||
length=12.5,
|
||||
days=days[5:],
|
||||
balance_offset=2,
|
||||
#balance_offset=2,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
constraints=[PostShiftConstraint(days=2), PreShiftConstraint(days=2)],
|
||||
@@ -161,10 +162,10 @@ def main(
|
||||
name="weekend_truro",
|
||||
length=12.5,
|
||||
days=days[4:],
|
||||
balance_offset=3,
|
||||
# rota_on_nwds=True,
|
||||
# force_as_block=True,
|
||||
assign_as_block=True,
|
||||
#balance_offset=3,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
#assign_as_block=True,
|
||||
constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
||||
# force_as_block_unless_nwd=True
|
||||
),
|
||||
@@ -173,7 +174,7 @@ def main(
|
||||
name="weekend_torbay",
|
||||
length=12.5,
|
||||
days=days[4:],
|
||||
balance_offset=2,
|
||||
#balance_offset=2,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
||||
@@ -189,7 +190,7 @@ def main(
|
||||
name="weekend_plymouth1",
|
||||
length=8,
|
||||
days=days[5:],
|
||||
balance_offset=2.9,
|
||||
#balance_offset=2.9,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
@@ -204,7 +205,7 @@ def main(
|
||||
name="weekend_plymouth2",
|
||||
length=8,
|
||||
days=days[5:],
|
||||
balance_offset=2.9,
|
||||
#balance_offset=2.9,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
@@ -231,7 +232,7 @@ def main(
|
||||
name="night_weekday",
|
||||
length=12.25,
|
||||
days=days[:4],
|
||||
balance_offset=3.9,
|
||||
#balance_offset=3.9,
|
||||
balance_weighting=1,
|
||||
# hard_constrain_shift=False,
|
||||
workers_required=4,
|
||||
@@ -258,7 +259,7 @@ def main(
|
||||
name="night_weekend",
|
||||
length=12.25,
|
||||
days=days[4:],
|
||||
balance_offset=2.9,
|
||||
#balance_offset=2.9,
|
||||
balance_weighting=1,
|
||||
# hard_constrain_shift=False,
|
||||
workers_required=4,
|
||||
|
||||
@@ -466,6 +466,36 @@ renderWorkerList();
|
||||
// Column for prior-adjustment (hidden by default)
|
||||
h.append(`<th class='prior-adjust-col' style='display:none'>Prior Adjust</th>`);
|
||||
|
||||
// Ensure header styles for visibility and stickiness are present
|
||||
if ($('#tsummary-style').length === 0) {
|
||||
$('head').append(`
|
||||
<style id='tsummary-style'>
|
||||
/* Compact timetable styles */
|
||||
table.tsummary { border-collapse: collapse; width: 100%; overflow: auto; font-size: 12px; }
|
||||
table.tsummary th, table.tsummary td { border: 1px solid #eee; padding: 2px 4px; }
|
||||
table.tsummary th { background: #fafafa; position: sticky; top: 0; z-index: 5; white-space: nowrap; }
|
||||
/* Vertical headers for compact columns */
|
||||
table.tsummary th { writing-mode: vertical-rl; text-orientation: mixed; transform: rotate(180deg); padding: 4px 2px; height: 88px; font-size: 10px; }
|
||||
/* Keep prior-adjust column horizontal */
|
||||
table.tsummary th.prior-adjust-col { writing-mode: horizontal-tb; transform: none; height: auto; }
|
||||
/* Make header text readable */
|
||||
table.tsummary th > span { display: inline-block; transform: rotate(180deg); padding: 0 2px; }
|
||||
/* Ensure cells align under rotated headers */
|
||||
table.tsummary td { vertical-align: middle; white-space: nowrap; max-width: 6ch; overflow: hidden; text-overflow: ellipsis; }
|
||||
|
||||
/* Reduce worker summary and card sizes */
|
||||
.worker-summary { font-size: 11px; padding: 0px 6px; margin-bottom: 4px; }
|
||||
.worker-card { padding: 6px; margin-bottom: 4px; }
|
||||
|
||||
/* Compact shifts/settings table */
|
||||
table.shifts-table th, table.shifts-table td { padding: 4px 6px; font-size: 12px; }
|
||||
|
||||
/* Slightly thinner avoid highlight for compact layout */
|
||||
td.rota-day.avoid-shift.avoid-highlight { border-width: 1.5px !important; box-shadow: 0 0 4px rgba(255,140,0,0.18); }
|
||||
</style>
|
||||
`);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(".table-div .worker-row .worker").each((n, tr) => {
|
||||
|
||||
Reference in New Issue
Block a user