nss-evening-cohort-10 / nutshell-renaissance-fair

0 stars 0 forks source link

Add Event Staff #76

Open jbkey2015 opened 4 years ago

jbkey2015 commented 4 years ago

Staffs -> staffEvent: Smash

  1. Get all staff
  2. Get all staffEvents
  3. const staffEventSmash = []; staff.forEach((staff) => {
  4. If (staff.EventId === eventId) { staff.push("isChecked": true } else { "isChecked": false }
  5. resolve(staffEventSmash)

Place in staffEvents Component

const printstaffOpt = () => {
    let domString = '';
    forEach(staff){
    domString +=`
    <div class="form-check">
        <input class="form-check-input staff" type="checkbox" name="${staff.id}" id="${staff.id}" value="${staff.name}" ${(staff.isChecked === true) ? checked : unchecked}>
        <label class="form-check-label" for="${staff.id}">${staff.name}</label>
    </div>
  `;
    }
    utilities.printToDom('staffSelection', domString);
};

Modify Food Event

modifyStaffEvent = (staffId) => {
  if (checked) {
    staffEventData.addStaffEvent(staffId)
  };
};

Add Axios call const addStaffEvent = (staffId) => axios.post(${baseUrl}/staffEvents.json, staffId);