[NoQA] Feature: Travel Invoicing - Release 2.2: Toggle Behavior (Enable / Disable Travel Invoicing)#81458
Draft
ikevin127 wants to merge 3 commits intoExpensify:mainfrom
Draft
[NoQA] Feature: Travel Invoicing - Release 2.2: Toggle Behavior (Enable / Disable Travel Invoicing)#81458ikevin127 wants to merge 3 commits intoExpensify:mainfrom
ikevin127 wants to merge 3 commits intoExpensify:mainfrom
Conversation
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
UX Flow
Toggle ON (first‑time and subsequent)
WorkspaceTravelInvoicingSection.Toggle OFF (with pending‑balance guard + confirmation modal)
WorkspaceTravelInvoicingSectionchecks a derived flag such ashasOutstandingTravelBalance(policy):hasOutstandingTravelBalanceistrue:hasOutstandingTravelBalanceisfalse:ConfirmModalcomponent.Data & Onyx
getIsTravelInvoicingEnabled(policyID)fromONYXKEYS.COLLECTION.POLICY.private_expensifyCardSettingsforPROGRAM_TRAVEL_US, and/orPolicy.fetchPolicy(policyID)action) to propagate the newly enabled state into Onyx.shouldShowSummary = getIsTravelInvoicingEnabled(policyID) && hasTravelInvoicingSettlementAccount(policy)getIsTravelInvoicingEnabled(policyID)becomesfalse, soshouldShowSummarybecomes false and the summary hides automatically. We do not optimistically clearprivate_expensifyCardSettingsin the client.hasOutstandingTravelBalance(policyID)to determine whether the OFF flow is even allowed.Actions
New action function in
src/libs/actions/TravelInvoicing.ts:toggleTravelInvoicing({policyID, enabled}):ToggleTravelInvoicing.Policy.fetchPolicy(policyID)or relies on the backend to push the updated policy into Onyx.Components
WorkspaceTravelInvoicingSection:
onValueChangehandler, which:hasOutstandingTravelBalance(policy)before attempting to toggle OFF.toggleTravelInvoicing({policyID, enabled})when toggling ON or when toggling OFF is allowed.isSubmittingToggleto prevent double‑clicks while the request is in flight.isDisableConfirmModalVisibleto control rendering of the OFF confirmation modal.isDisableConfirmModalVisibleis true, passing:title={translate('travelInvoicing.disableModalTitle')}→ “Turn off Travel Invoicing?”prompt={translate('travelInvoicing.disableModalBody')}→ explanation text.confirmText={translate('travelInvoicing.disableModalConfirm')}→ “Turn off”.cancelText={translate('common.cancel')}.toggleTravelInvoicing({policyID, enabled: false})in the modal’s confirm handler, and only when there is no outstanding travel balance.Testing
Component tests for
WorkspaceTravelInvoicingSection:toggleTravelInvoicing({policyID, enabled: true})is called.hasOutstandingTravelBalance(policy)istrue, the toggle remains ON and a localized error/toast is shown;ConfirmModalis not rendered andtoggleTravelInvoicingis not called.hasOutstandingTravelBalance(policy)isfalse,ConfirmModalis rendered instead of calling the action immediately.toggleTravelInvoicing({policyID, enabled: false}).getIsTravelInvoicingEnabled(policyID)returnsfalseand the summary is no longer rendered.Fixed Issues
$ #78674
PROPOSAL:
Tests
TBD
Offline tests
TBD
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
TBR