const spread = new GC.Spread.Sheets.Workbook(document.getElementById('spreadContainer'));
spread.options.useTouchLayout = true;
spread.options.tabStripVisible = false;
const sheet = spread.getActiveSheet();
const rows = [
['점검 항목', '담당자', '상태'],
['소화기 점검', '김철수', '미완료'],
['비상구 확인', '이영희', '미완료'],
['전기 안전 점검', '박민준', '미완료'],
['가스 밸브 확인', '최유진', '미완료'],
];
rows.forEach((row, r) => {
row.forEach((val, c) => sheet.setValue(r, c, val));
if (r === 0) {
for (let c = 0; c < 3; c++)
sheet.getCell(0, c).backColor('#37474F').foreColor('#fff').font('bold 13px sans-serif').hAlign(1);
}
sheet.setRowHeight(r, 38);
});
[150, 100, 100].forEach((w, c) => sheet.setColumnWidth(c, w));
// 터치 툴바에 '완료 처리' 커스텀 버튼 추가 (체크 아이콘 — data URI, 외부 이미지 의존 없음)
const approveIcon = 'data:image/svg+xml,' + encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9 16.2 4.8 12l-1.4 1.4L9 19 20.6 7.4 19.2 6z" fill="#2E7D32"/></svg>'
);
spread.touchToolStrip.add(
new GC.Spread.Sheets.Touch.TouchToolStripItem(
'Approve',
'완료 처리',
approveIcon,
function () {
const sel = sheet.getSelections();
if (!sel.length) return;
const row = sel[0].row;
if (row < 1 || row >= rows.length) return;
spread.suspendPaint();
sheet.setValue(row, 2, '완료');
sheet.getCell(row, 2).backColor('#E8F5E9').foreColor('#2E7D32').font('bold 12px sans-serif').hAlign(1);
spread.resumePaint();
const log = document.getElementById('logArea');
if (log) log.textContent = `✔ ${sheet.getValue(row, 0)} — 완료 처리됨`;
}
)
);