# Public Lead Form - Quick Reference Guide

## Access the Form

**URL**: `/lead-form`

**From Navigation**: Link in header "Security Guard Services"

---

## Form Sections at a Glance

| # | Section | Required Fields | Dynamic | Notes |
|---|---------|-----------------|---------|-------|
| 1 | Client & Site Details | Yes (most) | No | Basic contact and location info |
| 2 | Service Type | Yes (1+) | No | Multi-select (Static, Armed, Escort) |
| 3 | Working Hours | Yes | No | 8H, 12H, or 24H (custom) |
| 4 | Overtime | No | No | Max OT hours (1-4) |
| 5 | Allowances | No | Yes | Multiple selections |
| 6 | Dynamic Questions | Conditional | Yes | Appears when service type selected |
| 7 | Inventory | No | Yes | Equipment quantities (appears with services) |
| 8 | Compliance | No | No | SMETA, RBA (auto for Malaysia), Labour Law |
| 9 | Additional Info | No | No | Notes, expectations, follow-up |

---

## Quick Checklist for Users

```
□ Fill company name and contact person
□ Enter email (must be unique)
□ Enter mobile and address
□ Select country and city
□ Choose site type (office, factory, etc.)
□ Select at least one service type
□ Specify working hours
□ (Optional) Add overtime and allowances
□ (Conditional) Answer dynamic questions based on service
□ (Optional) Specify inventory items needed
□ (Optional) Select compliance requirements
□ (Optional) Add notes and follow-up date
□ Click "Submit Lead" or "Save as Draft"
```

---

## Field Map

### Section 1: Client & Site Details
```
┌─ Company Name *
├─ Contact Person *
├─ Mobile Number *
├─ Email Address * (Unique)
├─ Country * (India/Malaysia dropdown)
├─ City / State *
├─ Postal Code *
├─ Address * (textarea)
├─ Service Location Details (textarea)
└─ Site Type * (office, factory, residential, event, retail, hospital, educational, other)
```

### Section 2: Service Type
```
┌─ □ Static Guard
├─ □ Armed Guard
└─ □ Escort Service (Pistol)
(Select at least 1)
```

### Section 3: Working Hours
```
┌─ ⊙ 8 Hours
├─ ⊙ 12 Hours
└─ ⊙ 24 Hours (Custom)
    └─ [Custom Hours Text] (if 24H selected)
```

### Section 4: Overtime
```
┌─ ⊙ 1 Hour
├─ ⊙ 2 Hours
├─ ⊙ 3 Hours
└─ ⊙ 4 Hours
```

### Section 5: Allowances
```
┌─ □ Transport Allowance
├─ □ Performance Bonus
├─ □ Attendance Allowance
├─ □ Supervisor Allowance
└─ □ Assistant Supervisor Allowance
```

### Section 6: Dynamic Questions (Changes based on service)
```
For Static Guard:
┌─ ⊙ Supervisor required? (Yes/No)
└─ ⊙ Night duty required? (Yes/No)

For Armed Guard:
┌─ ⊙ Armed Supervisor required? (Yes/No)
├─ ⊙ Assistant Supervisor required? (Yes/No)
└─ ⊙ Night duty required? (Yes/No)

For Escort Service:
┌─ ⊙ Escort frequency? (Daily/Weekly/As needed)
└─ ⊙ Armed escorts required? (Yes/No)
```

### Section 7: Inventory Requirements
```
Clothing:
┌─ Uniform Sets: [0] (number input)
├─ Jacket: [0]
├─ Blazer: [0]
├─ Safety Shoes: [0]
├─ Normal Shoes: [0]
└─ Accessories: [0]

Equipment:
┌─ Baton: [0]
├─ Torch Light: [0]
├─ Walkie-Talkie: [0]
└─ Body Camera: [0]

Infrastructure:
┌─ Guard Cabin: [0]
└─ Visitor Register: [0]
```

### Section 8: Compliance
```
┌─ □ SMETA Certification Required
├─ □ RBA Compliance Required (auto-checked if Malaysia)
└─ □ Local Labour Law Compliance
```

### Section 9: Additional Information
```
┌─ Sales Notes (textarea)
├─ Client Expectations (textarea)
├─ Follow-up Date (date picker)
├─ Budget Minimum (number)
└─ Budget Maximum (number)
```

---

## Smart Features

### 1. Country-based RBA Auto-Population
```
If Country = Malaysia
  → RBA checkbox is automatically checked
  → RBA checkbox is disabled (cannot uncheck)
  → Info message appears
```

### 2. Dynamic Questions Appear/Disappear
```
When service types selected
  → Questions section appears
  → Questions change based on service combination
  
When all services deselected
  → Questions section disappears
```

### 3. Custom Working Hours
```
When "24 Hours" selected
  → Custom working hours textarea appears
  → Example: "Monday-Friday 9AM-5PM, Saturday 10AM-2PM"
  
When "8 Hours" or "12 Hours" selected
  → Custom hours section hidden
```

### 4. Inventory Section Visibility
```
When service selected
  → Inventory section appears
  
When no service selected
  → Inventory section hidden
```

---

## Form Actions

### Save as Draft
```
Click: "Save as Draft" button
Result:
  - Form saved with status "draft"
  - Can be resumed later
  - Message: "Your form has been saved as draft..."
```

### Submit Lead
```
Click: "Submit Lead" button
Result:
  - Form submitted with status "submitted"
  - Sales team notified
  - Message: "Thank you! Your lead has been submitted..."
```

