zenityx commited on
Commit
ba6038e
·
verified ·
1 Parent(s): ca25b44

Update index.html

Browse files
Files changed (1) hide show
  1. 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>အော်ဒါများ (မီးဖိုချောင်)</title>
7
  <link rel="stylesheet" href="style.css">
8
  <style>
9
- body { background: #eef7fa; font-family: "Pyidaungsu", "Noto Sans Myanmar", "Tahoma", sans-serif;}
10
- .kitchen-table { width:100%; border-collapse: collapse; margin-top: 1em; }
11
- .kitchen-table th, .kitchen-table td { border: 1px solid #b3d2e5; padding: 6px 8px; text-align: left; }
12
- .kitchen-table th { background: #cee6fa; }
13
- .refresh-btn { background: #2177c2; color: #fff; border: none; border-radius: 8px; padding: 6px 18px; margin-bottom: 12px; cursor:pointer; }
14
- .k-row { font-size: 1.15em; }
15
- @media (max-width: 520px) {
16
- .kitchen-table td, .kitchen-table th { padding: 3px 4px; font-size: 0.97em; }
 
 
17
  }
18
  </style>
19
  </head>
20
  <body>
21
  <div class="container">
22
- <h2 style="text-align:center;">မီးဖိုချောင်အတွက် အော်ဒါစာရင်း</h2>
23
- <button class="refresh-btn" onclick="fetchKitchenOrders()">စာရင်း အသစ်ရယူရန်</button>
24
- <div id="kitchen-orders"></div>
25
  </div>
26
  <script>
27
- const scriptURL = "https://api.sheetbest.com/sheets/67a68e64-dca9-4eea-99b7-0431c5786cf6";
28
- // Dictionary: Thai menu -> Burmese menu
29
- const menuDict = {
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
- function getLatestUnpaidOrders(data) {
69
- const latest = {};
70
- data.forEach((row, idx) => {
71
- const key = `${row.table}__${row.menu}`;
72
- latest[key] = { ...row, idx };
73
- });
74
- return Object.values(latest).filter(r => (r.status ?? "unpaid") === "unpaid");
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
- async function fetchKitchenOrders() {
78
- document.querySelector('.refresh-btn').disabled = true;
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
- const summary = {};
85
- orders.forEach(item => {
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
- let html = `<table class="kitchen-table">
94
- <tr>
95
- <th>စားပွဲ</th>
96
- <th>မီနူး</th>
97
- <th>အရေအတွက်</th>
98
- <th>မှတ်ချက်</th>
99
- <th>အချိန်</th>
100
- </tr>`;
101
- Object.values(summary).forEach(row => {
102
- html += `<tr class="k-row">
103
- <td>${row.table}</td>
104
- <td>${menuDict[row.menu] || row.menu}</td>
105
- <td style="text-align:center;font-weight:bold">${row.qty}</td>
106
- <td>${row.note||""}</td>
107
- <td style="font-size:0.9em;color:#237;">${(row.time||'').replace('T','<br>')}</td>
108
- </tr>`;
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
- fetchKitchenOrders();
 
 
 
 
 
 
 
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>