-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.html
More file actions
448 lines (397 loc) · 17.8 KB
/
Copy pathIndex.html
File metadata and controls
448 lines (397 loc) · 17.8 KB
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap" rel="stylesheet">
<style>
body {
background-color: #f1f5f9;
font-family: 'Inter', -apple-system, sans-serif;
color: #334155;
}
.glass-sidebar {
background: #ffffff;
border-right: 1px solid #e2e8f0;
}
.card {
background: #ffffff;
border-radius: 12px;
border: 1px solid #e2e8f0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
padding: 24px;
}
.sidebar-item {
display: flex;
align-items: center;
padding: 10px 16px;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s;
font-size: 13px;
font-weight: 600;
color: #64748b;
margin-bottom: 4px;
}
.sidebar-item:hover {
background: #f8fafc;
color: #0f172a;
}
.sidebar-item.active {
background: #eff6ff;
color: #2563eb;
}
.label-tag {
display: block;
font-size: 11px;
font-weight: 700;
color: #94a3b8;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 6px;
}
.input-box {
width: 100%;
background: #fdfdfd;
border: 1px solid #e2e8f0;
border-radius: 8px;
padding: 10px 12px;
font-size: 14px;
outline: none;
transition: border-color 0.2s;
}
.input-box:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}
.btn-primary {
background: #2563eb;
color: #ffffff;
padding: 12px 20px;
border-radius: 8px;
font-weight: 700;
font-size: 14px;
transition: all 0.2s;
cursor: pointer;
border: none;
}
.btn-primary:hover {
background: #1d4ed8;
transform: translateY(-1px);
}
.btn-primary:active {
transform: translateY(0);
}
.btn-primary:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.btn-secondary {
background: #334155;
color: #ffffff;
font-size: 12px;
font-weight: 700;
padding: 8px 16px;
border-radius: 8px;
transition: 0.2s;
}
.btn-secondary:hover {
background: #1e293b;
}
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 10px;
}
.section-title {
font-size: 16px;
font-weight: 800;
color: #1e293b;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 8px;
}
.section-num {
background: #e2e8f0;
color: #475569;
font-size: 10px;
padding: 2px 6px;
border-radius: 4px;
}
</style>
</head>
<body class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<aside class="w-64 glass-sidebar flex flex-col p-6 overflow-hidden">
<div class="mb-8">
<h1 class="text-xl font-extrabold text-slate-900 tracking-tight">IMPACT7</h1>
<p class="text-[10px] text-blue-600 font-bold uppercase tracking-widest mt-1">Admin Console V26.1</p>
</div>
<div class="mb-4">
<input type="text" id="tabSearch" placeholder="시트 이름 검색..." class="input-box text-xs"
onkeyup="filterTabs()">
</div>
<div class="flex-1 overflow-y-auto" id="tabContainer">
<!-- Tabs will be rendered here -->
<div class="text-xs text-slate-400 p-4">데이터 로딩 중...</div>
</div>
<div class="mt-4 pt-4 border-t border-slate-100 flex items-center justify-between">
<span class="text-[10px] font-bold text-slate-400 uppercase">Total Sheets</span>
<span id="tabCount" class="text-sm font-extrabold text-slate-800">0</span>
</div>
</aside>
<!-- Main Content -->
<main class="flex-1 overflow-y-auto p-10 bg-[#f8fafc]">
<div class="max-w-5xl mx-auto space-y-8">
<!-- Section 1 & 2: Wizard and Navigation -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- New Sheet Wizard -->
<div class="card">
<h3 class="section-title">
<span class="section-num">01</span> 시트 생성 마법사
</h3>
<div class="space-y-4">
<div>
<label class="label-tag">새 시트 이름</label>
<input type="text" id="newName" class="input-box" placeholder="예: 2024_02_테스트">
</div>
<div>
<label class="label-tag">참조 시트 (AT1)</label>
<select id="prevDP" class="input-box"></select>
</div>
<button id="createBtn" onclick="runAutomation()" class="btn-primary w-full mt-2">시트 생성 및
자동화</button>
</div>
</div>
<!-- Sheet Navigator -->
<div class="card">
<h3 class="section-title">
<span class="section-num">02</span> 활성 탭 이동
</h3>
<div class="space-y-4">
<div>
<label class="label-tag">이동할 탭 선택</label>
<select id="activeDP" class="input-box"></select>
</div>
<button onclick="gotoSelectedTab()" class="btn-secondary w-full mt-2">선택한 시트로 이동</button>
</div>
</div>
</div>
<!-- Section 3: Detailed Grade Entry -->
<div class="card">
<h3 class="section-title">
<span class="section-num">03</span> 성적 데이터 상세 입력
</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-x-6 gap-y-5">
<div>
<label class="label-tag">학생 이름</label>
<input type="text" id="entry_name" class="input-box">
</div>
<div>
<label class="label-tag">학교명</label>
<input type="text" id="entry_school" class="input-box">
</div>
<div>
<label class="label-tag">학년</label>
<select id="entry_grade" class="input-box">
<option value="1">1학년</option>
<option value="2">2학년</option>
<option value="3">3학년</option>
<option value="6">6학년</option>
</select>
</div>
<div>
<label class="label-tag">응시일</label>
<input type="date" id="entry_date" class="input-box">
</div>
<div>
<label class="label-tag">소속 단지</label>
<select id="entry_dept" class="input-box">
<option value="2단지">2단지</option>
<option value="10단지">10단지</option>
<option value="기타">기타</option>
</select>
</div>
<div>
<label class="label-tag">시험 종류</label>
<select id="entry_type" class="input-box">
<optgroup label="반편성">
<option value="재원생 반편성">재원생 반편성</option>
<option value="비원생 반편성">비원생 반편성</option>
</optgroup>
<optgroup label="재시험">
<option value="재원생 재시험">재원생 재시험</option>
<option value="비원생 재시험">비원생 재시험</option>
</optgroup>
<option value="기타">기타</option>
</select>
</div>
</div>
<div class="mt-8 pt-6 border-t border-slate-100">
<label class="label-tag mb-4 text-slate-500">과목별 점수 (SCORE ENTRY)</label>
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-6 gap-x-3 gap-y-6">
<div class="flex flex-col gap-1">
<label class="text-[10px] font-extrabold text-slate-400 whitespace-nowrap">L/C (20)</label>
<input type="number" id="entry_lc" class="input-box" max="20" placeholder="0">
</div>
<div class="flex flex-col gap-1">
<label class="text-[10px] font-extrabold text-slate-400 whitespace-nowrap">Voca (20)</label>
<input type="number" id="entry_voca" class="input-box" max="20" placeholder="0">
</div>
<div class="flex flex-col gap-1">
<label class="text-[10px] font-extrabold text-slate-400 whitespace-nowrap">Gr (20)</label>
<input type="number" id="entry_gr" class="input-box" max="20" placeholder="0">
</div>
<div class="flex flex-col gap-1">
<label class="text-[10px] font-extrabold text-slate-400 whitespace-nowrap">R/C (20)</label>
<input type="number" id="entry_rc" class="input-box" max="20" placeholder="0">
</div>
<div class="flex flex-col gap-1">
<label class="text-[10px] font-extrabold text-slate-400 whitespace-nowrap">Syn (25)</label>
<input type="number" id="entry_syn" class="input-box" max="25" placeholder="0">
</div>
<div class="flex flex-col gap-1">
<label
class="text-[9px] font-extrabold text-blue-600 uppercase whitespace-nowrap">개별보정</label>
<input type="number" id="entry_adj" class="input-box border-blue-50" placeholder="0">
</div>
</div>
</div>
<div class="mt-10 flex justify-end">
<button onclick="submitGrade()" class="btn-primary px-16 py-4 shadow-lg shadow-blue-100">
성적 데이터 저장하기
</button>
</div>
</div>
<!-- Status Feedback -->
<div id="status"
class="hidden p-4 rounded-lg bg-green-50 border border-green-100 text-green-700 text-xs font-semibold text-center">
</div>
</div>
</main>
<script>
let allTabNames = [];
window.onload = () => {
// 당일까지 입력 가능하도록 수정
const today = new Date().toLocaleDateString('en-CA'); // YYYY-MM-DD format based on local time
const dateInput = document.getElementById('entry_date');
dateInput.max = today;
dateInput.value = today;
loadData();
};
function loadData() {
google.script.run.withSuccessHandler(res => {
allTabNames = res;
renderTabs(res);
updateDropdowns(res);
}).getSheetNames();
}
function renderTabs(names) {
const container = document.getElementById('tabContainer');
document.getElementById('tabCount').innerText = names.length;
container.innerHTML = names.map(n => `
<div class="sidebar-item" onclick="google.script.run.activateSheet('${n}')">
<span class="w-1.5 h-1.5 rounded-full bg-slate-200 mr-2.5"></span>
${n}
</div>
`).join('');
}
function updateDropdowns(names) {
const dp1 = document.getElementById('activeDP');
const dp2 = document.getElementById('prevDP');
const options = names.map(n => `<option value="${n}">${n}</option>`).join('');
dp1.innerHTML = '<option value="" disabled selected>이동할 탭 선택</option>' + options;
dp2.innerHTML = '<option value="" disabled selected>참조 대상 선택</option>' + options;
}
function filterTabs() {
const query = document.getElementById('tabSearch').value.toLowerCase();
const filtered = allTabNames.filter(n => n.toLowerCase().includes(query));
renderTabs(filtered);
}
function gotoSelectedTab() {
const name = document.getElementById('activeDP').value;
if (name) google.script.run.activateSheet(name);
}
function runAutomation() {
const btn = document.getElementById('createBtn');
const data = {
newSheetName: document.getElementById('newName').value,
prevSheetName: document.getElementById('prevDP').value
};
if (!data.newSheetName || !data.prevSheetName) return alert('시트 이름과 참조 시트를 모두 선택해주세요.');
btn.disabled = true;
btn.innerText = '생성 중...';
google.script.run.withSuccessHandler((res) => {
btn.disabled = false;
btn.innerText = '시트 생성 및 자동화';
if (res.status === 'SUCCESS') {
loadData();
alert('성공: 새 시트가 생성되었습니다.');
document.getElementById('newName').value = '';
} else {
alert('에러: ' + res.message);
}
}).createNewExamSheet(data);
}
function submitGrade() {
const btn = event.target;
const originalText = btn.innerText;
const data = {
name: document.getElementById('entry_name').value,
school: document.getElementById('entry_school').value,
grade: document.getElementById('entry_grade').value,
date: document.getElementById('entry_date').value,
dept: document.getElementById('entry_dept').value,
type: document.getElementById('entry_type').value,
scores: {
lc: parseInt(document.getElementById('entry_lc').value) || 0,
voca: parseInt(document.getElementById('entry_voca').value) || 0,
gr: parseInt(document.getElementById('entry_gr').value) || 0,
rc: parseInt(document.getElementById('entry_rc').value) || 0,
syn: parseInt(document.getElementById('entry_syn').value) || 0,
adj: parseInt(document.getElementById('entry_adj').value) || 0
}
};
if (!data.name) return alert('학생 이름을 입력해주세요.');
if (data.scores.lc > 20 || data.scores.voca > 20 || data.scores.gr > 20 || data.scores.rc > 20 || data.scores.syn > 25) {
return alert('입력 가능한 점수 범위를 초과했습니다. 다시 확인해주세요.');
}
btn.disabled = true;
btn.innerText = '기록 중...';
google.script.run
.withSuccessHandler(res => {
btn.disabled = false;
btn.innerText = originalText;
if (res.status === 'SUCCESS') {
alert(res.message);
resetGradeForm(); // 폼 초기화 호출
} else {
alert('에러: ' + res.message);
}
})
.withFailureHandler(err => {
btn.disabled = false;
btn.innerText = originalText;
alert('시스템 통신 에러: ' + err);
})
.submitGradeData(data);
}
function resetGradeForm() {
// 폼 초기화: 다음 사람 입력을 위해 이름과 점수 관련 필드 위주로 초기화
document.getElementById('entry_name').value = '';
document.getElementById('entry_lc').value = '';
document.getElementById('entry_voca').value = '';
document.getElementById('entry_gr').value = '';
document.getElementById('entry_rc').value = '';
document.getElementById('entry_syn').value = '';
document.getElementById('entry_adj').value = '';
// 학교, 학년, 응시일, 소속, 종류는 반복 입력 가능성이 높으므로 유지하거나 선택적으로 초기화
// 여기서는 '이름'에 포커스를 줌
document.getElementById('entry_name').focus();
}
</script>
</body>
</html>