m1m02530125 commited on
Commit
adaee93
·
1 Parent(s): ac927ca

UI/UX改善: 警告表示・ヘルプ記述・ログイン画面・アクセシビリティを修正

Browse files

- シフト自動生成成功時にもソルバーの注意事項(警告)を表示するように変更
- ヘルプページの「全員一覧モード」等、実装と異なる説明を実態に合わせて修正
- ログイン画面のパスワード設定状況デバッグ表示を削除
- シフト表画面のアイコンのみボタンにaria-label/titleを追加
- シフト入力の全休確認をネイティブconfirm()からアプリ共通スタイルのモーダルに変更
- ダッシュボードの未使用変数is_sを削除

routes/auth_routes.py CHANGED
@@ -18,7 +18,7 @@ def _safe_next(url: str) -> str:
18
 
19
  def _login_page(**kwargs):
20
  """キャッシュ無効ヘッダー付きでログインページを返す"""
21
- resp = make_response(render_template("auth/login.html", pw_len=len(APP_PASSWORD), **kwargs))
22
  resp.headers["Cache-Control"] = "no-store, no-cache, must-revalidate"
23
  resp.headers["Pragma"] = "no-cache"
24
  return resp
 
18
 
19
  def _login_page(**kwargs):
20
  """キャッシュ無効ヘッダー付きでログインページを返す"""
21
+ resp = make_response(render_template("auth/login.html", **kwargs))
22
  resp.headers["Cache-Control"] = "no-store, no-cache, must-revalidate"
23
  resp.headers["Pragma"] = "no-cache"
24
  return resp
