# Enterprise Registration Implementation Plan

## Overview
Create a comprehensive registration flow that replaces the current simple OTP-based flow with a multi-step form for enterprise users.

## Files to Create

### 1. Templates
- `app/templates/auth/register_flow.html` - Main multi-step registration form
- `app/templates/auth/verify_otp.html` - OTP verification page
- `app/templates/auth/complete_registration.html` - Success page

### 2. Routes (app/routes/auth.py)
- `register_flow` - POST handler for step 1 (user data submission)
- `verify_otp` - POST handler for step 2 (OTP verification)
- `complete_registration` - POST handler for step 3 (account creation)

### 3. Database Models (app/models/user.py)
- Add new fields for user data (company_name, industry_type, company_size, activity_type, company_sector, target_market, budget_range, company_stage)

## Step 1: User Data Form (register_flow.html)

### Fields to Include:
- Full Name (الاسم الكامل)
- Phone (رقم الهاتف)
- Email (البريد الإلكتروني)
- Password (كلمة المرور)
- Confirm Password (تأكيد كلمة المرور)

### Industry Type (صنوع المنظمة)
- Educational (تعليمي)
- Manufacturing (صناعي)
- Services (سياحي)
- Technology (تقني)
- Healthcare (طبي)
- Retail (تجزء)
- Other (أخرى)

### Company Size (حجم الشركة)
- Startup (1-50 موظف)
- Small (51-200 موظف)
- Medium (201-500 موظف)
- Large (501+ موظف)
- Enterprise (مؤسسات كبرى)

### Company Stage (مرحلة الشركة)
- Idea (فكرة)
- MVP (منتج أولي)
- Growth (نمو)
- Mature (مستقرة)

### Activity Type (طبيعة النشاط)
- R&D Research (بحث وتطوير)
- Product Development (تطوير المنتجات)
- Market Research (بحث السوق)
- Innovation (ابتكار وتطوير)

### Target Market (السوق المستهدف)
- Local (محلي)
- Regional (إقليمي)
- Global (عالمي)
- GCC (مجلس التعاون الخليجي)
- International (دولي)

### Budget Range (نطاق الميزانية)
- Less than 100K SAR (< 100,000 ر.س)
- 100K-500K SAR (100,000 - 500,000 ر.س)
- 500K-1M SAR (500,000 - 1,000,000 ر.س)
- 1M+ SAR (1,000,000+ ر.س)
- 10M+ SAR (10,000,000+ ر.س)

## Step 2: OTP Verification (verify_otp.html)

### Features:
- 6-digit OTP input with auto-focus
- Resend OTP button with countdown timer
- Progress indicator (3 steps)
- Arabic labels
- Clean modern design

### Design Considerations:
- RTL support for Arabic text
- Responsive design (mobile-first)
- Progress indicator showing current step
- Visual feedback on OTP input (green when correct, red shake on error)
- Auto-advance to next input after digit entry
- Auto-submit when all 6 digits entered
- Paste support for OTP codes
- Backspace navigation between inputs

## Step 3: Account Completion (complete_registration.html)

### Features:
- Success message with animation
- Auto-login after 2 seconds
- Redirect to dashboard after account creation
- User data summary display
- Flash messages for errors

## Implementation Order

1. Create database migration to add new user fields
2. Create templates with RTL Arabic support
3. Create routes with proper error handling
4. Test the complete flow
5. Update existing register page to link to new flow

## Database Migration

```sql
-- Add new columns to users table
ALTER TABLE users ADD COLUMN company_name VARCHAR(200);
ALTER TABLE users ADD COLUMN phone VARCHAR(20);
ALTER TABLE users ADD COLUMN industry_type VARCHAR(50);
ALTER TABLE users ADD COLUMN company_size VARCHAR(50);
ALTER TABLE users ADD COLUMN activity_type VARCHAR(50);
ALTER TABLE users ADD COLUMN company_sector VARCHAR(100);
ALTER TABLE users ADD COLUMN target_market VARCHAR(100);
ALTER TABLE users ADD COLUMN budget_range VARCHAR(50);
ALTER TABLE users ADD COLUMN company_stage VARCHAR(50);
```

## Notes

- All user data fields should be optional in database
- Password requirements: minimum 8 characters
- Industry type default can be 'other'
- Phone format should accept Saudi format (+966...)
- Email validation should be required for OTP
