{ "format_version": 1, "id": "kitchen_subscription", "name": "Subscription", "plural": "Subscriptions", "picture": null, "builtin": false, "engine": null, "visibility": "mine(customer)", "columns": [ { "key": "name", "name": "Subscription", "type": "text", "required": true }, { "key": "customer", "name": "Customer", "type": "link", "link_to": "kitchen_customer", "required": true, "contributes": { "label": "Subscriptions" } }, { "key": "plan", "name": "Plan", "type": "link", "link_to": "kitchen_plan", "required": true, "contributes": { "label": "Subscribers" } }, { "key": "meals", "name": "Meals", "type": "number", "required": true, "reading": "{value} meals" }, { "key": "started_on", "name": "Started", "type": "date" }, { "key": "ends_on", "name": "Ends", "type": "date", "reading": "ends {value}" }, { "key": "slot", "name": "Slot", "type": "choice", "choices": [ "breakfast", "lunch", "evening", "dinner" ], "format": "words" }, { "key": "address", "name": "Address", "type": "longtext" }, { "key": "price", "name": "Price", "type": "amount", "currency": "currency" }, { "key": "currency", "name": "Currency", "type": "text" }, { "key": "status", "name": "Status", "type": "choice", "choices": [ "active", "paused", "ended" ], "format": "words" }, { "key": "meals_taken", "name": "Meals taken", "type": "number", "computed": { "rollup": { "table": "kitchen_order", "link": "subscription", "op": "sum", "column": "quantity" } } }, { "key": "meals_left", "name": "Meals left", "type": "number", "computed": { "formula": { "op": "difference", "of": [ "meals", "meals_taken" ] } }, "reading": "{value} meals left" } ], "title": "name", "date": "ends_on", "project": null, "order": null, "slip": { "title": "name", "photo": null, "toggle": null, "subtitle": [ "meals_left", "ends_on" ], "trailing": "price" }, "tile": { "face": "slip-list" }, "page": [ { "heading": null, "columns": [ "name", "customer", "plan", "status", "meals", "meals_taken", "meals_left" ] }, { "heading": "When", "columns": [ "started_on", "ends_on", "slot" ] }, { "heading": "Where", "columns": [ "address" ] }, { "heading": "Money", "columns": [ "price", "currency" ] } ], "sort": { "column": "ends_on", "descending": false, "tie": "name" }, "empty": { "title": "No subscriptions", "message": "A customer who buys a plan holds one here." }, "by_day": "ends_on", "card": { "face": "sharmila.membership", "fields": [ { "slot": "title", "column": "name" }, { "slot": "subtitle", "column": "meals_left", "also": [ "slot" ] }, { "slot": "price", "column": "price" }, { "slot": "next_charge", "column": "ends_on" }, { "slot": "state", "column": "status", "only": [ "paused", "ended" ] }, { "slot": "body", "column": "address" } ], "corner": [ { "column": "ends_on", "form": "relative", "within": 7 } ] }, "acts": [ { "id": "pause", "label": "Pause", "object": "clock", "kind": "update", "verb": "set", "data": { "column": "status", "value": "paused" }, "when": { "status": "active" } }, { "id": "resume", "label": "Resume", "object": "retry", "kind": "update", "verb": "set", "data": { "column": "status", "value": "active" }, "when": { "status": "paused" } } ], "instructions": "One row per meal plan a customer bought: the plan, how many meals it holds, when it runs, the slot and the address meals go to. Each order taken against it names it, and Meals left counts down from those orders. Who may see the row is read from its customer column." }