Skip to content
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

Draft
wants to merge 25 commits into
base: integrationTesting
Choose a base branch
from

Conversation

pambecker
Copy link
Contributor

Agility ticket

Summary

When the user has answered a question regarding an address field as "Yes" and has begun filling out address information, when they change their mind and click "No" the address information should be cleared.

How to test

  1. Login as a Milmove user, create a new HHG shipment or edit an existing one.
  2. Click on the yes to 2nd Pickup Address, fill in all required fields.
  3. Click on yes to 3rd Pickup Address, fill in all required fields.
  4. Click on yes to 2nd Delivery address, fill in all required fields.
  5. Click on yes to 3rd Delivery address, fill in all required fields.
  6. Save.
  7. Go back into the above shipment and delete Address line 1 from 3rd pickup address.
  8. Verify that you get the Required message and that the Save button is disabled.
  9. Switch to No I do not have a 3nd pickup address, verify that Save is enabled again.
  10. Do this same approach for 2nd pickup (wipe out address line 1, switch to No), and for both 2nd and 3rd Delivery address.
  11. Do the same thing on a PPM shipment.
  12. Now login as an SC, go into a move and create or edit an HHG and PPM and do it all over again (steps 2-10).

@pambecker pambecker added G-Unit Scrum Team G INTEGRATION Slated for Integration Testing labels Mar 7, 2025
@pambecker pambecker self-assigned this Mar 7, 2025
@pambecker pambecker marked this pull request as ready for review March 7, 2025 04:12
@pambecker pambecker requested a review from a team as a code owner March 7, 2025 04:12
@pambecker pambecker changed the title B 22493 int B 22493 int - clear addr fields when toggle to No Mar 7, 2025
@@ -154,7 +154,7 @@ export FEATURE_FLAG_SAFETY_MOVE=true
export FEATURE_FLAG_MANAGE_SUPPORTING_DOCS=true

# Feature flags to enable third address
export FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
export FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=true
Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor Author

@pambecker pambecker Mar 7, 2025

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

Copy link
Contributor

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

Copy link
Contributor

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

@@ -252,6 +253,104 @@ class MtoShipmentForm extends Component {
});
}
};
const handleAddressToggleChange = (e) => {
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you could refactor to something like this

const updateAddressToggle = (fieldName, value, fieldKey, blankValue) => {
  setValues((prevValues) => ({
    ...prevValues,
    [fieldName]: value,
    [fieldKey]: value === 'false' ? blankValue : { ...prevValues[fieldKey] },
  }));
};

const handleAddressToggleChange = (e) => {
  const { name, value } = e.target;

  const fieldMap = {
    hasSecondaryPickup: { key: 'secondaryPickup', blankValue: { blankAddress } },
    hasTertiaryPickup: { key: 'tertiaryPickup', blankValue: { blankAddress } },
    hasDeliveryAddress: { key: 'delivery', blankValue: { ...values.delivery, address: newDutyLocationAddress } },
    hasSecondaryDelivery: { key: 'secondaryDelivery', blankValue: { blankAddress } },
    hasTertiaryDelivery: { key: 'tertiaryDelivery', blankValue: { blankAddress } },
  };

  if (fieldMap[name]) {
    updateAddressToggle(name, value, fieldMap[name].key, fieldMap[name].blankValue);
  }
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@pambecker pambecker marked this pull request as draft March 7, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
G-Unit Scrum Team G INTEGRATION Slated for Integration Testing
Development

Successfully merging this pull request may close these issues.

5 participants