use yew::prelude::*; use web_sys::HtmlInputElement; use crate::models::*; #[derive(Properties, PartialEq)] pub struct StepOneProps { pub form_data: CompanyFormData, pub on_form_update: Callback, } pub enum StepOneMsg { UpdateCompanyName(String), UpdateDescription(String), UpdateEmail(String), UpdateIndustry(String), SelectCompanyType(CompanyType), } pub struct StepOne { form_data: CompanyFormData, } impl Component for StepOne { type Message = StepOneMsg; type Properties = StepOneProps; fn create(ctx: &Context) -> Self { Self { form_data: ctx.props().form_data.clone(), } } fn update(&mut self, ctx: &Context, msg: Self::Message) -> bool { match msg { StepOneMsg::UpdateCompanyName(value) => { self.form_data.company_name = value; } StepOneMsg::UpdateDescription(value) => { self.form_data.company_purpose = Some(value); } StepOneMsg::UpdateEmail(value) => { self.form_data.company_email = value; } StepOneMsg::UpdateIndustry(value) => { self.form_data.company_industry = if value.is_empty() { None } else { Some(value) }; } StepOneMsg::SelectCompanyType(company_type) => { self.form_data.company_type = company_type; } } // Notify parent of form data changes ctx.props().on_form_update.emit(self.form_data.clone()); true } fn changed(&mut self, ctx: &Context, _old_props: &Self::Properties) -> bool { self.form_data = ctx.props().form_data.clone(); true } fn view(&self, ctx: &Context) -> Html { let link = ctx.link(); html! {
// Company Type Selection
{self.render_company_type_option(ctx, CompanyType::SingleFZC, "Single FZC", "Perfect for individual entrepreneurs and solo ventures. Simple structure with one shareholder.", vec!["1 shareholder only", "Cannot issue digital assets", "Can hold external shares", "Connect to bank", "Participate in ecosystem"], "$20 setup + $20/month")} {self.render_company_type_option(ctx, CompanyType::StartupFZC, "Startup FZC", "Ideal for small teams and early-stage startups. Allows multiple shareholders and digital asset issuance.", vec!["Up to 5 shareholders", "Can issue digital assets", "Hold external shares", "Connect to bank", "Full ecosystem access"], "$50 setup + $50/month")} {self.render_company_type_option(ctx, CompanyType::GrowthFZC, "Growth FZC", "Designed for growing businesses that need more flexibility and can hold physical assets.", vec!["Up to 20 shareholders", "Can issue digital assets", "Hold external shares", "Connect to bank", "Hold physical assets"], "$100 setup + $100/month")} {self.render_company_type_option(ctx, CompanyType::GlobalFZC, "Global FZC", "Enterprise-level structure for large organizations with unlimited shareholders and full capabilities.", vec!["Unlimited shareholders", "Can issue digital assets", "Hold external shares", "Connect to bank", "Hold physical assets"], "$2000 setup + $200/month")} {self.render_company_type_option(ctx, CompanyType::CooperativeFZC, "Cooperative FZC", "Democratic organization structure with collective decision-making and equitable distribution.", vec!["Unlimited members", "Democratic governance", "Collective decision-making", "Equitable distribution", "Full capabilities"], "$2000 setup + $200/month")}
} } } impl StepOne { fn render_company_type_option( &self, ctx: &Context, company_type: CompanyType, title: &str, description: &str, benefits: Vec<&str>, price: &str, ) -> Html { let link = ctx.link(); let is_selected = self.form_data.company_type == company_type; let card_class = if is_selected { "card border-success mb-3 shadow-sm" } else { "card border-light mb-3" }; html! {
{title}

{description}

{price}
{"Key Features:"}
    {for benefits.iter().map(|benefit| { html! {
  • {benefit}
  • } })}
{if is_selected { html! { } } else { html! {} }}
} } }