# Quick Test Guide - Wholesale Partner Documents

## 🚀 Start Testing in 3 Steps

### Step 1: Start Development Server
```bash
cd afinet-portal
npm run dev
```

### Step 2: Navigate to Registration
Open browser: `http://localhost:3000/register`

### Step 3: Test the Flow

#### Test A: Local Partner (10 Documents)
1. Click "Wholesale Partner"
2. Fill basic info (name, email, phone)
3. Click "In-Country Partner" tab
4. Upload these 10 documents:
   - Company Profile (PDF)
   - CR14 (PDF)
   - Certificate of Incorporation (PDF)
   - Tax Clearance (PDF)
   - Director ID #1 (2 files - front/back)
   - Director ID #2 (2 files - front/back)
   - Director Residence #1 (PDF)
   - Director Residence #2 (PDF)
   - ZIMRA Certificate (PDF)
   - POTRAZ License (PDF)
5. Fill company details
6. Submit

#### Test B: International Partner (7 Documents)
1. Click "Wholesale Partner"
2. Fill basic info
3. Click "International Partner" tab
4. Upload these 7 documents:
   - Certificate of Incorporation (PDF)
   - Articles of Association (PDF)
   - Shareholder IDs (multiple files OK)
   - Directors List (PDF)
   - Tax ID Number (PDF)
   - NDA Document (PDF)
   - MSA Document (PDF)
5. Fill company details
6. Submit

---

## ✅ What to Verify

### Frontend
- [ ] Partner type tabs appear
- [ ] Document fields change when switching tabs
- [ ] Drag & drop works
- [ ] Click to browse works
- [ ] File validation works (try 11MB file - should fail)
- [ ] Invalid file type rejected (try .txt file)
- [ ] Remove file works
- [ ] Required validation works (try submitting without files)
- [ ] Success message appears

### Backend (Check Laravel logs)
- [ ] Customer record created
- [ ] Documents saved to `storage/app/public/customer_documents/`
- [ ] Database records in `customer_documents` table
- [ ] Email sent to `COMPANY_MAIL`
- [ ] Documents uploaded to Odoo

### Odoo
- [ ] Partner record exists
- [ ] Attachments linked to partner
- [ ] All documents present

---

## 🐛 Common Issues & Fixes

| Issue | Solution |
|-------|----------|
| "Please upload all required documents" | Upload all files before submitting |
| "File size must be less than 10MB" | Use smaller files or compress |
| "Only PDF, JPG, PNG... allowed" | Use correct file format |
| Components not rendering | Check imports in register page |
| Backend errors | Check Laravel logs, verify migrations ran |
| Odoo sync fails | Verify Odoo credentials in .env |

---

## 📊 Expected Results

### Success Flow
```
1. User uploads all documents ✓
2. Form validates successfully ✓
3. Backend creates customer ✓
4. Documents saved locally ✓
5. Documents synced to Odoo ✓
6. Email sent with attachments ✓
7. User sees success message ✓
```

### Success Message
```
┌─────────────────────────────────────────┐
│  ✓ Registration Submitted Successfully! │
│                                         │
│  Your wholesale partner application     │
│  is under review                        │
│                                         │
│  What happens next?                     │
│  • Our team will review your documents │
│  • You'll receive email notification   │
│  • Approval takes 1-2 business days    │
└─────────────────────────────────────────┘
```

---

## 🔍 Debug Commands

### Check Laravel Logs
```bash
cd afinet-portal-backend
tail -f storage/logs/laravel.log
```

### Check Uploaded Files
```bash
cd afinet-portal-backend
ls -la storage/app/public/customer_documents/
```

### Check Database
```bash
cd afinet-portal-backend
php artisan tinker
>>> \App\Models\CustomerDocument::latest()->get()
```

### Test Odoo Connection
```bash
cd afinet-portal-backend
php artisan tinker
>>> app(\App\Services\OdooService::class)->testConnection()
```

---

## 📝 Test Data

Use these sample files for testing:
- Create dummy PDFs with meaningful names
- Use images for ID documents
- Keep files under 10MB
- Test with multiple file formats

Sample file names:
- `company_profile.pdf`
- `cr14_document.pdf`
- `certificate_incorporation.pdf`
- `director_id_front.jpg`
- `director_id_back.jpg`

---

## ⏱️ Time Estimate

- **Setup**: 2 minutes
- **Test Local Partner**: 5 minutes
- **Test International Partner**: 5 minutes
- **Verify Backend**: 3 minutes
- **Total**: ~15 minutes

---

## 🎯 Success Criteria

✅ All documents upload without errors
✅ Validation prevents submission without required docs
✅ Success message displays after submission
✅ Email received with attachments
✅ Documents visible in Odoo
✅ No console errors
✅ No backend errors in logs

---

## 📞 Need Help?

Check these files for detailed info:
- `WHOLESALE_DOCUMENTS_COMPLETE.md` - Full implementation details
- `IMPLEMENTATION_SUMMARY.md` - Technical overview
- `PHASE_2_COMPONENTS_READY.md` - Component documentation

---

**Ready to test!** 🚀
