code wiki / _hdl_build / nx_aw_schedule.nx
nx_aw_schedule.nx source
↩ module page · 93 lines · 10390 B
1// nx_aw_schedule.nx -- emits the andelinwest.com CONSULTATION SCHEDULER page (the team's next live rung) and
2// writes the nx_aw_push spec files so it can be streamed onto sites/andelinwest/schedule.html. Sovereign emit
3// (raw sys_write, no template engine, ZERO third-party JS/CSS/CDN). Brand-consistent with nx_andelin_pro's
4// token design system (WCAG 2.2 AA: labels, 44px+ targets, focus-visible, contrast, landmarks). The booking
5// form is FUNCTIONAL NOW with no backend: a tiny dependency-free script assembles the appointment into a
6// pre-filled message to intake@andelinwest.com (works WITH the firm's sovereign email/MTA). RUNG 2 = a server
7// POST /schedule handler -> nx_cms_store + nx_cms_email auto-confirm + nx_cron reminder (the email-wired path).
8// writes /tmp/andelin_schedule.html + /tmp/aw_sched.src + /tmp/aw_sched.dst
9// then: nx_aw_push /tmp/aw_sched.src /tmp/aw_sched.dst (publish) -> fetch-verify the live URL
10// license_tier: ORIGINAL
11import "nx_syscalls.nx"
12
13const SCHED_LOCAL: *u8 = "/tmp/andelin_schedule.html" as *u8
14const SCHED_SRC: *u8 = "/tmp/aw_sched.src" as *u8
15const SCHED_DST: *u8 = "/tmp/aw_sched.dst" as *u8
16const SCHED_REMOTE: *u8 = "cat > /volume1/homes/elderwesto/nishihost/sites/andelinwest/schedule.html\n" as *u8
17
18func aw(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return n }
19func sx_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
20func sx_write_file(path: *u8, content: *u8) -> i64 {
21 let fd: i64 = sys_openat_wr(path, 0x1a4); if fd < 0 { return 0-1 }
22 var n: i64=0; while content[n]!=(0 as u8){n=n+1} sys_write(fd, content, n); sys_close(fd); return n
23}
24
25func emit(fd: i64) -> i64 {
26 aw(fd, "<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\">\n" as *u8)
27 aw(fd, "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n" as *u8)
28 aw(fd, "<title>Schedule a Free Consultation · Andelin West, PLLC</title>\n" as *u8)
29 aw(fd, "<meta name=\"description\" content=\"Request a free consultation with Andelin West, PLLC -- Utah attorneys for family law, estate planning, business law, and personal injury. Pick a date and time; we confirm by phone or email.\">\n" as *u8)
30 aw(fd, "<style>\n" as *u8)
31 aw(fd, ":root{--ink:#0A1B2E;--brand:#13315C;--brand2:#0B2545;--accent:#B68A35;--accent-ink:#1A1206;--paper:#FBFAF7;--surface:#fff;--line:#E4E0D7;--muted:#566273}\n" as *u8)
32 aw(fd, "*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:17px/1.65 system-ui,-apple-system,\"Segoe UI\",sans-serif}\n" as *u8)
33 aw(fd, "h1,h2,h3{font-family:Georgia,\"Times New Roman\",serif;color:var(--brand);line-height:1.2;margin:0 0 .4em}\n" as *u8)
34 aw(fd, "a{color:var(--brand)}.wrap{max-width:760px;margin:0 auto;padding:0 24px}\n" as *u8)
35 aw(fd, ".btn{display:inline-block;min-height:48px;padding:14px 26px;border-radius:8px;font-weight:700;text-decoration:none;border:0;cursor:pointer;font-size:1.05rem}\n" as *u8)
36 aw(fd, ".btn-gold{background:var(--accent);color:var(--accent-ink)}.btn-ghost{background:transparent;color:#fff;border:1.5px solid rgba(255,255,255,.6)}\n" as *u8)
37 aw(fd, ":focus-visible{outline:3px solid var(--accent);outline-offset:2px}\n" as *u8)
38 aw(fd, "header{background:var(--brand2);color:#fff;position:sticky;top:0;z-index:20}header .wrap{max-width:1100px;display:flex;align-items:center;gap:18px;flex-wrap:wrap;padding:13px 24px}\n" as *u8)
39 aw(fd, ".brand{font-family:Georgia,serif;font-weight:700;font-size:1.3rem;color:#fff;text-decoration:none}.brand span{color:var(--accent)}\n" as *u8)
40 aw(fd, ".tel{color:#fff;font-weight:700;text-decoration:none;margin-left:auto}.tel b{color:var(--accent)}\n" as *u8)
41 aw(fd, ".hero{background:linear-gradient(160deg,#13315C,#0B2545);color:#fff;padding:64px 0 56px}.hero .wrap{max-width:760px}.hero h1{color:#fff;font-size:2.3rem}.eyebrow{color:var(--accent);font-weight:700;letter-spacing:.12em;text-transform:uppercase;font-size:.8rem;margin:0 0 14px}.lead{font-size:1.2rem;color:#e7edf5;max-width:54ch}\n" as *u8)
42 aw(fd, "main{padding:48px 0}.card{background:var(--surface);border:1px solid var(--line);border-top:3px solid var(--accent);border-radius:12px;padding:34px}\n" as *u8)
43 aw(fd, ".field{display:block;margin:0 0 18px}.field label{display:block;font-weight:600;margin:0 0 6px}.req{color:#b00020}\n" as *u8)
44 aw(fd, ".field input,.field select,.field textarea{width:100%;padding:13px;border:1px solid #cdd7e3;border-radius:8px;font-size:1rem;font-family:inherit;min-height:48px}\n" as *u8)
45 aw(fd, ".row{display:grid;grid-template-columns:1fr 1fr;gap:18px}@media(max-width:560px){.row{grid-template-columns:1fr}}\n" as *u8)
46 aw(fd, ".note{background:#f3f6fb;border-left:4px solid var(--accent);padding:14px 18px;border-radius:0 8px 8px 0;color:var(--muted);font-size:.95rem;margin:0 0 24px}\n" as *u8)
47 aw(fd, ".fineprint{font-size:.82rem;color:var(--muted);margin-top:16px}.alt{display:flex;gap:14px;flex-wrap:wrap;align-items:center;margin-top:22px;color:var(--muted)}\n" as *u8)
48 aw(fd, "footer{background:var(--brand2);color:#aebdd2;padding:34px 0;margin-top:24px}footer .wrap{max-width:1100px}footer .fbrand{font-family:Georgia,serif;color:#fff;font-size:1.15rem}footer .disc{font-size:.82rem;line-height:1.6;max-width:74ch;display:block;margin-top:8px}footer a{color:#cfd9e8}\n" as *u8)
49 aw(fd, "</style></head><body>\n" as *u8)
50
51 aw(fd, "<header><div class=\"wrap\"><a class=\"brand\" href=\"/\">Andelin<span>West</span></a><a class=\"tel\" href=\"tel:+18015550100\">Call <b>(801) 555-0100</b></a></div></header>\n" as *u8)
52 aw(fd, "<div class=\"hero\"><div class=\"wrap\"><p class=\"eyebrow\">Free · No obligation</p><h1>Schedule your consultation</h1><p class=\"lead\">Pick a day and time that works for you. We will confirm by phone or email -- usually the same day.</p></div></div>\n" as *u8)
53
54 aw(fd, "<main><div class=\"wrap\"><div class=\"card\">\n" as *u8)
55 aw(fd, "<p class=\"note\">Your request goes straight to our intake team at <strong>intake@andelinwest.com</strong>. For an urgent matter, please call <a href=\"tel:+18015550100\">(801) 555-0100</a>.</p>\n" as *u8)
56 aw(fd, "<form id=\"bk\">\n" as *u8)
57 aw(fd, "<div class=\"row\"><span class=\"field\"><label for=\"name\">Your name <span class=\"req\">*</span></label><input id=\"name\" name=\"name\" type=\"text\" autocomplete=\"name\" required></span><span class=\"field\"><label for=\"phone\">Phone <span class=\"req\">*</span></label><input id=\"phone\" name=\"phone\" type=\"tel\" autocomplete=\"tel\" required></span></div>\n" as *u8)
58 aw(fd, "<span class=\"field\"><label for=\"email\">Email</label><input id=\"email\" name=\"email\" type=\"email\" autocomplete=\"email\"></span>\n" as *u8)
59 aw(fd, "<span class=\"field\"><label for=\"matter\">What kind of matter?</label><select id=\"matter\" name=\"matter\"><option>Family Law</option><option>Estate Planning</option><option>Business Law</option><option>Personal Injury</option><option>Something else</option></select></span>\n" as *u8)
60 aw(fd, "<div class=\"row\"><span class=\"field\"><label for=\"date\">Preferred date</label><input id=\"date\" name=\"date\" type=\"date\"></span><span class=\"field\"><label for=\"time\">Preferred time</label><select id=\"time\" name=\"time\"><option>Morning (9-12)</option><option>Afternoon (12-5)</option><option>Evening (after 5)</option><option>Any time</option></select></span></div>\n" as *u8)
61 aw(fd, "<span class=\"field\"><label for=\"detail\">Briefly, what is going on?</label><textarea id=\"detail\" name=\"detail\" rows=\"4\"></textarea></span>\n" as *u8)
62 aw(fd, "<button class=\"btn btn-gold\" type=\"submit\">Request my consultation</button>\n" as *u8)
63 aw(fd, "<p class=\"fineprint\">Submitting this form does not create an attorney-client relationship. Please do not include confidential details until we have agreed to represent you.</p>\n" as *u8)
64 aw(fd, "</form>\n" as *u8)
65 aw(fd, "<div class=\"alt\"><span>Prefer email?</span><a class=\"btn btn-gold\" href=\"mailto:intake@andelinwest.com?subject=Consultation%20request\">Email intake@andelinwest.com</a></div>\n" as *u8)
66 aw(fd, "</div></div></main>\n" as *u8)
67
68 // dependency-free handler: assemble the appointment into a pre-filled email to the firm's intake mailbox
69 aw(fd, "<script>\n" as *u8)
70 aw(fd, "document.getElementById('bk').addEventListener('submit',function(e){e.preventDefault();var f=e.target;" as *u8)
71 aw(fd, "var subj='Consultation request: '+f.matter.value+' - '+(f.date.value||'(no date)')+' '+f.time.value;" as *u8)
72 aw(fd, "var body='Name: '+f.name.value+' | Phone: '+f.phone.value+' | Email: '+f.email.value+' | Matter: '+f.matter.value+' | Preferred: '+(f.date.value||'(any)')+' '+f.time.value+' | Details: '+f.detail.value;" as *u8)
73 aw(fd, "window.location.href='mailto:intake@andelinwest.com?subject='+encodeURIComponent(subj)+'&body='+encodeURIComponent(body);});\n" as *u8)
74 aw(fd, "</script>\n" as *u8)
75
76 aw(fd, "<footer><div class=\"wrap\"><span class=\"fbrand\">Andelin West, PLLC</span><span class=\"disc\">© 2026 Andelin West, PLLC. Licensed by the Utah State Bar. This website is for general information only and is not legal advice; viewing it does not create an attorney-client relationship. <a href=\"/\">Home</a></span></div></footer>\n" as *u8)
77 aw(fd, "</body></html>\n" as *u8)
78 return 0
79}
80
81func main() -> i64 {
82 let fd: i64 = sys_openat_wr(SCHED_LOCAL, 0x1a4)
83 if fd < 0 { sx_puts("SCHED-EMIT-FAIL: cannot open output\n" as *u8); sys_exit(1); return 1 }
84 emit(fd)
85 sys_close(fd)
86 // push spec files for nx_aw_push (additive: writes sites/andelinwest/schedule.html, does NOT touch index.html)
87 sx_write_file(SCHED_SRC, "/tmp/andelin_schedule.html\n" as *u8)
88 sx_write_file(SCHED_DST, SCHED_REMOTE)
89 sx_puts("SCHED-EMIT-OK page=/tmp/andelin_schedule.html spec.src=/tmp/aw_sched.src spec.dst=/tmp/aw_sched.dst\n" as *u8)
90 sx_puts(" remote target: /volume1/homes/elderwesto/nishihost/sites/andelinwest/schedule.html (additive)\n" as *u8)
91 sx_puts(" publish: _offc/nx_aw_push.elf /tmp/aw_sched.src /tmp/aw_sched.dst then fetch https://andelinwest.com/schedule.html\n" as *u8)
92 sys_exit(0); return 0
93}