Commit ·
9814978
1
Parent(s): 87d20ce
正社員の希望種別に「朝のみ可」「晩のみ可」を追加 (#10)
Browse files- pattern_id に am_only/pm_only を追加し、フレックス出勤を表現
- ソルバーに slot_block_map を導入し、朝のみ可→ディナー禁止/晩のみ可→朝食禁止のハード制約を全箇所に適用
- ShiftRequest._slot_coverage() で am_only/pm_only の breakfast/dinner カバレッジを正しく算出
- シフト入力画面に新状態のボタン・色分け・一括設定を追加
- Excel/PDF出力・スケジュール画面の表示に新パターンの色分けを追加
- export/excel_exporter.py +14 -0
- export/pdf_exporter.py +14 -0
- models/schedule.py +4 -0
- optimizer/solver.py +22 -3
- routes/schedule.py +4 -0
- templates/shifts/input.html +19 -2
export/excel_exporter.py
CHANGED
|
@@ -29,6 +29,8 @@ 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("solid", fgColor="FCA5A5") # 赤塗りつぶし(正社員希望休)
|
|
|
|
|
|
|
| 32 |
FILL_WHITE = PatternFill("solid", fgColor="FFFFFF") # 白(通常・白地)
|
| 33 |
FILL_EVEN = PatternFill("solid", fgColor="FFFFFF") # 白(偶数行も白で統一)
|
| 34 |
FILL_SUMMARY = PatternFill("solid", fgColor="F8FAFC") # 集計行
|
|
@@ -44,6 +46,8 @@ 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 |
|
|
@@ -109,6 +113,10 @@ def _get_shift_text(
|
|
| 109 |
d_raw = assignments.get((emp_id, date_str, TimeSlot.DINNER.value))
|
| 110 |
|
| 111 |
if not b_raw and not d_raw:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
return "-", "off"
|
| 113 |
|
| 114 |
# 4タプルから位置情報を展開
|
|
@@ -290,6 +298,12 @@ def export_excel(
|
|
| 290 |
elif style == "leave":
|
| 291 |
fill = FILL_LEAVE
|
| 292 |
font = FONT_LEAVE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
elif style == "off":
|
| 294 |
fill = FILL_SUN_D if (dow == 6 or is_h) else (FILL_SAT_D if dow == 5 else base_fill)
|
| 295 |
font = FONT_OFF
|
|
|
|
| 29 |
FILL_SUN_D = PatternFill("solid", fgColor="FFF1F2") # 極薄赤(日曜データ)
|
| 30 |
FILL_LEAVE = PatternFill("solid", fgColor="D1FAE5") # 緑(有給)
|
| 31 |
FILL_FT_OFF = PatternFill("solid", fgColor="FCA5A5") # 赤塗りつぶし(正社員希望休)
|
| 32 |
+
FILL_AM_ONLY = PatternFill("solid", fgColor="DBEAFE") # 水色(朝のみ可)
|
| 33 |
+
FILL_PM_ONLY = PatternFill("solid", fgColor="FED7AA") # オレンジ(晩のみ可)
|
| 34 |
FILL_WHITE = PatternFill("solid", fgColor="FFFFFF") # 白(通常・白地)
|
| 35 |
FILL_EVEN = PatternFill("solid", fgColor="FFFFFF") # 白(偶数行も白で統一)
|
| 36 |
FILL_SUMMARY = PatternFill("solid", fgColor="F8FAFC") # 集計行
|
|
|
|
| 46 |
FONT_NOTE = Font(size=8, bold=True)
|
| 47 |
FONT_LEAVE = Font(color="166534", bold=True, size=9) # 有給:緑
|
| 48 |
FONT_FT_OFF = Font(color="DC2626", bold=True, size=9) # 正社員希望休:赤
|
| 49 |
+
FONT_AM_ONLY = Font(color="1E40AF", bold=True, size=9) # 朝のみ可:青
|
| 50 |
+
FONT_PM_ONLY = Font(color="C2410C", bold=True, size=9) # 晩のみ可:オレンジ
|
| 51 |
FONT_OFF = Font(color="9CA3AF", size=9)
|
| 52 |
FONT_SUM = Font(size=8)
|
| 53 |
|
|
|
|
| 113 |
d_raw = assignments.get((emp_id, date_str, TimeSlot.DINNER.value))
|
| 114 |
|
| 115 |
if not b_raw and not d_raw:
|
| 116 |
+
if req and req.pattern_id == "am_only":
|
| 117 |
+
return "朝のみ可", "am_only"
|
| 118 |
+
if req and req.pattern_id == "pm_only":
|
| 119 |
+
return "晩のみ可", "pm_only"
|
| 120 |
return "-", "off"
|
| 121 |
|
| 122 |
# 4タプルから位置情報を展開
|
|
|
|
| 298 |
elif style == "leave":
|
| 299 |
fill = FILL_LEAVE
|
| 300 |
font = FONT_LEAVE
|
| 301 |
+
elif style == "am_only":
|
| 302 |
+
fill = FILL_AM_ONLY
|
| 303 |
+
font = FONT_AM_ONLY
|
| 304 |
+
elif style == "pm_only":
|
| 305 |
+
fill = FILL_PM_ONLY
|
| 306 |
+
font = FONT_PM_ONLY
|
| 307 |
elif style == "off":
|
| 308 |
fill = FILL_SUN_D if (dow == 6 or is_h) else (FILL_SAT_D if dow == 5 else base_fill)
|
| 309 |
font = FONT_OFF
|
export/pdf_exporter.py
CHANGED
|
@@ -40,6 +40,10 @@ COL_TXT_OFF = colors.HexColor("#9CA3AF") # 休み文字
|
|
| 40 |
COL_TXT_LEAVE = colors.HexColor("#166534") # 有給文字(緑)
|
| 41 |
COL_FT_OFF_BG = colors.HexColor("#FCA5A5") # 正社員希望休背景(赤塗りつぶし)
|
| 42 |
COL_FT_OFF_TX = colors.HexColor("#DC2626") # 正社員希望休文字(赤)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
# ── フォント登録 ─────────────────────────────────────────────────────────
|
|
@@ -117,6 +121,10 @@ def _get_shift_text(
|
|
| 117 |
d_raw = assignments.get((emp_id, date_str, TimeSlot.DINNER.value))
|
| 118 |
|
| 119 |
if not b_raw and not d_raw:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
return "-", "off"
|
| 121 |
|
| 122 |
# 4タプルから位置情報を展開
|
|
@@ -290,6 +298,12 @@ def _build_block_table(
|
|
| 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":
|
| 294 |
if dow == 6 or is_h:
|
| 295 |
cmds.append(("BACKGROUND", (col, r), (col, r), COL_SUN_D))
|
|
|
|
| 40 |
COL_TXT_LEAVE = colors.HexColor("#166534") # 有給文字(緑)
|
| 41 |
COL_FT_OFF_BG = colors.HexColor("#FCA5A5") # 正社員希望休背景(赤塗りつぶし)
|
| 42 |
COL_FT_OFF_TX = colors.HexColor("#DC2626") # 正社員希望休文字(赤)
|
| 43 |
+
COL_AM_ONLY_BG = colors.HexColor("#DBEAFE") # 朝のみ可背景(水色)
|
| 44 |
+
COL_AM_ONLY_TX = colors.HexColor("#1E40AF") # 朝のみ可文字(青)
|
| 45 |
+
COL_PM_ONLY_BG = colors.HexColor("#FED7AA") # 晩のみ可背景(オレンジ)
|
| 46 |
+
COL_PM_ONLY_TX = colors.HexColor("#C2410C") # 晩のみ可文字(オレンジ)
|
| 47 |
|
| 48 |
|
| 49 |
# ── フォント登録 ─────────────────────────────────────────────────────────
|
|
|
|
| 121 |
d_raw = assignments.get((emp_id, date_str, TimeSlot.DINNER.value))
|
| 122 |
|
| 123 |
if not b_raw and not d_raw:
|
| 124 |
+
if req and req.pattern_id == "am_only":
|
| 125 |
+
return "朝のみ可", "am_only"
|
| 126 |
+
if req and req.pattern_id == "pm_only":
|
| 127 |
+
return "晩のみ可", "pm_only"
|
| 128 |
return "-", "off"
|
| 129 |
|
| 130 |
# 4タプルから位置情報を展開
|
|
|
|
| 298 |
elif style == "leave":
|
| 299 |
cmds.append(("BACKGROUND", (col, r), (col, r), COL_LEAVE))
|
| 300 |
cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_TXT_LEAVE))
|
| 301 |
+
elif style == "am_only":
|
| 302 |
+
cmds.append(("BACKGROUND", (col, r), (col, r), COL_AM_ONLY_BG))
|
| 303 |
+
cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_AM_ONLY_TX))
|
| 304 |
+
elif style == "pm_only":
|
| 305 |
+
cmds.append(("BACKGROUND", (col, r), (col, r), COL_PM_ONLY_BG))
|
| 306 |
+
cmds.append(("TEXTCOLOR", (col, r), (col, r), COL_PM_ONLY_TX))
|
| 307 |
elif style == "off":
|
| 308 |
if dow == 6 or is_h:
|
| 309 |
cmds.append(("BACKGROUND", (col, r), (col, r), COL_SUN_D))
|
models/schedule.py
CHANGED
|
@@ -33,6 +33,10 @@ class ShiftRequest:
|
|
| 33 |
sp = ShiftPattern("_c", "カスタム", self.custom_start, self.custom_end)
|
| 34 |
return sp.covers_breakfast(), sp.covers_dinner()
|
| 35 |
return False, False
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
p = PATTERN_MAP.get(self.pattern_id)
|
| 37 |
return (p.covers_breakfast(), p.covers_dinner()) if p else (False, False)
|
| 38 |
|
|
|
|
| 33 |
sp = ShiftPattern("_c", "カスタム", self.custom_start, self.custom_end)
|
| 34 |
return sp.covers_breakfast(), sp.covers_dinner()
|
| 35 |
return False, False
|
| 36 |
+
if self.pattern_id == "am_only":
|
| 37 |
+
return True, False
|
| 38 |
+
if self.pattern_id == "pm_only":
|
| 39 |
+
return False, True
|
| 40 |
p = PATTERN_MAP.get(self.pattern_id)
|
| 41 |
return (p.covers_breakfast(), p.covers_dinner()) if p else (False, False)
|
| 42 |
|
optimizer/solver.py
CHANGED
|
@@ -136,9 +136,15 @@ def solve(
|
|
| 136 |
# 希望シフト(アルバイト用)と社員の休希望・有休を分けて管理
|
| 137 |
req_map: dict[tuple[int, str, str], bool] = {}
|
| 138 |
off_map: dict[tuple[int, str], bool] = {} # 社員の休希望・有休
|
|
|
|
|
|
|
| 139 |
for r in requests:
|
| 140 |
if r.pattern_id in ("off_request", "paid_leave"):
|
| 141 |
off_map[(r.employee_id, r.date)] = True
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
else:
|
| 143 |
if r.breakfast:
|
| 144 |
req_map[(r.employee_id, r.date, TimeSlot.BREAKFAST.value)] = True
|
|
@@ -261,8 +267,10 @@ def solve(
|
|
| 261 |
for slot in slots:
|
| 262 |
if emp.employment_type == EmploymentType.FULL_TIME:
|
| 263 |
# 社員:休希望・有休の日以外は常時出勤可
|
|
|
|
| 264 |
can_work = not off_map.get((emp.id, ds), False) \
|
| 265 |
-
and ds not in emp.fixed_unavailable_dates
|
|
|
|
| 266 |
elif slot == TimeSlot.BREAKFAST and emp.always_available_breakfast:
|
| 267 |
can_work = ds not in emp.fixed_unavailable_dates
|
| 268 |
elif slot == TimeSlot.DINNER and emp.always_available_dinner:
|
|
@@ -352,6 +360,7 @@ def solve(
|
|
| 352 |
req_map.get((emp.id, ds, TimeSlot.BREAKFAST.value))
|
| 353 |
or (emp.employment_type == EmploymentType.FULL_TIME
|
| 354 |
and not off_map.get((emp.id, ds), False)
|
|
|
|
| 355 |
and ds not in emp.fixed_unavailable_dates)
|
| 356 |
)
|
| 357 |
]
|
|
@@ -396,6 +405,7 @@ def solve(
|
|
| 396 |
or emp.always_available_breakfast
|
| 397 |
or (emp.employment_type == EmploymentType.FULL_TIME
|
| 398 |
and not off_map.get((emp.id, ds), False)
|
|
|
|
| 399 |
and ds not in emp.fixed_unavailable_dates)
|
| 400 |
]
|
| 401 |
if min_cln > 0 and cln_vars:
|
|
@@ -409,6 +419,7 @@ def solve(
|
|
| 409 |
or emp.always_available_breakfast
|
| 410 |
or (emp.employment_type == EmploymentType.FULL_TIME
|
| 411 |
and not off_map.get((emp.id, ds), False)
|
|
|
|
| 412 |
and ds not in emp.fixed_unavailable_dates)
|
| 413 |
]
|
| 414 |
if ldr_cln_vars:
|
|
@@ -562,6 +573,8 @@ def solve(
|
|
| 562 |
continue
|
| 563 |
if off_map.get((emp.id, ds), False) or ds in emp.fixed_unavailable_dates:
|
| 564 |
continue
|
|
|
|
|
|
|
| 565 |
if emp.primary_position is None or emp.can_work_both_positions:
|
| 566 |
continue # 両対応 FT は二重計上回避のためスキップ
|
| 567 |
if emp.primary_position.value != pos.value:
|
|
@@ -655,7 +668,9 @@ def solve(
|
|
| 655 |
logger.info(" [フェーズ2] ベストエフォート求解開始")
|
| 656 |
best_assignments, best_warnings = _solve_best_effort(
|
| 657 |
active_employees, date_strs, slots, positions,
|
| 658 |
-
req_map, off_map, req_hours, config,
|
|
|
|
|
|
|
| 659 |
reservation_counts=reservation_counts,
|
| 660 |
reserv_thresh_b=reserv_thresh_b, reserv_extra_b=reserv_extra_b,
|
| 661 |
reserv_thresh_d=reserv_thresh_d, reserv_extra_d=reserv_extra_d,
|
|
@@ -724,6 +739,7 @@ def _extract_assignments(solver, assign, active_employees, date_strs, slots, pos
|
|
| 724 |
def _solve_best_effort(
|
| 725 |
active_employees, date_strs, slots, positions,
|
| 726 |
req_map, off_map, req_hours, config: SolverConfig | None = None,
|
|
|
|
| 727 |
shift_constraints: dict | None = None,
|
| 728 |
reservation_counts: dict | None = None,
|
| 729 |
reserv_thresh_b: int = 0, reserv_extra_b: int = 0,
|
|
@@ -737,6 +753,8 @@ def _solve_best_effort(
|
|
| 737 |
if shift_constraints is None:
|
| 738 |
from db import repositories as repo
|
| 739 |
shift_constraints = repo.get_shift_constraints()
|
|
|
|
|
|
|
| 740 |
model = cp_model.CpModel()
|
| 741 |
|
| 742 |
assign: dict = {}
|
|
@@ -765,7 +783,8 @@ def _solve_best_effort(
|
|
| 765 |
for slot in slots:
|
| 766 |
if emp.employment_type == EmploymentType.FULL_TIME:
|
| 767 |
can_work = not off_map.get((emp.id, ds), False) \
|
| 768 |
-
and ds not in emp.fixed_unavailable_dates
|
|
|
|
| 769 |
elif slot == TimeSlot.BREAKFAST and emp.always_available_breakfast:
|
| 770 |
can_work = ds not in emp.fixed_unavailable_dates
|
| 771 |
elif slot == TimeSlot.DINNER and emp.always_available_dinner:
|
|
|
|
| 136 |
# 希望シフト(アルバイト用)と社員の休希望・有休を分けて管理
|
| 137 |
req_map: dict[tuple[int, str, str], bool] = {}
|
| 138 |
off_map: dict[tuple[int, str], bool] = {} # 社員の休希望・有休
|
| 139 |
+
# 社員のフレックス出勤(朝のみ可→ディナー不可、晩のみ可→朝食不可)
|
| 140 |
+
slot_block_map: dict[tuple[int, str], TimeSlot] = {}
|
| 141 |
for r in requests:
|
| 142 |
if r.pattern_id in ("off_request", "paid_leave"):
|
| 143 |
off_map[(r.employee_id, r.date)] = True
|
| 144 |
+
elif r.pattern_id == "am_only":
|
| 145 |
+
slot_block_map[(r.employee_id, r.date)] = TimeSlot.DINNER
|
| 146 |
+
elif r.pattern_id == "pm_only":
|
| 147 |
+
slot_block_map[(r.employee_id, r.date)] = TimeSlot.BREAKFAST
|
| 148 |
else:
|
| 149 |
if r.breakfast:
|
| 150 |
req_map[(r.employee_id, r.date, TimeSlot.BREAKFAST.value)] = True
|
|
|
|
| 267 |
for slot in slots:
|
| 268 |
if emp.employment_type == EmploymentType.FULL_TIME:
|
| 269 |
# 社員:休希望・有休の日以外は常時出勤可
|
| 270 |
+
# (朝のみ可/晩のみ可の日は該当しない時間帯への配置を禁止)
|
| 271 |
can_work = not off_map.get((emp.id, ds), False) \
|
| 272 |
+
and ds not in emp.fixed_unavailable_dates \
|
| 273 |
+
and slot_block_map.get((emp.id, ds)) != slot
|
| 274 |
elif slot == TimeSlot.BREAKFAST and emp.always_available_breakfast:
|
| 275 |
can_work = ds not in emp.fixed_unavailable_dates
|
| 276 |
elif slot == TimeSlot.DINNER and emp.always_available_dinner:
|
|
|
|
| 360 |
req_map.get((emp.id, ds, TimeSlot.BREAKFAST.value))
|
| 361 |
or (emp.employment_type == EmploymentType.FULL_TIME
|
| 362 |
and not off_map.get((emp.id, ds), False)
|
| 363 |
+
and slot_block_map.get((emp.id, ds)) != TimeSlot.BREAKFAST
|
| 364 |
and ds not in emp.fixed_unavailable_dates)
|
| 365 |
)
|
| 366 |
]
|
|
|
|
| 405 |
or emp.always_available_breakfast
|
| 406 |
or (emp.employment_type == EmploymentType.FULL_TIME
|
| 407 |
and not off_map.get((emp.id, ds), False)
|
| 408 |
+
and slot_block_map.get((emp.id, ds)) != TimeSlot.BREAKFAST
|
| 409 |
and ds not in emp.fixed_unavailable_dates)
|
| 410 |
]
|
| 411 |
if min_cln > 0 and cln_vars:
|
|
|
|
| 419 |
or emp.always_available_breakfast
|
| 420 |
or (emp.employment_type == EmploymentType.FULL_TIME
|
| 421 |
and not off_map.get((emp.id, ds), False)
|
| 422 |
+
and slot_block_map.get((emp.id, ds)) != TimeSlot.BREAKFAST
|
| 423 |
and ds not in emp.fixed_unavailable_dates)
|
| 424 |
]
|
| 425 |
if ldr_cln_vars:
|
|
|
|
| 573 |
continue
|
| 574 |
if off_map.get((emp.id, ds), False) or ds in emp.fixed_unavailable_dates:
|
| 575 |
continue
|
| 576 |
+
if slot_block_map.get((emp.id, ds)) == slot:
|
| 577 |
+
continue
|
| 578 |
if emp.primary_position is None or emp.can_work_both_positions:
|
| 579 |
continue # 両対応 FT は二重計上回避のためスキップ
|
| 580 |
if emp.primary_position.value != pos.value:
|
|
|
|
| 668 |
logger.info(" [フェーズ2] ベストエフォート求解開始")
|
| 669 |
best_assignments, best_warnings = _solve_best_effort(
|
| 670 |
active_employees, date_strs, slots, positions,
|
| 671 |
+
req_map, off_map, req_hours, config,
|
| 672 |
+
slot_block_map=slot_block_map,
|
| 673 |
+
shift_constraints=shift_constraints,
|
| 674 |
reservation_counts=reservation_counts,
|
| 675 |
reserv_thresh_b=reserv_thresh_b, reserv_extra_b=reserv_extra_b,
|
| 676 |
reserv_thresh_d=reserv_thresh_d, reserv_extra_d=reserv_extra_d,
|
|
|
|
| 739 |
def _solve_best_effort(
|
| 740 |
active_employees, date_strs, slots, positions,
|
| 741 |
req_map, off_map, req_hours, config: SolverConfig | None = None,
|
| 742 |
+
slot_block_map: dict | None = None,
|
| 743 |
shift_constraints: dict | None = None,
|
| 744 |
reservation_counts: dict | None = None,
|
| 745 |
reserv_thresh_b: int = 0, reserv_extra_b: int = 0,
|
|
|
|
| 753 |
if shift_constraints is None:
|
| 754 |
from db import repositories as repo
|
| 755 |
shift_constraints = repo.get_shift_constraints()
|
| 756 |
+
if slot_block_map is None:
|
| 757 |
+
slot_block_map = {}
|
| 758 |
model = cp_model.CpModel()
|
| 759 |
|
| 760 |
assign: dict = {}
|
|
|
|
| 783 |
for slot in slots:
|
| 784 |
if emp.employment_type == EmploymentType.FULL_TIME:
|
| 785 |
can_work = not off_map.get((emp.id, ds), False) \
|
| 786 |
+
and ds not in emp.fixed_unavailable_dates \
|
| 787 |
+
and slot_block_map.get((emp.id, ds)) != slot
|
| 788 |
elif slot == TimeSlot.BREAKFAST and emp.always_available_breakfast:
|
| 789 |
can_work = ds not in emp.fixed_unavailable_dates
|
| 790 |
elif slot == TimeSlot.DINNER and emp.always_available_dinner:
|
routes/schedule.py
CHANGED
|
@@ -69,6 +69,10 @@ def _build_time_map(requests) -> dict:
|
|
| 69 |
t = f"{r.custom_start}〜{r.custom_end}"
|
| 70 |
elif r.pattern_id == "double":
|
| 71 |
t = "6:00〜23:00"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
elif r.pattern_id:
|
| 73 |
p = PATTERN_MAP.get(r.pattern_id)
|
| 74 |
t = f"{p.start}〜{p.end}" if (p and p.start and p.end) else ""
|
|
|
|
| 69 |
t = f"{r.custom_start}〜{r.custom_end}"
|
| 70 |
elif r.pattern_id == "double":
|
| 71 |
t = "6:00〜23:00"
|
| 72 |
+
elif r.pattern_id == "am_only":
|
| 73 |
+
t = "朝のみ可"
|
| 74 |
+
elif r.pattern_id == "pm_only":
|
| 75 |
+
t = "晩のみ可"
|
| 76 |
elif r.pattern_id:
|
| 77 |
p = PATTERN_MAP.get(r.pattern_id)
|
| 78 |
t = f"{p.start}〜{p.end}" if (p and p.start and p.end) else ""
|
templates/shifts/input.html
CHANGED
|
@@ -103,6 +103,8 @@
|
|
| 103 |
.pat-work { background: #dcfce7; color: #166534; border-color: #86efac; }
|
| 104 |
.pat-ofr { background: #fecaca; color: #991b1b; border-color: #f87171; }
|
| 105 |
.pat-leave{ background: #fef9c3; color: #854d0e; border-color: #fde047; }
|
|
|
|
|
|
|
| 106 |
.pat-b { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
|
| 107 |
.pat-d { background: #fed7aa; color: #c2410c; border-color: #fb923c; }
|
| 108 |
.pat-db { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
|
|
@@ -189,6 +191,12 @@
|
|
| 189 |
<button type="button" class="btn btn-sm btn-outline-warning" onclick="bulkFull('paid_leave')">
|
| 190 |
<i class="bi bi-calendar-check me-1"></i>有休
|
| 191 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
{% else %}
|
| 193 |
<span class="label">全日:</span>
|
| 194 |
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="bulkPart('')">
|
|
@@ -214,10 +222,17 @@
|
|
| 214 |
{% set cur_pid = req.pattern_id if req and req.pattern_id else '' %}
|
| 215 |
|
| 216 |
{% if current_emp.employment_type.value == 'full_time' %}
|
| 217 |
-
{% set btn_cls = 'pat-work' if cur_pid == ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
{% set btn_html %}
|
| 219 |
{% if cur_pid == 'off_request' %}<i class="bi bi-x-circle me-1"></i>休希望
|
| 220 |
{% elif cur_pid == 'paid_leave' %}<i class="bi bi-calendar-check me-1"></i>有休
|
|
|
|
|
|
|
| 221 |
{% else %}<i class="bi bi-check2 me-1"></i>出勤予定{% endif %}
|
| 222 |
{% endset %}
|
| 223 |
{% else %}
|
|
@@ -386,11 +401,13 @@ function bulkPart(patId) {
|
|
| 386 |
});
|
| 387 |
}
|
| 388 |
|
| 389 |
-
// ── 社員:
|
| 390 |
const FULL_STATES = [
|
| 391 |
{ val: '', cls: 'pat-work', html: '<i class="bi bi-check2 me-1"></i>出勤予定' },
|
| 392 |
{ val: 'off_request', cls: 'pat-ofr', html: '<i class="bi bi-x-circle me-1"></i>休希望' },
|
| 393 |
{ val: 'paid_leave', cls: 'pat-leave',html: '<i class="bi bi-calendar-check me-1"></i>有休' },
|
|
|
|
|
|
|
| 394 |
];
|
| 395 |
|
| 396 |
function cycleOff(btn) {
|
|
|
|
| 103 |
.pat-work { background: #dcfce7; color: #166534; border-color: #86efac; }
|
| 104 |
.pat-ofr { background: #fecaca; color: #991b1b; border-color: #f87171; }
|
| 105 |
.pat-leave{ background: #fef9c3; color: #854d0e; border-color: #fde047; }
|
| 106 |
+
.pat-am { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
|
| 107 |
+
.pat-pm { background: #fed7aa; color: #c2410c; border-color: #fb923c; }
|
| 108 |
.pat-b { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
|
| 109 |
.pat-d { background: #fed7aa; color: #c2410c; border-color: #fb923c; }
|
| 110 |
.pat-db { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
|
|
|
|
| 191 |
<button type="button" class="btn btn-sm btn-outline-warning" onclick="bulkFull('paid_leave')">
|
| 192 |
<i class="bi bi-calendar-check me-1"></i>有休
|
| 193 |
</button>
|
| 194 |
+
<button type="button" class="btn btn-sm btn-outline-info" onclick="bulkFull('am_only')">
|
| 195 |
+
<i class="bi bi-sunrise me-1"></i>朝のみ可
|
| 196 |
+
</button>
|
| 197 |
+
<button type="button" class="btn btn-sm btn-outline-info" onclick="bulkFull('pm_only')">
|
| 198 |
+
<i class="bi bi-sunset me-1"></i>晩のみ可
|
| 199 |
+
</button>
|
| 200 |
{% else %}
|
| 201 |
<span class="label">全日:</span>
|
| 202 |
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="bulkPart('')">
|
|
|
|
| 222 |
{% set cur_pid = req.pattern_id if req and req.pattern_id else '' %}
|
| 223 |
|
| 224 |
{% if current_emp.employment_type.value == 'full_time' %}
|
| 225 |
+
{% set btn_cls = 'pat-work' if cur_pid == ''
|
| 226 |
+
else 'pat-ofr' if cur_pid == 'off_request'
|
| 227 |
+
else 'pat-leave' if cur_pid == 'paid_leave'
|
| 228 |
+
else 'pat-am' if cur_pid == 'am_only'
|
| 229 |
+
else 'pat-pm' if cur_pid == 'pm_only'
|
| 230 |
+
else 'pat-work' %}
|
| 231 |
{% set btn_html %}
|
| 232 |
{% if cur_pid == 'off_request' %}<i class="bi bi-x-circle me-1"></i>休希望
|
| 233 |
{% elif cur_pid == 'paid_leave' %}<i class="bi bi-calendar-check me-1"></i>有休
|
| 234 |
+
{% elif cur_pid == 'am_only' %}<i class="bi bi-sunrise me-1"></i>朝のみ可
|
| 235 |
+
{% elif cur_pid == 'pm_only' %}<i class="bi bi-sunset me-1"></i>晩のみ可
|
| 236 |
{% else %}<i class="bi bi-check2 me-1"></i>出勤予定{% endif %}
|
| 237 |
{% endset %}
|
| 238 |
{% else %}
|
|
|
|
| 401 |
});
|
| 402 |
}
|
| 403 |
|
| 404 |
+
// ── 社員:状態サイクル ────────────────────────────────────────────
|
| 405 |
const FULL_STATES = [
|
| 406 |
{ val: '', cls: 'pat-work', html: '<i class="bi bi-check2 me-1"></i>出勤予定' },
|
| 407 |
{ val: 'off_request', cls: 'pat-ofr', html: '<i class="bi bi-x-circle me-1"></i>休希望' },
|
| 408 |
{ val: 'paid_leave', cls: 'pat-leave',html: '<i class="bi bi-calendar-check me-1"></i>有休' },
|
| 409 |
+
{ val: 'am_only', cls: 'pat-am', html: '<i class="bi bi-sunrise me-1"></i>朝のみ可' },
|
| 410 |
+
{ val: 'pm_only', cls: 'pat-pm', html: '<i class="bi bi-sunset me-1"></i>晩のみ可' },
|
| 411 |
];
|
| 412 |
|
| 413 |
function cycleOff(btn) {
|