Cotton code
238 lines · 4.4 KB · JSONRaw
{  "format_version": 1,  "id": "kitchen_delivery",  "name": "Delivery",  "plural": "Deliveries",  "picture": {    "photo": "photo:b2c5d49aa05ad823987a98219f76a6038ed855971f1a2850defd47f302069be5"  },  "builtin": false,  "engine": null,  "visibility": "mine(customer)",  "columns": [    {      "key": "name",      "name": "Delivery",      "type": "text",      "required": true    },    {      "key": "order",      "name": "Order",      "type": "link",      "link_to": "kitchen_order",      "required": true,      "contributes": {        "label": "Delivery"      }    },    {      "key": "customer",      "name": "Customer",      "type": "link",      "link_to": "kitchen_customer",      "required": true    },    {      "key": "due_on",      "name": "Due",      "type": "date",      "required": true    },    {      "key": "slot",      "name": "Slot",      "type": "choice",      "choices": [        "breakfast",        "lunch",        "evening",        "dinner"      ],      "format": "words"    },    {      "key": "address",      "name": "Address",      "type": "longtext"    },    {      "key": "delivered",      "name": "Delivered",      "type": "bool"    },    {      "key": "delivered_at",      "name": "Delivered at",      "type": "date"    },    {      "key": "subscription",      "name": "Plan",      "type": "link",      "link_to": "kitchen_subscription"    },    {      "key": "paid",      "name": "Paid",      "type": "bool"    },    {      "key": "total",      "name": "Total",      "type": "amount",      "computed": {        "lookup": {          "through": "order",          "column": "total"        }      },      "currency": "currency"    },    {      "key": "currency",      "name": "Currency",      "type": "text",      "computed": {        "lookup": {          "through": "order",          "column": "currency"        }      }    }  ],  "title": "name",  "date": "due_on",  "project": null,  "order": null,  "slip": {    "title": "name",    "photo": null,    "toggle": null,    "subtitle": [      "slot",      "delivered",      "paid"    ],    "trailing": "total"  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "name",        "order",        "customer",        "subscription",        "due_on",        "slot",        "delivered",        "paid"      ]    },    {      "heading": "Where",      "columns": [        "address"      ]    },    {      "heading": "Money",      "columns": [        "total",        "currency"      ]    },    {      "heading": "Done",      "columns": [        "delivered_at"      ]    }  ],  "sort": {    "column": "due_on",    "descending": false,    "tie": "name"  },  "empty": {    "title": "No orders",    "message": "Each order comes here to be delivered."  },  "by_day": "due_on",  "acts": [    {      "id": "delivered",      "label": "Delivered",      "object": "tick",      "kind": "update",      "verb": "set",      "data": {        "column": "delivered",        "value": true      },      "when": {        "delivered": false      }    },    {      "id": "paid",      "label": "Paid",      "object": "tick",      "kind": "update",      "verb": "set",      "data": {        "column": "paid",        "value": true      },      "when": {        "paid": false      }    }  ],  "instructions": "One row per order going out, written by rule when the order is taken: the order, its customer, its day, slot and address, and its plan when it is a meal on one. The chef delivers it herself: Delivered dates it, and Paid writes the payment for the order's total (a meal on a plan is paid by the plan). Who may see the row is read from its customer column.",  "card": {    "face": "nancy.delivery",    "fields": [      {        "slot": "title",        "column": "name"      },      {        "slot": "subtitle",        "column": "slot"      },      {        "slot": "body",        "column": "address"      },      {        "slot": "amount",        "column": "total"      },      {        "slot": "date",        "column": "due_on"      },      {        "slot": "facts",        "column": "total",        "also": [          "delivered",          "paid",          "delivered_at"        ]      }    ],    "corner": [      {        "column": "due_on",        "form": "late",        "within": 1      }    ]  }}