Skip to content

Commit

Permalink
Merge pull request #13741 from transcom/B-20490-INT-part2
Browse files Browse the repository at this point in the history
B 20490 int part2
  • Loading branch information
pambecker authored Sep 20, 2024
2 parents 8c70e18 + ca11a40 commit d92c3d0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,11 @@ import { getMtoShipmentLabel } from 'utils/formatMtoShipment';

const formatChangedValues = (historyRecord) => {
const { changedValues } = historyRecord;
const { diversion, usesExternalVendor } = historyRecord.changedValues;

const newChangedValues = {
...changedValues,
...getMtoShipmentLabel(historyRecord),
};

if (diversion) {
newChangedValues.diversion = 'Yes';
} else {
newChangedValues.diversion = 'No';
}
if (usesExternalVendor) {
newChangedValues.uses_external_vendor = 'Yes';
} else {
newChangedValues.uses_external_vendor = 'No';
}
if (historyRecord.context[0].shipment_type === 'PPM') {
newChangedValues.status = null; // Status will always be draft when shipment is created, not useful information.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,10 @@ import o from 'constants/MoveHistory/UIDisplay/Operations';
import t from 'constants/MoveHistory/Database/Tables';
import LabeledDetails from 'pages/Office/MoveHistory/LabeledDetails';

const formatChangedValues = (historyRecord) => {
const { changedValues } = historyRecord;
const { emailIsPreferred, phoneIsPreferred } = changedValues;
const newChangedValues = { ...changedValues };
if (emailIsPreferred) {
newChangedValues.email_is_preferred = 'Yes';
} else {
newChangedValues.email_is_preferred = 'No';
}
if (phoneIsPreferred) {
newChangedValues.phone_is_preferred = 'Yes';
} else {
newChangedValues.phone_is_preferred = 'No';
}
return { ...historyRecord, changedValues: newChangedValues };
};

export default {
action: a.UPDATE,
eventName: o.updateCustomer,
tableName: t.service_members,
getEventNameDisplay: () => 'Updated profile',
getDetails: (historyRecord) => <LabeledDetails historyRecord={formatChangedValues(historyRecord)} />,
getDetails: (historyRecord) => <LabeledDetails historyRecord={historyRecord} />,
};

0 comments on commit d92c3d0

Please sign in to comment.