Skip to content

[Due for payment 2025-06-16] [Due for payment 2025-06-13] [Multi-tags] Admin - Editing Tag Levels #61757

Closed

Description

@yuwenmemon

Tracking GH: https://github.com/Expensify/Expensify/issues/418655

Design Doc: https://docs.google.com/document/d/1_p8qZXVKG-s32i9GKqVjCLEcEREBUEgYcxk3KYHXMVg/edit?usp=sharing


Admin: Editing Tag Levels

  1. Rearrange toggle position for multi-level tags

We already Disallow "Required" for a tag level when no tags in the level are enabled on NewDot, so we don’t need to make changes here, according to design mocks, we need to move the toggle below the custom tag name field so to update that, we should edit WorkspaceViewTagsPage and rearrange the components as follows:

<OfflineWithFeedback
  ...props
>
  <MenuItemWithTopDescription
    ...props
    description={translate(`workspace.tags.customTagName`)}
  />
</OfflineWithFeedback>;

{
  !hasDependentTags && (
    <View style={[styles.pv4, styles.ph5]}>
      <ToggleSettingOptionRow
        ...props      />
    </View>
  );
}

Note that we hide the Toggle for dependent tags as we can only mark Independent multi-level tags as not required: \

Image
  1. Add functionality to mark tags as Required/Not Required

On WorkspaceTagsPage, we want to give the ability to mark independent tags as not required, to do that:

  1. Update condition to show selector component

Update condition canSelectMultiple to hide the selector options only when the tags are dependent:


const hasDependentTags = useMemo(() => PolicyUtils.hasDependentTags(policy, policyTags), [policy, policyTags]);

const canSelectMultiple = !hasDependentTags && (shouldUseNarrowLayout ? selectionMode?.isEnabled : true);
  1. Hide existing delete and enable/disable options for multi-level tags

We need to hide the Delete and Disable tag options for multi-level tags. To do that we should update the options const. We should not push both these buttons if we have multi-level tags here, here and here:

if (!hasAccountingConnections && !isUsingMultiLevelTags) {
  options.push({
    text: translate(
      selectedTagsArray.length === 1
        ? "workspace.tags.deleteTag"
        : "workspace.tags.deleteTags"
    ),
    ...props
  });
}

if (enabledTagCount > 0 && !isUsingMultiLevelTags) {
  options.push({
    text: translate(
      enabledTagCount === 1
        ? "workspace.tags.disableTag"
        : "workspace.tags.disableTags"
    ),
    ...props
  });
}

if (disabledTagCount > 0 && !isUsingMultiLevelTags) {
  options.push({
    text: translate(
      disabledTagCount === 1
        ? "workspace.tags.enableTag"
        : "workspace.tags.enableTags"
    ),
    value: CONST.POLICY.BULK_ACTION_TYPES.ENABLE,
    ...props,
  });
}

  1. Introduce new options Require/Don’t Require for multi-level tags

We need to introduce option to mark multi-level Independent tags as required/not required for that first we need to update the en.ts and es.ts files to include new params, the text would be

1. “Require Tag/Tags” with `Expensicons.Document `icon.
2. “Don’t require”  with `Expensicons.DocumentSlash `icon.

SPANISH TRANSLATION

English Spanish
Require Tag Etiqueta obligatoria
Require Tags Etiquetas obligatorias
Don’t require No requerir.

Then we have to count the required and not required selected Independent tags:

let requiredTagCount = 0;
const tagListIndexesToMarkNotRequired: number[] = [];

let notRequiredTagCount = 0;
const tagListIndexesToMarkRequired: number[] = [];


