The item list loads automatically from the Off The Rails Google Sheet. Use this screen to optionally connect the shared orders backend (Apps Script) so all chefs' orders pool into one live list.
Apps Script Setup (one-time)
In your Google Sheet go to Extensions → Apps Script, paste this code, click Deploy → New deployment → Web app (Anyone can access), copy the URL above.
// Paste into Google Apps Script
const SHEET_NAME = 'Daily Orders';
const RESET_HOUR = 9;
function doGet(e) {
const action = e.parameter.action || '';
if (action === 'clear') {
clearOrders();
} else if (action === 'deleteline') {
const sku = e.parameter.sku || '';
const sh = getOrderSheet();
const today = getTodayKey();
const rows = sh.getDataRange().getValues();
for (let i = rows.length-1; i >= 1; i--) {
if (rows[i][0] === today && rows[i][5] === sku) {
sh.deleteRow(i+1);
}
}
}
return ContentService.createTextOutput('ok');
}
function doPost(e) {
const data = JSON.parse(e.postData.contents);
const result = writeOrder(data);
return ContentService
.createTextOutput(JSON.stringify(result))
.setMimeType(ContentService.MimeType.JSON);
}
function getTodayKey() {
const now = new Date();
if (now.getHours() < RESET_HOUR) {
now.setDate(now.getDate() - 1);
}
return Utilities.formatDate(now, 'UTC', 'yyyy-MM-dd');
}
function getOrderSheet() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
let sh = ss.getSheetByName(SHEET_NAME);
if (!sh) {
sh = ss.insertSheet(SHEET_NAME);
sh.appendRow(['Date','Chef','Time','Supplier',
'Item','SKU','Qty','Unit']);
}
return sh;
}
function writeOrder(data) {
const sh = getOrderSheet();
const today = getTodayKey();
data.items.forEach(item => {
sh.appendRow([today, data.chef, data.time,
item.supplier, item.name,
item.sku, item.qty, item.unit]);
});
return ContentService
.createTextOutput(JSON.stringify({ok:true}))
.setMimeType(ContentService.MimeType.JSON);
}
function readOrders() {
const sh = getOrderSheet();
const today = getTodayKey();
const rows = sh.getDataRange().getValues();
const items = [];
for (let i = 1; i < rows.length; i++) {
if (rows[i][0] === today) {
items.push({
chef: rows[i][1], time: rows[i][2],
supplier: rows[i][3], name: rows[i][4],
sku: rows[i][5], qty: rows[i][6],
unit: rows[i][7]
});
}
}
return ContentService
.createTextOutput(JSON.stringify({ok:true, items}))
.setMimeType(ContentService.MimeType.JSON);
}
function clearOrders() {
const sh = getOrderSheet();
const today = getTodayKey();
const rows = sh.getDataRange().getValues();
for (let i = rows.length - 1; i >= 1; i--) {
if (rows[i][0] === today) sh.deleteRow(i + 1);
}
return ContentService
.createTextOutput(JSON.stringify({ok:true}))
.setMimeType(ContentService.MimeType.JSON);
}