m1m02530125 Claude Sonnet 4.6 commited on
Commit
1cfe99d
·
1 Parent(s): 0ba0af8

improve: redesign reinforcement assignment modal UX

Browse files

- Dark-themed modal matching app style
- Two clear sections: 通常担当 / 応援で追加 / 担当を外す
- 通常担当: large icon buttons, current assignment highlighted
- 応援: radio toggle (ホール/キッチン) + time inputs
- Slot-aware preset chips (全時間/早番/遅番) auto-fill on open
- Default preset applied on modal open
- Inline validation highlight on missing time input

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

Files changed (1) hide show
  1. templates/schedule/index.html +160 -33
templates/schedule/index.html CHANGED
@@ -76,6 +76,49 @@
76
  .chip-hall { background: #dbeafe; color: #1e40af; border-radius: 4px; padding: 1px 5px; font-size: .75rem; }
77
  .chip-kitchen { background: #dcfce7; color: #166534; border-radius: 4px; padding: 1px 5px; font-size: .75rem; }
78
  .chip-empty { color: #cbd5e1; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  </style>
80
  {% endblock %}
81
  {% block content %}
@@ -287,37 +330,73 @@
287
 
288
  <!-- 担当編集モーダル -->
289
  <div class="modal fade" id="assignModal" tabindex="-1">
290
- <div class="modal-dialog modal-dialog-centered modal-sm">
291
- <div class="modal-content">
292
- <div class="modal-header py-2">
293
- <h6 class="modal-title" id="assignModalTitle"></h6>
294
- <button type="button" class="btn-close btn-sm" data-bs-dismiss="modal"></button>
 
 
 
 
 
295
  </div>
296
- <div class="modal-body p-2">
297
- <div id="assign-btns" class="d-grid gap-2">
298
- <button class="btn btn-outline-primary btn-sm" onclick="doAssign('hall')">
299
- <i class="bi bi-people me-1"></i>ホール担当にする
300
- </button>
301
- <button class="btn btn-outline-success btn-sm" onclick="doAssign('kitchen')">
302
- <i class="bi bi-fire me-1"></i>キッチン担当にする
303
- </button>
304
- <hr class="my-1">
305
- <div class="small text-muted mb-1">応援(カスタム時間)</div>
306
- <div class="d-flex gap-1 align-items-center">
307
- <input type="time" id="reinf-start" class="form-control form-control-sm" style="width:50%">
308
- <span class="small">〜</span>
309
- <input type="time" id="reinf-end" class="form-control form-control-sm" style="width:50%">
 
310
  </div>
311
- <div class="d-flex gap-1">
312
- <button class="btn btn-outline-secondary btn-sm flex-grow-1" onclick="doReinf('hall')">H応援</button>
313
- <button class="btn btn-outline-secondary btn-sm flex-grow-1" onclick="doReinf('kitchen')">K応援</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  </div>
 
 
 
 
 
 
 
 
 
315
  </div>
316
- <div id="remove-btn" class="d-grid mt-2" style="display:none!important">
317
- <button class="btn btn-outline-danger btn-sm" onclick="doRemove()">
 
 
318
  <i class="bi bi-x-circle me-1"></i>担当を外す
319
  </button>
320
  </div>
 
321
  </div>
322
  </div>
323
  </div>
@@ -406,31 +485,79 @@ function parseT(s) {
406
  }
407
 
408
  let _modal = null;
409
- let _cell = null; // 現在操作中のセル
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
 
411
  function openAssignModal(cell) {
412
  _cell = cell;
413
- const name = cell.dataset.empName;
414
- const ds = cell.dataset.date;
415
- const slotJp = cell.dataset.slot === 'breakfast' ? '朝食' : 'ディナー';
416
- document.getElementById('assignModalTitle').textContent = `${name} ${ds.slice(5).replace('-','/')}(${slotJp})`;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
 
418
- const assigned = cell.dataset.assigned === 'true';
419
- document.getElementById('remove-btn').style.display = assigned ? 'grid' : 'none';
 
 
 
 
420
 
421
  if (!_modal) _modal = new bootstrap.Modal(document.getElementById('assignModal'));
422
  _modal.show();
423
  }
424
 
 
 
 
 
 
 
 
 
425
  function doAssign(pos) {
426
  const d = _cell.dataset;
427
  callAssign({ employee_id: +d.empId, date: d.date, time_slot: d.slot, position: pos, action: 'add' });
428
  }
429
 
430
- function doReinf(pos) {
431
  const start = document.getElementById('reinf-start').value;
432
  const end = document.getElementById('reinf-end').value;
433
- if (!start || !end) { alert('開始・終了時刻を入力してください'); return; }
 
 
 
 
 
 
 
434
  const d = _cell.dataset;
435
  callAssign({ employee_id: +d.empId, date: d.date, time_slot: d.slot, position: pos,
436
  action: 'add', is_reinforcement: true, reinf_start: start, reinf_end: end });
 
76
  .chip-hall { background: #dbeafe; color: #1e40af; border-radius: 4px; padding: 1px 5px; font-size: .75rem; }
77
  .chip-kitchen { background: #dcfce7; color: #166534; border-radius: 4px; padding: 1px 5px; font-size: .75rem; }
78
  .chip-empty { color: #cbd5e1; }
79
+
80
+ /* ── 担当編集モーダル ── */
81
+ .asgn-modal-content {
82
+ background: #1e293b; color: white; border: none; border-radius: 16px;
83
+ }
84
+ .asgn-section {
85
+ padding: .65rem 0;
86
+ border-bottom: 1px solid #334155;
87
+ }
88
+ .asgn-section:last-child { border-bottom: none; }
89
+ .asgn-section-label {
90
+ font-size: .68rem; font-weight: 700; letter-spacing: .06em;
91
+ text-transform: uppercase; color: #64748b; margin-bottom: .55rem;
92
+ }
93
+ .asgn-pos-btn {
94
+ background: #0f172a; border: 1px solid #334155; color: #94a3b8;
95
+ border-radius: 10px; padding: .65rem .4rem; font-size: .82rem;
96
+ transition: all .15s; cursor: pointer;
97
+ }
98
+ .asgn-pos-btn:hover { background: #1e40af; border-color: #1e40af; color: white; }
99
+ .asgn-pos-btn.hall { background: #1d4ed8; border-color: #1d4ed8; color: white; }
100
+ .asgn-pos-btn.kitchen{ background: #15803d; border-color: #15803d; color: white; }
101
+ .reinf-pos-toggle .btn-check:checked + .btn-outline-primary {
102
+ background: #1d4ed8; color: white;
103
+ }
104
+ .reinf-pos-toggle .btn-check:checked + .btn-outline-success {
105
+ background: #15803d; color: white;
106
+ }
107
+ .reinf-time {
108
+ background: #0f172a; border-color: #334155; color: white; font-size: .9rem;
109
+ }
110
+ .reinf-time:focus {
111
+ background: #0f172a; color: white; border-color: #38bdf8;
112
+ box-shadow: 0 0 0 3px rgba(56,189,248,.15);
113
+ }
114
+ .preset-chip {
115
+ display: inline-block; background: #334155; color: #94a3b8;
116
+ border-radius: 20px; padding: 2px 10px; font-size: .72rem;
117
+ cursor: pointer; transition: all .15s; user-select: none;
118
+ }
119
+ .preset-chip:hover, .preset-chip.active {
120
+ background: #38bdf8; color: #0f172a;
121
+ }
122
  </style>
123
  {% endblock %}
124
  {% block content %}
 
330
 
331
  <!-- 担当編集モーダル -->
332
  <div class="modal fade" id="assignModal" tabindex="-1">
333
+ <div class="modal-dialog modal-dialog-centered" style="max-width:340px">
334
+ <div class="modal-content asgn-modal-content">
335
+
336
+ <!-- ヘッダー -->
337
+ <div class="modal-header border-secondary py-2 px-3">
338
+ <div>
339
+ <div class="fw-semibold" id="asgn-name" style="font-size:.95rem"></div>
340
+ <div class="small text-muted" id="asgn-sub"></div>
341
+ </div>
342
+ <button type="button" class="btn-close btn-close-white ms-auto" data-bs-dismiss="modal"></button>
343
  </div>
344
+
345
+ <div class="modal-body px-3 py-2">
346
+
347
+ <!-- ① 通常担当 -->
348
+ <div class="asgn-section">
349
+ <div class="asgn-section-label">通常担当</div>
350
+ <div class="d-flex gap-2">
351
+ <button class="asgn-pos-btn flex-grow-1 text-center" id="btn-hall"
352
+ onclick="doAssign('hall')">
353
+ <i class="bi bi-people-fill d-block mb-1" style="font-size:1.4rem"></i>ホール
354
+ </button>
355
+ <button class="asgn-pos-btn flex-grow-1 text-center" id="btn-kitchen"
356
+ onclick="doAssign('kitchen')">
357
+ <i class="bi bi-fire d-block mb-1" style="font-size:1.4rem"></i>キッチン
358
+ </button>
359
  </div>
360
+ </div>
361
+
362
+ <!-- ② 応援追加 -->
363
+ <div class="asgn-section">
364
+ <div class="asgn-section-label">応援で追加(カスタム時間)</div>
365
+
366
+ <!-- ポジション選択 -->
367
+ <div class="btn-group reinf-pos-toggle w-100 mb-2" role="group">
368
+ <input type="radio" class="btn-check" name="reinf-pos" id="rp-hall" value="hall" checked>
369
+ <label class="btn btn-outline-primary btn-sm" for="rp-hall">
370
+ <i class="bi bi-people me-1"></i>ホール
371
+ </label>
372
+ <input type="radio" class="btn-check" name="reinf-pos" id="rp-kitchen" value="kitchen">
373
+ <label class="btn btn-outline-success btn-sm" for="rp-kitchen">
374
+ <i class="bi bi-fire me-1"></i>キッチン
375
+ </label>
376
+ </div>
377
+
378
+ <!-- 時間入力 -->
379
+ <div class="small text-muted mb-1">時間帯
380
+ <span id="preset-chips" class="ms-2"></span>
381
  </div>
382
+ <div class="d-flex align-items-center gap-1 mb-2">
383
+ <input type="time" id="reinf-start" class="form-control form-control-sm reinf-time">
384
+ <span class="text-muted small">〜</span>
385
+ <input type="time" id="reinf-end" class="form-control form-control-sm reinf-time">
386
+ </div>
387
+
388
+ <button class="btn btn-primary w-100" onclick="doReinf()">
389
+ <i class="bi bi-person-plus me-1"></i>応援として追加
390
+ </button>
391
  </div>
392
+
393
+ <!-- ③ 担当を外す(割当済みの場合のみ) -->
394
+ <div id="remove-section" class="asgn-section" style="display:none">
395
+ <button class="btn btn-outline-danger w-100 btn-sm" onclick="doRemove()">
396
  <i class="bi bi-x-circle me-1"></i>担当を外す
397
  </button>
398
  </div>
399
+
400
  </div>
401
  </div>
402
  </div>
 
485
  }
486
 
487
  let _modal = null;
488
+ let _cell = null;
489
+
490
+ // スロット別プリセット時間
491
+ const SLOT_PRESETS = {
492
+ breakfast: [
493
+ { label: '全時間', start: '06:00', end: '11:00' },
494
+ { label: '早番', start: '06:00', end: '09:00' },
495
+ { label: '遅番', start: '09:00', end: '11:00' },
496
+ ],
497
+ dinner: [
498
+ { label: '全時間', start: '17:00', end: '22:00' },
499
+ { label: '早番', start: '17:00', end: '20:00' },
500
+ { label: '遅番', start: '19:00', end: '22:00' },
501
+ ],
502
+ };
503
 
504
  function openAssignModal(cell) {
505
  _cell = cell;
506
+ const { empName, date, slot, assigned, pos } = cell.dataset;
507
+ const slotJp = slot === 'breakfast' ? '朝食' : 'ディナー';
508
+
509
+ document.getElementById('asgn-name').textContent = empName;
510
+ document.getElementById('asgn-sub').textContent =
511
+ date.slice(5).replace('-', '/') + '(' + slotJp + ')';
512
+
513
+ // 通常担当ボタン:現在の割当ポジションをハイライト
514
+ document.getElementById('btn-hall').className =
515
+ 'asgn-pos-btn flex-grow-1 text-center' + (pos === 'hall' ? ' hall' : '');
516
+ document.getElementById('btn-kitchen').className =
517
+ 'asgn-pos-btn flex-grow-1 text-center' + (pos === 'kitchen' ? ' kitchen' : '');
518
+
519
+ // プリセットチップを生成
520
+ const presets = SLOT_PRESETS[slot] || [];
521
+ const chipsEl = document.getElementById('preset-chips');
522
+ chipsEl.innerHTML = presets.map(p =>
523
+ `<span class="preset-chip" onclick="applyPreset('${p.start}','${p.end}',this)">${p.label}</span>`
524
+ ).join(' ');
525
 
526
+ // デフォルトで全時間をセット
527
+ if (presets.length) applyPreset(presets[0].start, presets[0].end, null);
528
+
529
+ // 担当を外すボタン
530
+ document.getElementById('remove-section').style.display =
531
+ assigned === 'true' ? 'block' : 'none';
532
 
533
  if (!_modal) _modal = new bootstrap.Modal(document.getElementById('assignModal'));
534
  _modal.show();
535
  }
536
 
537
+ function applyPreset(start, end, el) {
538
+ document.getElementById('reinf-start').value = start;
539
+ document.getElementById('reinf-end').value = end;
540
+ // アクティブチップ切替
541
+ document.querySelectorAll('.preset-chip').forEach(c => c.classList.remove('active'));
542
+ if (el) el.classList.add('active');
543
+ }
544
+
545
  function doAssign(pos) {
546
  const d = _cell.dataset;
547
  callAssign({ employee_id: +d.empId, date: d.date, time_slot: d.slot, position: pos, action: 'add' });
548
  }
549
 
550
+ function doReinf() {
551
  const start = document.getElementById('reinf-start').value;
552
  const end = document.getElementById('reinf-end').value;
553
+ if (!start || !end) {
554
+ document.getElementById('reinf-start').classList.add('is-invalid');
555
+ document.getElementById('reinf-end').classList.add('is-invalid');
556
+ return;
557
+ }
558
+ document.getElementById('reinf-start').classList.remove('is-invalid');
559
+ document.getElementById('reinf-end').classList.remove('is-invalid');
560
+ const pos = document.querySelector('input[name="reinf-pos"]:checked').value;
561
  const d = _cell.dataset;
562
  callAssign({ employee_id: +d.empId, date: d.date, time_slot: d.slot, position: pos,
563
  action: 'add', is_reinforcement: true, reinf_start: start, reinf_end: end });