for (const tagName of selectedTagsArray) {
  if (tagListKeyedByName[tagName]?.required) {
    requiredTagCount++;
    tagListIndexesToMarkNotRequired.push(
      tagListKeyedByName[tagName]?.orderWeight ?? 0
    );
  } else {
    notRequiredTagCount++;
    tagListIndexesToMarkRequired.push(
      tagListKeyedByName[tagName]?.orderWeight ?? 0
    );
  }
The above implementation is done similar to the way we do when we calculate the enable/disable  tags [count](https://github.com/Expensify/App/blob/0288c7ab0cb779387b642c339bcf4513678e9073/src/pages/workspace/tags/WorkspaceTagsPage.tsx#L234).
  1. Introduce new util to mark independent multi-level tags as required/not required

We will create new setPolicyTagListsRequired Util which calls the SetPolicyTagListsRequired API command:

\

function setPolicyTagListsRequired(
  policyID: string,
  tagListIndexes: number[],
  requireTagList: boolean
);

We will create 3 Onyx data: Optimistic, Success and Failure. And send it to the API SetPolicyTagListsRequired along with the parameters.

  1. Then we have to add the required options to the dropdown along with the action to perform: \
if (requiredTagCount > 0) {
  options.push({
    icon: Expensicons.DocumentSlash,
    text: translate("workspace.tags.markNotRequired"),
    value: CONST.POLICY.BULK_ACTION_TYPES.DISABLE,
    onSelected: () => {
      setSelectedTags({});
      Tag.setPolicyTagListsRequired(policyID, tagListIndexesToMarkNotRequired, false);
    },
  });
}

if (notRequiredTagCount > 0) {
  options.push({
    icon: Expensicons.Document,
    text: translate("workspace.tags.markRequired"),
    value: CONST.POLICY.BULK_ACTION_TYPES.ENABLE,
    onSelected: () => {
      setSelectedTags({});
      Tag.setPolicyTagListsRequired(policyID, tagListIndexesToMarkRequired, true);
    },
  });
}
Issue OwnerCurrent Issue Owner: @abekkala

Activity

  1. added
    Daily
    NewFeature
    on May 9, 2025
  2. melvin-bot commented on May 9, 2025

    @melvin-bot

    Triggered auto assignment to @abekkala (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.

  3. added
    Weekly
    and removed
    Daily
    on May 9, 2025
  4. allgandalf commented on May 12, 2025

    @allgandalf
    Contributor

    Will start to work on it this week

  5. abekkala commented on May 16, 2025

    @abekkala
    Contributor

    @allgandalf can you link the PR here please?

  6. allgandalf commented on May 19, 2025

    @allgandalf
    Contributor

    will link one by EOD, combining this issue with other issue for importing tags, hence the delay! thanks for the patience

  7. added
    Reviewing
    and removed
    Weekly
    on May 27, 2025
  8. 19 remaining items

  9. melvin-bot commented on Jun 9, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.62-0 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 2025-06-16. 🎊

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

    • @allgandalf requires payment (Needs manual offer from BZ)
  10. melvin-bot commented on Jun 9, 2025

    @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:

    • [@allgandalf] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
    • [@abekkala] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.
  11. akinwale commented on Jun 13, 2025

    @akinwale
    Contributor

    @allgandalf can you complete the checklist? did this one not require a regression test?

    @abekkala This is part of an ongoing project / new feature, so the checklist isn't required here. I would need to be assigned as C+ since I reviewed the PR. Thanks.

  12. added
    Daily
    and removed
    Weekly
    on Jun 13, 2025
  13. melvin-bot commented on Jun 16, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@abekkala)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  14. akinwale commented on Jun 16, 2025

    @akinwale
    Contributor

    @abekkala Bump for payment summary. Thanks.

  15. abekkala commented on Jun 16, 2025

    @abekkala
    Contributor

    PAYMENT SUMMARY FOR JUN 16

    • Fix: @allgandalf - are you getting paid for this project elsewhere? I noticed you commented above to close this issue out.
    • PR Review: @akinwale [$250] payment via NewDot
  16. allgandalf commented on Jun 17, 2025

    @allgandalf
    Contributor

    are you getting paid for this project elsewhere?

    Yes @abekkala

  17. JmillsExpensify commented on Jun 26, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @akinwale

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

Metadata

Metadata

Labels

Awaiting PaymentDailyEngineeringNewFeature

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions