Add customer info step (name + project) between access control and quote

This commit is contained in:
Todd
2026-05-25 22:11:44 -04:00
parent b696c5054d
commit f65d1555d2
3 changed files with 111 additions and 5 deletions

View File

@ -2,6 +2,7 @@ import { useReducer } from 'react';
import StepOperator from './StepOperator';
import StepGroundLoops from './StepGroundLoops';
import StepAccessControl from './StepAccessControl';
import StepCustomerInfo from './StepCustomerInfo';
import QuoteSummary from './QuoteSummary';
const initialState = {
@ -18,6 +19,7 @@ const initialState = {
accessControl: [],
remoteButtons: 4,
remoteQuantity: 1,
customerInfo: { name: '', project: '' },
};
function reducer(state, action) {
@ -82,8 +84,10 @@ function reducer(state, action) {
return { ...state, remoteButtons: action.payload };
case 'SET_REMOTE_QUANTITY':
return { ...state, remoteQuantity: Math.max(1, action.payload) };
case 'SET_CUSTOMER_INFO':
return { ...state, customerInfo: action.payload };
case 'NEXT_STEP':
return { ...state, step: Math.min(state.step + 1, 4) };
return { ...state, step: Math.min(state.step + 1, 5) };
case 'PREV_STEP':
return { ...state, step: Math.max(state.step - 1, 1) };
case 'SET_GROUND_LOOP_SIZE':
@ -98,7 +102,7 @@ function reducer(state, action) {
},
};
case 'GO_TO_STEP':
return { ...state, step: Math.min(action.payload, 4) };
return { ...state, step: Math.min(action.payload, 5) };
case 'RESET':
return { ...initialState };
default:
@ -108,13 +112,14 @@ function reducer(state, action) {
export default function Wizard({ pricing, onLogout }) {
const [state, dispatch] = useReducer(reducer, initialState);
const { step, operator, armChoice, optionalParts, groundLoops, accessControl, remoteButtons, remoteQuantity } = state;
const { step, operator, armChoice, optionalParts, groundLoops, accessControl, remoteButtons, remoteQuantity, customerInfo } = state;
const steps = [
{ num: 1, label: 'Operator' },
{ num: 2, label: 'Ground Loops' },
{ num: 3, label: 'Access Control' },
{ num: 4, label: 'Quote' },
{ num: 4, label: 'Customer' },
{ num: 5, label: 'Quote' },
];
return (
@ -226,9 +231,18 @@ export default function Wizard({ pricing, onLogout }) {
)}
{step === 4 && (
<StepCustomerInfo
value={customerInfo}
onChange={(info) => dispatch({ type: 'SET_CUSTOMER_INFO', payload: info })}
onBack={() => dispatch({ type: 'PREV_STEP' })}
onNext={() => dispatch({ type: 'NEXT_STEP' })}
/>
)}
{step === 5 && (
<QuoteSummary
pricing={pricing}
selections={{ operator, armChoice, optionalParts, groundLoops, accessControl, remoteButtons, remoteQuantity }}
selections={{ operator, armChoice, optionalParts, groundLoops, accessControl, remoteButtons, remoteQuantity, customerInfo }}
onBack={() => dispatch({ type: 'PREV_STEP' })}
onNew={() => dispatch({ type: 'RESET' })}
/>