Skip to content

[HOLD for payment 2024-07-10] [#Wave-Control: Add NetSuite] Settings Configuration in NewDot: Top-Level Subsidiary Selector #43435

Closed

Description

@yuwenmemon

Tracking Issue: https://github.com/Expensify/Expensify/issues/377671

Design Doc Section: https://docs.google.com/document/d/1WubNv_VAv78IxG4FKsi9aS0pWESfWvUYbqBAAy5b4bc/edit#heading=h.ursdzd4yhqi0


(High-Level Section)

Route

  • Route: /settings/workspaces/{policyID}/accounting/netsuite/subsidiary
  • PageComponent: NetSuiteSubsidiarySelector
  • Calls UpdateNetSuiteSubsidiary
    • subsidiaryName: name of the selected subsidiary from options.data.subsidiaryList array.
    • The pendingAction for the OfflineWithFeedback component will be policy.pendingFields.subsidiary

AD_4nXcY-wNB2ht40Cb61Cn42fRiPYRnM-dx6O8_P5Qvr00KKpFEnPQ2My0nMzymympXv3tKR1IXeS0G8H6X9hhW1pIR6KNWXBvtpe75f-DI_gg2aSVlYy-58GY2

We’ll have a NetSuiteSubsidiarySelectorPage, which will populate the list of subsidiaries from the data.subsidiaryList. The sample data shows the list of subsidiaries here.

The basic code for the page will look as follows:

function NetSuiteNetSuiteSubsidiarySelectorPage({policy}: WithPolicyConnectionsProps) {
    const policyID = policy?.id ?? '';

    const { subsidiary } = policy?.connections?.netsuite?.config ?? {};  
    const subsidiaryOptions = useMemo<SelectorType[]>(() => {
        const subsidiaryList = policy?.connections?.netsuite?.options?.data.subsidiaryList ?? {} ?? [];
        const isMatchFound = subsidiaryList?.some(({subsidiaryObj}) => subsidiaryObj === subsidiary); // toLowerCase() ?

        return (subsidiaryList ?? []).map(({id, name}, index) => ({
            value: name,
            text: name,
            keyForList: id,
            isSelected: isMatchFound ? subsidiary === id : index === 0,
        }));
    });

    const listHeaderComponent = useMemo( // Move this to another file as a standalone component.
        () => (
            <View style={[styles.pb2, styles.ph5]}>
                <Text style={[styles.pb5, styles.textNormal]}>{translate('workspace.netsuite.subsidiary.description')}</Text>
            </View>
        ),
        [translate, styles.pb2, styles.ph5, styles.pb5, styles.textNormal],
    );

    const initiallyFocusedOptionKey = useMemo(() => subsidiaryList?.find((subsidiary) => subsidiary.isSelected)?.keyForList, [subsidiaryOptions]);

    const updateSubsidiary = useCallback(
        ({value}: SelectorType) => {
            Connections.updateNetSuiteSubsidiary(policyID, CONST.POLICY.CONNECTIONS.NAME.NET_SUITE, CONST.NET_SUITE_CONFIG, {
                subsidiary: value,
                subsidiaryID: //
            });
            Navigation.goBack(ROUTES.POLICY_ACCOUNTING.getRoute(policyID));
        },
        [policyID],
    );

    return (
        <SelectionScreen
            policyID={policyID}
            accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
            featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
            displayName={NetSuiteNetSuiteSubsidiarySelectorPage.displayName}
            sections={[{data: subsidiaryOptions}]}
            listItem={RadioListItem}
            onSelectRow={updateSubsidiary}
            initiallyFocusedOptionKey={initiallyFocusedOptionKey}
            headerContent={listHeaderComponent}
            onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING.getRoute(policyID))}
            title="workspace.netsuite.subsidiary.title"
        />
    );
}

NetSuiteNetSuiteSubsidiarySelectorPage.displayName = 'NetSuiteNetSuiteSubsidiarySelectorPage';

export default withPolicyConnections(NetSuiteNetSuiteSubsidiarySelectorPage);
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d62f33ad0e1e9fe6
  • Upwork Job ID: 1800281430610989476
  • Last Price Increase: 2024-06-10
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @JmillsExpensify

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    NewFeatureSomething to build that is a new item.
    on Jun 10, 2024
  2. melvin-bot commented on Jun 10, 2024

    @melvin-bot
  3. changed the title [-][#Wave-Control: Add NetSuite] Settings Configuration in NewDot: Top-Level Subsidiary Selector[/-] [+][$250] [#Wave-Control: Add NetSuite] Settings Configuration in NewDot: Top-Level Subsidiary Selector[/+] on Jun 10, 2024
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 10, 2024
  5. melvin-bot commented on Jun 10, 2024

    @melvin-bot

    Triggered auto assignment to @JmillsExpensify (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

  6. melvin-bot commented on Jun 10, 2024

    @melvin-bot

    Current assignee @mananjadhav is eligible for the External assigner, not assigning anyone new.

  7. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 10, 2024
  8. self-assigned this
    on Jun 10, 2024
  9. 24 remaining items

  10. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jun 30, 2024
  11. changed the title [-][#Wave-Control: Add NetSuite] Settings Configuration in NewDot: Top-Level Subsidiary Selector[/-] [+][HOLD for payment 2024-07-10] [#Wave-Control: Add NetSuite] Settings Configuration in NewDot: Top-Level Subsidiary Selector[/+] on Jul 3, 2024
  12. melvin-bot commented on Jul 3, 2024

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  13. melvin-bot commented on Jul 3, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.3-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2024-07-10. 🎊

    For reference, here are some details about the assignees on this issue:

    • @mananjadhav requires payment through NewDot Manual Requests
  14. melvin-bot commented on Jul 3, 2024

    @melvin-bot

    BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@mananjadhav] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
    • [@JmillsExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.
  15. mananjadhav commented on Jul 10, 2024

    @mananjadhav
    Collaborator

    Payout for this will be centrally paid, no further action here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionExternalAdded to denote the issue can be worked on by a contributorNewFeatureSomething to build that is a new item.WeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions