first commit

This commit is contained in:
2025-11-11 11:19:13 +07:00
parent c838b2a979
commit fe028d274b
64 changed files with 8125 additions and 0 deletions

32
plan-app/renderer.js Normal file
View File

@@ -0,0 +1,32 @@
// renderer.js
const { ipcRenderer } = require('electron');
document.getElementById('btnSelect').addEventListener('click', async () => {
console.log('🟢 clicked select'); // Debug
const filePath = await ipcRenderer.invoke('select-file');
console.log('📁 File selected:', filePath);
if (filePath) document.getElementById('filePath').value = filePath;
});
document.getElementById('btnRun').addEventListener('click', async () => {
const filePath = document.getElementById('filePath').value;
const mode = document.getElementById('mode').value;
if (!filePath) {
document.getElementById('status').innerText = '⚠️ กรุณาเลือกไฟล์ Excel ก่อน';
return;
}
document.getElementById('status').innerText = 'กำลังประมวลผล...';
try {
const resultMessage = await ipcRenderer.invoke('run-script', { script: mode, filePath });
// ตรวจสอบข้อความที่ส่งกลับมาจาก main process
if (resultMessage === 'ยกเลิกการบันทึก') {
document.getElementById('status').innerText = 'สถานะ: ยกเลิกโดยผู้ใช้';
} else {
document.getElementById('status').innerText = `${resultMessage}`; // แสดงข้อความสำเร็จที่ได้รับ
}
} catch (err) {
document.getElementById('status').innerText = '❌ เกิดข้อผิดพลาด: ' + err;
}
});