m1m02530125 Claude Sonnet 4.6 commited on
Commit
29c5e2e
·
1 Parent(s): 1cfe99d

feat: add help page with usage guide and developer info

Browse files

- /help route with accordion sections for each feature
- Covers: スタッフ管理, 希望シフト, 自動生成, シフト表, 客数管理, 設定
- Developer card with email and GitHub link
- Anchor links in TOC chips auto-expand the relevant section
- Added ヘルプ to desktop sidebar, hamburger drawer, and _in_drawer detection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

routes/help_routes.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from flask import Blueprint, render_template
2
+
3
+ bp = Blueprint("help", __name__, url_prefix="/help")
4
+
5
+
6
+ @bp.get("/")
7
+ def index():
8
+ return render_template("help/index.html")
templates/base.html CHANGED
@@ -138,6 +138,7 @@
138
  ('schedule.list_periods','bi-calendar3', 'シフト表'),
139
  ('customers.list_periods','bi-cup-hot-fill', '客数管理'),
140
  ('settings.index', 'bi-gear-fill', '設定'),
 
141
  ] %}
142
  {% for endpoint, icon, label in nav_items %}
143
  <a href="{{ url_for(endpoint) }}"
@@ -155,7 +156,8 @@
155
  <!-- Mobile Bottom Nav -->
156
  {% set _in_drawer = request.endpoint and (
157
  request.endpoint.startswith('customers') or
158
- request.endpoint.startswith('settings')
 
159
  ) %}
160
  <div class="bottom-nav">
161
  {% for endpoint, icon, label in [
@@ -184,8 +186,9 @@
184
  <div class="drawer-title">メニュー</div>
185
 
186
  {% for endpoint, icon, label, desc in [
187
- ('customers.list_periods', 'bi-cup-hot-fill', '客数管理', '予約客数の入力'),
188
- ('settings.index', 'bi-gear-fill', '設定', 'シフト制約・アプリ設定'),
 
189
  ] %}
190
  <a href="{{ url_for(endpoint) }}"
191
  class="{{ 'active' if request.endpoint and request.endpoint.startswith(endpoint.split('.')[0]) else '' }}"
 
138
  ('schedule.list_periods','bi-calendar3', 'シフト表'),
139
  ('customers.list_periods','bi-cup-hot-fill', '客数管理'),
140
  ('settings.index', 'bi-gear-fill', '設定'),
141
+ ('help.index', 'bi-question-circle','ヘルプ'),
142
  ] %}
143
  {% for endpoint, icon, label in nav_items %}
144
  <a href="{{ url_for(endpoint) }}"
 
156
  <!-- Mobile Bottom Nav -->
157
  {% set _in_drawer = request.endpoint and (
158
  request.endpoint.startswith('customers') or
159
+ request.endpoint.startswith('settings') or
160
+ request.endpoint.startswith('help')
161
  ) %}
162
  <div class="bottom-nav">
