Skip to content

[Due for payment 2025-05-28] [Multi-tags] Admin - Downloading Tags #61758

Description

@yuwenmemon

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

Design Doc: https://docs.google.com/document/d/1_p8qZXVKG-s32i9GKqVjCLEcEREBUEgYcxk3KYHXMVg/edit?tab=t.0


From the Design Doc:

Admin: Downloading Tags

First, we will not hide the threeDotsMenuItems for multi-level tags, we need to set shouldShowThreeDotsButton={true} for all cases (currently we hide it when tags are multi-level).

  1. Call new downloadMultiLeveltagsCSV function for multi-level tags

We are not going to support download for Multi-Level Dependent Tags, we need to update the condition for showing the download CSV option along with that we need to create a new Util which will call ExportMultiLevelTagsCSV API endpoint for multi-level tags: \

// We hide the option to download tags in case of dependent tags
if (hasVisibleTags && !hasDependentTags) {
  menuItems.push({
    icon: Expensicons.Download,
    text: translate("spreadsheet.downloadCSV"),
    onSelected: () => {
      if (isOffline) {
        Modal.close(() => setIsOfflineModalVisible(true));
        return;
      }
      Modal.close(() => {
	// Here we will check if the policy has multilevel tags
	// And will call the appropriate API command
        if (policy?.isUsingMultiLevelTags) {
          Tag.downloadMultiLeveltagsCSV(policyID, () => {
            setIsDownloadFailureModalVisible(true);
          });
          return;
        }
        Tag.downloadTagsCSV(policyID, () => {
          setIsDownloadFailureModalVisible(true);
        });
      });
    },
  });
}
  1. Create new util to download multi-level independent tags

The downloadMultiLeveltagsCSV steps util will be similar to downloadTagsCSV only difference is we will call ExportMultiLevelTagsCSV endpoint in this case:
The Util downloadMultiLeveltagsCSV endpoint will be as follows: \

function downloadMultiLeveltagsCSV(
  policyID: string,
  onDownloadFailed: () => void
) {
  const finalParameters = enhanceParameters(
    WRITE_COMMANDS.EXPORT_MULTI_LEVEL_TAGS_CSV,
    {
      policyID,
    }
  );
  const fileName = "MultiLevelTags.csv";

  const formData = new FormData();
  Object.entries(finalParameters).forEach(([key, value]) => {
    formData.append(key, String(value));
  });

  fileDownload(
    ApiUtils.getCommandURL({
      command: WRITE_COMMANDS.EXPORT_MULTI_LEVEL_TAGS_CSV,
    }),
    fileName,
    "",
    false,
    formData,
    CONST.NETWORK.METHOD.POST,
    onDownloadFailed
  );
}

The API command EXPORT_MULTI_LEVEL_TAGS_CSV will be implemented according to the backend changes here.

We will rename the command ExportTagsCSV to ExportSingleLevelTagsCSV (More details here)

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021922164703131803558
  • Upwork Job ID: 1922164703131803558
  • Last Price Increase: 2025-05-13
  • Automatic offers:
    • allgandalf | Reviewer | 107454938
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @joekaufmanexpensify

Activity

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 productionDailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorNewFeatureSomething to build that is a new item.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions