File size: 13,767 Bytes
72be99e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!DOCTYPE html>
<html lang="th">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>เข้าร่วมกลุ่ม - Group Maker</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
    <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');
        
        body {
            font-family: 'Prompt', sans-serif;
        }
        
        .progress-bar {
            transition: width 0.5s ease;
        }
        
        .group-color-A {
            background-color: #ef4444;
        }
        
        .group-color-B {
            background-color: #3b82f6;
        }
        
        .group-color-C {
            background-color: #10b981;
        }
        
        .group-color-D {
            background-color: #f59e0b;
        }
        
        .group-color-E {
            background-color: #8b5cf6;
        }
        
        .pulse {
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.05);
            }
            100% {
                transform: scale(1);
            }
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Navigation -->
    <nav class="bg-white shadow-sm">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex">
                    <div class="flex-shrink-0 flex items-center">
                        <i data-feather="users" class="text-indigo-600 h-8 w-8"></i>
                        <span class="ml-2 text-xl font-bold text-gray-900">Group Maker</span>
                    </div>
                </div>
                <div class="hidden sm:ml-6 sm:flex sm:items-center">
                    <a href="index.html" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:text-indigo-600 hover:bg-gray-100">หน้าหลัก</a>
                </div>
                <div class="-mr-2 flex items-center sm:hidden">
                    <button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500">
                        <i data-feather="menu" class="block h-6 w-6"></i>
                    </button>
                </div>
            </div>
        </div>
    </nav>

    <!-- Main Content -->
    <div class="max-w-md mx-auto py-12 px-4 sm:px-6 lg:px-8">
        <!-- QR Scan Section -->
        <div id="qr-section" class="bg-white p-6 rounded-lg shadow-md text-center" data-aos="fade-up">
            <div class="flex justify-center">
                <i data-feather="maximize-2" class="h-12 w-12 text-indigo-600"></i>
            </div>
            <h2 class="mt-4 text-xl font-bold text-gray-900">สแกน QR Code</h2>
            <p class="mt-2 text-gray-600">สแกน QR Code จากแอดมินเพื่อเข้าร่วมกิจกรรม</p>
            
            <div class="mt-6">
                <button onclick="showJoinForm()" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
                    <i data-feather="camera" class="mr-2"></i> สแกน QR Code
                </button>
                <p class="mt-2 text-sm text-gray-500">หรือกรอกรหัสกิจกรรมด้วยตนเอง</p>
            </div>
        </div>

        <!-- Join Form Section (Hidden by default) -->
        <div id="join-form-section" class="bg-white p-6 rounded-lg shadow-md mt-6 hidden" data-aos="fade-up">
            <div class="flex justify-center">
                <i data-feather="user-plus" class="h-12 w-12 text-indigo-600"></i>
            </div>
            <h2 class="mt-4 text-xl font-bold text-gray-900">เข้าร่วมกิจกรรม</h2>
            
            <div class="mt-6 space-y-4">
                <div>
                    <label for="session-id" class="block text-sm font-medium text-gray-700">รหัสกิจกรรม</label>
                    <input type="text" id="session-id" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
                </div>
                
                <div>
                    <label for="user-name" class="block text-sm font-medium text-gray-700">ชื่อของคุณ</label>
                    <input type="text" id="user-name" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" placeholder="ชื่อเล่นหรือชื่อจริง">
                </div>
                
                <div>
                    <label for="user-id" class="block text-sm font-medium text-gray-700">รหัสประจำตัว (ไม่จำเป็น)</label>
                    <input type="text" id="user-id" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" placeholder="เช่น รหัสนักเรียน, รหัสพนักงาน">
                </div>
                
                <div class="pt-2">
                    <button onclick="joinSession()" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
                        <i data-feather="log-in" class="mr-2"></i> เข้าร่วมกิจกรรม
                    </button>
                </div>
            </div>
        </div>

        <!-- Waiting Room Section (Hidden by default) -->
        <div id="waiting-room" class="bg-white p-6 rounded-lg shadow-md mt-6 hidden" data-aos="fade-up">
            <div class="flex justify-center">
                <i data-feather="clock" class="h-12 w-12 text-indigo-600"></i>
            </div>
            <h2 class="mt-4 text-xl font-bold text-gray-900">กำลังรอผลการจัดกลุ่ม</h2>
            <p class="mt-2 text-gray-600">กิจกรรม: <span id="activity-name" class="font-medium">กิจกรรมทีมบิลด์ดิ้ง</span></p>
            
            <div class="mt-6">
                <div class="flex justify-between text-sm text-gray-600">
                    <span>ผู้เข้าร่วมแล้ว</span>
                    <span><span id="current-participants">12</span>/<span id="max-participants">30</span></span>
                </div>
                <div class="mt-1 w-full bg-gray-200 rounded-full h-2.5">
                    <div id="progress-bar" class="progress-bar bg-indigo-600 h-2.5 rounded-full" style="width: 40%"></div>
                </div>
            </div>
            
            <div class="mt-6">
                <div class="bg-indigo-50 p-4 rounded-md">
                    <div class="flex">
                        <div class="flex-shrink-0">
                            <i data-feather="info" class="h-5 w-5 text-indigo-600"></i>
                        </div>
                        <div class="ml-3">
                            <p class="text-sm text-indigo-700">
                                กรุณารอจนกว่าแอดมินจะเริ่มการจัดกลุ่ม ผลลัพธ์จะแสดงที่นี่โดยอัตโนมัติ
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Results Section (Hidden by default) -->
        <div id="results-section" class="bg-white p-6 rounded-lg shadow-md mt-6 hidden" data-aos="fade-up">
            <div class="flex justify-center">
                <i data-feather="award" class="h-12 w-12 text-indigo-600"></i>
            </div>
            <h2 class="mt-4 text-xl font-bold text-gray-900">ผลการจัดกลุ่ม</h2>
            <p class="mt-2 text-gray-600">กิจกรรม: <span class="font-medium">กิจกรรมทีมบิลด์ดิ้ง</span></p>
            
            <div class="mt-6">
                <div class="pulse bg-indigo-100 text-indigo-800 text-lg font-bold py-3 px-4 rounded-lg text-center">
                    คุณอยู่ใน <span id="user-group" class="group-color-A px-2 py-1 rounded">กลุ่ม A</span>
                </div>
            </div>
            
            <div class="mt-6 space-y-4">
                <div class="group-card group-color-A p-4 rounded-lg shadow-sm">
                    <h3 class="font-bold text-white">กลุ่ม A</h3>
                    <ul class="mt-2 space-y-1">
                        <li class="text-white">สมชาย ใจดี</li>
                        <li class="text-white">คุณเอง</li>
                        <li class="text-white">สุภาพร สวยงาม</li>
                    </ul>
                </div>
                
                <div class="group-card group-color-B p-4 rounded-lg shadow-sm">
                    <h3 class="font-bold text-white">กลุ่ม B</h3>
                    <ul class="mt-2 space-y-1">
                        <li class="text-white">วิเชษฐ์ เก่งมาก</li>
                        <li class="text-white">อรุณี สดใส</li>
                        <li class="text-white">ประเสริฐ ชัยชนะ</li>
                    </ul>
                </div>
                
                <div class="group-card group-color-C p-4 rounded-lg shadow-sm">
                    <h3 class="font-bold text-white">กลุ่ม C</h3>
                    <ul class="mt-2 space-y-1">
                        <li class="text-white">สมหมาย ใจเย็น</li>
                        <li class="text-white">สุดารัตน์ น่ารัก</li>
                        <li class="text-white">อนุชา กล้าหาญ</li>
                    </ul>
                </div>
            </div>
            
            <div class="mt-6">
                <button class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
                    <i data-feather="save" class="mr-2"></i> บันทึกผลการจัดกลุ่ม
                </button>
            </div>
        </div>
    </div>

    <script>
        AOS.init();
        feather.replace();
        
        function showJoinForm() {
            document.getElementById('qr-section').classList.add('hidden');
            document.getElementById('join-form-section').classList.remove('hidden');
        }
        
        function joinSession() {
            const sessionId = document.getElementById('session-id').value;
            const userName = document.getElementById('user-name').value;
            
            if (!sessionId || !userName) {
                alert('กรุณากรอกรหัสกิจกรรมและชื่อของคุณ');
                return;
            }
            
            // Simulate joining session
            document.getElementById('join-form-section').classList.add('hidden');
            document.getElementById('waiting-room').classList.remove('hidden');
            
            // Simulate real-time updates
            let participants = 12;
            const maxParticipants = 30;
            const interval = setInterval(() => {
                participants += Math.floor(Math.random() * 3);
                if (participants > maxParticipants) {
                    participants = maxParticipants;
                    clearInterval(interval);
                    
                    // After 5 seconds, show results
                    setTimeout(() => {
                        document.getElementById('waiting-room').classList.add('hidden');
                        document.getElementById('results-section').classList.remove('hidden');
                        
                        // Play notification sound
                        const audio = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-positive-interface-beep-221.mp3');
                        audio.play();
                    }, 5000);
                }
                
                document.getElementById('current-participants').textContent = participants;
                const progressPercent = (participants / maxParticipants) * 100;
                document.getElementById('progress-bar').style.width = `${progressPercent}%`;
            }, 1000);
        }
    </script>
</body>
</html>