keanacobarde / FEDuo

0 stars 0 forks source link

COMPONENT - Schedule Details #9

Open keanacobarde opened 2 months ago

keanacobarde commented 2 months ago

User Story

I, as the user, should be able to reach a schedule details page which will allow me to see all the classes associated with a schedule.

Acceptance Criteria

image WHEN I select on the Schedule card, I should be able to

Dependencies

3, #4 - Authentication must be complete in order for the user to reach this portion of the application, and the home page must also be complete as well.

Dev Notes

function ItemCard({ itemObj, context, orderId, onUpdate, }) { const router = useRouter();

const deleteThisItem = () => { if (window.confirm(Delete ${itemObj.name}?)) { const payload = { orderId, orderItemId: itemObj.orderItemId, }; deleteItemFromOrder(payload).then(() => onUpdate()); } };

const addItemToThisOrder = () => { const payload = { orderId, itemId: itemObj.id, }; addItemToOrder(payload).then(() => router.push(/orders/${orderId})); };

return (

{itemObj.name} ${itemObj.price} {context !== 'orderdetails' ? ( ) : ( )}

); }

ItemCard.propTypes = { itemObj: PropTypes.shape({ id: PropTypes.number.isRequired, orderItemId: PropTypes.number, name: PropTypes.string.isRequired, price: PropTypes.number.isRequired, }).isRequired, context: PropTypes.string.isRequired, orderId: PropTypes.number.isRequired, onUpdate: PropTypes.func, };

ItemCard.defaultProps = { onUpdate: () => {}, };

export default ItemCard;