Files
homebox_lens/tasks/work_order_item_creation_update.md
2025-09-26 10:30:59 +03:00

3.3 KiB

Work Order: Update Item Creation and Edit to Full API Compliance

METADATA

  • FEATURE_NAME: Item Creation and Edit Screen Enhancement
  • REQUESTED_BY: user
  • TIMESTAMP: 2025-09-25T07:15:00Z

OVERVIEW

This work order outlines the steps required to update the Item creation and editing functionality in the Homebox Lens mobile application to fully comply with the Homebox API specification. This includes enhancing the UI to capture all required fields and updating the ViewModel to correctly map these fields to the domain models.

REQUIREMENTS GAPS

Current implementation in app/src/main/java/com/homebox/lens/ui/screen/itemedit/ItemEditScreen.kt and app/src/main/java/com/homebox/lens/ui/screen/itemedit/ItemEditViewModel.kt only handles a subset of the fields defined in tech_spec/api_summary.md.

Missing UI fields for Item:

  • assetId
  • notes
  • serialNumber
  • value
  • purchasePrice
  • purchaseDate
  • warrantyUntil
  • parentId

Missing ViewModel mappings:

  • All the above fields are hardcoded to null in ItemCreate and ItemUpdate objects.

STEPS

STEP 1: Enhance UI Layer (ItemEditScreen.kt)

Description

Update the ItemEditScreen composable to include input fields for all missing item properties.

Action

  • Add TextField or appropriate input components for assetId, notes, serialNumber, value, purchasePrice.
  • Add DatePicker components for purchaseDate and warrantyUntil.
  • Add TextField for parentId.
  • Implement a multi-select component for labelIds to allow selecting multiple labels from a list.
  • Ensure locationId selection is properly implemented (verify existing functionality).

STEP 2: Update ViewModel Layer (ItemEditViewModel.kt)

Description

Update ItemEditViewModel to handle the new UI fields and correctly map them to domain models.

Action

  • Update ItemEditUiState sealed interface or data class to include all new fields from STEP 1.
  • Add corresponding handler functions like onAssetIdChanged, onNotesChanged, etc., to update the UI state.
  • Modify createItem and updateItem functions to properly map all fields from uiState to ItemCreate and ItemUpdate domain models instead of hardcoding them to null.

STEP 3: Integrate QR Scanner with Item Creation

Description

Modify the QR scanner feature to automatically populate the assetId field when navigating to the item creation screen.

Action

  • Update ScanScreen to navigate to ItemEditScreen with the scanned barcode as pre-filled assetId.
  • Add navigation logic in ScanViewModel to handle the transition.
  • Ensure ItemEditScreen can receive and use this pre-filled value.

STEP 4: Update Project Manifest

Description

Update tech_spec/PROJECT_MANIFEST.xml to reflect the changes in item creation/editing functionality.

Action

  • Add a new <FEATURE> entry for "Item Creation and Edit Enhancement" or update the existing one if it already covers item creation.
  • Include all relevant components, classes, and properties in the manifest.

STEP 5: Create Engineer Task

Description

Create a task for the engineer to implement the outlined changes.

Action

  • Save this work order to a file in the tasks directory.
  • Switch to Engineer and provide this work order as a task.