Cotton code
216 lines · 4.1 KB · JSONRaw
{  "format_version": 1,  "id": "yoga_booking",  "name": "Booking",  "plural": "Bookings",  "picture": null,  "builtin": false,  "engine": null,  "visibility": "mine(member)",  "columns": [    {      "key": "name",      "name": "Booking",      "type": "text"    },    {      "key": "member",      "name": "Member",      "type": "link",      "link_to": "yoga_member",      "required": true,      "contributes": {        "label": "Bookings"      }    },    {      "key": "session",      "name": "Session",      "type": "link",      "link_to": "yoga_session",      "required": true,      "contributes": {        "label": "Booked"      }    },    {      "key": "quantity",      "name": "Places",      "type": "number",      "default": 1,      "units": {        "one": "place",        "other": "places"      }    },    {      "key": "starts",      "name": "Starts",      "type": "time",      "computed": {        "lookup": {          "through": "session",          "column": "starts"        }      }    },    {      "key": "photo",      "name": "Photo",      "type": "photo",      "computed": {        "lookup": {          "through": "session",          "column": "photo"        }      }    },    {      "key": "on",      "name": "On",      "type": "date"    },    {      "key": "here",      "name": "Came",      "type": "bool"    },    {      "key": "present",      "name": "Here",      "type": "number",      "computed": {        "rollup": {          "table": "yoga_attendance",          "link": "booking",          "op": "count"        }      },      "reading": "{value} here"    },    {      "key": "member_left",      "name": "Pack left",      "type": "number",      "computed": {        "lookup": {          "through": "member",          "column": "pack_left"        }      },      "reading": "{value} classes left"    },    {      "key": "staff_override",      "name": "Staff override",      "type": "bool",      "default": false    }  ],  "title": "name",  "date": "on",  "project": null,  "order": null,  "slip": {    "title": "name",    "photo": null,    "toggle": null,    "subtitle": [      "member",      "present"    ],    "trailing": "on"  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "name",        "member",        "session",        "quantity",        "on",        "present"      ]    }  ],  "sort": {    "column": "on",    "descending": true,    "tie": "name"  },  "empty": {    "title": "No bookings",    "message": "Book a member from a session."  },  "delete": false,  "acts": [    {      "id": "here",      "label": "Here",      "object": "tick",      "kind": "update",      "verb": "set",      "data": {        "column": "here",        "value": true      },      "when": {        "here": false,        "present": 0      }    },    {      "id": "here_override",      "label": "Here with staff override",      "object": "tick",      "kind": "update",      "verb": "set",      "data": {        "column": "staff_override",        "value": true      },      "when": {        "present": 0,        "staff_override": false      }    },    {      "id": "cancel",      "label": "Cancel",      "kind": "delete",      "verb": "cancel_reservation",      "confirm": "Cancel this booking?",      "object": "bin"    }  ],  "instructions": "One row per member booked into a session, made only by reserve_record and removed only by cancel_reservation {tool: \"yoga\", id}. Never create one directly. Mark the member here with the Here act (run_record_act {table: \"yoga_booking\", id, act: \"here\"}): its rule writes the attendance row.",  "card": {    "face": "event",    "fields": [      {        "slot": "photo",        "column": "photo"      },      {        "slot": "title",        "column": "name"      },      {        "slot": "subtitle",        "column": "quantity"      },      {        "slot": "date",        "column": "on",        "form": "weekday_date",        "also": [          "starts"        ]      }    ]  }}