163
  {% for endpoint, icon, label in [
 
186
  <div class="drawer-title">メニュー</div>
187
 
188
  {% for endpoint, icon, label, desc in [
189
+ ('customers.list_periods', 'bi-cup-hot-fill', '客数管理', '予約客数の入力'),
190
+ ('settings.index', 'bi-gear-fill', '設定', 'シフト制約・アプリ設定'),
191
+ ('help.index', 'bi-question-circle', 'ヘルプ', '使い方・開発者情報'),
192
  ] %}
193
  <a href="{{ url_for(endpoint) }}"
194
  class="{{ 'active' if request.endpoint and request.endpoint.startswith(endpoint.split('.')[0]) else '' }}"
templates/help/index.html ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends "base.html" %}
2
+ {% block title %}ヘルプ - SDU-Shift{% endblock %}
3
+ {% block head %}
4
+ <style>
5
+ .help-hero {
6
+ background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
7
+ color: white; padding: 2rem 1rem 1.5rem; text-align: center;
8
+ border-bottom: 1px solid #334155;
9
+ }
10
+ .help-hero .app-icon { font-size: 3rem; margin-bottom: .5rem; }
11
+ .help-hero h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 .25rem; }
12
+ .help-hero p { color: #94a3b8; font-size: .85rem; margin: 0; }
13
+
14
+ .help-section { margin-bottom: 1rem; }
15
+
16
+ .help-card {
17
+ background: white; border-radius: 12px;
18
+ box-shadow: 0 1px 3px rgba(0,0,0,.08); overflow: hidden;
19
+ }
20
+ .help-card-header {
21
+ display: flex; align-items: center; gap: .75rem;
22
+ padding: .85rem 1rem; cursor: pointer;
23
+ border-bottom: 1px solid transparent;
24
+ transition: background .15s; user-select: none;
25
+ }
26
+ .help-card-header:hover { background: #f8fafc; }
27
+ .help-card-header.open { border-bottom-color: #e2e8f0; }
28
+ .help-card-icon {
29
+ width: 36px; height: 36px; border-radius: 8px;
30
+ display: flex; align-items: center; justify-content: center;
31
+ font-size: 1.1rem; flex-shrink: 0;
32
+ }
33
+ .help-card-title { font-weight: 600; font-size: .95rem; flex-grow: 1; }
34
+ .help-card-chevron { color: #94a3b8; font-size: .8rem; transition: transform .2s; }
35
+ .help-card-chevron.open { transform: rotate(180deg); }
36
+ .help-card-body { padding: 1rem; display: none; font-size: .88rem; line-height: 1.7; }
37
+ .help-card-body.open { display: block; }
38
+
39
+ .step-list { list-style: none; padding: 0; margin: 0; }
40
+ .step-list li {
41
+ display: flex; gap: .75rem; padding: .4rem 0;
42
+ border-bottom: 1px solid #f1f5f9;
43
+ }
44
+ .step-list li:last-child { border-bottom: none; }
45
+ .step-num {
46
+ width: 22px; height: 22px; background: #0ea5e9; color: white;
47
+ border-radius: 50%; font-size: .72rem; font-weight: 700;
48
+ display: flex; align-items: center; justify-content: center; flex-shrink: 0;
49
+ margin-top: 1px;
50
+ }
51
+ .tip-box {
52
+ background: #f0f9ff; border-left: 3px solid #0ea5e9;
53
+ border-radius: 0 8px 8px 0; padding: .6rem .85rem;
54
+ font-size: .82rem; color: #0c4a6e; margin-top: .75rem;
55
+ }
56
+ .warn-box {
57
+ background: #fffbeb; border-left: 3px solid #f59e0b;
58
+ border-radius: 0 8px 8px 0; padding: .6rem .85rem;
59
+ font-size: .82rem; color: #78350f; margin-top: .75rem;
60
+ }
61
+ kbd {
62
+ background: #1e293b; color: white; border-radius: 4px;
63
+ padding: 1px 6px; font-size: .78rem; font-family: monospace;
64
+ }
65
+
66
+ /* 開発者カード */
67
+ .dev-card {
68
+ background: #1e293b; color: white; border-radius: 12px;
69
+ padding: 1.25rem; margin-top: .5rem;
70
+ }
71
+ .dev-avatar {
72
+ width: 52px; height: 52px; border-radius: 50%;
73
+ background: linear-gradient(135deg, #0ea5e9, #6366f1);
74
+ display: flex; align-items: center; justify-content: center;
75
+ font-size: 1.5rem; flex-shrink: 0;
76
+ }
77
+ .dev-contact a {
78
+ display: flex; align-items: center; gap: .5rem;
79
+ color: #94a3b8; text-decoration: none; font-size: .85rem;
80
+ padding: .35rem 0; transition: color .15s;
81
+ }
82
+ .dev-contact a:hover { color: #38bdf8; }
83
+ .version-badge {
84
+ display: inline-block; background: #334155; color: #94a3b8;
85
+ border-radius: 20px; padding: 2px 10px; font-size: .72rem;
86
+ font-family: monospace;
87
+ }
88
+ </style>
89
+ {% endblock %}
90
+
91
+ {% block content %}
92
+ <!-- ヒーロー -->
93
+ <div class="help-hero">
94
+ <div class="app-icon">🍽️</div>
95
+ <h2>SDU-Shift</h2>
96
+ <p>飲食店向けシフト管理アプリ ヘルプ</p>
97
+ </div>
98
+
99
+ <div class="content">
100
+
101
+ <!-- ── 目次 ── -->
102
+ <div class="d-flex flex-wrap gap-2 mb-3">
103
+ {% for anchor, label, color in [
104
+ ('#staff', 'スタッフ管理', '#dbeafe'),
105
+ ('#shift', '希望シフト', '#dcfce7'),
106
+ ('#generate', '自動生成', '#fef9c3'),
107
+ ('#schedule', 'シフト表', '#ede9fe'),
108
+ ('#customer', '客数管理', '#fee2e2'),
109
+ ('#settings', '設定', '#e2e8f0'),
110
+ ('#dev', '開発者情報', '#1e293b'),
111
+ ] %}
112
+ <a href="{{ anchor }}" class="text-decoration-none">
113
+ <span style="background:{{ color }};color:#1e293b;border-radius:20px;
114
+ padding:3px 12px;font-size:.78rem;font-weight:600;
115
+ {% if anchor == '#dev' %}color:white{% endif %}">
116
+ {{ label }}
117
+ </span>
118
+ </a>
119
+ {% endfor %}
120
+ </div>
121
+
122
+ {# ── セクションマクロ ── #}
123
+ {% macro section(id, icon, icon_bg, title, content_id) %}
124
+ <div class="help-section" id="{{ id }}">
125
+ <div class="help-card">
126
+ <div class="help-card-header" onclick="toggleCard(this, '{{ content_id }}')">
127
+ <div class="help-card-icon" style="background:{{ icon_bg }}">
128
+ <i class="bi {{ icon }}"></i>
129
+ </div>
130
+ <span class="help-card-title">{{ title }}</span>
131
+ <i class="bi bi-chevron-down help-card-chevron"></i>
132
+ </div>
133
+ <div class="help-card-body" id="{{ content_id }}">
134
+ {% endmacro %}
135
+
136
+ {# スタッフ管理 #}
137
+ {{ section('staff', 'bi-people-fill', '#dbeafe', 'スタッフ管理', 'body-staff') }}
138
+ <ul class="step-list">
139
+ <li><span class="step-num">1</span><div><strong>スタッフを追加</strong>する — 「+ スタッフを追加」ボタンから名前・ポジション・リーダー設定などを入力。</div></li>
140
+ <li><span class="step-num">2</span><div><strong>並び順を変更</strong>する — 各カード左端の <i class="bi bi-grip-vertical text-muted"></i> をドラッグして順番を入れ替えられます。</div></li>
141
+ <li><span class="step-num">3</span><div><strong>アーカイブ</strong>する — 退職・長期休暇などのスタッフはアーカイブにすることで一覧から非表示になります。データは保持されます。</div></li>
142
+ </ul>
143
+ <div class="tip-box">
144
+ <i class="bi bi-lightbulb-fill me-1"></i>
145
+ <strong>リーダー設定</strong>:自動生成時にリーダー最低人数の制約が適用されます。ポジションごとに設定できます。
146
+ </div>
147
+ </div>
148
+ </div>
149
+ </div>
150
+
151
+ {# 希望シフト入力 #}
152
+ {{ section('shift', 'bi-pencil-square', '#dcfce7', '希望シフト入力', 'body-shift') }}
153
+ <ul class="step-list">
154
+ <li><span class="step-num">1</span><div><strong>期間を作成</strong>する — 年月を選び「前半(1〜15日)」または「後半(16〜末日)」を選択。</div></li>
155
+ <li><span class="step-num">2</span><div><strong>希望を入力</strong>する — スタッフ名で検索して個別入力、または「全員一覧」で一括確認。</div></li>
156
+ <li><span class="step-num">3</span><div><strong>CSVでインポート</strong>する — GoogleフォームなどからエクスポートしたCSVをそのまま読み込めます。</div></li>
157
+ </ul>
158
+ <div class="tip-box">
159
+ <i class="bi bi-lightbulb-fill me-1"></i>
160
+ <strong>入力モード:</strong>
161
+ 1人フォーカスモード(デフォルト)では名前を検索して1人ずつ入力。全員一覧モードはスクロールで全員を一度に確認できます。
162
+ </div>
163
+ <div class="warn-box">
164
+ <i class="bi bi-exclamation-triangle-fill me-1"></i>
165
+ 最新4期間分が一覧に表示されます。それ以前は「すべて表示」から確認できます。
166
+ </div>
167
+ </div>
168
+ </div>
169
+ </div>
170
+
171
+ {# 自動生成 #}
172
+ {{ section('generate', 'bi-lightning-fill', '#fef9c3', 'シフト自動生成', 'body-generate') }}
173
+ <ul class="step-list">
174
+ <li><span class="step-num">1</span><div><strong>希望シフトを入力済みの期間</strong>を選択する。</div></li>
175
+ <li><span class="step-num">2</span><div><strong>優先度を設定</strong>する(各項目の <i class="bi bi-question-circle text-muted"></i> をタップすると詳細説明が表示されます)。</div></li>
176
+ <li><span class="step-num">3</span><div><strong>「生成開始」</strong>ボタンを押す。最大25秒で最適なシフトを算出します。</div></li>
177
+ </ul>
178
+
179
+ <div class="mt-2 mb-1 small fw-semibold text-muted">優先度設定の意味</div>
180
+ <table class="table table-sm table-bordered" style="font-size:.82rem">
181
+ <thead class="table-light"><tr><th>設定項目</th><th>内容</th></tr></thead>
182
+ <tbody>
183
+ <tr><td>希望シフト尊重</td><td>スタッフの希望日程をどれだけ重視するか</td></tr>
184
+ <tr><td>公平な配分</td><td>出勤日数・朝食/ディナーの偏りを均す度合い</td></tr>
185
+ <tr><td>連続出勤回避</td><td>同じスタッフが連日出勤しないよう制限する強さ</td></tr>
186
+ <tr><td>固定パターン</td><td>各スタッフに設定した固定シフトパターンの適用度</td></tr>
187
+ </tbody>
188
+ </table>
189
+ <div class="warn-box">
190
+ <i class="bi bi-exclamation-triangle-fill me-1"></i>
191
+ 生成中は他の画面に移動しても構いません。完了後に「シフト表」から結果を確認してください。
192
+ </div>
193
+ </div>
194
+ </div>
195
+ </div>
196
+
197
+ {# シフト表 #}
198
+ {{ section('schedule', 'bi-calendar3', '#ede9fe', 'シフト表', 'body-schedule') }}
199
+ <ul class="step-list">
200
+ <li><span class="step-num">1</span><div><strong>朝食/ディナー・ホール/キッチン</strong>のタブで表示を切り替えます。</div></li>
201
+ <li><span class="step-num">2</span><div><strong>セルをタップ</strong>すると手動で担当を追加・変更できます。</div></li>
202
+ <li><span class="step-num">3</span><div><strong>日付ヘッダーをタップ</strong>するとその日の全員のタイムラインを確認できます。</div></li>
203
+ <li><span class="step-num">4</span><div>右上のボタンから <strong>Excel / PDF</strong> でエクスポートできます。</div></li>
204
+ </ul>
205
+
206
+ <div class="mt-2 mb-1 small fw-semibold text-muted">人員不足アラート</div>
207
+ <p class="mb-1">ページ上部に不足がある場合はカードが表示されます。タップするとスロット×ポジション別の不足日チップが展開されます。</p>
208
+ <div class="d-flex gap-2 flex-wrap mb-2" style="font-size:.8rem">
209
+ <span style="background:#fecaca;color:#991b1b;border-radius:4px;padding:2px 8px;font-weight:600">赤:人員不足</span>
210
+ <span style="background:#fde68a;color:#92400e;border-radius:4px;padding:2px 8px;font-weight:600">黄:リーダー不足</span>
211
+ </div>
212
+
213
+ <div class="mt-2 mb-1 small fw-semibold text-muted">応援要員の追加</div>
214
+ <p class="mb-0">セルをタップ →「応援で追加」セクションで時間帯を指定して追加。プリセット(全時間/早番/遅番)で素早く設定できます。</p>
215
+ </div>
216
+ </div>
217
+ </div>
218
+
219
+ {# 客数管理 #}
220
+ {{ section('customer', 'bi-cup-hot-fill', '#fee2e2', '客数管理', 'body-customer') }}
221
+ <ul class="step-list">
222
+ <li><span class="step-num">1</span><div>期間を選択して各日の<strong>予約客数(朝食・ディナー)</strong>を入力します。</div></li>
223
+ <li><span class="step-num">2</span><div>閾値を超えると<strong>赤</strong>、以下は<strong>緑</strong>で色分け表示されます。</div></li>
224
+ <li><span class="step-num">3</span><div>閾値は「設定」ページの<strong>客数閾値</strong>から変更できます。</div></li>
225
+ </ul>
226
+ <div class="tip-box">
227
+ <i class="bi bi-lightbulb-fill me-1"></i>
228
+ 客数の多い日を一目で把握してシフト配置の参考にしてください。
229
+ </div>
230
+ </div>
231
+ </div>
232
+ </div>
233
+
234
+ {# 設定 #}
235
+ {{ section('settings', 'bi-gear-fill', '#e2e8f0', '設定', 'body-settings') }}
236
+ <table class="table table-sm table-bordered" style="font-size:.82rem">
237
+ <thead class="table-light"><tr><th>項目</th><th>内容</th></tr></thead>
238
+ <tbody>
239
+ <tr><td>シフト制約</td><td>各スロット×ポジションの最低人数・最低リーダー数を設定</td></tr>
240
+ <tr><td>客数閾値</td><td>客数管理の色分け基準を朝食/ディナー別に設定</td></tr>
241
+ <tr><td>バックアップ</td><td>全データをJSONファイルでダウンロード</td></tr>
242
+ <tr><td>リストア</td><td>バックアップJSONからデータを復元(既存データは上書き)</td></tr>
243
+ </tbody>
244
+ </table>
245
+ <div class="warn-box">
246
+ <i class="bi bi-exclamation-triangle-fill me-1"></i>
247
+ リストアを実行すると既存のデータはすべて置き換わります。事前にバックアップを取ることを推奨します。
248
+ </div>
249
+ </div>
250
+ </div>
251
+ </div>
252
+
253
+ <!-- ── 開発者情報 ── -->
254
+ <div class="help-section" id="dev">
255
+ <div class="small text-muted fw-semibold mb-2" style="letter-spacing:.05em;text-transform:uppercase">
256
+ 開発者情報・連絡先
257
+ </div>
258
+ <div class="dev-card">
259
+ <div class="d-flex align-items-center gap-3 mb-3">
260
+ <div class="dev-avatar">👨‍💻</div>
261
+ <div>
262
+ <div class="fw-semibold" style="font-size:1rem">SDU-Shift 開発チーム</div>
263
+ <span class="version-badge mt-1">v1.0 Flask + OR-Tools</span>
264
+ </div>
265
+ </div>
266
+
267
+ <div class="dev-contact">
268
+ <div class="small text-muted mb-1" style="letter-spacing:.04em;text-transform:uppercase;font-size:.68rem">連絡先</div>
269
+ <a href="mailto:m1m02530125@oit.ac.jp">
270
+ <i class="bi bi-envelope-fill" style="color:#38bdf8"></i>
271
+ m1m02530125@oit.ac.jp
272
+ </a>
273
+ <a href="https://github.com/Richiesss/shift-tool" target="_blank" rel="noopener">
274
+ <i class="bi bi-github" style="color:#94a3b8"></i>
275
+ github.com/Richiesss/shift-tool
276
+ </a>
277
+ </div>
278
+
279
+ <hr style="border-color:#334155;margin:1rem 0 .75rem">
280
+
281
+ <div class="small text-muted" style="line-height:1.8">
282
+ <div class="mb-1">
283
+ <i class="bi bi-info-circle me-1" style="color:#38bdf8"></i>
284
+ バグ報告・機能要望は上記メールまたは GitHub Issues へ
285
+ </div>
286
+ <div class="mb-1">
287
+ <i class="bi bi-tools me-1" style="color:#38bdf8"></i>
288
+ 技術スタック:Flask / PostgreSQL (Neon) / OR-Tools CP-SAT / Bootstrap 5
289
+ </div>
290
+ <div>
291
+ <i class="bi bi-cloud me-1" style="color:#38bdf8"></i>
292
+ ホスティング:HuggingFace Spaces(無料プラン)
293
+ </div>
294
+ </div>
295
+ </div>
296
+ </div>
297
+
298
+ <!-- フッター余白 -->
299
+ <div style="height:1rem"></div>
300
+ </div>
301
+ {% endblock %}
302
+
303
+ {% block scripts %}
304
+ <script>
305
+ function toggleCard(header, bodyId) {
306
+ const body = document.getElementById(bodyId);
307
+ const chevron = header.querySelector('.help-card-chevron');
308
+ const isOpen = body.classList.contains('open');
309
+ body.classList.toggle('open', !isOpen);
310
+ header.classList.toggle('open', !isOpen);
311
+ chevron.classList.toggle('open', !isOpen);
312
+ }
313
+
314
+ // アンカーリンクで自動展開
315
+ (function() {
316
+ const hash = location.hash;
317
+ if (!hash) return;
318
+ const section = document.querySelector(hash);
319
+ if (!section) return;
320
+ const header = section.querySelector('.help-card-header');
321
+ if (header) {
322
+ const bodyId = header.getAttribute('onclick').match(/'([^']+)'\s*\)/)[1];
323
+ toggleCard(header, bodyId);
324
+ setTimeout(() => section.scrollIntoView({ behavior: 'smooth', block: 'start' }), 100);
325
+ }
326
+ })();
327
+ </script>
328
+ {% endblock %}
web_app.py CHANGED
@@ -73,6 +73,7 @@ def create_app():
73
  from routes.customers import bp as cust_bp
74
  from routes.settings_routes import bp as settings_bp
75
  from routes.export_routes import bp as export_bp
 
76
 
77
  app.register_blueprint(emp_bp)
78
  app.register_blueprint(shifts_bp)
@@ -81,6 +82,7 @@ def create_app():
81
  app.register_blueprint(cust_bp)
82
  app.register_blueprint(settings_bp)
83
  app.register_blueprint(export_bp)
 
84
 
85
  @app.teardown_appcontext
86
  def close_db(error):
 
73
  from routes.customers import bp as cust_bp
74
  from routes.settings_routes import bp as settings_bp
75
  from routes.export_routes import bp as export_bp
76
+ from routes.help_routes import bp as help_bp
77
 
78
  app.register_blueprint(emp_bp)
79
  app.register_blueprint(shifts_bp)
 
82
  app.register_blueprint(cust_bp)
83
  app.register_blueprint(settings_bp)
84
  app.register_blueprint(export_bp)
85
+ app.register_blueprint(help_bp)
86
 
87
  @app.teardown_appcontext
88
  def close_db(error):