|
39 | 39 | overlay.className = 'ticket-notification-overlay'; |
40 | 40 | overlay.innerHTML = ` |
41 | 41 | <div class="ticket-notification"> |
| 42 | + <button class="notification-close-btn" aria-label="閉じる">×</button> |
42 | 43 | <div class="notification-content"> |
43 | 44 | <h2>🔔 新しいチケット</h2> |
44 | 45 | <div class="notification-info"> |
|
60 | 61 | `; |
61 | 62 |
|
62 | 63 | document.body.appendChild(overlay); |
63 | | - |
| 64 | + |
| 65 | + // 通知を閉じる関数 |
| 66 | + function closeNotification() { |
| 67 | + if (autoCloseTimeout) { |
| 68 | + clearTimeout(autoCloseTimeout); |
| 69 | + } |
| 70 | + overlay.classList.remove('show'); |
| 71 | + setTimeout(() => overlay.remove(), 300); |
| 72 | + } |
| 73 | + |
| 74 | + // 閉じるボタンのイベント |
| 75 | + const closeBtn = overlay.querySelector('.notification-close-btn'); |
| 76 | + closeBtn.addEventListener('click', closeNotification); |
| 77 | + |
| 78 | + // オーバレイの背景をクリックしても閉じる |
| 79 | + overlay.addEventListener('click', (e) => { |
| 80 | + if (e.target === overlay) { |
| 81 | + closeNotification(); |
| 82 | + } |
| 83 | + }); |
| 84 | + |
64 | 85 | setTimeout(() => overlay.classList.add('show'), 10); |
65 | | - |
| 86 | + |
66 | 87 | setTimeout(() => overlay.classList.add('flash'), 100); |
67 | | - |
68 | | - setTimeout(() => { |
| 88 | + |
| 89 | + // 10秒後に自動的に閉じる |
| 90 | + const autoCloseTimeout = setTimeout(() => { |
69 | 91 | overlay.classList.remove('show'); |
70 | 92 | setTimeout(() => overlay.remove(), 300); |
71 | 93 | }, 10000); |
|
110 | 132 |
|
111 | 133 | function createStaffCard(staff) { |
112 | 134 | const escapedName = escapeHtml(staff.fullName); |
113 | | - const ticketCount = staff.currentTickets ? staff.currentTickets.length : 0; |
114 | 135 | const statusBadge = staff.isWorking |
115 | | - ? `<span class="badge bg-success">対応中 (${ticketCount})</span>` |
| 136 | + ? '<span class="badge bg-success">対応中</span>' |
116 | 137 | : '<span class="badge bg-secondary">待機中</span>'; |
117 | 138 |
|
118 | 139 | let ticketInfo = ''; |
119 | 140 | if (staff.isWorking && staff.currentTickets && staff.currentTickets.length > 0) { |
120 | 141 | const ticketList = staff.currentTickets.map(ticket => { |
121 | 142 | const escapedTitle = escapeHtml(ticket.title); |
| 143 | + const escapedGroupName = escapeHtml(ticket.studentGroupName); |
122 | 144 | return ` |
123 | 145 | <div class="mb-1"> |
124 | 146 | <a href="/admin/tickets/${ticket.id}" class="text-decoration-none"> |
| 147 | + <span class="badge bg-info text-dark me-1" style="font-size: 0.95rem; padding: 0.4rem 0.6rem;">${escapedGroupName}</span> |
125 | 148 | ${escapedTitle} |
126 | 149 | <i class="bi bi-box-arrow-up-right ms-1"></i> |
127 | 150 | </a> |
|
0 commit comments