Skip to content

Tags - physical and historical tags #404

Description

@NathanWEdwards

The app should retain historical tag numbers and support additional tag numbers for physical labels, etc.

The app currently stores and reads one tag number per donation item:

  • Donation has tagNumber: string | null | undefined, assigns it in the constructor, and exposes getTagNumber(). (main)
  • DonationDetail has tagNumber and a separate tagNumberForItemDelivered, but both are still single strings. (main)
  • InventoryItem also models tagNumber as a single string and exposes it through getTagNumber(). (main)
  • Firestore converters persist and hydrate only tagNumber; they do not normalize old/new multi-tag shapes. (main)
  • Admin edit UI only exposes one “Tag Number” field and has a one-click “Generate New Tag Number” behavior. (main)

Introduce a multi-tag model that preserves tagNumber as a generated primary tag. For example:

tagNumber?: string | null;          // legacy + generated primary tag
tagNumbers?: string[];              // all referenced tags, normalized
labelTagNumber?: string | null;     // secondary tag used for physical labeling

Keep existing documents readable without migration while allowing new documents to store multiple references.

tagNumbers = tagNumbers ?? (tagNumber ? [tagNumber] : []);
labelTagNumber = labelTagNumber ?? tagNumber ?? null;

User stories

Admin intake / acceptance
As an admin reviewing a donation, I want the item to receive the normal generated tag number and optionally record a secondary label tag, so labeling can match the physical label while preserving the digital one.

Admin edit / correction
As an admin editing a donation, I want to add, remove, or correct multiple tag numbers and choose which tag is used for labeling, so data can be fixed without overwriting historical tag references.

Inventory lookup
As an aid worker or admin browsing inventory, I want search to match any tag number attached to the item, including the secondary label tag, so scanning or typing either number finds the correct item.

Donation details / audit trail
As an admin viewing a donation, I want to see all tag numbers and clearly identify the label tag, so I can reconcile physical labels, historical references, and current app records.

Lifecycle reporting
As an admin exporting a lifecycle report, I want the report to include all tag numbers and the label tag, so external audits and records stay consistent.

Legacy document support
As any app user, I want older donations created before this change to continue loading, searching, editing, and reporting normally, so this feature does not break existing inventory or donation history.

Open questions

  • Can digital tags be set as physical tags for labeling?
  • Should physical tags be autogenerated?
  • Should "No tag" display when a physical label is not present?

Requirements criteria

Data model

  • Donation-like models must support multiple tag numbers.
    Donation, and InventoryItem should include tagNumbers?: string[] and labelTagNumber?: string | null
  • Existing tagNumber should remain readable and writable.
    • If a document only has tagNumber, the app should normalize it into tagNumbers: [tagNumber]
    • If a document lacks labelTagNumber, use the existing tagNumber as the default label tag
  • Generated tag behavior should remain stable
  • With this feature, generated tags should be appended into tagNumbers and/or stored as primary tagNumber, not replaced by a secondary label tag unless explicitly intended

Admin UI

  • Edit Donation must allow multiple tag values
  • Donation Details must display all tags
  • “Label tag” should be displayed prominently and “Other tag numbers” separately
  • Resetting a donation to approval queue must define tag behavior

Inventory and ordering

  • Inventory search must match every tag
    • Search should check tagNumber, tagNumbers, and labelTagNumber
  • Inventory cards/details must show label tag
  • Cards should show the label tag; details should show all tags

Reports

  • Lifecycle report must export all tags
  • Current report has one Tag Number column and uses donation.tagNumber for filename fallback
  • Add columns such as "Primary Tag Number," "Label Tag Number", and "All Tag Numbers"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions