Skip to content

Donor Lookup Feature -- Edit Donation Functionality #233

@jayrevolinskyjr

Description

@jayrevolinskyjr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    UrgentNeed everyone's attentionfeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions