Files
homebox_lens/tasks/work_order_item_edit_screen.xml

98 lines
5.0 KiB
XML

<![CDATA[
<WORK_ORDER>
<META>
<VERSION>1.0</VERSION>
<CREATED_AT>{timestamp}</CREATED_AT>
<TITLE>[ARCHITECT -> DEV] Refactor Item Edit Screen</TITLE>
<DESCRIPTION>
This work order instructs the developer agent to refactor the Item Edit screen to include all available API fields and implement a user-friendly, grouped layout.
</DESCRIPTION>
<ASSIGNED_TO>agent-developer</ASSIGNED_TO>
<LABELS>type::refactoring,feature::item-edit,status::pending</LABELS>
</META>
<SPECIFICATION>
<GOAL>
The primary goal is to refactor the `ItemEditScreen` to include all available fields from the Homebox API for creating and updating items, and to present them in a user-friendly manner.
</GOAL>
<CONTEXT>
<FILE_LIST>
<FILE path="domain/src/main/java/com/homebox/lens/domain/model/Item.kt" />
<FILE path="data/src/main/java/com/homebox/lens/data/db/entity/ItemEntity.kt" />
<FILE path="data/src/main/java/com/homebox/lens/data/api/dto/ItemCreateDto.kt" />
<FILE path="data/src/main/java/com/homebox/lens/data/api/dto/ItemUpdateDto.kt" />
<FILE path="data/src/main/java/com/homebox/lens/data/api/dto/ItemOutDto.kt" />
<FILE path="data/src/main/java/com/homebox/lens/data/db/entity/Mapper.kt" />
<FILE path="app/src/main/java/com/homebox/lens/ui/screen/itemedit/ItemEditViewModel.kt" />
<FILE path="app/src/main/java/com/homebox/lens/ui/screen/itemedit/ItemEditScreen.kt" />
</FILE_LIST>
</CONTEXT>
</SPECIFICATION>
<EXECUTION_PLAN>
<STEP id="1" name="Update Domain Model">
<ACTION>Modify `domain/src/main/java/com/homebox/lens/domain/model/Item.kt`.</ACTION>
<DETAILS>
- Add the following fields to the `Item` data class:
- `archived: Boolean`
- `assetId: String?`
- `fields: List<CustomField>`
- `insured: Boolean`
- `lifetimeWarranty: Boolean`
- `manufacturer: String?`
- `modelNumber: String?`
- `notes: String?`
- `parentId: String?`
- `purchaseFrom: String?`
- `purchaseTime: String?`
- `serialNumber: String?`
- `soldNotes: String?`
- `soldPrice: Double?`
- `soldTime: String?`
- `soldTo: String?`
- `syncChildItemsLocations: Boolean`
- `warrantyDetails: String?`
- `warrantyExpires: String?`
- Rename the existing `value: BigDecimal?` field to `purchasePrice: Double?`.
</DETAILS>
</STEP>
<STEP id="2" name="Update Data Layer">
<ACTION>Update database entity, DTOs, and mappers.</ACTION>
<DETAILS>
- Modify `data/src/main/java/com/homebox/lens/data/db/entity/ItemEntity.kt` to reflect the new `Item` model.
- Ensure `ItemCreateDto`, `ItemUpdateDto`, and `ItemOutDto` contain all necessary fields according to the API spec.
- Update the mapping functions in `data/src/main/java/com/homebox/lens/data/db/entity/Mapper.kt` to handle all new fields correctly across all layers.
</DETAILS>
</STEP>
<STEP id="3" name="Update ViewModel">
<ACTION>Modify `app/src/main/java/com/homebox/lens/ui/screen/itemedit/ItemEditViewModel.kt`.</ACTION>
<DETAILS>
- Update `loadItem` and `saveItem` to handle the state for all new fields.
- Add public functions to update the state for each new field (e.g., `updateManufacturer(String)`, `toggleInsured(Boolean)`).
</DETAILS>
</STEP>
<STEP id="4" name="Implement UI">
<ACTION>Refactor `app/src/main/java/com/homebox/lens/ui/screen/itemedit/ItemEditScreen.kt`.</ACTION>
<DETAILS>
- Implement a user-friendly layout using tabs or expandable cards for the following groups: General, Purchase, Warranty, Identification, Status & Notes.
- Use appropriate controls for each field type (e.g., `Switch` for booleans, Date Picker for dates).
- Connect all UI controls to the ViewModel.
- Implement basic input validation.
</DETAILS>
</STEP>
</EXECUTION_PLAN>
<VERIFICATION>
<CHECK>The application compiles successfully.</CHECK>
<CHECK>The Item Edit screen displays all new fields, grouped logically.</CHECK>
<CHECK>Creating a new item with all fields populated works correctly.</CHECK>
<CHECK>Editing an existing item and modifying the new fields works correctly.</CHECK>
<CHECK>Data is persisted correctly and is visible in the Item Details screen after saving.</CHECK>
</VERIFICATION>
</WORK_ORDER>
]]>