Spaces:
Running
Running
Update index.html
Browse files- index.html +112 -98
index.html
CHANGED
|
@@ -2,118 +2,132 @@
|
|
| 2 |
<html lang="my">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
| 6 |
-
<title
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
<style>
|
| 9 |
-
|
| 10 |
-
.kitchen-table {
|
| 11 |
-
.kitchen-table th
|
| 12 |
-
.kitchen-table
|
| 13 |
-
.
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
}
|
| 18 |
</style>
|
| 19 |
</head>
|
| 20 |
<body>
|
| 21 |
<div class="container">
|
| 22 |
-
<
|
| 23 |
-
<button
|
| 24 |
-
<div id="kitchen-
|
| 25 |
</div>
|
| 26 |
<script>
|
| 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 |
-
document.querySelector('.refresh-btn').textContent = '...ရယူနေပါသည်...';
|
| 80 |
-
const res = await fetch(scriptURL);
|
| 81 |
-
const data = await res.json();
|
| 82 |
-
const orders = getLatestUnpaidOrders(data);
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
const key = `${item.table}__${item.menu}`;
|
| 87 |
-
if (!summary[key]) summary[key] = { menu: item.menu, table: item.table, qty: 0, note: "", time: item.timestamp || "" };
|
| 88 |
-
summary[key].qty += Number(item.qty || 1);
|
| 89 |
-
if (item.note && item.note.trim() && summary[key].note.trim() === "") summary[key].note = item.note;
|
| 90 |
-
if (item.timestamp) summary[key].time = item.timestamp;
|
| 91 |
-
});
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
});
|
| 110 |
-
html += `</table>`;
|
| 111 |
-
if (Object.keys(summary).length === 0) html = "<div style='color:#aaa;text-align:center'>အော်ဒါအသစ် မရှိသေးပါ</div>";
|
| 112 |
-
document.getElementById('kitchen-orders').innerHTML = html;
|
| 113 |
-
document.querySelector('.refresh-btn').disabled = false;
|
| 114 |
-
document.querySelector('.refresh-btn').textContent = 'စာရင်း အသစ်ရယူရန်';
|
| 115 |
}
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
</script>
|
| 118 |
</body>
|
| 119 |
</html>
|
|
|
|
| 2 |
<html lang="my">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>စာရင်းမုန့်ဆိုင် (ครัว - รวมทะเล ข้าวต้มปลา)</title>
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
<style>
|
| 9 |
+
.kitchen-table { width: 100%; border-collapse: collapse; margin: 18px 0; }
|
| 10 |
+
.kitchen-table th, .kitchen-table td { border: 1px solid #d0e5f7; padding: 8px 7px; text-align: left;}
|
| 11 |
+
.kitchen-table th { background: #e6f3ff; }
|
| 12 |
+
.kitchen-table td { font-size: 1.05em; }
|
| 13 |
+
.table-head { font-size:1.22em; margin-bottom:10px; color: #1b77c2; }
|
| 14 |
+
#refresh-btn { background: #1b77c2; color:#fff; border:none; border-radius:6px; padding:7px 18px; font-size:1em; cursor:pointer;}
|
| 15 |
+
#refresh-btn:hover { background: #185ea2; }
|
| 16 |
+
@media (max-width:600px) {
|
| 17 |
+
.kitchen-table th, .kitchen-table td { padding: 5px 2px; font-size: 0.97em;}
|
| 18 |
+
.table-head { font-size:1em;}
|
| 19 |
}
|
| 20 |
</style>
|
| 21 |
</head>
|
| 22 |
<body>
|
| 23 |
<div class="container">
|
| 24 |
+
<div class="table-head">🍲 မီးဖိုချောင် မှာ အစားအသောက် အော်ဒါများ (รายการสั่งอาหารฝั่งครัว)</div>
|
| 25 |
+
<button id="refresh-btn" onclick="loadKitchen()">ဒေတာအသစ်ယူမည် (ดึงข้อมูล)</button>
|
| 26 |
+
<div id="kitchen-list"></div>
|
| 27 |
</div>
|
| 28 |
<script>
|
| 29 |
+
const scriptURL = "https://api.sheetbest.com/sheets/67a68e64-dca9-4eea-99b7-0431c5786cf6";
|
| 30 |
+
// --- แผนที่ชื่อเมนู ไทย ↔ พม่า
|
| 31 |
+
const menuMap = {
|
| 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 |
+
function getBilingualMenu(menu) {
|
| 71 |
+
const my = menuMap[menu] || "";
|
| 72 |
+
if (my) return `<span style="font-size:1.08em;">${my}</span><br><span style="font-size:0.97em;color:#3574af">${menu}</span>`;
|
| 73 |
+
return `<span>${menu}</span>`;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
async function loadKitchen() {
|
| 77 |
+
document.getElementById('kitchen-list').innerHTML = "<div style='color:#bbb'>ခဏစောင့်ပါ... (กำลังโหลด...)</div>";
|
| 78 |
+
const res = await fetch(scriptURL);
|
| 79 |
+
const data = await res.json();
|
| 80 |
+
|
| 81 |
+
// Soft delete รวมยอดแต่ละเมนูแต่ละโต๊ะ
|
| 82 |
+
const orders = {};
|
| 83 |
+
data.forEach(row => {
|
| 84 |
+
if ((row.status ?? "unpaid") !== "unpaid") return;
|
| 85 |
+
if (!row.menu || !row.table) return;
|
| 86 |
+
const key = row.table + "___" + row.menu;
|
| 87 |
+
if (!orders[key]) {
|
| 88 |
+
orders[key] = {
|
| 89 |
+
table: row.table,
|
| 90 |
+
menu: row.menu,
|
| 91 |
+
qty: 0,
|
| 92 |
+
note: row.note || "",
|
| 93 |
+
time: row.timestamp || "",
|
| 94 |
+
};
|
| 95 |
+
}
|
| 96 |
+
orders[key].qty += Number(row.qty || 1);
|
| 97 |
+
if (row.timestamp) orders[key].time = row.timestamp;
|
| 98 |
+
});
|
| 99 |
|
| 100 |
+
// Filter เฉพาะที่ qty > 0
|
| 101 |
+
let orderArr = Object.values(orders).filter(o => o.qty > 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
+
// sort ใหม่สุดด้านบน (เรียงเวลาล่าสุด)
|
| 104 |
+
orderArr = orderArr.sort((a, b) => (b.time > a.time ? 1 : -1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
+
let html = `<table class="kitchen-table">
|
| 107 |
+
<tr>
|
| 108 |
+
<th>စားပွဲ<br>(โต๊ะ)</th>
|
| 109 |
+
<th>မီနူး<br>(เมนู)</th>
|
| 110 |
+
<th>အရေအတွက်<br>(จำนวน)</th>
|
| 111 |
+
<th>မှတ်ချက်<br>(หมายเหตุ)</th>
|
| 112 |
+
<th>အချိန်<br>(เวลา)</th>
|
| 113 |
+
</tr>`;
|
| 114 |
+
for (const o of orderArr) {
|
| 115 |
+
html += `<tr>
|
| 116 |
+
<td style="text-align:center">${o.table}</td>
|
| 117 |
+
<td>${getBilingualMenu(o.menu)}</td>
|
| 118 |
+
<td style="text-align:center">${o.qty}</td>
|
| 119 |
+
<td>${o.note ? o.note : ""}</td>
|
| 120 |
+
<td style="font-size:0.95em;">${o.time ? o.time.substring(0,19).replace("T", " ") : ""}</td>
|
| 121 |
+
</tr>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
}
|
| 123 |
+
html += "</table>";
|
| 124 |
+
if (!orderArr.length) html = "<div style='color:#bbb'>မရှိသေးပါ (ยังไม่มีออเดอร์ค้างในระบบ)</div>";
|
| 125 |
+
|
| 126 |
+
document.getElementById('kitchen-list').innerHTML = html;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
// --- โหลดครั้งแรก ---
|
| 130 |
+
loadKitchen();
|
| 131 |
</script>
|
| 132 |
</body>
|
| 133 |
</html>
|