templates/auth/login.html CHANGED
@@ -34,7 +34,6 @@
34
  .btn-login:hover { background: #0284c7; }
35
  .btn-login:disabled { background: #334155; cursor: not-allowed; }
36
  .alert { border-radius: 10px; font-size: .85rem; }
37
- .debug-info { font-size: .7rem; color: #475569; margin-top: 1rem; text-align: center; }
38
  </style>
39
  </head>
40
  <body>
@@ -69,10 +68,6 @@
69
  <span id="btnText">ログイン</span>
70
  </button>
71
  </form>
72
-
73
- <div class="debug-info">
74
- パスワード設定: {{ '✓ あり (%d文字)' % pw_len if pw_len else '✗ 未設定(誰でもアクセス可)' }}
75
- </div>
76
  </div>
77
 
78
  <script>
 
34
  .btn-login:hover { background: #0284c7; }
35
  .btn-login:disabled { background: #334155; cursor: not-allowed; }
36
  .alert { border-radius: 10px; font-size: .85rem; }
 
37
  </style>
38
  </head>
39
  <body>
 
68
  <span id="btnText">ログイン</span>
69
  </button>
70
  </form>
 
 
 
 
71
  </div>
72
 
73
  <script>
templates/dashboard/index.html CHANGED
@@ -224,7 +224,6 @@
224
  <div class="slot-row">
225
  {% endif %}
226
  {% set cnt = today_staff.get((slot_v, pos_v), 0) %}
227
- {% set is_s = (slot_v, pos_v) | string in today_short | map('string') | list %}
228
  <div class="slot-cell {{ 'short' if today_short and (slot_v+'/'+pos_l+'(') in today_short|join('') else '' }}">
229
  <span class="pos-lbl">{{ pos_l }}</span>
230
  <span class="pos-cnt">{{ cnt }}<small>名</small></span>
 
224
  <div class="slot-row">
225
  {% endif %}
226
  {% set cnt = today_staff.get((slot_v, pos_v), 0) %}
 
227
  <div class="slot-cell {{ 'short' if today_short and (slot_v+'/'+pos_l+'(') in today_short|join('') else '' }}">
228
  <span class="pos-lbl">{{ pos_l }}</span>
229
  <span class="pos-cnt">{{ cnt }}<small>名</small></span>
templates/generate/waiting.html CHANGED
@@ -16,6 +16,15 @@
16
  <span class="text-muted small">モデルを構築しています…</span>
17
  </p>
18
 
 
 
 
 
 
 
 
 
 
19
  <!-- フェーズ表示 -->
20
  <div class="d-flex justify-content-between align-items-center small mb-1">
21
  <span id="phase-label" class="fw-semibold text-primary">
@@ -185,6 +194,13 @@
185
  }
186
  }
187
 
 
 
 
 
 
 
 
188
  // ── 完了・エラー処理 ───────────────────────────────────────────────────
189
  function finish(ok, warnOrErr) {
190
  stopLogPolling();
@@ -199,9 +215,25 @@
199
  phaseLabel.classList.remove('text-primary', 'text-warning');
200
  phaseLabel.classList.add('text-success');
201
  elapsedLabel.textContent = '完了';
202
- statusMsg.innerHTML =
203
- '<span class="text-success fw-semibold">シフト表に移動します…</span>';
204
- setTimeout(() => { window.location.href = scheduleUrl; }, 800);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  } else {
206
  const msg = typeof warnOrErr === 'string' ? warnOrErr : '';
207
  bar.classList.add('bg-danger');
 
16
  <span class="text-muted small">モデルを構築しています…</span>
17
  </p>
18
 
19
+ <!-- 生成完了時の注意事項(ある場合のみ表示) -->
20
+ <div id="warn-box" class="alert alert-warning text-start small py-2 mb-3" style="display:none"></div>
21
+
22
+ <!-- 注意事項確認後にシフト表へ進むボタン -->
23
+ <a id="goto-btn" href="{{ url_for('schedule.index', period_id=period.id) }}"
24
+ class="btn btn-success btn-sm mb-2" style="display:none">
25
+ <i class="bi bi-arrow-right-circle me-1"></i>シフト表へ進む
26
+ </a>
27
+
28
  <!-- フェーズ表示 -->
29
  <div class="d-flex justify-content-between align-items-center small mb-1">
30
  <span id="phase-label" class="fw-semibold text-primary">
 
194
  }
195
  }
196
 
197
+ // ── HTMLエスケープ ────────────────────────────────────────────────────
198
+ function escapeHtml(s) {
199
+ const div = document.createElement('div');
200
+ div.textContent = s;
201
+ return div.innerHTML;
202
+ }
203
+
204
  // ── 完了・エラー処理 ───────────────────────────────────────────────────
205
  function finish(ok, warnOrErr) {
206
  stopLogPolling();
 
215
  phaseLabel.classList.remove('text-primary', 'text-warning');
216
  phaseLabel.classList.add('text-success');
217
  elapsedLabel.textContent = '完了';
218
+
219
+ const warnings = Array.isArray(warnOrErr) ? warnOrErr : [];
220
+ const gotoBtn = document.getElementById('goto-btn');
221
+ if (warnings.length > 0) {
222
+ statusMsg.innerHTML =
223
+ '<span class="text-success fw-semibold">生成完了 — 下記の注意事項をご確認ください</span>';
224
+ const warnBox = document.getElementById('warn-box');
225
+ warnBox.innerHTML = '<i class="bi bi-exclamation-triangle me-1"></i>注意事項' +
226
+ '<ul class="mb-0 ps-3 mt-1">' +
227
+ warnings.map(w => '<li>' + escapeHtml(w) + '</li>').join('') +
228
+ '</ul>';
229
+ warnBox.style.display = '';
230
+ gotoBtn.style.display = '';
231
+ setTimeout(() => { window.location.href = scheduleUrl; }, 6000);
232
+ } else {
233
+ statusMsg.innerHTML =
234
+ '<span class="text-success fw-semibold">シフト表に移動します…</span>';
235
+ setTimeout(() => { window.location.href = scheduleUrl; }, 800);
236
+ }
237
  } else {
238
  const msg = typeof warnOrErr === 'string' ? warnOrErr : '';
239
  bar.classList.add('bg-danger');
templates/help/index.html CHANGED
@@ -316,21 +316,15 @@
316
 
317
  <ul class="step-list">
318
  <li><span class="step-num">1</span><div><strong>期間を作成</strong> — 年月を選び「前半(1〜15日)」または「後半(16〜末日)」ボタンをタップします。</div></li>
319
- <li><span class="step-num">2</span><div><strong>希望を入力</strong> — スタッフ名のチップをタップして1人ずつ入力するか、一覧モードで全員をまとめて確認します。</div></li>
320
  <li><span class="step-num">3</span><div><strong>CSVでインポート</strong> — Google フォームなどからエクスポートした CSV をそのまま読み込めます。</div></li>
321
  </ul>
322
 
323
- <div class="sub-heading">入力モード</div>
324
- <table class="table table-sm table-bordered mb-3" style="font-size:.82rem">
325
- <thead class="table-light"><tr><th>モード</th><th>内容</th></tr></thead>
326
- <tbody>
327
- <tr><td>1人フォーカスモード(デフォルト)</td><td>上部チップから名前を選んで1人ずつ入力。入力済みのスタッフは<span style="color:#166534;font-weight:600">緑</span>で表示されます。</td></tr>
328
- <tr><td>全員一覧モード</td><td>全スタッフを縦スクロールで一度に確認・編集できます。</td></tr>
329
- </tbody>
330
- </table>
331
 
332
  <div class="sub-heading">一括操作ボタン</div>
333
- <p style="font-size:.82rem">各スタッフの入力画面上部に一括ボタンがあります。「全希望」「全休み」「全朝食」「全ディナー」のように一度にまとめて設定できます。</p>
334
 
335
  <div class="tip-box">
336
  <i class="bi bi-lightbulb-fill me-1"></i>
 
316
 
317
  <ul class="step-list">
318
  <li><span class="step-num">1</span><div><strong>期間を作成</strong> — 年月を選び「前半(1〜15日)」または「後半(16〜末日)」ボタンをタップします。</div></li>
319
+ <li><span class="step-num">2</span><div><strong>希望を入力</strong> — 上部のスタッフ名チップをタップして対象者を切り替えながら、1人ずつ希望シフトを入力します。</div></li>
320
  <li><span class="step-num">3</span><div><strong>CSVでインポート</strong> — Google フォームなどからエクスポートした CSV をそのまま読み込めます。</div></li>
321
  </ul>
322
 
323
+ <div class="sub-heading">入力画面の見方</div>
324
+ <p style="font-size:.82rem">画面上部のスタッフ名チップから対象者を選ぶと、その人の希望シフト入力欄が表示されます。1人ずつ切り替えながら入力してください。</p>
 
 
 
 
 
 
325
 
326
  <div class="sub-heading">一括操作ボタン</div>
327
+ <p style="font-size:.82rem">各スタッフの入力画面上部に一括ボタンがあります。社員は「出勤」「休希望」「有休」「朝のみ可」「晩のみ可」を全日にまとめて設定でき、アルバイトは「(休み)」または過去によく使われたパターン(最大3件)を全日にまとめて設定できます。</p>
328
 
329
  <div class="tip-box">
330
  <i class="bi bi-lightbulb-fill me-1"></i>
templates/schedule/index.html CHANGED
@@ -206,26 +206,28 @@
206
  <div class="ms-auto d-flex gap-1">
207
  {% if period %}
208
  {% if period.status == 'confirmed' %}
209
- <a href="{{ url_for('export.excel', period_id=period.id) }}" class="btn btn-outline-light btn-sm">
210
  <i class="bi bi-file-earmark-spreadsheet"></i>
211
  </a>
212
- <a href="{{ url_for('export.pdf', period_id=period.id) }}" class="btn btn-outline-light btn-sm">
213
  <i class="bi bi-file-earmark-pdf"></i>
214
  </a>
215
  {% else %}
216
  <button class="btn btn-outline-secondary btn-sm" style="opacity:.45;cursor:not-allowed"
 
217
  onclick="showToast('エクスポートするには先に「確定」ボタンを押してください', 'warning')">
218
  <i class="bi bi-file-earmark-spreadsheet"></i>
219
  </button>
220
  <button class="btn btn-outline-secondary btn-sm" style="opacity:.45;cursor:not-allowed"
 
221
  onclick="showToast('エクスポートするには先に「確定」ボタンを押してください', 'warning')">
222
  <i class="bi bi-file-earmark-pdf"></i>
223
  </button>
224
  {% endif %}
225
- <a href="{{ url_for('schedule.stats_multi') }}" class="btn btn-outline-light btn-sm">
226
  <i class="bi bi-bar-chart-fill"></i>
227
  </a>
228
- <button class="btn btn-outline-light btn-sm" onclick="openHistory({{ period.id }})">
229
  <i class="bi bi-clock-history"></i>
230
  </button>
231
  {% endif %}
 
206
  <div class="ms-auto d-flex gap-1">
207
  {% if period %}
208
  {% if period.status == 'confirmed' %}
209
+ <a href="{{ url_for('export.excel', period_id=period.id) }}" class="btn btn-outline-light btn-sm" title="Excel出力" aria-label="Excel出力">
210
  <i class="bi bi-file-earmark-spreadsheet"></i>
211
  </a>
212
+ <a href="{{ url_for('export.pdf', period_id=period.id) }}" class="btn btn-outline-light btn-sm" title="PDF出力" aria-label="PDF出力">
213
  <i class="bi bi-file-earmark-pdf"></i>
214
  </a>
215
  {% else %}
216
  <button class="btn btn-outline-secondary btn-sm" style="opacity:.45;cursor:not-allowed"
217
+ title="Excel出力" aria-label="Excel出力"
218
  onclick="showToast('エクスポートするには先に「確定」ボタンを押してください', 'warning')">
219
  <i class="bi bi-file-earmark-spreadsheet"></i>
220
  </button>
221
  <button class="btn btn-outline-secondary btn-sm" style="opacity:.45;cursor:not-allowed"
222
+ title="PDF出力" aria-label="PDF出力"
223
  onclick="showToast('エクスポートするには先に「確定」ボタンを押してください', 'warning')">
224
  <i class="bi bi-file-earmark-pdf"></i>
225
  </button>
226
  {% endif %}
227
+ <a href="{{ url_for('schedule.stats_multi') }}" class="btn btn-outline-light btn-sm" title="統計" aria-label="統計">
228
  <i class="bi bi-bar-chart-fill"></i>
229
  </a>
230
+ <button class="btn btn-outline-light btn-sm" onclick="openHistory({{ period.id }})" title="変更履歴" aria-label="変更履歴">
231
  <i class="bi bi-clock-history"></i>
232
  </button>
233
  {% endif %}
templates/shifts/input.html CHANGED
@@ -328,6 +328,23 @@
328
  </div>
329
  </form>
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  {% else %}
332
  <div class="p-5 text-center text-muted">
333
  <i class="bi bi-person-x d-block mb-2" style="font-size:2rem"></i>
@@ -355,15 +372,23 @@ function isAllOff() {
355
  : inp.value === '');
356
  }
357
 
358
- // フォーム送信時:全休なら確認ダイアログ、送信後は離脱ガードをリセット
359
  document.getElementById('shift-form')?.addEventListener('submit', (ev) => {
360
- if (isAllOff() && !confirm('この期間、全ての日を「休み」として保存します。よろしいですか?')) {
361
  ev.preventDefault();
 
362
  return;
363
  }
364
  window._formDirty = false;
365
  });
366
 
 
 
 
 
 
 
 
367
  // ── パターンデータ ────────────────────────────────────────────────
368
  const PAT_LABELS = {
369
  '': '(休み)', 'paid_leave': '有給', 'custom': 'カスタム',
 
328
  </div>
329
  </form>
330
 
331
+ <!-- 全休確認モーダル -->
332
+ <div class="modal fade" id="allOffModal" tabindex="-1">
333
+ <div class="modal-dialog modal-dialog-centered modal-sm">
334
+ <div class="modal-content" style="background:#1e293b;color:white;border:none;border-radius:14px">
335
+ <div class="modal-body p-4 text-center">
336
+ <i class="bi bi-question-circle-fill text-warning d-block mb-2" style="font-size:2.2rem"></i>
337
+ <div class="fw-semibold mb-1">全て休みで保存しますか?</div>
338
+ <div style="color:#94a3b8;font-size:.85rem;margin-bottom:1.25rem">この期間、全ての日を「休み」として保存します。</div>
339
+ <div class="d-flex gap-2">
340
+ <button class="btn btn-secondary flex-grow-1" data-bs-dismiss="modal">戻る</button>
341
+ <button type="button" class="btn btn-warning flex-grow-1" id="all-off-proceed-btn">保存する</button>
342
+ </div>
343
+ </div>
344
+ </div>
345
+ </div>
346
+ </div>
347
+
348
  {% else %}
349
  <div class="p-5 text-center text-muted">
350
  <i class="bi bi-person-x d-block mb-2" style="font-size:2rem"></i>
 
372
  : inp.value === '');
373
  }
374
 
375
+ // フォーム送信時:全休なら確認モーダルを表示、送信後は離脱ガードをリセット
376
  document.getElementById('shift-form')?.addEventListener('submit', (ev) => {
377
+ if (isAllOff()) {
378
  ev.preventDefault();
379
+ new bootstrap.Modal(document.getElementById('allOffModal')).show();
380
  return;
381
  }
382
  window._formDirty = false;
383
  });
384
 
385
+ // 「保存する」(全休確認モーダル)
386
+ document.getElementById('all-off-proceed-btn')?.addEventListener('click', () => {
387
+ bootstrap.Modal.getInstance(document.getElementById('allOffModal'))?.hide();
388
+ window._formDirty = false;
389
+ document.getElementById('shift-form').submit();
390
+ });
391
+
392
  // ── パターンデータ ────────────────────────────────────────────────
393
  const PAT_LABELS = {
394
  '': '(休み)', 'paid_leave': '有給', 'custom': 'カスタム',