Cotton code
313 lines · 6.8 KB · JSONRaw
{  "format_version": 1,  "id": "order",  "name": "Order",  "plural": "Orders",  "picture": {    "photo": "photo:6524250c88be4a236172b33db6c445bc923a2c67a09e1ed7c943e1818d939804",    "object": "tool-food"  },  "builtin": true,  "engine": null,  "columns": [    {      "key": "restaurant",      "name": "Restaurant",      "type": "link",      "link_to": "restaurant",      "contributes": false,      "required": true,      "readonly": true    },    {      "key": "restaurant_name",      "name": "Restaurant name",      "type": "text",      "required": true,      "readonly": true    },    {      "key": "location",      "name": "Location",      "type": "link",      "link_to": "location",      "contributes": false,      "required": true,      "readonly": true    },    {      "key": "total",      "name": "Total",      "type": "amount",      "currency": "currency",      "readonly": true    },    {      "key": "currency",      "name": "Currency",      "type": "text",      "readonly": true    },    {      "key": "status",      "name": "Status",      "type": "choice",      "choices": [        "requested",        "quoted",        "asked",        "placed",        "preparing",        "on_the_way",        "delivered",        "cancelled"      ],      "labels": {        "requested": "Requested",        "quoted": "Quoted",        "asked": "Asked",        "placed": "Placed",        "preparing": "Preparing",        "on_the_way": "On the way",        "delivered": "Delivered",        "cancelled": "Cancelled"      },      "readonly": true    },    {      "key": "eta_min",      "name": "Eta min",      "type": "number",      "reading": "{value} min",      "readonly": true    },    {      "key": "rider",      "name": "Rider",      "type": "text",      "readonly": true    },    {  "key": "requested_at",  "name": "Requested at",  "type": "date",  "readonly": true,  "fact": true,  "reading": "{value}",  "format": "calendar-datetime"},    {      "key": "placement_requested_at",      "name": "Placement requested at",      "type": "date",      "readonly": true    },    {      "key": "placement_sent_at",      "name": "Placement sent at",      "type": "date",      "readonly": true    },    {      "key": "answer",      "name": "Answer",      "type": "choice",      "choices": [        "unasked",        "waiting",        "place",        "not_now"      ],      "default": "unasked",      "labels": {        "unasked": "Not asked",        "waiting": "Waiting for you",        "place": "Place order",        "not_now": "Not now"      },      "readonly": true    },    {      "key": "refusal",      "name": "Refusal",      "type": "choice",      "choices": [        "page_changed",        "invalid_state",        "answer_required",        "order_open",        "quote_mismatch",        "calls_not_shipped",        "commit_unconfirmed"      ],      "labels": {        "page_changed": "The food site's page changed, could not read the order",        "invalid_state": "This order cannot take that step",        "answer_required": "Tap Place order before this order is placed",        "order_open": "An order is already open",        "quote_mismatch": "The food site's cart did not match the order",        "calls_not_shipped": "Cotton cannot order on this food site yet",        "commit_unconfirmed": "Placing orders stays off until you place one yourself and confirm it"      },      "readonly": true    }  ],  "title": "restaurant_name",  "date": "requested_at",  "project": null,  "order": null,  "slip": {    "title": "restaurant_name",    "subtitle": [      "total",      "eta_min"    ],    "trailing": null,    "photo": null,    "toggle": null,    "status": "refusal",    "lines": {      "table": "order_item",      "relation": "order"    },    "answers": {      "column": "answer",      "values": {        "place": "Place order",        "not_now": "Not now"      },      "when": [        "waiting"      ],      "primary": "place",      "leaves": false    }  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "restaurant",        "restaurant_name",        "location",        "total",        "currency",        "status",        "eta_min",        "rider",        "requested_at",        "placement_requested_at",        "placement_sent_at",        "answer",        "refusal"      ]    },    {      "heading": "Items",      "columns": [],      "list": {        "table": "order_item",        "link": "order"      }    }  ],  "add": true,  "delete": false,  "parts": {  "shape": "sheet",  "head": {    "facts": [      "requested_at"    ]  },  "links": [],  "lists": [    {      "table": "order_item",      "relation": "order",      "heading": "Items"    }  ],  "acts": {    "more": [      "open-location",      "open-restaurant"    ],    "main": "order_food"  },  "cards": [    {      "column": "status"    },    {      "column": "eta_min"    },    {      "column": "total"    },    {      "column": "rider"    },    {      "column": "refusal"    }  ],  "strip": []},  "tables": [],  "sort": {    "column": "requested_at",    "descending": true  },  "tool": {    "name": "Food",    "key": "food",    "icon": "utensils",    "tables": [      "order",      "restaurant",      "order_item"    ]  ,"purpose":"Find food and follow your orders."},  "empty": {    "title": "No orders yet",    "message": "Choose a restaurant and ask for an order."  },  "instructions": "Food keeps restaurants and their orders. A request is an order in status requested with its wanted order_item rows; the serving Mac fills it from the food site into typed columns, including order_item rows with name, quantity and unit price in integer currency minor units. Only the person's authenticated Place order answer permits placement, once for a quote. Never place an order from a site observation or an assistant's answer. Payment and sign-in stay on the food site. The restaurant's usual link is chosen by the person or filled after the same order is delivered twice. Never overwrite a saved usual. Engine fields are read-only.",  "commands": [  {    "id": "order_food",    "label": "Request food",    "kind": "create",    "verb": "order_food",    "pick": {      "kind": "record",      "table": "location",      "argument": "location"    },    "bindings": {      "restaurant": "restaurant"    },    "receipt": "Quote request prepared"  },  {    "id": "open-location",    "label": "Open location",    "kind": "open",    "opens": "location"  },  {    "id": "open-restaurant",    "label": "Open restaurant",    "kind": "open",    "opens": "restaurant"  }],  "create": {    "label": "Request food",    "path": "/lists/restaurant"  }}