| Product | Content | ผู้รับผิดชอบ | สถานะ | วันที่ |
|---|---|---|---|---|
กรุณาเข้าสู่ระบบเพื่อเข้าใช้งานแอปพลิเคชัน
กำลังรอข้อมูลจาก Google Sheet...
| Product | Content | ผู้รับผิดชอบ | สถานะ | วันที่ |
|---|---|---|---|---|
ดูงานที่มีกำหนดปล่อยโพสต์ในมุมมองรายเดือน
สรุปงานที่ยังไม่ปิด แยกตามผู้รับผิดชอบและกำหนดใกล้สุด
แสดงรายการผลงานที่สิ้นสุดขั้นตอนการตัดต่อแล้ว
จัดการโปรไฟล์ การแสดงผล และฐานข้อมูล
function doGet(e) {
var cache = CacheService.getScriptCache();
var sheetName = (e && e.parameter && e.parameter.sheet) || "ตารางงาน 2026";
var cacheKey = "work_schedule_v4_" + sheetName;
try {
var cached = cache.get(cacheKey);
if (cached) {
return ContentService
.createTextOutput(cached)
.setMimeType(ContentService.MimeType.JSON);
}
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getSheetByName(sheetName) || spreadsheet.getSheets()[0];
var lastRow = sheet.getLastRow();
var lastColumn = sheet.getLastColumn();
if (lastRow === 0 || lastColumn === 0) {
return jsonOutput({
status: "success",
data: [],
backgroundsByColumn: {}
});
}
var allValues = sheet.getRange(1, 1, lastRow, lastColumn).getValues();
var headers = allValues[0].map(function(header) {
return header ? header.toString().trim() : "";
});
var wantedColumns = [
"product send",
"content",
"products",
"owner",
"สถานะ",
"ปก",
"วันที่",
"draft 1",
"draft 2",
"draft 3",
"ปล่อยโพสต์",
"post",
"remark"
];
var selectedIndexes = [];
headers.forEach(function(header, index) {
var normalized = header.toLowerCase();
var matched = wantedColumns.some(function(columnName) {
return normalized === columnName || normalized.indexOf(columnName) !== -1;
});
if (matched && selectedIndexes.indexOf(index) === -1) {
selectedIndexes.push(index);
}
});
var data = allValues.map(function(row) {
return selectedIndexes.map(function(index) {
return row[index];
});
});
var contentIndex = headers.findIndex(function(header) {
return header.toLowerCase() === "content";
});
var statusIndex = headers.findIndex(function(header) {
return header.toLowerCase() === "สถานะ";
});
var backgroundsByColumn = {};
if (contentIndex !== -1) {
backgroundsByColumn.content = sheet
.getRange(1, contentIndex + 1, lastRow, 1)
.getBackgrounds()
.map(function(row) { return row[0]; });
}
if (statusIndex !== -1) {
backgroundsByColumn.status = sheet
.getRange(1, statusIndex + 1, lastRow, 1)
.getBackgrounds()
.map(function(row) { return row[0]; });
}
var payload = JSON.stringify({
status: "success",
data: data,
backgroundsByColumn: backgroundsByColumn,
cachedAt: new Date().toISOString()
});
cache.put(cacheKey, payload, 30);
return ContentService
.createTextOutput(payload)
.setMimeType(ContentService.MimeType.JSON);
} catch (error) {
return jsonOutput({
status: "error",
message: error.toString()
});
}
}
function jsonOutput(payload) {
return ContentService
.createTextOutput(JSON.stringify(payload))
.setMimeType(ContentService.MimeType.JSON);
}
อนุญาตให้คนนอกล็อกอินเข้ามาและอยู่ในสถานะรออนุมัติ
| ผู้ใช้ (Email) | สถานะ | สิทธิ์ | จัดการ |
|---|
| กำลังโหลด... |