// components/RegistrationWizard.tsx // Client Component. New-company registration wizard. "use client"; import { useState } from "react"; import type { DirectorInput, ShareholderInput, CompanyInput, WizardState } from "@/lib/wizard-types"; import DirectorStep from "@/components/DirectorStep"; const MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; const STEPS = [ { id: "directors", label: "Directors" }, { id: "company", label: "Company" }, { id: "shareholders",label: "Shareholders" }, { id: "review", label: "Review" }, ] as const; type StepId = (typeof STEPS)[number]["id"]; function uid(): string { return typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : Math.random().toString(36).slice(2) + Date.now().toString(36); } function blankDirector(): DirectorInput { return { ui_key: uid(), first_names: "", surname: "", id_no: "", date_of_birth: "", residential_address: "", postal_address: "", cell_phone: "", email: "", section69: { q1_probation: null, q2_court_prohibited: null, q3_unrehabilitated_insolvent: null, q4_public_regulation: null, q5_removed_from_office: null, q6_convicted_offence: null, }, }; } function blankShareholder(): ShareholderInput { return { ui_key: uid(), is_director: false, director_index: null, name: "", id_or_entity_no: "", quantity_of_shares: 0, share_percent: 0 }; } function emptyCompany(): CompanyInput { return { proposed_name_1: "", proposed_name_2: "", proposed_name_3: "", proposed_name_4: "", trading_address: "", postal_address: "", financial_year_end: 2, // February default authorised_shares: "1000", value_per_share: 1, // R1.00 default company_cell: "", company_email: "", public_officer: "", company_secretary: "", }; } // ── Company Step ────────────────────────────────────────────────────────────── function CompanyStep({ company, directors, onUpdate, }: { company: CompanyInput; directors: DirectorInput[]; onUpdate: (p: Partial) => void; }) { const set = (p: Partial) => onUpdate(p); const filledDirectors = directors.filter((d) => d.first_names.trim() && d.surname.trim()); return (
{/* Proposed names */}

Proposed company names

{([ { key: "proposed_name_1" as const, placeholder: "First choice" }, { key: "proposed_name_2" as const, placeholder: "Second choice" }, { key: "proposed_name_3" as const, placeholder: "Third choice" }, { key: "proposed_name_4" as const, placeholder: "Fourth choice (optional)" }, ]).map(({ key, placeholder }) => (
set({ [key]: e.target.value })} />
))}
{/* Addresses */}

Addresses

{/* Trading address */}
{filledDirectors.length > 0 && ( )}