### Clear Form
```
Click: "Clear Form" button
Result:
  - All fields emptied
  - Page not reloaded
  - Start over from scratch
```

---

## Validation Rules

### Must Have (Required)
- [ ] Company name (text)
- [ ] Contact person (text)
- [ ] Email (valid format, unique)
- [ ] Mobile number (text)
- [ ] Address (text)
- [ ] City (text)
- [ ] Postal code (text)
- [ ] Country (India or Malaysia)
- [ ] Site type (select one)
- [ ] Service type (select at least one)
- [ ] Working hours (select one)

### Optional (Can Skip)
- [ ] Overtime hours
- [ ] Allowances
- [ ] Inventory items
- [ ] Compliance requirements
- [ ] Notes and expectations
- [ ] Follow-up date
- [ ] Budget range

---

## Data Handling

### What Gets Stored

**Direct Fields** (stored in leads table):
- Company name, contact, email, mobile
- Address, city, postal code, country
- Site type, working hours
- Compliance requirements
- Notes, expectations, follow-up date
- Budget range

**Complex Data** (stored in sales_notes as JSON):
- Service types selected
- Allowances selected
- Overtime hours
- Inventory quantities
- Custom working hours

### What Gets Generated (Auto)
- Lead status: "draft" or "submitted"
- Lead source: "website"
- Service type ID: 1 (Security)
- Guard type: "both"
- Guard count: 1
- State: "N/A"
- RBA required: true (if Malaysia), false (if India)

---

## Error Messages & Solutions

### "This email address is already in use"
- **Cause**: Email already exists in system
- **Solution**: Use different email or contact admin

### "Validation failed. Please check your inputs"
- **Cause**: Required field missing or invalid value
- **Solution**: 
  - Check all fields marked with *
  - Verify country is India or Malaysia
  - Select at least one service type

### "At least one service type must be selected"
- **Cause**: No checkboxes checked in service type section
- **Solution**: Select Static Guard, Armed Guard, or Escort Service

### "Form not submitting"
- **Cause**: JavaScript disabled or browser issue
- **Solution**: Enable JavaScript, try different browser

---

## Browser Compatibility

| Browser | Support | Notes |
|---------|---------|-------|
| Chrome | ✅ Full | Recommended |
| Firefox | ✅ Full | Full support |
| Safari | ✅ Full | iOS/Mac |
| Edge | ✅ Full | Windows |
| IE 11 | ❌ Not Supported | Use modern browser |

---

## Mobile Usage

### Optimizations
- Full-width on phones (1 column)
- 2 columns on tablets
- Touch-friendly buttons
- Auto-focus on error fields

### Recommendations
- Fill on tablet or desktop for best experience
- Mobile: Use landscape for better spacing

---

## After Submission

### What Happens Next

**For "Submit Lead"**:
1. Form submitted to sales team
2. You see: "Thank you! Your lead has been submitted..."
3. Sales team contacts you within 24 hours
4. Process: Review → Quotation → Negotiation

**For "Save as Draft"**:
1. Form saved without submission
2. You see: "Your form has been saved as draft..."
3. You can resume later using your email
4. No sales team notification yet

---

## Tips & Tricks

### ✓ Do This
- Fill required fields first (marked with *)
- Use company email for professionalism
- Be specific in notes section
- Include follow-up date for tracking
- Specify exact inventory needs

### ✗ Avoid This
- Don't use duplicate email
- Don't leave required fields empty
- Don't submit without service type selection
- Don't include phone/card numbers in notes
- Don't upload files (not supported)

---

## Key Business Rules

### Rule 1: Unique Email
```
Each company can have only one lead record
Error if email already submitted
```

### Rule 2: Service Type Required
```
Must select at least one:
  - Static Guard
  - Armed Guard
  - Escort Service
```

### Rule 3: RBA for Malaysia
```
Country = Malaysia → RBA automatically enabled
Country = India → RBA optional
```

### Rule 4: No Pricing in Lead Form
```
- No cost shown
- No price per guard
- No quotation generated
- Quotation created AFTER conversion to client
```

### Rule 5: Converted Leads Cannot Edit
```
Once lead converted to client:
- Lead form locked
- Cannot make changes
- Must edit through client management
```

---

## Field Dependencies

```
Country Changes
  └─ If Malaysia: RBA auto-checked
  
Service Type Selected
  ├─ Dynamic Questions appear
  └─ Inventory Section appears
  
Service Type Deselected
  ├─ Dynamic Questions disappear
  └─ Inventory Section disappears
  
Working Hours = 24
  └─ Custom Hours textarea appears
  
Working Hours = 8 or 12
  └─ Custom Hours textarea disappears
```

---

## Summary Table

| Aspect | Details |
|--------|---------|
| **URL** | /lead-form |
| **Access** | Public (no login) |
| **Form Time** | 5-10 minutes |
| **Sections** | 9 sections |
| **Required Fields** | ~12 fields |
| **Optional Fields** | ~20 fields |
| **Service Types** | 3 options |
| **Inventory Items** | 12 items |
| **Status Options** | Draft / Submitted |
| **Response Time** | 24 hours |

---

## Getting Help

- **Form Issues**: Contact admin
- **Technical Help**: [support@example.com]
- **Sales Questions**: [sales@example.com]
- **Chat Support**: Available weekdays 9 AM - 6 PM

