diff --git a/src/components/Dashboard/Dashboard.jsx b/src/components/Dashboard/Dashboard.jsx index 78f269f..c7def57 100644 --- a/src/components/Dashboard/Dashboard.jsx +++ b/src/components/Dashboard/Dashboard.jsx @@ -48,7 +48,7 @@ const Dashboard = (props) => { }; const resetQueueForm = () => { - setPhoneNumber('') + setPhoneNumber(''); return document.getElementById("phone-input-form").reset(); }; @@ -60,6 +60,9 @@ const Dashboard = (props) => { if (isOpen) { dashboard.setAttribute("style", "top: 3vh"); addbutton.innerHTML = "CLOSE"; + addbutton.addEventListener('click', function () { + resetQueueForm(); + }); addbutton.setAttribute("style", "background: #ff421f; color: white"); addbutton.removeEventListener("click", handleExpand); addbutton.addEventListener("click", handleCollapse); diff --git a/src/components/WaitList/WaitList.jsx b/src/components/WaitList/WaitList.jsx index 382474a..52782a0 100644 --- a/src/components/WaitList/WaitList.jsx +++ b/src/components/WaitList/WaitList.jsx @@ -2,14 +2,41 @@ import React from 'react'; import styles from './WaitList.module.scss' import clock from '../../utils/imgs/clock.png' import Reservation from '../Reservation'; +import { actionUpdateReservation } from '../../actions'; +import { connect } from "react-redux"; const WaitList = (props) => { let { retailerName, waitList, + holdList, handlePlusPartySize, } = props; + const clearReservations = () => { + let waitLength = waitList.length; + let holdLength = holdList.length; + + if (waitLength === 0 && holdLength === 0) { + return alert('No reservations to cancel.'); + } + if (waitLength !== 0) { + waitList.forEach((res) => { + let data = { queueStatus: 'cancelled' } + props.dispatchUpdateReservation(data, res.id); + }); + alert(`Wait list cleared ${waitLength} reservations.`) + }; + if (holdLength !== 0) { + holdList.forEach((res) => { + let data = { queueStatus: 'cancelled' } + props.dispatchUpdateReservation(data, res.id); + }) + alert(`Hold list cleared ${holdLength} reservations.`) + } + return + }; + return (