@blueshed/joined 0.0.0-stage → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/joined/SKILL.md +17 -0
- package/.claude/skills/joined/reference.md +768 -0
- package/LICENSE +19 -0
- package/README.md +115 -2
- package/docs/design.md +148 -0
- package/docs/introduction.md +193 -0
- package/docs/learning.md +76 -0
- package/docs/stories.md +82 -0
- package/examples/app.css +27 -0
- package/examples/cafe/books.html +38 -0
- package/examples/cafe/books.json +13 -0
- package/examples/cafe/books.ts +64 -0
- package/examples/cafe/cafe.css +512 -0
- package/examples/cafe/front.html +115 -0
- package/examples/cafe/front.ts +7 -0
- package/examples/cafe/generated/books.elements.ts +52 -0
- package/examples/cafe/generated/books.queries.ts +11 -0
- package/examples/cafe/generated/books.rules.ts +42 -0
- package/examples/cafe/generated/kitchen.elements.ts +87 -0
- package/examples/cafe/generated/kitchen.queries.ts +47 -0
- package/examples/cafe/generated/kitchen.rules.ts +98 -0
- package/examples/cafe/generated/menu.elements.ts +61 -0
- package/examples/cafe/generated/menu.queries.ts +28 -0
- package/examples/cafe/generated/menu.rules.ts +65 -0
- package/examples/cafe/generated/order.elements.ts +87 -0
- package/examples/cafe/generated/order.queries.ts +47 -0
- package/examples/cafe/generated/order.rules.ts +95 -0
- package/examples/cafe/generated/staff.elements.ts +55 -0
- package/examples/cafe/generated/staff.queries.ts +27 -0
- package/examples/cafe/generated/staff.rules.ts +59 -0
- package/examples/cafe/generated/supplies.elements.ts +62 -0
- package/examples/cafe/generated/supplies.queries.ts +43 -0
- package/examples/cafe/generated/supplies.rules.ts +84 -0
- package/examples/cafe/generated/till.elements.ts +93 -0
- package/examples/cafe/generated/till.queries.ts +57 -0
- package/examples/cafe/generated/till.rules.ts +113 -0
- package/examples/cafe/index.html +70 -0
- package/examples/cafe/kitchen.css +107 -0
- package/examples/cafe/kitchen.html +39 -0
- package/examples/cafe/kitchen.ts +125 -0
- package/examples/cafe/menu.html +55 -0
- package/examples/cafe/menu.json +41 -0
- package/examples/cafe/menu.ts +84 -0
- package/examples/cafe/migrations/001-cafe.ts +11 -0
- package/examples/cafe/order.html +37 -0
- package/examples/cafe/order.ts +45 -0
- package/examples/cafe/rail-drag.ts +30 -0
- package/examples/cafe/routes.ts +32 -0
- package/examples/cafe/staff.json +20 -0
- package/examples/cafe/stories.jsonl +43 -0
- package/examples/cafe/supplies.html +77 -0
- package/examples/cafe/supplies.json +33 -0
- package/examples/cafe/supplies.ts +170 -0
- package/examples/cafe/till.json +95 -0
- package/examples/cafe/till.ts +122 -0
- package/examples/cafe/trust.ts +20 -0
- package/examples/cafe/views.ts +171 -0
- package/examples/docs.ts +28 -0
- package/examples/film.jpg +0 -0
- package/examples/hello/generated/elements.ts +45 -0
- package/examples/hello/generated/queries.ts +24 -0
- package/examples/hello/generated/rules.ts +45 -0
- package/examples/hello/hello.css +27 -0
- package/examples/hello/hello.json +1 -0
- package/examples/hello/index.html +32 -0
- package/examples/hello/migrations/001-hello.ts +6 -0
- package/examples/hello/page.ts +49 -0
- package/examples/hello/routes.ts +6 -0
- package/examples/hello/stories.jsonl +3 -0
- package/examples/index.html +146 -0
- package/examples/page.ts +11 -0
- package/examples/people/adding.ts +20 -0
- package/examples/people/generated/elements.ts +68 -0
- package/examples/people/generated/queries.ts +28 -0
- package/examples/people/generated/rules.ts +85 -0
- package/examples/people/links.ts +124 -0
- package/examples/people/migrations/001-people.ts +6 -0
- package/examples/people/migrations/002-add-people-member-and-guard-people.ts +7 -0
- package/examples/people/migrations/003-add-people-rank-and-guard-people.ts +7 -0
- package/examples/people/order.ts +61 -0
- package/examples/people/people.css +65 -0
- package/examples/people/people.json +26 -0
- package/examples/people/routes.ts +12 -0
- package/examples/people/stories.jsonl +20 -0
- package/examples/people/trust.ts +14 -0
- package/examples/people/view.ts +115 -0
- package/examples/routes.ts +11 -0
- package/examples/trip/answer-rows.ts +70 -0
- package/examples/trip/answers.ts +11 -0
- package/examples/trip/bar.ts +89 -0
- package/examples/trip/calendar-map.css +709 -0
- package/examples/trip/calendar-map.ts +249 -0
- package/examples/trip/drags.ts +143 -0
- package/examples/trip/drawer.ts +250 -0
- package/examples/trip/event-form.ts +199 -0
- package/examples/trip/generated/elements.ts +144 -0
- package/examples/trip/generated/queries.ts +46 -0
- package/examples/trip/generated/rules.ts +239 -0
- package/examples/trip/holding.ts +61 -0
- package/examples/trip/ics.ts +117 -0
- package/examples/trip/index.html +82 -0
- package/examples/trip/line-stops.ts +92 -0
- package/examples/trip/line-words.ts +79 -0
- package/examples/trip/line.ts +121 -0
- package/examples/trip/map.ts +234 -0
- package/examples/trip/mercator.ts +28 -0
- package/examples/trip/migrations/001-trip.ts +7 -0
- package/examples/trip/migrations/002-add-events-zone-and-guard-events.ts +7 -0
- package/examples/trip/migrations/003-guard-events-and-create-events_asked-and-more.ts +9 -0
- package/examples/trip/migrations/004-create-stays.ts +6 -0
- package/examples/trip/migrations/005-guard-events-and-create-events_arrives-and-more.ts +8 -0
- package/examples/trip/month.ts +87 -0
- package/examples/trip/other-weeks.ts +67 -0
- package/examples/trip/page.ts +121 -0
- package/examples/trip/peek.ts +71 -0
- package/examples/trip/people-chips.ts +74 -0
- package/examples/trip/place-search.ts +51 -0
- package/examples/trip/places.ts +34 -0
- package/examples/trip/routes.ts +27 -0
- package/examples/trip/shell.ts +39 -0
- package/examples/trip/stays.css +51 -0
- package/examples/trip/stays.ts +68 -0
- package/examples/trip/stories.jsonl +72 -0
- package/examples/trip/time.ts +46 -0
- package/examples/trip/told.ts +48 -0
- package/examples/trip/trip.json +69 -0
- package/examples/trip/trust.ts +51 -0
- package/examples/trip/week.ts +237 -0
- package/examples/trip/words.ts +4 -0
- package/examples/trip/writes.ts +91 -0
- package/examples/trip/zones.ts +16 -0
- package/examples/trips/card.ts +149 -0
- package/examples/trips/generated/elements.ts +60 -0
- package/examples/trips/generated/queries.ts +28 -0
- package/examples/trips/generated/rules.ts +62 -0
- package/examples/trips/index.html +47 -0
- package/examples/trips/map.ts +52 -0
- package/examples/trips/migrations/001-trips.ts +8 -0
- package/examples/trips/new-trip.ts +46 -0
- package/examples/trips/page.ts +9 -0
- package/examples/trips/routes.ts +7 -0
- package/examples/trips/stories.jsonl +12 -0
- package/examples/trips/trips.css +183 -0
- package/examples/trips/trips.json +7 -0
- package/examples/weeks/derive.ts +23 -0
- package/examples/weeks/generated/elements.ts +52 -0
- package/examples/weeks/generated/rules.ts +33 -0
- package/examples/weeks/routes.ts +4 -0
- package/examples/weeks/weeks.json +1 -0
- package/examples/welcome.css +299 -0
- package/package.json +55 -4
- package/src/attachment.ts +70 -0
- package/src/cli.ts +52 -0
- package/src/client.ts +98 -0
- package/src/compile.ts +2034 -0
- package/src/css.d.ts +5 -0
- package/src/definitions.ts +268 -0
- package/src/demo.css +29 -0
- package/src/demo.ts +42 -0
- package/src/draft.ts +69 -0
- package/src/engine.ts +288 -0
- package/src/file-value.ts +13 -0
- package/src/files.ts +187 -0
- package/src/follow.ts +56 -0
- package/src/hues.ts +3 -0
- package/src/icon-names.ts +77 -0
- package/src/icon.png +0 -0
- package/src/icons.ts +32 -0
- package/src/keep.ts +33 -0
- package/src/link.ts +31 -0
- package/src/mcp.ts +252 -0
- package/src/members/demo.ts +53 -0
- package/src/members/generated/elements.ts +68 -0
- package/src/members/generated/queries.ts +29 -0
- package/src/members/generated/rules.ts +65 -0
- package/src/members/group.ts +294 -0
- package/src/members/keys.ts +221 -0
- package/src/members/members.json +9 -0
- package/src/members/migrations/001-members.ts +6 -0
- package/src/members/migrations/002-guard-members.ts +11 -0
- package/src/members/migrations/003-add-members-act-and-guard-members.ts +7 -0
- package/src/members/panel.css +208 -0
- package/src/members/panel.ts +398 -0
- package/src/members/routes.ts +4 -0
- package/src/members/stories.jsonl +27 -0
- package/src/members/trust.ts +116 -0
- package/src/migrate.ts +597 -0
- package/src/migrations/001-joined.ts +13 -0
- package/src/migrations/002-group-keys.ts +16 -0
- package/src/migrations/003-change-inverse.ts +10 -0
- package/src/migrations/004-change-followed.ts +6 -0
- package/src/ops.ts +61 -0
- package/src/page.css +79 -0
- package/src/page.ts +413 -0
- package/src/parts.css +471 -0
- package/src/parts.ts +152 -0
- package/src/server.ts +862 -0
- package/src/settings.ts +94 -0
- package/src/starter.ts +89 -0
- package/src/store.ts +815 -0
- package/src/stories.ts +387 -0
- package/src/toast.ts +52 -0
- package/src/together.ts +167 -0
- package/src/tokens.css +85 -0
- package/src/tokens.json +457 -0
- package/src/upkeep.ts +86 -0
- package/src/visitors.ts +43 -0
- package/src/write.ts +567 -0
- package/starter/CLAUDE.md +37 -0
- package/starter/gitignore +3 -0
- package/starter/tests/hello-page.test.ts +14 -0
- package/starter/tests/hello.test.ts +8 -0
- package/starter/tsconfig.json +17 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>joined: the cafe's menu</title>
|
|
7
|
+
<link rel="stylesheet" href="joined/tokens.css" />
|
|
8
|
+
<link rel="stylesheet" href="joined/page.css" />
|
|
9
|
+
<link rel="stylesheet" href="../app.css" />
|
|
10
|
+
<link rel="stylesheet" href="./cafe.css" />
|
|
11
|
+
</head>
|
|
12
|
+
<body data-flavour="blueberry">
|
|
13
|
+
<a class="brand" href="/"><img src="joined/icon.png" alt="" width="28" height="28" />joined</a>
|
|
14
|
+
<header class="band">
|
|
15
|
+
<h1>The menu</h1>
|
|
16
|
+
<p class="lead">What the cafe sells, its prices and what's left. The manager changes an item in a drawer.</p>
|
|
17
|
+
<nav class="bar">
|
|
18
|
+
<members-panel></members-panel>
|
|
19
|
+
<a href="/cafe">The cafe</a> <a href="/cafe/till" data-holds="till">Till</a>
|
|
20
|
+
<a href="/cafe/menu" data-holds="menu" aria-current="page">Menu</a>
|
|
21
|
+
<a href="/cafe/kitchen" data-holds="kitchen">Kitchen</a>
|
|
22
|
+
<a href="/cafe/supplies" data-holds="supplies">Supplies</a>
|
|
23
|
+
<a href="/cafe/books" data-holds="books">Books</a>
|
|
24
|
+
</nav>
|
|
25
|
+
</header>
|
|
26
|
+
<main class="cafe menu">
|
|
27
|
+
<section class="card" aria-label="The menu">
|
|
28
|
+
<j-items doc="menu"></j-items>
|
|
29
|
+
</section>
|
|
30
|
+
</main>
|
|
31
|
+
<aside class="drawer" hidden aria-label="An item">
|
|
32
|
+
<form class="item">
|
|
33
|
+
<header>
|
|
34
|
+
<h2></h2>
|
|
35
|
+
<button
|
|
36
|
+
type="button"
|
|
37
|
+
class="icon-only"
|
|
38
|
+
name="close"
|
|
39
|
+
aria-label="Close"
|
|
40
|
+
title="Close"
|
|
41
|
+
data-icon="close"
|
|
42
|
+
></button>
|
|
43
|
+
</header>
|
|
44
|
+
<label>Name<input name="name" required autocomplete="off" /></label>
|
|
45
|
+
<label>Price, £<input name="price" required inputmode="decimal" pattern="\d+(\.\d{1,2})?" /></label>
|
|
46
|
+
<p class="note" role="status"></p>
|
|
47
|
+
<footer>
|
|
48
|
+
<button type="button" class="act" name="never">Never mind</button>
|
|
49
|
+
<button class="act ink" name="go" data-icon="check">Save</button>
|
|
50
|
+
</footer>
|
|
51
|
+
</form>
|
|
52
|
+
</aside>
|
|
53
|
+
<script type="module" src="./menu.ts"></script>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"items": [
|
|
4
|
+
{
|
|
5
|
+
"id": 1,
|
|
6
|
+
"name": "Espresso",
|
|
7
|
+
"price": 250,
|
|
8
|
+
"stock": 40
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": 2,
|
|
12
|
+
"name": "Flat white",
|
|
13
|
+
"price": 340,
|
|
14
|
+
"stock": 30
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": 3,
|
|
18
|
+
"name": "Latte",
|
|
19
|
+
"price": 360,
|
|
20
|
+
"stock": 30
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": 4,
|
|
24
|
+
"name": "Pot of tea",
|
|
25
|
+
"price": 280,
|
|
26
|
+
"stock": 20
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": 5,
|
|
30
|
+
"name": "Croissant",
|
|
31
|
+
"price": 290,
|
|
32
|
+
"stock": 2
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": 6,
|
|
36
|
+
"name": "Cheese toastie",
|
|
37
|
+
"price": 650,
|
|
38
|
+
"stock": 8
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// The menu's page: each item a row (its name, its price, what's left), and an item changed in a drawer, the smallest
|
|
2
|
+
// to copy: a Draft (joined/draft) holds what's typed until Save, one write; Never mind puts it back; a change made
|
|
3
|
+
// elsewhere fills what isn't being typed in, and keeps what is. Refused, why is said in it, and what was typed stays.
|
|
4
|
+
// What's open is in the URL's hash (#item=3, inHash), so Back closes it and a link opens it. Only the manager may
|
|
5
|
+
// change an item, as its may says: no one else is offered the drawer.
|
|
6
|
+
|
|
7
|
+
import "joined/panel";
|
|
8
|
+
import "joined/toast";
|
|
9
|
+
import { Draft } from "joined/draft";
|
|
10
|
+
import { iconButton, iconify } from "joined/icons";
|
|
11
|
+
import { inHash } from "joined/parts";
|
|
12
|
+
import * as menu from "./generated/menu.rules.ts";
|
|
13
|
+
import { JItem } from "./generated/menu.elements.ts";
|
|
14
|
+
import { money } from "./views.ts";
|
|
15
|
+
|
|
16
|
+
const drawer = document.querySelector<HTMLElement>("aside.drawer")!,
|
|
17
|
+
form = drawer.querySelector("form")!,
|
|
18
|
+
draft = new Draft(form, form.querySelector(".note")!);
|
|
19
|
+
/** The item in the drawer, if one is. */
|
|
20
|
+
let open: Item | null = null;
|
|
21
|
+
/** An item as the drawer holds it: its name, and its price in pounds, as it's typed. */
|
|
22
|
+
const fields = (it: Item) => ({ name: it.data.name, price: (it.data.price / 100).toFixed(2) });
|
|
23
|
+
/** Whether what's typed differs from the item: Save and Never mind offered then, and said. */
|
|
24
|
+
const shown = () => draft.show(Object.keys(draft.edits()).length ? "changed" : "kept");
|
|
25
|
+
|
|
26
|
+
/** An item's row: its name, price and what's left, and a way into the drawer where its person may change it. */
|
|
27
|
+
class Item extends JItem {
|
|
28
|
+
#words = document.createElement("span");
|
|
29
|
+
#edit = iconButton("edit", "", () => show(this));
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
if (!this.childElementCount) this.append(this.#words, this.#edit);
|
|
32
|
+
this.draw();
|
|
33
|
+
hash.again(); // named in the address before it was on the page: opened now it is
|
|
34
|
+
}
|
|
35
|
+
draw() {
|
|
36
|
+
this.#words.textContent = `${this.data.name} ${money(this.data.price)} (${this.data.stock} left)`;
|
|
37
|
+
this.#edit.ariaLabel = `Change ${this.data.name}`;
|
|
38
|
+
this.#edit.hidden = !this.matches('[may~="replace:name"], [may~="replace:price"]');
|
|
39
|
+
// the one in the drawer, changed elsewhere: what isn't being typed in follows it
|
|
40
|
+
if (this === open) (draft.fill(fields(this)), shown());
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The drawer, with an item in it, or closed; marked in the hash as it's opened or closed. */
|
|
45
|
+
function show(it: Item | null, mark = true) {
|
|
46
|
+
open = it;
|
|
47
|
+
drawer.hidden = !it;
|
|
48
|
+
if (it) {
|
|
49
|
+
drawer.querySelector("h2")!.textContent = it.data.name;
|
|
50
|
+
draft.refuse("");
|
|
51
|
+
draft.fill(fields(it), true);
|
|
52
|
+
shown();
|
|
53
|
+
}
|
|
54
|
+
if (mark) hash.mark(it?.key ?? null);
|
|
55
|
+
}
|
|
56
|
+
const items = document.getElementsByTagName(menu.collections.items.tag) as HTMLCollectionOf<Item>;
|
|
57
|
+
const hash = inHash(
|
|
58
|
+
"item",
|
|
59
|
+
() => [...items],
|
|
60
|
+
() => open,
|
|
61
|
+
(it) => show(it, false),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
form.addEventListener("input", shown);
|
|
65
|
+
form.addEventListener("submit", async (e) => {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
if (!open) return;
|
|
68
|
+
const { name, price } = draft.edits() as { name?: string; price?: string };
|
|
69
|
+
const why = await open.replace({
|
|
70
|
+
...(name !== undefined ? { name: name.trim() } : {}),
|
|
71
|
+
...(price !== undefined ? { price: Math.round(Number(price) * 100) } : {}),
|
|
72
|
+
});
|
|
73
|
+
draft.refuse(why ?? "");
|
|
74
|
+
// kept: what the drawer holds is the item as it is now
|
|
75
|
+
if (!why && open) (draft.fill(fields(open), true), shown());
|
|
76
|
+
});
|
|
77
|
+
draft.inside(
|
|
78
|
+
drawer,
|
|
79
|
+
() => show(null),
|
|
80
|
+
() => open && (draft.refuse(""), draft.fill(fields(open), true), shown()),
|
|
81
|
+
);
|
|
82
|
+
iconify();
|
|
83
|
+
// defined last, once all it draws with is made
|
|
84
|
+
customElements.define(menu.collections.items.tag, Item);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Made by `bun run compile` from the stories: what they say beyond the migrations before it.
|
|
2
|
+
import { createTable } from "joined/migrate";
|
|
3
|
+
|
|
4
|
+
export const changes = [
|
|
5
|
+
createTable("items", { columns: { name: { type: "text", is: { type: "string", said: "name is a string" } }, price: { type: "integer", is: { type: "integer", said: "price is a whole number" } }, stock: { type: "integer", is: { type: "integer", said: "stock is a whole number" } } }, strict: true, needs: { columns: ["name", "price", "stock"], said: "an item needs name (string), price (integer), stock (integer)" } }),
|
|
6
|
+
createTable("lines", { columns: { order: { type: "integer", is: { type: "integer", said: "order is a whole number" }, to: { table: "orders", said: "order links only to orders the till document holds", held: ["line in till links to it", "lines in till link to it"] } }, item: { type: "integer", is: { type: "integer", said: "item is a whole number" }, to: { table: "items", said: "item links only to items the menu document holds", held: ["line in till links to it", "lines in till link to it"] } }, qty: { type: "integer", is: { type: "integer", said: "qty is a whole number" } }, name: { type: "text", nullable: true, is: { type: "string", said: "name is a string" } }, price: { type: "integer", nullable: true, is: { type: "integer", said: "price is a whole number" } } }, strict: true, needs: { columns: ["order", "item", "qty"], said: "a line needs order (an id in orders), item (an id in items), qty (integer); may have name (string), price (integer)" } }),
|
|
7
|
+
createTable("orders", { columns: { customer: { type: "text", is: { type: "string", said: "customer is a string" } }, status: { type: "text", nullable: true, is: { type: "string", said: "status is a string" } }, placed: { type: "text", nullable: true, is: { type: "form", form: "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(\\.\\d{3})?Z$", said: "placed is an instant (YYYY-MM-DDTHH:MM:SSZ)" } }, code: { type: "text", nullable: true, is: { type: "string", said: "code is a string" } }, total: { type: "integer", nullable: true, is: { type: "integer", said: "total is a whole number" } } }, strict: true, needs: { columns: ["customer"], said: "an order needs customer (string); may have status (string), placed (instant), code (string), total (integer)" } }),
|
|
8
|
+
createTable("posts", { columns: { role: { type: "text", is: { type: "string", said: "role is a string" } } }, strict: true, needs: { columns: ["role"], said: "a post needs role (string), members (ids in members)" } }),
|
|
9
|
+
createTable("posts_members", { columns: { posts: { type: "integer", to: { table: "posts", said: "posts is one of posts", onDelete: "cascade" } }, members: { type: "integer", to: { table: "members", said: "members links only to members the members document holds", onDelete: "cascade" } } }, unique: [["posts", "members"]], strict: true, once: "members links to {members} already" }),
|
|
10
|
+
createTable("supplies", { columns: { title: { type: "text", is: { type: "string", said: "title is a string" } }, item: { type: "integer", is: { type: "integer", said: "item is a whole number" }, to: { table: "items", said: "item links only to items the menu document holds", held: ["supply in supplies links to it", "supplys in supplies link to it"] } }, qty: { type: "integer", is: { type: "integer", said: "qty is a whole number" } }, price: { type: "integer", is: { type: "integer", said: "price is a whole number" } }, buyer: { type: "integer", nullable: true, is: { type: "integer", said: "buyer is a whole number" }, to: { table: "members", said: "buyer links only to members the members document holds", onDelete: "set null" } }, supplier: { type: "integer", nullable: true, is: { type: "integer", said: "supplier is a whole number" }, to: { table: "members", said: "supplier links only to members the members document holds", onDelete: "set null" } }, "terms.days": { type: "integer", nullable: true, is: { type: "integer", said: "terms.days is a whole number" } }, "terms.by": { type: "text", nullable: true, is: { type: "string", said: "terms.by is a string" } }, delivered: { type: "boolean", is: { type: "boolean", said: "delivered is a boolean" } } }, strict: true, needs: { columns: ["title", "item", "qty", "price", "buyer", "supplier", "terms.days", "terms.by", "delivered"], said: "a supply needs title (string), item (an id in items), qty (integer), price (integer), buyer (an id in members), supplier (an id in members), terms.days (integer), terms.by (string), delivered (boolean)" } }),
|
|
11
|
+
];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>joined: your order</title>
|
|
7
|
+
<link rel="stylesheet" href="joined/tokens.css" />
|
|
8
|
+
<link rel="stylesheet" href="joined/page.css" />
|
|
9
|
+
<link rel="stylesheet" href="../app.css" />
|
|
10
|
+
<link rel="stylesheet" href="./cafe.css" />
|
|
11
|
+
</head>
|
|
12
|
+
<body data-flavour="bondi">
|
|
13
|
+
<header class="band">
|
|
14
|
+
<h1>Your order</h1>
|
|
15
|
+
</header>
|
|
16
|
+
<main class="cafe yours">
|
|
17
|
+
<section class="card" aria-label="Your order">
|
|
18
|
+
<ol class="steps">
|
|
19
|
+
<li data-step="placed">Placed</li>
|
|
20
|
+
<li data-step="being made">Being made</li>
|
|
21
|
+
<li data-step="ready">Ready</li>
|
|
22
|
+
<li data-step="collected">Collected</li>
|
|
23
|
+
</ol>
|
|
24
|
+
<j-orders doc="order?code="></j-orders>
|
|
25
|
+
<j-lines doc="order?code="></j-lines>
|
|
26
|
+
</section>
|
|
27
|
+
</main>
|
|
28
|
+
<dialog class="ask">
|
|
29
|
+
<h2></h2>
|
|
30
|
+
<footer>
|
|
31
|
+
<button type="button" class="act" name="keep">Never mind</button>
|
|
32
|
+
<button type="button" class="act danger" name="sure">Cancel it</button>
|
|
33
|
+
</footer>
|
|
34
|
+
</dialog>
|
|
35
|
+
<script type="module" src="./order.ts"></script>
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// A customer's page, at their order's link (/cafe/order/<its code>): their order alone, by its code, with no
|
|
2
|
+
// sign-in. Where it is (placed, being made, ready, collected), what the cafe says of it, its lines and total; and,
|
|
3
|
+
// while it's placed, Cancel my order.
|
|
4
|
+
|
|
5
|
+
import { askFirst } from "joined/parts";
|
|
6
|
+
import * as order from "./generated/order.rules.ts";
|
|
7
|
+
|
|
8
|
+
const code = location.pathname.split("/").filter(Boolean).at(-1)!;
|
|
9
|
+
// the order this page holds: the one whose code it has, said before its elements are (they hold what they're told)
|
|
10
|
+
for (const el of document.querySelectorAll(`${order.collections.orders.place}, ${order.collections.lines.place}`))
|
|
11
|
+
el.setAttribute("doc", `order?code=${code}`);
|
|
12
|
+
const { JLine, JOrder } = await import("./generated/order.elements.ts");
|
|
13
|
+
const { lineView, orderView } = await import("./views.ts");
|
|
14
|
+
|
|
15
|
+
/** What the cafe says while the order is where it is. */
|
|
16
|
+
const SAYS: Record<string, string> = {
|
|
17
|
+
placed: "We've got your order",
|
|
18
|
+
"being made": "Your order is being made",
|
|
19
|
+
ready: "Your order is ready: come to the counter!",
|
|
20
|
+
collected: "Enjoy!",
|
|
21
|
+
cancelled: "Your order is cancelled",
|
|
22
|
+
};
|
|
23
|
+
const Order = orderView(
|
|
24
|
+
JOrder,
|
|
25
|
+
[{ words: "Cancel my order", from: "placed", to: "cancelled", ask: "Cancel your order?" }],
|
|
26
|
+
askFirst(document.querySelector("dialog.ask")!),
|
|
27
|
+
{ late: false }, // a customer is never told it's late: that's the staff's to know
|
|
28
|
+
);
|
|
29
|
+
/** Where the order is, and what the cafe says of it: the order this page holds, as it is now. */
|
|
30
|
+
const where = () => {
|
|
31
|
+
const status = document.querySelector<InstanceType<typeof Order>>(order.collections.orders.tag)?.data.status ?? "";
|
|
32
|
+
document.querySelector("h1")!.textContent = SAYS[status] ?? "Your order";
|
|
33
|
+
document.body.dataset.status = status;
|
|
34
|
+
};
|
|
35
|
+
customElements.define(
|
|
36
|
+
order.collections.orders.tag,
|
|
37
|
+
class extends Order {
|
|
38
|
+
draw() {
|
|
39
|
+
super.draw();
|
|
40
|
+
where();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
new MutationObserver(where).observe(document.querySelector(order.collections.orders.place)!, { childList: true });
|
|
45
|
+
customElements.define(order.collections.lines.tag, lineView(JLine));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// A ticket dragged across the kitchen's rail, the smallest drag to copy (docs/design.md, "What a drag does"): it
|
|
2
|
+
// follows the pointer, the column it may go to marked as it's over it; let go there, its move is made, as its button
|
|
3
|
+
// makes it; let go anywhere else, it goes back. A mouse picks it up at once, a finger once it's held still a moment
|
|
4
|
+
// (held, joined/follow), so a swipe still scrolls the page. Nothing is written until it's let go.
|
|
5
|
+
|
|
6
|
+
import { follow, held } from "joined/follow";
|
|
7
|
+
|
|
8
|
+
/** A press on a ticket, picked up and followed: let go over `to`, `go` makes the move. */
|
|
9
|
+
export function dragged(down: PointerEvent, ticket: HTMLElement, to: HTMLElement, go: () => void) {
|
|
10
|
+
held(down, () => {
|
|
11
|
+
const over = (e: PointerEvent) => {
|
|
12
|
+
const r = to.getBoundingClientRect();
|
|
13
|
+
return e.clientX >= r.left && e.clientX <= r.right && e.clientY >= r.top && e.clientY <= r.bottom;
|
|
14
|
+
};
|
|
15
|
+
ticket.toggleAttribute("dragged", true);
|
|
16
|
+
follow(
|
|
17
|
+
down,
|
|
18
|
+
(e) => {
|
|
19
|
+
ticket.style.translate = `${e.clientX - down.clientX}px ${e.clientY - down.clientY}px`;
|
|
20
|
+
to.toggleAttribute("over", over(e));
|
|
21
|
+
},
|
|
22
|
+
(e) => {
|
|
23
|
+
ticket.style.translate = "";
|
|
24
|
+
ticket.toggleAttribute("dragged", false);
|
|
25
|
+
to.toggleAttribute("over", false);
|
|
26
|
+
if (e && over(e)) go();
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// The cafe (fewer's, in joined): one app, its documents over its tables. The staff and the menu; the till, the
|
|
2
|
+
// kitchen and a customer's order, each holding the orders it's for (its stories' where) with their lines; the
|
|
3
|
+
// supplies the cafe buys, each its buyer's and its supplier's; and each side's books. Its pages: the front (whose
|
|
4
|
+
// page is whose), the till, the menu, the kitchen, a customer's own (by its link, no sign-in), the supplies and the
|
|
5
|
+
// books.
|
|
6
|
+
|
|
7
|
+
import front from "./front.html";
|
|
8
|
+
import till from "./index.html";
|
|
9
|
+
import kitchen from "./kitchen.html";
|
|
10
|
+
import menuPage from "./menu.html";
|
|
11
|
+
import order from "./order.html";
|
|
12
|
+
import supplies from "./supplies.html";
|
|
13
|
+
import books from "./books.html";
|
|
14
|
+
import * as staffDoc from "./generated/staff.rules.ts";
|
|
15
|
+
import * as menuDoc from "./generated/menu.rules.ts";
|
|
16
|
+
import * as tillDoc from "./generated/till.rules.ts";
|
|
17
|
+
import * as kitchenDoc from "./generated/kitchen.rules.ts";
|
|
18
|
+
import * as orderDoc from "./generated/order.rules.ts";
|
|
19
|
+
import * as suppliesDoc from "./generated/supplies.rules.ts";
|
|
20
|
+
import * as booksDoc from "./generated/books.rules.ts";
|
|
21
|
+
|
|
22
|
+
export const documents = [staffDoc, menuDoc, tillDoc, kitchenDoc, orderDoc, suppliesDoc, booksDoc];
|
|
23
|
+
export { trust } from "./trust.ts";
|
|
24
|
+
export const routes = {
|
|
25
|
+
"/cafe": front,
|
|
26
|
+
"/cafe/till": till,
|
|
27
|
+
"/cafe/menu": menuPage,
|
|
28
|
+
"/cafe/kitchen": kitchen,
|
|
29
|
+
"/cafe/order/:code": order,
|
|
30
|
+
"/cafe/supplies": supplies,
|
|
31
|
+
"/cafe/books": books,
|
|
32
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{"cast":{"wai":"nora","cook":"dev","manager":"peter","buyer":"peter","roaster":"nick"}}
|
|
2
|
+
{"links":{"item":{"to":"items","one":true},"order":{"to":"orders","one":true},"buyer":{"to":"members","one":true},"supplier":{"to":"members","one":true}}}
|
|
3
|
+
{"roles":{"manager":"staff/posts[role=manager]@members","till":"staff/posts[role=till]@members","kitchen":"staff/posts[role=kitchen]@members","buyer":"@buyer","supplier":"@supplier"}}
|
|
4
|
+
{"owns":{"supplies":"@buyer | @supplier"}}
|
|
5
|
+
{"fills":{"orders":{"status":"placed","placed":"now","code":"random","total":0}}}
|
|
6
|
+
{"copies":{"lines":{"from":"item","fields":["name","price"]}}}
|
|
7
|
+
{"totals":{"orders":{"total":{"of":"lines","by":"order","sum":"qty","times":"price"}}}}
|
|
8
|
+
{"moves":{"orders":"status"}}
|
|
9
|
+
{"window":{"orders":{"code":"code"}}}
|
|
10
|
+
{"guests":{"orders":"code"}}
|
|
11
|
+
{"where":{"till":{"holds":"till | manager","orders":[{"status":["placed","being made","ready"]},{"status":["collected","cancelled"],"last":8,"by":"placed"}],"lines":"orders"},"kitchen":{"holds":"kitchen | manager","orders":{"status":["placed","being made","ready"]},"lines":"orders"},"order":{"holds":"till | manager","lines":"orders"}}}
|
|
12
|
+
{"takes":{"lines":{"qty":"item.stock","while":"order.status!=cancelled","refused":"The kitchen has {stock} of {name}: not enough to take {qty}."}}}
|
|
13
|
+
{"gives":{"supplies":{"qty":"item.stock","while":"delivered","refused":"The kitchen has {stock} of {name}: not enough to take {qty}."}}}
|
|
14
|
+
{"documents":{"books":{"entries":{"from":"supplies","when":"delivered","sides":{"buyer":"bought","supplier":"sold"},"fields":["title","buyer","supplier"],"total":{"sum":"qty","times":"price"}}}}}
|
|
15
|
+
{"story":"Peter puts Dev in the kitchen too","as":"manager","does":{"doc":"staff","ops":[{"op":"add","path":"/posts/-","value":{"role":"kitchen","members":[4]}}]},"seen":["manager"]}
|
|
16
|
+
{"story":"Wai can't give anyone a role","as":"wai","cannot":{"doc":"staff","ops":[{"op":"add","path":"/posts/-","value":{"role":"till","members":[4]}}]},"refused":"you may not add at /posts/-"}
|
|
17
|
+
{"story":"Peter puts muffins on the menu","as":"manager","does":{"doc":"menu","ops":[{"op":"add","path":"/items/-","value":{"name":"Muffin","price":300,"stock":12}}]},"seen":["manager","wai"]}
|
|
18
|
+
{"story":"Peter prices a latte at £3.80","as":"manager","does":{"doc":"menu","ops":[{"op":"replace","path":"/items/3/price","value":380}]},"seen":["manager","wai"]}
|
|
19
|
+
{"story":"Peter renames the flat white: it's oat milk now","as":"manager","does":{"doc":"menu","ops":[{"op":"replace","path":"/items/2/name","value":"Flat white, oat"}]},"seen":["manager","wai"]}
|
|
20
|
+
{"story":"Wai can't change a price","as":"wai","cannot":{"doc":"menu","ops":[{"op":"replace","path":"/items/3/price","value":1}]},"refused":"you may not replace at /items/3/price"}
|
|
21
|
+
{"story":"Wai places Sam's order, a latte and a croissant: the cafe prices it, numbers it and gives it a code","as":"wai","does":{"doc":"till","ops":[{"op":"add","path":"/orders/-","value":{"customer":"Sam"}},{"op":"add","path":"/lines/-","value":{"order":6,"item":3,"qty":1}},{"op":"add","path":"/lines/-","value":{"order":6,"item":5,"qty":1}}]},"seen":["wai","manager"],"then":{"/orders/6/total":650,"/orders/6/status":"placed","menu/items/3/stock":29,"menu/items/5/stock":1}}
|
|
22
|
+
{"story":"Wai hands Cy's order over","as":"wai","does":{"doc":"till","ops":[{"op":"replace","path":"/orders/3/status","value":"collected"}]},"seen":["wai","manager"]}
|
|
23
|
+
{"story":"Wai cancels Jo's order before the kitchen starts it","as":"wai","does":{"doc":"till","ops":[{"op":"replace","path":"/orders/4/status","value":"cancelled"}]},"seen":["wai","manager"]}
|
|
24
|
+
{"story":"No one skips a step: Ann's order can't go from placed to ready","as":"wai","cannot":{"doc":"till","ops":[{"op":"replace","path":"/orders/1/status","value":"ready"}]},"refused":"that isn't a move you can make"}
|
|
25
|
+
{"story":"An order's lines are set as it's placed: Wai can't add to Ann's","as":"wai","cannot":{"doc":"till","ops":[{"op":"add","path":"/lines/-","value":{"order":1,"item":2,"qty":1}}]},"refused":"an order's lines are set when it's placed"}
|
|
26
|
+
{"story":"Wai can't give an order its total: the cafe works it out","as":"wai","cannot":{"doc":"till","ops":[{"op":"add","path":"/orders/-","value":{"customer":"Mo","total":1}}]},"refused":"total is the server's to fill"}
|
|
27
|
+
{"story":"Three croissants: the kitchen has two","as":"wai","cannot":{"doc":"till","ops":[{"op":"add","path":"/orders/-","value":{"customer":"Lee"}},{"op":"add","path":"/lines/-","value":{"order":6,"item":5,"qty":3}}]},"refused":"The kitchen has 2 of Croissant: not enough to take 3."}
|
|
28
|
+
{"story":"Cook can't place an order: the till isn't hers","as":"cook","cannot":{"doc":"till","ops":[{"op":"add","path":"/orders/-","value":{"customer":"Mo"}}]}}
|
|
29
|
+
{"story":"Cook starts Ann's order","as":"cook","does":{"doc":"kitchen","ops":[{"op":"replace","path":"/orders/1/status","value":"being made"}]},"seen":["cook","manager"]}
|
|
30
|
+
{"story":"Cook marks Bo's order ready: the kitchen keeps it, ready, until it's handed over","as":"cook","does":{"doc":"kitchen","ops":[{"op":"replace","path":"/orders/2/status","value":"ready"}]},"seen":["cook","manager"]}
|
|
31
|
+
{"story":"The kitchen can't hand an order over","as":"cook","cannot":{"doc":"kitchen","ops":[{"op":"replace","path":"/orders/3/status","value":"collected"}]},"refused":"that isn't a move you can make"}
|
|
32
|
+
{"story":"Ann cancels her order while it's placed","does":{"doc":"order?code=q3Zt9xKcW1aB","ops":[{"op":"replace","path":"/orders/1/status","value":"cancelled"}]}}
|
|
33
|
+
{"story":"Bo can't cancel once the kitchen has started","cannot":{"doc":"order?code=Bo7pL2mRv8Yd","ops":[{"op":"replace","path":"/orders/2/status","value":"cancelled"}]},"refused":"that isn't a move you can make"}
|
|
34
|
+
{"story":"Ann can't touch Jo's order","cannot":{"doc":"order?code=q3Zt9xKcW1aB","ops":[{"op":"replace","path":"/orders/4/status","value":"cancelled"}]},"refused":"you may not replace at /orders/4/status"}
|
|
35
|
+
{"story":"Peter orders twenty croissants from Nick","as":"buyer","does":{"doc":"supplies","ops":[{"op":"add","path":"/supplies/-","value":{"title":"Croissants, Monday","item":5,"qty":20,"price":120,"buyer":1,"supplier":2,"terms":{"days":14,"by":"invoice"},"delivered":false}}]},"seen":["buyer","roaster"],"unseen":["wai"]}
|
|
36
|
+
{"story":"Nick sets his price","as":"roaster","does":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/1/price","value":110}]},"seen":["roaster","buyer"]}
|
|
37
|
+
{"story":"Nick gives thirty days to pay","as":"roaster","does":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/1/terms/days","value":30}]},"seen":["roaster","buyer"]}
|
|
38
|
+
{"story":"Peter can't set his own terms","as":"buyer","cannot":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/1/terms/days","value":90}]},"refused":"you may not replace at /supplies/1/terms/days"}
|
|
39
|
+
{"story":"Nick delivers: the kitchen has twenty more croissants","as":"roaster","does":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/1/delivered","value":true}]},"seen":["roaster","buyer"],"then":{"menu/items/5/stock":22}}
|
|
40
|
+
{"story":"Peter can't say it's delivered: that's Nick's","as":"buyer","cannot":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/1/delivered","value":true}]},"refused":"you may not replace at /supplies/1/delivered"}
|
|
41
|
+
{"story":"Nora can't order in Peter's name","as":"wai","cannot":{"doc":"supplies","ops":[{"op":"add","path":"/supplies/-","value":{"title":"Croissants, Monday","item":5,"qty":20,"price":120,"buyer":1,"supplier":2,"terms":{"days":14,"by":"invoice"},"delivered":false}}]},"refused":"you may not add at /supplies/-"}
|
|
42
|
+
{"story":"Nick can't change his price once it's delivered: both books have it","as":"roaster","cannot":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/2/price","value":200}]},"refused":"a delivered supply keeps its price and terms"}
|
|
43
|
+
{"story":"Nick can't take back a delivery the kitchen has used","as":"roaster","cannot":{"doc":"supplies","ops":[{"op":"replace","path":"/supplies/2/delivered","value":false}]},"refused":"The kitchen has 2 of Croissant: not enough to take 30."}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>joined: the cafe's supplies</title>
|
|
7
|
+
<link rel="stylesheet" href="joined/tokens.css" />
|
|
8
|
+
<link rel="stylesheet" href="joined/page.css" />
|
|
9
|
+
<link rel="stylesheet" href="../app.css" />
|
|
10
|
+
<link rel="stylesheet" href="./cafe.css" />
|
|
11
|
+
</head>
|
|
12
|
+
<body data-flavour="lime">
|
|
13
|
+
<a class="brand" href="/"><img src="joined/icon.png" alt="" width="28" height="28" />joined</a>
|
|
14
|
+
<header class="band">
|
|
15
|
+
<h1>Supplies</h1>
|
|
16
|
+
<p class="lead">
|
|
17
|
+
What the cafe buys, each supply shared by its buyer and its supplier, and no one else. Each changes only their
|
|
18
|
+
own part: the buyer orders, the supplier sets the price and the days to pay, and says Delivered. Then the till
|
|
19
|
+
has more to sell, and both sides' books have it.
|
|
20
|
+
</p>
|
|
21
|
+
<nav class="bar">
|
|
22
|
+
<members-panel></members-panel>
|
|
23
|
+
<a href="/cafe">The cafe</a> <a href="/cafe/till" data-holds="till">Till</a>
|
|
24
|
+
<a href="/cafe/menu" data-holds="menu">Menu</a>
|
|
25
|
+
<a href="/cafe/kitchen" data-holds="kitchen">Kitchen</a>
|
|
26
|
+
<a href="/cafe/supplies" data-holds="supplies" aria-current="page">Supplies</a>
|
|
27
|
+
<a href="/cafe/books" data-holds="books">Books</a>
|
|
28
|
+
</nav>
|
|
29
|
+
</header>
|
|
30
|
+
<main class="cafe supplies">
|
|
31
|
+
<section class="card" aria-label="Order a supply">
|
|
32
|
+
<h2>Order a supply</h2>
|
|
33
|
+
<form class="add buy">
|
|
34
|
+
<label
|
|
35
|
+
>What it's for<input name="title" placeholder="Croissants, Monday" required autocomplete="off"
|
|
36
|
+
/></label>
|
|
37
|
+
<label>Of<select name="item"></select></label>
|
|
38
|
+
<label>How many<input name="qty" type="number" min="1" value="10" /></label>
|
|
39
|
+
<label
|
|
40
|
+
>Price each, £<input name="price" type="number" min="0" step="0.01" value="1.00" inputmode="decimal"
|
|
41
|
+
/></label>
|
|
42
|
+
<label>From<select name="supplier"></select></label>
|
|
43
|
+
<button class="act ink" data-icon="add">Order</button>
|
|
44
|
+
<p class="said" role="status"></p>
|
|
45
|
+
</form>
|
|
46
|
+
<j-items doc="menu" hidden></j-items>
|
|
47
|
+
</section>
|
|
48
|
+
<section class="card" aria-label="Supplies">
|
|
49
|
+
<h2>Supplies</h2>
|
|
50
|
+
<j-supplies doc="supplies"></j-supplies>
|
|
51
|
+
</section>
|
|
52
|
+
</main>
|
|
53
|
+
<aside class="drawer" hidden aria-label="A supply's terms">
|
|
54
|
+
<form class="terms">
|
|
55
|
+
<header>
|
|
56
|
+
<h2></h2>
|
|
57
|
+
<button
|
|
58
|
+
type="button"
|
|
59
|
+
class="icon-only"
|
|
60
|
+
name="close"
|
|
61
|
+
aria-label="Close"
|
|
62
|
+
title="Close"
|
|
63
|
+
data-icon="close"
|
|
64
|
+
></button>
|
|
65
|
+
</header>
|
|
66
|
+
<label>Price each, £<input name="price" required inputmode="decimal" pattern="\d+(\.\d{1,2})?" /></label>
|
|
67
|
+
<label>Days to pay<input name="days" required type="number" min="0" step="1" /></label>
|
|
68
|
+
<p class="note" role="status"></p>
|
|
69
|
+
<footer>
|
|
70
|
+
<button type="button" class="act" name="never">Never mind</button>
|
|
71
|
+
<button class="act ink" name="go" data-icon="check">Save</button>
|
|
72
|
+
</footer>
|
|
73
|
+
</form>
|
|
74
|
+
</aside>
|
|
75
|
+
<script type="module" src="./supplies.ts"></script>
|
|
76
|
+
</body>
|
|
77
|
+
</html>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"supplies": [
|
|
4
|
+
{
|
|
5
|
+
"id": 1,
|
|
6
|
+
"title": "Croissants, Monday",
|
|
7
|
+
"item": 5,
|
|
8
|
+
"qty": 20,
|
|
9
|
+
"price": 120,
|
|
10
|
+
"buyer": 1,
|
|
11
|
+
"supplier": 2,
|
|
12
|
+
"terms": {
|
|
13
|
+
"days": 14,
|
|
14
|
+
"by": "invoice"
|
|
15
|
+
},
|
|
16
|
+
"delivered": false
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": 2,
|
|
20
|
+
"title": "Croissants, last week",
|
|
21
|
+
"item": 5,
|
|
22
|
+
"qty": 30,
|
|
23
|
+
"price": 115,
|
|
24
|
+
"buyer": 1,
|
|
25
|
+
"supplier": 2,
|
|
26
|
+
"terms": {
|
|
27
|
+
"days": 14,
|
|
28
|
+
"by": "invoice"
|
|
29
|
+
},
|
|
30
|
+
"delivered": true
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|