Commit ·
f1289ac
1
Parent(s): 8bbbac1
正社員の希望休(off_request)に赤網掛けを表示
Browse files- シフト表画面:CSS 45度斜線ハッチング(repeating-linear-gradient)
- Excel:lightDown PatternFill(赤斜線網掛け)
- PDF:薄赤背景 + 「休」赤文字
全出力で pattern_id == 'off_request' の正社員を一貫して識別する
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- export/excel_exporter.py +10 -1
- export/pdf_exporter.py +10 -1
- routes/schedule.py +10 -0
- templates/schedule/index.html +11 -1
export/excel_exporter.py
CHANGED
|
@@ -28,6 +28,7 @@ FILL_WD_H = PatternFill("solid", fgColor="E2E8F0") # 薄グレー(平日
|
|
| 28 |
FILL_SAT_D = PatternFill("solid", fgColor="EFF6FF") # 極薄青(土曜データ)
|
| 29 |
FILL_SUN_D = PatternFill("solid", fgColor="FFF1F2") # 極薄赤(日曜データ)
|
| 30 |
FILL_LEAVE = PatternFill("solid", fgColor="D1FAE5") # 緑(有給)
|
|
|
|
| 31 |
FILL_WHITE = PatternFill("solid", fgColor="FFFFFF") # 白(通常・白地)
|
| 32 |
FILL_EVEN = PatternFill("solid", fgColor="FFFFFF") # 白(偶数行も白で統一)
|
| 33 |
FILL_SUMMARY = PatternFill("solid", fgColor="F8FAFC") # 集計行
|
|
@@ -42,6 +43,7 @@ FONT_NAME = Font(bold=True, size=9)
|
|
| 42 |
FONT_DATA = Font(size=9)
|
| 43 |
FONT_NOTE = Font(size=8, bold=True)
|
| 44 |
FONT_LEAVE = Font(color="166534", bold=True, size=9) # 有給:緑
|
|
|
|
| 45 |
FONT_OFF = Font(color="9CA3AF", size=9)
|
| 46 |
FONT_SUM = Font(size=8)
|
| 47 |
|
|
@@ -94,6 +96,10 @@ def _get_shift_text(
|
|
| 94 |
req = req_map.get((emp_id, date_str))
|
| 95 |
note = (req.note or "").strip() if req else ""
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
# 有給チェック(paid_leave パターン or メモに「有給」)
|
| 98 |
if (req and req.pattern_id == "paid_leave") or "有給" in note:
|
| 99 |
return "有給", "leave"
|
|
@@ -278,7 +284,10 @@ def export_excel(
|
|
| 278 |
is_h = date_str in holidays
|
| 279 |
text, style = _get_shift_text(emp.id, date_str, assignments, req_map)
|
| 280 |
|
| 281 |
-
if style == "
|
|
|
|
|
|
|
|
|
|
| 282 |
fill = FILL_LEAVE
|
| 283 |
font = FONT_LEAVE
|
| 284 |
elif style == "off":
|
|
|
|
| 28 |
FILL_SAT_D = PatternFill("solid", fgColor="EFF6FF") # 極薄青(土曜データ)
|
| 29 |
FILL_SUN_D = PatternFill("solid", fgColor="FFF1F2") # 極薄赤(日曜データ)
|
| 30 |
FILL_LEAVE = PatternFill("solid", fgColor="D1FAE5") # 緑(有給)
|
| 31 |
+
FILL_FT_OFF = PatternFill(patternType="lightDown", fgColor="DC2626", bgColor="FFFFFF") # 赤斜線(正社員希望休)
|
| 32 |
FILL_WHITE = PatternFill("solid", fgColor="FFFFFF") # 白(通常・白地)
|
| 33 |
FILL_EVEN = PatternFill("solid", fgColor="FFFFFF") # 白(偶数行も白で統一)
|
| 34 |
FILL_SUMMARY = PatternFill("solid", fgColor="F8FAFC") # 集計行
|
|
|
|
| 43 |
FONT_DATA = Font(size=9)
|
| 44 |
FONT_NOTE = Font(size=8, bold=True)
|
| 45 |
FONT_LEAVE = Font(color="166534", bold=True, size=9) # 有給:緑
|
| 46 |
+
FONT_FT_OFF = Font(color="DC2626", bold=True, size=9) # 正社員希望休:赤
|
| 47 |
FONT_OFF = Font(color="9CA3AF", size=9)
|
| 48 |
FONT_SUM = Font(size=8)
|
| 49 |
|
|
|
|
| 96 |
req = req_map.get((emp_id, date_str))
|
| 97 |
note = (req.note or "").strip() if req else ""
|
| 98 |
|
| 99 |
+
# 正社員希望休
|
| 100 |
+
if req and req.pattern_id == "off_request":
|
| 101 |
+
return "休", "ft_off"
|
| 102 |
+
|
| 103 |
# 有給チェック(paid_leave パターン or メモに「有給」)
|
| 104 |
if (req and req.pattern_id == "paid_leave") or "有給" in note:
|
| 105 |
return "有給", "leave"
|
|
|
|
| 284 |
is_h = date_str in holidays
|
| 285 |
text, style = _get_shift_text(emp.id, date_str, assignments, req_map)
|
| 286 |
|
| 287 |
+
if style == "ft_off":
|
| 288 |
+
fill = FILL_FT_OFF
|
| 289 |
+
font = FONT_FT_OFF
|
| 290 |
+
elif style == "leave":
|
| 291 |
fill = FILL_LEAVE
|
| 292 |
font = FONT_LEAVE
|
| 293 |
elif style == "off":
|
export/pdf_exporter.py
CHANGED
|
@@ -38,6 +38,8 @@ COL_TXT_SAT = colors.HexColor("#1D4ED8") # 土曜文字(青)
|
|
| 38 |
COL_TXT_SUN = colors.HexColor("#DC2626") # 日曜文字(赤)
|
| 39 |
COL_TXT_OFF = colors.HexColor("#9CA3AF") # 休み文字
|
| 40 |
COL_TXT_LEAVE = colors.HexColor("#166534") # 有給文字(緑)
|
|
|
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
# ── フォント登録 ─────────────────────────────────────────────────────────
|
|
@@ -104,6 +106,10 @@ def _get_shift_text(
|
|
| 104 |
req = req_map.get((emp_id, date_str))
|
| 105 |
note = (req.note or "").strip() if req else ""
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
if (req and req.pattern_id == "paid_leave") or "有給" in note:
|
| 108 |
return "有給", "leave"
|
| 109 |
|
|
@@ -278,7 +284,10 @@ def _build_block_table(
|
|
| 278 |
dow = d.weekday()
|
| 279 |
text, style = _get_shift_text(emp.id, date_str, assignments, req_map)
|
| 280 |
is_h = date_str in _hols
|
| 281 |
-
if style == "
|
|
|
|
|
|
|
|
|
|
| 282 |
cmds.append(("BACKGROUND", (col, r), (col, r), COL_LEAVE))
|
| 283 |
cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_TXT_LEAVE))
|
| 284 |
elif style == "off":
|
|
|
|
| 38 |
COL_TXT_SUN = colors.HexColor("#DC2626") # 日曜文字(赤)
|
| 39 |
COL_TXT_OFF = colors.HexColor("#9CA3AF") # 休み文字
|
| 40 |
COL_TXT_LEAVE = colors.HexColor("#166534") # 有給文字(緑)
|
| 41 |
+
COL_FT_OFF_BG = colors.HexColor("#FEE2E2") # 正社員希望休背景(薄赤)
|
| 42 |
+
COL_FT_OFF_TX = colors.HexColor("#DC2626") # 正社員希望休文字(赤)
|
| 43 |
|
| 44 |
|
| 45 |
# ── フォント登録 ─────────────────────────────────────────────────────────
|
|
|
|
| 106 |
req = req_map.get((emp_id, date_str))
|
| 107 |
note = (req.note or "").strip() if req else ""
|
| 108 |
|
| 109 |
+
# 正社員希望休
|
| 110 |
+
if req and req.pattern_id == "off_request":
|
| 111 |
+
return "休", "ft_off"
|
| 112 |
+
|
| 113 |
if (req and req.pattern_id == "paid_leave") or "有給" in note:
|
| 114 |
return "有給", "leave"
|
| 115 |
|
|
|
|
| 284 |
dow = d.weekday()
|
| 285 |
text, style = _get_shift_text(emp.id, date_str, assignments, req_map)
|
| 286 |
is_h = date_str in _hols
|
| 287 |
+
if style == "ft_off":
|
| 288 |
+
cmds.append(("BACKGROUND", (col, r), (col, r), COL_FT_OFF_BG))
|
| 289 |
+
cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_FT_OFF_TX))
|
| 290 |
+
elif style == "leave":
|
| 291 |
cmds.append(("BACKGROUND", (col, r), (col, r), COL_LEAVE))
|
| 292 |
cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_TXT_LEAVE))
|
| 293 |
elif style == "off":
|
routes/schedule.py
CHANGED
|
@@ -204,6 +204,15 @@ def index(period_id):
|
|
| 204 |
submitted_ids = {r.employee_id for r in shift_requests}
|
| 205 |
unsubmitted_count = sum(1 for e in all_employees if e.id not in submitted_ids)
|
| 206 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
holidays = holiday_set(dates)
|
| 208 |
|
| 209 |
# 社員デフォルト勤務時間(ポジション別・設定画面で変更可能)
|
|
@@ -239,6 +248,7 @@ def index(period_id):
|
|
| 239 |
needs_regen=needs_regen,
|
| 240 |
unsubmitted_count=unsubmitted_count,
|
| 241 |
reservation_counts=reservation_counts,
|
|
|
|
| 242 |
today=today,
|
| 243 |
ft_times=ft_times,
|
| 244 |
holidays=holidays,
|
|
|
|
| 204 |
submitted_ids = {r.employee_id for r in shift_requests}
|
| 205 |
unsubmitted_count = sum(1 for e in all_employees if e.id not in submitted_ids)
|
| 206 |
|
| 207 |
+
# 正社員の希望休日(off_request)セット
|
| 208 |
+
ft_off_dates = {
|
| 209 |
+
(r.employee_id, r.date)
|
| 210 |
+
for r in shift_requests
|
| 211 |
+
if r.pattern_id == 'off_request'
|
| 212 |
+
and emp_map.get(r.employee_id) is not None
|
| 213 |
+
and emp_map[r.employee_id].employment_type.value == 'full_time'
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
holidays = holiday_set(dates)
|
| 217 |
|
| 218 |
# 社員デフォルト勤務時間(ポジション別・設定画面で変更可能)
|
|
|
|
| 248 |
needs_regen=needs_regen,
|
| 249 |
unsubmitted_count=unsubmitted_count,
|
| 250 |
reservation_counts=reservation_counts,
|
| 251 |
+
ft_off_dates=ft_off_dates,
|
| 252 |
today=today,
|
| 253 |
ft_times=ft_times,
|
| 254 |
holidays=holidays,
|
templates/schedule/index.html
CHANGED
|
@@ -119,6 +119,15 @@
|
|
| 119 |
.chip-hall { background: #dbeafe; color: #1e40af; border-radius: 4px; padding: 1px 5px; font-size: .75rem; }
|
| 120 |
.chip-kitchen { background: #dcfce7; color: #166534; border-radius: 4px; padding: 1px 5px; font-size: .75rem; }
|
| 121 |
.chip-empty { color: #cbd5e1; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
/* スタッフ名リンク */
|
| 123 |
.emp-name-link {
|
| 124 |
color: inherit; text-decoration: none; display: block;
|
|
@@ -410,7 +419,8 @@
|
|
| 410 |
{% set default_slot_time = ft_times.get(pos, ft_times['hall'])[slot] %}
|
| 411 |
{% set req_time = time_map.get((emp.id, ds, slot), '') %}
|
| 412 |
{% set display_time = req_time if req_time else (default_slot_time if is_ft else '') %}
|
| 413 |
-
|
|
|
|
| 414 |
style="cursor:pointer"
|
| 415 |
data-emp-id="{{ emp.id }}"
|
| 416 |
data-emp-name="{{ emp.name }}"
|
|
|
|
| 119 |
.chip-hall { background: #dbeafe; color: #1e40af; border-radius: 4px; padding: 1px 5px; font-size: .75rem; }
|
| 120 |
.chip-kitchen { background: #dcfce7; color: #166534; border-radius: 4px; padding: 1px 5px; font-size: .75rem; }
|
| 121 |
.chip-empty { color: #cbd5e1; }
|
| 122 |
+
/* 正社員の希望休:赤斜線ハッチング */
|
| 123 |
+
.ft-off {
|
| 124 |
+
background-image: repeating-linear-gradient(
|
| 125 |
+
45deg,
|
| 126 |
+
rgba(220,38,38,.18) 0px, rgba(220,38,38,.18) 1.5px,
|
| 127 |
+
transparent 1.5px, transparent 7px
|
| 128 |
+
);
|
| 129 |
+
background-color: #fff1f2;
|
| 130 |
+
}
|
| 131 |
/* スタッフ名リンク */
|
| 132 |
.emp-name-link {
|
| 133 |
color: inherit; text-decoration: none; display: block;
|
|
|
|
| 419 |
{% set default_slot_time = ft_times.get(pos, ft_times['hall'])[slot] %}
|
| 420 |
{% set req_time = time_map.get((emp.id, ds, slot), '') %}
|
| 421 |
{% set display_time = req_time if req_time else (default_slot_time if is_ft else '') %}
|
| 422 |
+
{% set is_ft_off = (emp.id, ds) in ft_off_dates %}
|
| 423 |
+
<td class="text-center {{ 'sun' if (dow == 6 or is_holiday) else 'sat' if dow == 5 else '' }} {{ 'today-col' if ds == today else '' }} assign-cell {{ 'ft-off' if is_ft_off else '' }}"
|
| 424 |
style="cursor:pointer"
|
| 425 |
data-emp-id="{{ emp.id }}"
|
| 426 |
data-emp-name="{{ emp.name }}"
|