As a user, I should be able to edit items on the crew information.
AC
WHEN the crew page loads
THEN each crew card should have an edit button
AND when i click that edit button a modal should pop up
AND the modal should be populated with the info from that crew member
AND when I hit the save button it updates firebase
Dev Notes
in index.html
add in boostramp modal
change the id from exampleModal to crewEditModal
in crew component
Add an edit button - use fontawesome pencil, give it a class of edit-crew
Make sure there is a crew id on the card (should have already added this with delete)
in the-table component
add an event listener to the clickEvents function on .edit-crew that calls editCrewEvent on click
editCrewEvent should open the modal - $('#crewEditModal').modal('show')
v2 in the-lounge component
modify editCrewEvent to call crewData.getSingleCrew (pass in the crewId from the closest card)
crewData.getSingleCrew accept a foodId and should do axios.get to crew/${crewId}.json
on failure of crewData.getSingleCrew promise console.error('modals suck')
on success of crewData.getSingleCrew promise target every input on the modal and set the value to what comes back:
`$('#edit-crew-name').value(crew.name);
^^ food is the the thing that comes back in .then
add an event listener to the edit button on the modal - this should call updateCrewEvent
updateCrewEvent should build up the crew object (grabs values from each input)
to get the uid firebase.auth().currentUser.uid
crewData.updateCrew and passes in the new crew object AND the crewId
crewData.updateCrew takes in updatedCrew and foodId, and does axios.put to crew.json
on failure of crewData.updateCrew promise console.error('not able to update')
on success of crewData.updateCrew close the modal AND recall printCrew
User Story
As a user, I should be able to edit items on the crew information.
AC
WHEN the crew page loads THEN each crew card should have an edit button AND when i click that edit button a modal should pop up AND the modal should be populated with the info from that crew member AND when I hit the save button it updates firebase
Dev Notes
in index.html
exampleModal
tocrewEditModal
in crew component
in the-table component
clickEvents
function on .edit-crew that calls editCrewEvent on click$('#crewEditModal').modal('show')
v2 in the-lounge component
editCrewEvent
to callcrewData.getSingleCrew
(pass in the crewId from the closest card)crewData.getSingleCrew
accept a foodId and should doaxios.get
tocrew/${crewId}.json
crewData.getSingleCrew
promiseconsole.error('modals suck')
crewData.getSingleCrew
promise target every input on the modal and set the value to what comes back:`$('#edit-crew-name').value(crew.name);
^^ food is the the thing that comes back in .thenupdateCrewEvent
updateCrewEvent
should build up the crew object (grabs values from each input)firebase.auth().currentUser.uid
crewData.updateCrew
and passes in the new crew object AND the crewIdcrewData.updateCrew
takes in updatedCrew and foodId, and doesaxios.put
tocrew.json
crewData.updateCrew
promiseconsole.error('not able to update')
crewData.updateCrew
close the modal AND recallprintCrew