ChicoState / ChicoState/PantryNode

Donor Lookup Feature -- Edit Donation Functionality

Open
#233 0 comments 0 reactions 0 assignees View on GitHub
feature Urgent
Dominant language
TypeScript
Stars
3
Forks
34
PR merge metrics
No merged PRs in 30d

Description

## This is an issue spawned from #193
### More specifically, spawned from the original 'Edit Button' task.

- [ ] When a user hits the 'Edit' button on a given 'Donor View' page, the 'Edit' button will disappear from the corresponding row and be replaced by a '-' button, a '+' button, a 'Delete' button, and a 'Confirm/Cancel' button.
- [ ] Given that the row is assigned a specific index/key, pass the index/key that corresponds to the newly-edited column to the list/map used to populate 'Donor View' page.
- [ ] Retrieve the Date, Name, and Quantity returned from the object located within the list used to populate the 'Donor View' page.
- [ ] Store those values into a 'prototype' JSON that tracks the Date, Name, Quantity, and original index/key.
- [ ] When the user presses the '-' button reduce the quantity of the given item by one in the 'prototype' JSON.
- [ ] When the user presses the '+' button increase the quantity of the given item by one in the 'prototype' JSON.
- [ ] When the user presses the 'Delete' button, prompt the user that 'This will remove the item from the Database, are you sure?'
- If the user presses 'Yes' on the prompt:
- Issue a Sequelize DELETE request/route on the item based on the attributes found within the 'prototype' JSON.
- Re-populate the map/list used to display the 'Donor View' page.
- Dump the current 'prototype' JSON.
- If the user presses 'No' on the prompt, simply close the prompt window.
- [ ] If the 'Prototype' JSON is different from the Item Quantity and Availability,
- Then the 'Confirm/Cancel' button will display 'Confirm'
- If pressed as a 'Confirm' Button
- Issue a Sequelize UPDATE request/route on the donation based on the attributes found within the 'prototype' JSON.
- Revert to the original 'Edit' button state.
- Re-populate the 'Donor View' page with the appropriate backend call.
- [ ] If the 'Prototype' JSON is NOT different from the Item Quantity and Availability
- Then the 'Confirm/Cancel' button renders as a 'Cancel' button
- If pressed as the 'Cancel' button, the 'Donor View' page reverts to the 'Edit' button state.

#### Note: The Sequelize API endpoints will need to match up with the Item's Date, Name, and Quantity exactly in order to work properly.

The list above can be copy-pasted into tasks if necessary. 'Prototype' ER Diagram is WIP.

Original UML Diagram from #193 included for reference to 'Donor Lookup' and 'Donor View' pages.

![UpdatedDonorLookup](https://user-images.githubusercontent.com/98365370/235050788-8bc99136-2abf-4b20-83ea-7da7d1a4a8c8.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.