As a user, I should be able to add a new excursion. When I add a new excursion I will be selecting which crew members to take along, and selecting a destination.
AC
WHEN the user clicks on add new excursion button
THEN a modal will pop up with crew members and destinations
THEN the user will select crew members and a destination
THEN the user will click submit
AND the new excursion will be sent to firebase and will display on the DOM.
DevNotes
An axios post call function will be written in the excursionsData.js file which will take in an excursion object.
An event listener will be added that will display a modal.
The modal will read destinations and crew.
Selected destination will be input as the excursions destination ID.
Selected crew will be posted as individual excursionCrew objects to firebase using a forEach loop over selected crew members to create and post:
(in excurstionCrewData.js)
const addExcursionCrew = (excursionCrew) => axios.post(${baseUrl}/excursionCrew.json, excursionCrew);
A new object will be defined as a new excursion and pushed up as follows:
(in excursionData.js)
const addNewExcursion = (newExcursion) => axios.post(${baseUrl}/excursions.json, newExcursion);
This object only contains a destination id, a name, and a date.
Lastly, we will hide the modal, and reprint the excursions READ section.
User Story
As a user, I should be able to add a new excursion. When I add a new excursion I will be selecting which crew members to take along, and selecting a destination.
AC
WHEN the user clicks on add new excursion button THEN a modal will pop up with crew members and destinations THEN the user will select crew members and a destination THEN the user will click submit AND the new excursion will be sent to firebase and will display on the DOM.
DevNotes
const addExcursionCrew = (excursionCrew) => axios.post(${baseUrl}/excursionCrew.json, excursionCrew);
const addNewExcursion = (newExcursion) => axios.post(
${baseUrl}/excursions.json, newExcursion);
This object only contains a destination id, a name, and a date.