{empty ? "Sign above with your mouse or finger" : "Signature captured"}
);
}
/* ---- Demo data store (in-memory + localStorage) ---- */
const PORTAL_KEY = "wc_portal_v3";
const defaultStore = {
houses: [
{ id: "h1", name: "Creekside House", manager: "James Ortiz", address: "2013 Mark Twain Lane", beds: [
{ id: "b1", label: "Room 1 · Bed A", resident: "Marcus Reed" },
{ id: "b2", label: "Room 1 · Bed B", resident: "Devon King" },
{ id: "b3", label: "Room 2 · Bed A", resident: "Theo Lang" },
{ id: "b4", label: "Room 2 · Bed B", resident: null },
]},
{ id: "h2", name: "Willow House", manager: "Nadia Brooks", address: "1426 Creekside Drive", beds: [
{ id: "b5", label: "Room 1 · Bed A", resident: "Sam Whitfield" },
{ id: "b6", label: "Room 1 · Bed B", resident: null },
{ id: "b7", label: "Room 2 · Bed A", resident: null },
]},
],
staff: ["James Ortiz", "Nadia Brooks", "Rebecca Hale", "Sam Whitfield"],
residents: [
{ id: "r1", name: "Marcus Reed", phone: "(940) 555-0181", house: "Creekside House", phase: 2, status: "Active", balance: 0 },
{ id: "r2", name: "Devon King", phone: "(940) 555-0163", house: "Creekside House", phase: 1, status: "Active", balance: 175 },
{ id: "r3", name: "Theo Lang", phone: "(940) 555-0129", house: "Creekside House", phase: 3, status: "Active", balance: 0 },
{ id: "r4", name: "Sam Whitfield", phone: "(940) 555-0147", house: "Willow House", phase: 2, status: "Active", balance: 350 },
{ id: "r5", name: "Alex Monroe", phone: "(940) 555-0173", house: "Awaiting bed", phase: 1, status: "Onboarding", balance: 175 },
],
applications: [
{ id: "a1", name: "Jordan Rivera", submitted: "Jul 1", situation: "Leaving residential treatment", status: "pending" },
{ id: "a2", name: "Chris Delgado", submitted: "Jun 30", situation: "Just completed detox", status: "pending" },
{ id: "a3", name: "Alex Monroe", submitted: "Jun 28", situation: "Sober but need structure", status: "approved" },
],
forms: [
{ id: "f1", title: "Resident Agreement & House Rules Waiver", kind: "waiver", required: true, status: "published",
body: "I understand and agree to the house rules of Willow Creek Sober Living, including complete abstinence from alcohol and non-prescribed drugs, participation in house meetings and chores, curfew by phase, and respect for housemates and staff. I understand that violation of these agreements may result in discharge from the residence.",
fields: [{ label: "Full legal name", type: "text" }, { label: "Date of birth", type: "date" }] },
{ id: "f2", title: "Liability & Activities Waiver", kind: "waiver", required: true, status: "published",
body: "I release Willow Creek Sober Living, its staff and volunteers from liability for personal injury or loss of property arising from ordinary house activities, transportation to meetings, and recreational outings, except in cases of gross negligence.",
fields: [{ label: "Full legal name", type: "text" }, { label: "Emergency contact & phone", type: "text" }] },
{ id: "f3", title: "Declaration of Sobriety Commitment", kind: "declaration", required: true, status: "published",
body: "I declare my commitment to my recovery: to remain abstinent, to be honest with my house community, to attend agreed meetings, and to ask for help when I am struggling. I make this declaration freely, for myself.",
fields: [{ label: "Full legal name", type: "text" }, { label: "Sobriety date", type: "date" }] },
{ id: "f4", title: "Medical Information & Consent", kind: "form", required: false, status: "published",
body: "Please share current medications, allergies, and conditions our house team should know about. This information is kept confidential and used only to keep you safe.",
fields: [{ label: "Current medications", type: "textarea" }, { label: "Allergies", type: "text" }, { label: "Primary physician", type: "text" }] },
{ id: "f5", title: "Photo & Media Release", kind: "form", required: false, status: "draft",
body: "I grant / do not grant permission for Willow Creek to use photographs that include me in community materials. Consent may be withdrawn at any time in writing.",
fields: [{ label: "Full legal name", type: "text" }] },
],
signedForms: { "Marcus Reed": ["f1", "f2", "f3", "f4"], "Devon King": ["f1"], "Sam Whitfield": ["f1", "f2"], "Alex Monroe": ["f1", "f2", "f3", "f4"] },
payments: [
{ id: "p1", resident: "Marcus Reed", date: "Jun 23, 2026", amount: 175, method: "Visa ··4242", status: "Paid", receiptNo: "WC-2026-1074" },
{ id: "p2", resident: "Marcus Reed", date: "Jun 16, 2026", amount: 175, method: "Visa ··4242", status: "Paid", receiptNo: "WC-2026-0961" },
{ id: "p3", resident: "Devon King", date: "Jun 16, 2026", amount: 175, method: "Cash", status: "Paid", receiptNo: "WC-2026-0958" },
],
cms: {
heroHeadline: "A calmer place to begin again.",
heroSub: "Structured, supportive recovery housing where accountability meets belonging — so early sobriety has room to take root.",
weeklyRate: 175, depositFee: 150, lateFee: 25, bedsOpenNote: "3 beds open this week", phone: "(940) 555-0142",
},
};
function loadStore() {
try {
const raw = localStorage.getItem(PORTAL_KEY);
if (raw) return JSON.parse(raw);
} catch (e) {}
return JSON.parse(JSON.stringify(defaultStore));
}
function saveStore(s) { try { localStorage.setItem(PORTAL_KEY, JSON.stringify(s)); } catch (e) {} }
/* ---- Receipts ---- */
function makeReceiptNo() {
return "WC-" + new Date().getFullYear() + "-" + String(Math.floor(1000 + Math.random() * 9000));
}
function ReceiptModal({ payment, cms, onClose, onRegenerate }) {
const { Button, Badge } = window.WillowCreekDesignSystem_90378c;
const printReceipt = () => {
const w = window.open("", "_blank", "width=420,height=640");
if (!w) return;
w.document.write(`Receipt ${payment.receiptNo}
❦ Willow Creek Sober Living
2013 Mark Twain Lane · Denton, TX 76210 · ${cms.phone}
Payment receipt
Receipt ${payment.receiptNo}
$${payment.amount}.00
PAID
Resident${payment.resident}
DescriptionWeekly program fee
Date${payment.date}
Method${payment.method}
Processed byStripe
Thank you. This receipt was generated by the Willow Creek resident portal and can be regenerated at any time by the resident or an administrator. Demo document — no real charge was made.