index.js
//function to ask and collect data for manager
function to ask and collect data for manager
function to ask and collect data for manager
function startCollectingInfo() {
  console.log(
    "\n" +
      "            ******************** Welcome to Team Dashboard **************************\n"
  );
  console.log(
    "            ********************    Create your Team       **************************\n"
  );
  inquirer
    .prompt([
      {
        type: "input",
        name: "name",
        message: "Please enter the team Manager's Name :",
        validate: (name) => {
          if (name) {
            return true;
          } else {
            return "Please enter the team Manager's name.";
          }
        },
      },
      {
        type: "input",
        name: "empId",
        message: "Please enter the team Manager's Employee Id :",
        validate: (empId) => {
          if (regexNumber.test(empId)) {
            return true;
          } else {
            return "Please enter valid EmpId";
          }
        },
      },
      {
        type: "input",
        name: "emailId",
        message: "Please enter the team Manager's EmailId :",
        validate: (emailId) => {
          if (regexEmail.test(emailId)) {
            return true;
          } else {
            return "Please enter a valid email Id.";
          }
        },
      },
      {
        type: "input",
        name: "officeNumber",
        message: "Please enter  team Manager's office number :",
        validate: (officeNumber) => {
          if (regexNumber.test(officeNumber)) {
            return true;
          } else {
            return "Please enter valid number.";
          }
        },
      },
    ])
    .then((responsedata) => {
      const { name, empId, emailId, officeNumber } = responsedata;
      const manager = new Manager(name, empId, emailId, officeNumber);
      const addManager = {
        role: manager.getRole(),
        name: manager.getName(),
        id: manager.getId(),
        email: manager.getEmail(),
        extrafield: manager.getofficeNumber(),
      };
      allTeamMembers.push(addManager);
      promptOtherQuestions();
    });
}
function startCollectingInfo ( ) { console . log ( "\n" + "            ******************** Welcome to Team Dashboard **************************\n" ) ; console . log ( "            ********************    Create your Team       **************************\n" ) ; inquirer . prompt ( [ { type : "input" , name : "name" , message : "Please enter the team Manager's Name :" , validate : ( name ) => { if ( name ) { return true ; } else { return "Please enter the team Manager's name." ; } } , } , { type : "input" , name : "empId" , message : "Please enter the team Manager's Employee Id :" , validate : ( empId ) => { if ( regexNumber . test ( empId ) ) { return true ; } else { return "Please enter valid EmpId" ; } } , } , { type : "input" , name : "emailId" , message : "Please enter the team Manager's EmailId :" , validate : ( emailId ) => { if ( regexEmail . test ( emailId ) ) { return true ; } else { return "Please enter a valid email Id." ; } } , } , { type : "input" , name : "officeNumber" , message : "Please enter  team Manager's office number :" , validate : ( officeNumber ) => { if ( regexNumber . test ( officeNumber ) ) { return true ; } else { return "Please enter valid number." ; } } , } , ] ) . then ( ( responsedata ) => { const { name , empId , emailId , officeNumber } = responsedata ; const manager = new Manager ( name , empId , emailId , officeNumber ) ; const addManager = { role : manager . getRole ( ) , name : manager . getName ( ) , id : manager . getId ( ) , email : manager . getEmail ( ) , extrafield : manager . getofficeNumber ( ) , } ; allTeamMembers . push ( addManager ) ; promptOtherQuestions ( ) ; } ) ; }
function to ask and collect data for manager
function to ask and collect data for manager
//welcome msg //collect manager info and add to allteammember array //prompted to enter the team manager’s name, employee ID, email address, and office number // console.log(responsedata); //destructor the object and pass it to manager class //create an instance of manager with user input // create an object for allTeamMmenber having info from manager object //store object in global array