> For the complete documentation index, see [llms.txt](https://docs.airdev.co/reviews-platform-template/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.airdev.co/reviews-platform-template/assets/reuseables/popup-add_edit_item.md).

# popup add\_edit\_item

Modal for adding or editing an item

## Popup Add Edit Item Reusable Overview

This is the popup used for adding or modifying an `Item` on the platform. Exists in the [menufocusgroup\_review reusable](/reviews-platform-template/assets/reuseables/menufocusgroup_review.md) and on the [owner's portal](/reviews-platform-template/assets/pages/owners-portal-page.md).

## Key Workflows

#### Button New Item is clicked

* Creates a new `Item` (and sets its `Review count` to **0**) if one does not exist already
* Triggers the `save_item` workflow

#### Button Add Image is clicked

* Creates an `Image` instance and adds it to the `Images` state of `popup add_edit_item`
* If the `Item` does not have a primary image - which should only be the case when creating a new item or if you’ve deleted every existing image - then the newly created `Image` will be marked as the primary image
* The new `Image(s)` are not saved to the `Item` until `Button New Item` is clicked

#### Group Make Primary Image is clicked

* Sets the `Image primary` state to that cell’s `Image`

#### Group Remove Image is clicked

* Deletes that cell’s `Image`

#### save\_item \[Custom workflow]

* Updates the `Item` with the inputted values from the form
* When saving the `Image main` and `Images` we refer to the `Image primary`  and `Image` states on `popup add_edit_item`
* Links the `Item` to the `Images`

## Key Elements

#### RepeatingGroup Images

* Contains the list of `Images` for the item
* Populated from the `Images` state on `popup add_edit_item`
