# Quote Wizard Session - 2026-03-13

## Summary
Fixed multiple bugs in the MSP Quote Wizard and deployed updates to IX server.

## Bugs Fixed

### 1. Amount Mismatch Bug ($710 displayed vs $330 saved)
**Root Cause:** `calculateQuote()` in useQuote.ts was including GPS and Support costs unconditionally, without checking `serviceInterests` flags. GPS and Support were enabled by default in `initialServiceInterests`.

**Fix:** Updated `calculateQuote()` to check `serviceInterests.gps` and `serviceInterests.support` before including those costs:
```typescript
const gpsMonthly = serviceInterests.gps ? getGPSMonthly() : 0;
const supportMonthly = serviceInterests.support ? getSupportMonthly() : 0;
```

**Files Changed:**
- `frontend/src/hooks/useQuote.ts` - calculateQuote() now respects serviceInterests
- `frontend/src/components/wizard/steps/Step6Summary.tsx` - Conditionally render GPS/Support sections

### 2. Email Sender Name ("Seafile Noreply")
**Root Cause:** Graph API sendMail was using the mailbox's configured display name instead of specifying one in the API call.

**Fix:** Added `from` and `replyTo` fields to the Graph API request:
```php
'from' => [
    'emailAddress' => [
        'name' => 'Arizona Computer Guru',
        'address' => GRAPH_SENDER_EMAIL,
    ],
],
'replyTo' => [
    [
        'emailAddress' => [
            'name' => 'Arizona Computer Guru',
            'address' => 'admin@azcomputerguru.com',
        ],
    ],
],
```

**Files Changed:**
- `php-api/api/config.php` - Added GRAPH_SENDER_NAME, GRAPH_REPLY_TO_EMAIL, GRAPH_REPLY_TO_NAME
- `php-api/api/services/email_service.php` - Added from/replyTo to sendMail payload

### 3. Submit Button Not Disabled
**Issue:** Submit button was clickable before terms checkbox was selected.

**Fix:** Added `!contactInfo.agreedToTerms` to disabled condition:
```typescript
disabled={isSubmitting || !contactInfo.agreedToTerms}
```

**Files Changed:**
- `frontend/src/components/wizard/steps/Step7Contact.tsx`

## Deployments

### Frontend (React)
- Built with Vite: `npm run build`
- Deployed to IX: `/home/azcomputerguru/public_html/quote/`
- Latest bundle: `index-DunPq78q.js`

### Backend (PHP)
- Updated config.php with email settings
- Updated email_service.php with from/replyTo fields
- Files deployed via SCP to IX server

## Database Verification
Confirmed quotes are saving correctly:
- Test Two: $295 (GPS $260 + Web Hosting $35) - NO phantom support charge
- Mike Test: $330 (GPS $260 + M365 $70)

## Configuration
- Reply-to email: admin@azcomputerguru.com
- Sender display name: Arizona Computer Guru
- Admin notification: mike@azcomputerguru.com

## Git Commits
- `c629890` - fix: Quote wizard - correct total calculation and email sender
- `c79c81e` - sync: Submit button disabled until terms agreed

## SSH Access (from Mac)
Working command:
```bash
ssh -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519 root@172.16.3.10
```

## Notes
- Browser caching may show old JS bundle - hard refresh required (Cmd+Shift+R)
- Cloudflare blocks curl requests to API - browser access works fine
