Cotton code
208 lines · 4.0 KB · JSONRaw
{  "format_version": 1,  "id": "kitchen_order",  "name": "Order",  "plural": "Orders",  "picture": null,  "builtin": false,  "engine": null,  "visibility": "mine(customer)",  "columns": [    {      "key": "name",      "name": "Order",      "type": "text"    },    {      "key": "customer",      "name": "Customer",      "type": "link",      "link_to": "kitchen_customer",      "required": true,      "contributes": {        "label": "Orders"      }    },    {      "key": "menu_day",      "name": "Menu day",      "type": "link",      "link_to": "kitchen_menu_day",      "required": true,      "contributes": {        "label": "Orders"      }    },    {      "key": "for_day",      "name": "For",      "type": "date"    },    {      "key": "quantity",      "name": "Plates",      "type": "number",      "reading": "{value} plates"    },    {      "key": "currency",      "name": "Currency",      "type": "text"    },    {      "key": "total",      "name": "Total",      "type": "amount",      "computed": {        "rollup": {          "table": "kitchen_order_line",          "link": "order",          "op": "sum",          "column": "line_total"        }      },      "currency": "currency"    },    {      "key": "subscription",      "name": "Plan",      "type": "link",      "link_to": "kitchen_subscription",      "contributes": {        "label": "Meals"      }    },    {      "key": "slot",      "name": "Slot",      "type": "choice",      "choices": [        "breakfast",        "lunch",        "evening",        "dinner"      ],      "format": "words"    },    {      "key": "address",      "name": "Address",      "type": "longtext"    },    {      "key": "plan_override",      "name": "Over the plan",      "type": "bool"    }  ],  "title": "name",  "date": "for_day",  "project": null,  "order": null,  "slip": {    "title": "name",    "photo": null,    "toggle": null,    "subtitle": [      "customer",      "slot",      "quantity"    ],    "trailing": "total"  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "name",        "customer",        "menu_day",        "subscription",        "for_day",        "slot",        "quantity"      ]    },    {      "heading": "Where",      "columns": [        "address"      ]    },    {      "heading": "Money",      "columns": [        "total",        "currency"      ]    }  ],  "sort": {    "column": "for_day",    "descending": true,    "tie": "name"  },  "empty": {    "title": "No orders",    "message": "Take an order from the day's menu."  },  "by_day": "for_day",  "delete": false,  "acts": [    {      "id": "cancel",      "label": "Cancel",      "kind": "delete",      "verb": "cancel_reservation",      "confirm": "Cancel this order?",      "object": "bin"    }  ],  "instructions": "One row per order against a day's menu, made only by reserve_record and removed only by cancel_reservation {tool: \"kitchen\", id}. Its lines say what was ordered and what each costs; the total is their sum. It carries the slot and address it goes to, and the customer's subscription when it is a meal on a plan. Its delivery is written by rule; the chef marks that Delivered and Paid.",  "card": {    "face": "plain",    "fields": [      {        "slot": "title",        "column": "name"      },      {        "slot": "subtitle",        "column": "slot",        "also": [          "quantity"        ]      },      {        "slot": "body",        "column": "address"      },      {        "slot": "amount",        "column": "total"      },      {        "slot": "date",        "column": "for_day"      },      {        "slot": "facts",        "column": "total",        "also": [          "quantity",          "for_day"        ]      }    ],    "corner": [      {        "column": "for_day",        "form": "late",        "within": 1      }    ]  }}