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();
return ContentService.createTextOutput('ok');
}
function doPost(e) {
const data = JSON.parse(e.postData.contents);
if (data.action === 'deleteline') {
deleteOrderLine(data.sku, data.sup);
return ContentService.createTextOutput('ok');
}
if (data.action === 'editline') {
deleteOrderLine(data.sku, data.sup);
const sh = getOrderSheet();
sh.appendRow([getTodayKey(), 'EDIT', data.time,
data.sup, data.name, data.sku, data.qty, '']);
return ContentService.createTextOutput('ok');
}
return writeOrder(data);
}
function getTodayKey() {
const now = new Date();
if (now.getHours() < RESET_HOUR) now.setDate(now.getDate() - 1);
return Utilities.formatDate(now, 'GMT', '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 deleteOrderLine(sku, sup) {
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 && String(rows[i][5]) === String(sku)) {
sh.deleteRow(i+1);
}
}
}
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, '']);
});
return ContentService.createTextOutput('ok');
}
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);
}
}