: asapien/signet

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
<!DOCTYPE html>
<html>
<head>
	<meta charset=utf-8>
	<meta name=viewport content="width=device-width, initial-scale=1">
	<title>PIM — Attribute Management</title>
	<style>
		:root { --ink: #1b2330; --muted: #637083; --line: #d9dfe7; --bg: #f3f5f8; --card: #fff; --accent: #1f5f8b; --danger: #a8322d; }
		* { box-sizing: border-box; }
		body { margin: 0; font: 14px/1.5 system-ui, sans-serif; color: var(--ink); background: var(--bg); }
		.bar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 1.5rem; padding: 0.6rem 1.2rem; background: var(--ink); color: #fff; z-index: 100; }
		.bar .brand { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.06em; }
		main { max-width: 800px; margin: 3rem auto 0; padding: 1.2rem; }
		.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
		h1 { font-size: 1.25rem; margin: 0 0 1rem; }
		h2 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 1rem 0 0.5rem; }
		label { display: block; font-size: 12px; color: var(--muted); margin: 0.5rem 0 0.15rem; font-weight: 600; }
		input, select { font: inherit; padding: 0.4rem; border: 1px solid #b9c3cf; border-radius: 4px; width: 100%; margin-bottom: 0.8rem; }
		button { font: inherit; padding: 0.4rem 0.85rem; border-radius: 4px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
		button:hover { border-color: #9aa7b6; }
		button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
		button.danger { color: var(--danger); }
		.row { display: flex; gap: 0.5rem; align-items: flex-end; }
		.row > * { flex: 1; }
		.row button { flex: 0 0 auto; margin: 0; }
		#attrs { display: none; }
		.attr-row { background: #fafbfc; border: 1px solid var(--line); border-radius: 4px; padding: 0.8rem; margin-bottom: 0.6rem; display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
		.attr-row span { font-size: 13px; flex: 1; }
		.attr-row button { margin: 0; padding: 0.3rem 0.6rem; font-size: 12px; }
		#error { display: none; background: #f8d9d8; color: #7a201c; padding: 0.8rem; border-radius: 4px; margin-bottom: 1rem; }
		#whoami { position: fixed; top: 0.6rem; right: 1.2rem; color: #cfd8e3; font-size: 12px; }
	</style>
</head>
<body>
	<div class=bar>
		<div class=brand>SIGNET PIM</div>
	</div>
	<div id=whoami></div>
	<main>
		<div id=error></div>
		<div id=auth class=card>
			<h1>Not authenticated</h1>
			<p>This PIM requires <code>pim_admin</code> role.</p>
		</div>
		<div id=attrs>
			<div class=card>
				<h1>Attribute Management</h1>
				<label>Organization</label>
				<select id=org onchange=loadAttrs()>
					<option value="">(select org)</option>
				</select>
				<div id=org-attrs style=display:none>
					<h2>Add Attribute</h2>
					<div class=row>
						<input type=text id=key placeholder="Attribute key (e.g. company_name)" maxlength=64>
						<select id=type style="flex: 0 0 80px; margin-bottom: 0.8rem;">
							<option value=text>text</option>
							<option value=date>date</option>
							<option value=number>number</option>
							<option value=image>image</option>
						</select>
						<button class=primary onclick=addAttr()>Add</button>
					</div>
					<h2>Attributes</h2>
					<div id=attrs-list></div>
				</div>
			</div>
		</div>
	</main>
	<script src=pim.js></script>
</body>
</html>