fix: Quote wizard - correct total calculation and email sender

- Fix calculateQuote() to respect serviceInterests flags
- Only include GPS/Support costs when user has enabled them
- Update Step6Summary to conditionally render service sections
- Add sender display name (Arizona Computer Guru) to emails
- Add reply-to address (admin@azcomputerguru.com)
- Fixes phantom $380 support charge appearing in totals

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 20:42:40 -07:00
parent fa15b03180
commit c629890e32
4 changed files with 104 additions and 71 deletions

View File

@@ -568,32 +568,40 @@ export function useQuote(): UseQuoteReturn {
}, [email]);
const calculateQuote = useCallback((): QuoteResult => {
const gpsMonthly = getGPSMonthly();
const supportMonthly = getSupportMonthly();
const voipMonthly = getVoIPMonthly();
const voipOneTime = getVoIPOneTime();
const supportBlockTimeOneTime = getSupportBlockTimeOneTime();
const webHostingMonthly = getWebHostingMonthly();
const emailMonthly = getEmailMonthly();
// Only include services that are enabled in serviceInterests
const gpsMonthly = serviceInterests.gps ? getGPSMonthly() : 0;
const supportMonthly = serviceInterests.support ? getSupportMonthly() : 0;
const supportBlockTimeOneTime = serviceInterests.support ? getSupportBlockTimeOneTime() : 0;
const voipMonthly = serviceInterests.voip ? getVoIPMonthly() : 0;
const voipOneTime = serviceInterests.voip ? getVoIPOneTime() : 0;
const webHostingMonthly = serviceInterests.webHosting ? getWebHostingMonthly() : 0;
const emailMonthly = serviceInterests.email ? getEmailMonthly() : 0;
// Calculate GPS breakdown
const gpsTier = gpsTiers.find((t) => t.id === gps.tierId);
const gpsMonitoring = gpsTier ? gpsTier.pricePerEndpoint * gps.endpointCount : 0;
// Calculate GPS breakdown (only if enabled)
let gpsMonitoring = 0;
let gpsEquipment = 0;
if (gps.includeEquipment && gps.equipmentDeviceCount > 0) {
const additionalDevices = Math.max(0, gps.equipmentDeviceCount - equipmentMonitoring.baseDevices);
gpsEquipment = equipmentMonitoring.basePrice + (additionalDevices * equipmentMonitoring.additionalDevicePrice);
if (serviceInterests.gps) {
const gpsTier = gpsTiers.find((t) => t.id === gps.tierId);
gpsMonitoring = gpsTier ? gpsTier.pricePerEndpoint * gps.endpointCount : 0;
if (gps.includeEquipment && gps.equipmentDeviceCount > 0) {
const additionalDevices = Math.max(0, gps.equipmentDeviceCount - equipmentMonitoring.baseDevices);
gpsEquipment = equipmentMonitoring.basePrice + (additionalDevices * equipmentMonitoring.additionalDevicePrice);
}
}
// Calculate support breakdown
const supportPlan = support.planId !== 'none' ? supportPlans.find((p) => p.id === support.planId) : null;
const supportPlanCost = supportPlan ? supportPlan.monthlyPrice : 0;
// Calculate support breakdown (only if enabled)
let supportPlanCost = 0;
if (serviceInterests.support && support.planId !== 'none') {
const supportPlan = supportPlans.find((p) => p.id === support.planId);
supportPlanCost = supportPlan ? supportPlan.monthlyPrice : 0;
}
// Calculate VoIP breakdown
const voipTier = voipTiers.find((t) => t.id === voip.tierId);
const voipService = voip.enabled && voipTier ? voipTier.pricePerUser * voip.userCount : 0;
// Calculate VoIP breakdown (only if enabled)
let voipService = 0;
let voipHardwareMonthly = 0;
if (voip.enabled) {
if (serviceInterests.voip && voip.enabled) {
const voipTier = voipTiers.find((t) => t.id === voip.tierId);
voipService = voipTier ? voipTier.pricePerUser * voip.userCount : 0;
voip.hardware.forEach((hw) => {
if (hw.isRental) {
const hardware = voipHardware.find((h) => h.id === hw.hardwareId);
@@ -639,7 +647,7 @@ export function useQuote(): UseQuoteReturn {
setQuoteResult(result);
return result;
}, [gps, support, voip, webHosting, email, getGPSMonthly, getSupportMonthly, getSupportBlockTimeOneTime, getVoIPMonthly, getVoIPOneTime, getWebHostingMonthly, getEmailMonthly]);
}, [serviceInterests, gps, support, voip, webHosting, email, getGPSMonthly, getSupportMonthly, getSupportBlockTimeOneTime, getVoIPMonthly, getVoIPOneTime, getWebHostingMonthly, getEmailMonthly]);
// ============================================================================
// Reset