Commit ·
659e49c
1
Parent(s): f1d4589
「おまかせ」スタッフのシフト希望を全日「希望あり」として自動補完表示する
Browse filesこれまでは「おまかせ」(全おまかせ)スタッフに対し、入力フォーム自体を
「提出不要」の静的バナーに置き換えていたが、ユーザーから「自動入力して
その旨を表示してほしい」との要望があったため、フォーム自体は表示したまま
未提出日を全日「希望あり」(朝食/ディナーのおまかせ設定に応じて
double/b_std/d_std1)で自動補完し、その旨を伝える案内を表示するよう変更した。
・実際にDBへ保存するのは従来通りユーザーが「保存」した時のみ
(ソルバーは always_available_* フラグを直接参照するため、この補完表示は
あくまでユーザー向けの可視化目的で、保存しなくても挙動に影響しない)
・既に提出済みの希望がある日はそちらを優先(補完で上書きしない)
・案内文で「実際の出勤日数・曜日は連続勤務日数の上限など他の制約を踏まえて
シフト生成時に調整される」旨を明記し、過剰な連続勤務にならないことを説明
- routes/shifts.py +24 -0
- templates/shifts/input.html +15 -12
routes/shifts.py
CHANGED
|
@@ -107,6 +107,28 @@ def input(period_id):
|
|
| 107 |
if pid:
|
| 108 |
req_map[key] = ShiftRequest(employee_id=current_emp.id, date=str(d), pattern_id=pid)
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
# 入力済み従業員数
|
| 111 |
# ・社員は出勤前提なので常にカウント
|
| 112 |
# ・朝食/ディナーともに「おまかせ」(always_available_*)なスタッフは、
|
|
@@ -143,6 +165,8 @@ def input(period_id):
|
|
| 143 |
patterns=ALL_PATTERNS,
|
| 144 |
emp_idx=emp_idx,
|
| 145 |
current_emp=current_emp,
|
|
|
|
|
|
|
| 146 |
prev_idx=prev_idx,
|
| 147 |
next_idx=next_idx,
|
| 148 |
filled_count=filled_count,
|
|
|
|
| 107 |
if pid:
|
| 108 |
req_map[key] = ShiftRequest(employee_id=current_emp.id, date=str(d), pattern_id=pid)
|
| 109 |
|
| 110 |
+
# 「おまかせ」スタッフのプリフィル
|
| 111 |
+
# 希望が未提出の日のみ、いつでも出勤可として全日「希望あり」を自動補完表示する
|
| 112 |
+
# (DBへの保存は行わず表示のみ。ソルバーは always_available_* フラグを直接参照して
|
| 113 |
+
# 常時出勤可として扱うため、この補完表示はあくまでユーザーへの可視化が目的)
|
| 114 |
+
cur_omakase_breakfast = bool(
|
| 115 |
+
current_emp and current_emp.employment_type != EmploymentType.FULL_TIME
|
| 116 |
+
and current_emp.always_available_breakfast
|
| 117 |
+
)
|
| 118 |
+
cur_omakase_dinner = bool(
|
| 119 |
+
current_emp and current_emp.employment_type != EmploymentType.FULL_TIME
|
| 120 |
+
and current_emp.always_available_dinner
|
| 121 |
+
)
|
| 122 |
+
if cur_omakase_breakfast or cur_omakase_dinner:
|
| 123 |
+
from utils.shift_patterns import default_pattern_from_fixed
|
| 124 |
+
pid = default_pattern_from_fixed(cur_omakase_breakfast, cur_omakase_dinner)
|
| 125 |
+
if pid:
|
| 126 |
+
for d in dates:
|
| 127 |
+
key = (current_emp.id, str(d))
|
| 128 |
+
if key in req_map:
|
| 129 |
+
continue
|
| 130 |
+
req_map[key] = ShiftRequest(employee_id=current_emp.id, date=str(d), pattern_id=pid)
|
| 131 |
+
|
| 132 |
# 入力済み従業員数
|
| 133 |
# ・社員は出勤前提なので常にカウント
|
| 134 |
# ・朝食/ディナーともに「おまかせ」(always_available_*)なスタッフは、
|
|
|
|
| 165 |
patterns=ALL_PATTERNS,
|
| 166 |
emp_idx=emp_idx,
|
| 167 |
current_emp=current_emp,
|
| 168 |
+
cur_omakase_breakfast=cur_omakase_breakfast,
|
| 169 |
+
cur_omakase_dinner=cur_omakase_dinner,
|
| 170 |
prev_idx=prev_idx,
|
| 171 |
next_idx=next_idx,
|
| 172 |
filled_count=filled_count,
|
templates/shifts/input.html
CHANGED
|
@@ -173,19 +173,23 @@
|
|
| 173 |
</div>
|
| 174 |
|
| 175 |
{% if current_emp %}
|
| 176 |
-
{%
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
<div class="
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
</div>
|
| 187 |
</div>
|
| 188 |
-
{%
|
| 189 |
<form id="shift-form" method="post" action="{{ url_for('shifts.save', period_id=period.id) }}">
|
| 190 |
<input type="hidden" name="save_emp_id" value="{{ current_emp.id }}">
|
| 191 |
{% if next_idx is not none %}
|
|
@@ -323,7 +327,6 @@
|
|
| 323 |
</button>
|
| 324 |
</div>
|
| 325 |
</form>
|
| 326 |
-
{% endif %}
|
| 327 |
|
| 328 |
{% else %}
|
| 329 |
<div class="p-5 text-center text-muted">
|
|
|
|
| 173 |
</div>
|
| 174 |
|
| 175 |
{% if current_emp %}
|
| 176 |
+
{% if cur_omakase_breakfast or cur_omakase_dinner %}
|
| 177 |
+
<div class="alert alert-info d-flex align-items-start gap-2 mb-3">
|
| 178 |
+
<i class="bi bi-info-circle-fill mt-1"></i>
|
| 179 |
+
<div>
|
| 180 |
+
<div class="fw-semibold">
|
| 181 |
+
{{ current_emp.name }}さんは
|
| 182 |
+
{% if cur_omakase_breakfast and cur_omakase_dinner %}朝食・ディナーともに{% elif cur_omakase_breakfast %}朝食について{% else %}ディナーについて{% endif %}
|
| 183 |
+
「おまかせ」設定です
|
| 184 |
+
</div>
|
| 185 |
+
<div class="small">
|
| 186 |
+
おまかせ設定しているので、全日希望として割り当てています。希望シフトの提出は不要です。<br>
|
| 187 |
+
(実際に出勤する日数・曜日は、連続勤務日数の上限など他の制約を踏まえてシフト生成時に調整されます。
|
| 188 |
+
内容を変更したい場合のみ、下記を編集して保存してください。)
|
| 189 |
+
</div>
|
| 190 |
</div>
|
| 191 |
</div>
|
| 192 |
+
{% endif %}
|
| 193 |
<form id="shift-form" method="post" action="{{ url_for('shifts.save', period_id=period.id) }}">
|
| 194 |
<input type="hidden" name="save_emp_id" value="{{ current_emp.id }}">
|
| 195 |
{% if next_idx is not none %}
|
|
|
|
| 327 |
</button>
|
| 328 |
</div>
|
| 329 |
</form>
|
|
|
|
| 330 |
|
| 331 |
{% else %}
|
| 332 |
<div class="p-5 text-center text-muted">
|