Add arm length options for MAT (12ft/17ft) and Techna (12ft/14ft)
This commit is contained in:
@ -7,6 +7,7 @@ import QuoteSummary from './QuoteSummary';
|
||||
const initialState = {
|
||||
step: 1,
|
||||
operator: null,
|
||||
armChoice: null,
|
||||
optionalParts: [],
|
||||
groundLoops: {
|
||||
needed: false,
|
||||
@ -22,7 +23,9 @@ const initialState = {
|
||||
function reducer(state, action) {
|
||||
switch (action.type) {
|
||||
case 'SELECT_OPERATOR':
|
||||
return { ...state, operator: action.payload, optionalParts: [], step: 2 };
|
||||
return { ...state, operator: action.payload, armChoice: null, optionalParts: [], step: 2 };
|
||||
case 'SET_ARM_CHOICE':
|
||||
return { ...state, armChoice: action.payload };
|
||||
case 'TOGGLE_OPTIONAL_PART': {
|
||||
const id = action.payload;
|
||||
const exists = state.optionalParts.includes(id);
|
||||
@ -105,7 +108,7 @@ function reducer(state, action) {
|
||||
|
||||
export default function Wizard({ pricing, onLogout }) {
|
||||
const [state, dispatch] = useReducer(reducer, initialState);
|
||||
const { step, operator, optionalParts, groundLoops, accessControl, remoteButtons, remoteQuantity } = state;
|
||||
const { step, operator, armChoice, optionalParts, groundLoops, accessControl, remoteButtons, remoteQuantity } = state;
|
||||
|
||||
const steps = [
|
||||
{ num: 1, label: 'Operator' },
|
||||
@ -182,8 +185,10 @@ export default function Wizard({ pricing, onLogout }) {
|
||||
<StepOperator
|
||||
operators={pricing.operators}
|
||||
selected={operator}
|
||||
armChoice={armChoice}
|
||||
optionalParts={optionalParts}
|
||||
onSelect={(id) => dispatch({ type: 'SELECT_OPERATOR', payload: id })}
|
||||
onSetArmChoice={(id) => dispatch({ type: 'SET_ARM_CHOICE', payload: id })}
|
||||
onToggleOptionalPart={(id) => dispatch({ type: 'TOGGLE_OPTIONAL_PART', payload: id })}
|
||||
onNext={() => dispatch({ type: 'NEXT_STEP' })}
|
||||
/>
|
||||
@ -223,7 +228,7 @@ export default function Wizard({ pricing, onLogout }) {
|
||||
{step === 4 && (
|
||||
<QuoteSummary
|
||||
pricing={pricing}
|
||||
selections={{ operator, optionalParts, groundLoops, accessControl, remoteButtons, remoteQuantity }}
|
||||
selections={{ operator, armChoice, optionalParts, groundLoops, accessControl, remoteButtons, remoteQuantity }}
|
||||
onBack={() => dispatch({ type: 'PREV_STEP' })}
|
||||
onNew={() => dispatch({ type: 'RESET' })}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user