-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
B 22493 int - clear addr fields when toggle to No #14979
base: integrationTesting
Are you sure you want to change the base?
Changes from all commits
59f0b92
752d8e6
c7bce7d
b925b37
1839910
e1a0843
9e311ae
710b01c
f96b7fa
eaf2cee
93de1e2
706f420
4c020a0
57d5a12
edce164
ec41739
6d86e16
0aef1d2
70d7b2f
37f0ced
3866cf8
f3a76a3
af96394
9118de3
b253977
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ const blankAddress = { | |
address: { | ||
streetAddress1: '', | ||
streetAddress2: '', | ||
streetAddress3: '', | ||
city: '', | ||
state: '', | ||
postalCode: '', | ||
|
@@ -252,6 +253,104 @@ class MtoShipmentForm extends Component { | |
}); | ||
} | ||
}; | ||
const handleAddressToggleChange = (e) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this into a helper function and call it from all the places you're doing this please There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe you could refactor to something like this
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I actually meant to go back and figure out something for this, but got held up on tests for so long, forgot about it. |
||
if (e.target.name === 'hasSecondaryPickup') { | ||
if (e.target.value === 'false') { | ||
setValues({ | ||
...values, | ||
hasSecondaryPickup: 'false', | ||
secondaryPickup: { | ||
blankAddress, | ||
}, | ||
}); | ||
} else if (e.target.value === 'true') { | ||
setValues({ | ||
...values, | ||
hasSecondaryPickup: 'true', | ||
secondaryPickup: { | ||
...values.secondaryPickup, | ||
}, | ||
}); | ||
} | ||
} | ||
if (e.target.name === 'hasTertiaryPickup') { | ||
if (e.target.value === 'false') { | ||
setValues({ | ||
...values, | ||
hasTertiaryPickup: 'false', | ||
tertiaryPickup: { | ||
blankAddress, | ||
}, | ||
}); | ||
} else if (e.target.value === 'true') { | ||
setValues({ | ||
...values, | ||
hasTertiaryPickup: 'true', | ||
tertiaryPickup: { | ||
...values.tertiaryPickup, | ||
}, | ||
}); | ||
} | ||
} | ||
if (e.target.name === 'hasDeliveryAddress') { | ||
if (e.target.value === 'false') { | ||
setValues({ | ||
...values, | ||
hasDeliveryAddress: 'false', | ||
delivery: { | ||
...values.delivery, | ||
address: newDutyLocationAddress, | ||
}, | ||
}); | ||
} else if (e.target.value === 'true') { | ||
setValues({ | ||
...values, | ||
hasDeliveryAddress: 'true', | ||
delivery: { | ||
...values.delivery, | ||
}, | ||
}); | ||
} | ||
} | ||
if (e.target.name === 'hasSecondaryDelivery') { | ||
if (e.target.value === 'false') { | ||
setValues({ | ||
...values, | ||
hasSecondaryDelivery: 'false', | ||
secondaryDelivery: { | ||
blankAddress, | ||
}, | ||
}); | ||
} else if (e.target.value === 'true') { | ||
setValues({ | ||
...values, | ||
hasSecondaryDelivery: 'true', | ||
secondaryDelivery: { | ||
...values.secondaryDelivery, | ||
}, | ||
}); | ||
} | ||
} | ||
if (e.target.name === 'hasTertiaryDelivery') { | ||
if (e.target.value === 'false') { | ||
setValues({ | ||
...values, | ||
hasTertiaryDelivery: 'false', | ||
tertiaryDelivery: { | ||
blankAddress, | ||
}, | ||
}); | ||
} else if (e.target.value === 'true') { | ||
setValues({ | ||
...values, | ||
hasTertiaryDelivery: 'true', | ||
tertiaryDelivery: { | ||
...values.tertiaryDelivery, | ||
}, | ||
}); | ||
} | ||
} | ||
}; | ||
|
||
const [isPreferredPickupDateAlertVisible, setIsPreferredPickupDateAlertVisible] = useState(false); | ||
const [isPreferredDeliveryDateAlertVisible, setIsPreferredDeliveryDateAlertVisible] = useState(false); | ||
|
@@ -384,6 +483,7 @@ class MtoShipmentForm extends Component { | |
title="Yes, I have a second pickup address" | ||
checked={hasSecondaryPickup === 'true'} | ||
disabled={!isPreceedingAddressComplete('true', values.pickup.address)} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
<Field | ||
as={Radio} | ||
|
@@ -395,6 +495,7 @@ class MtoShipmentForm extends Component { | |
title="No, I do not have a second pickup address" | ||
checked={hasSecondaryPickup !== 'true'} | ||
disabled={!isPreceedingAddressComplete('true', values.pickup.address)} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
</div> | ||
</FormGroup> | ||
|
@@ -426,6 +527,7 @@ class MtoShipmentForm extends Component { | |
values.secondaryPickup.address, | ||
) | ||
} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
<Field | ||
as={Radio} | ||
|
@@ -442,6 +544,7 @@ class MtoShipmentForm extends Component { | |
values.secondaryPickup.address, | ||
) | ||
} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
</div> | ||
</FormGroup> | ||
|
@@ -514,6 +617,7 @@ class MtoShipmentForm extends Component { | |
value="true" | ||
title="Yes, I know my delivery address" | ||
checked={hasDeliveryAddress === 'true'} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
<Field | ||
as={Radio} | ||
|
@@ -523,6 +627,7 @@ class MtoShipmentForm extends Component { | |
value="false" | ||
title="No, I do not know my delivery address" | ||
checked={hasDeliveryAddress === 'false'} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
</div> | ||
</FormGroup> | ||
|
@@ -553,6 +658,7 @@ class MtoShipmentForm extends Component { | |
title="Yes, I have a second delivery address" | ||
checked={hasSecondaryDelivery === 'true'} | ||
disabled={!isPreceedingAddressComplete('true', values.delivery.address)} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
<Field | ||
as={Radio} | ||
|
@@ -564,6 +670,7 @@ class MtoShipmentForm extends Component { | |
title="No, I do not have a second delivery address" | ||
checked={hasSecondaryDelivery === 'false'} | ||
disabled={!isPreceedingAddressComplete('true', values.delivery.address)} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
</div> | ||
</FormGroup> | ||
|
@@ -595,6 +702,7 @@ class MtoShipmentForm extends Component { | |
values.secondaryDelivery.address, | ||
) | ||
} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
<Field | ||
as={Radio} | ||
|
@@ -611,6 +719,7 @@ class MtoShipmentForm extends Component { | |
values.secondaryDelivery.address, | ||
) | ||
} | ||
onChange={handleAddressToggleChange} | ||
/> | ||
</div> | ||
</FormGroup> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the green light from @deandreJones on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is not on in prod, then it should not be on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm....we've had other flags that were turned on right away from creation. I see Boat, Mobile Home, Safety, Queue management, Bulk assignment all as True and none of those are on in prod. I just felt like we had this FF long enough to know any true issues, and I find myself having to change this one constantly lately. Not sure what the rule is but will check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well looks like those changes have been pushed under our noses. I'm just telling you what @deandreJones has said in the past
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file should reflect the current state of prod
so that when a dev starts work- they are working with the current state that is prod
you always have the option to use a .envrc.local file to override the values here