index.js
// Function to add new member cards to the HTML document for intern, manager and engineer
Function to add new member cards to the HTML document for intern, manager and engineer
Function to add new member cards to the HTML document for intern manager and engineer
function appendHTML(member) {
    return new Promise(function (resolve, reject) {
        const name = member.getName();
        const role = member.getRole();
        const id = member.getId();
        const email = member.getEmail();
        let data = "";
        if (role === "Engineer") {
            const gitHub = member.getGithub();
            data = `<div class="row" id="engineer">
            <div class="col-sm-12">
                <div class="card w-100 flex-layout">
                    <div class="avatar-img"><i class="fas fa-user-ninja"></i></div>
                    <div class="flex-direction-inner" style="width: 80%">
                        <h3>${name}</h3>
                        <p class="subtitle">Engineer</p>
                        <ul class="list-group list-group-flush">
                            <li class="list-group-item"><i class="far fa-id-badge" style="padding-right: 8px;"></i> ID:
                                ${id}
                            </li>
                            <li class="list-group-item"><i class="far fa-envelope" style="padding-right: 8px;"></i>
                                Email: <a href="mailto:${email}">${email}</a></li>
                            <li class="list-group-item"><i class="fab fa-github" style="padding-right: 8px;"></i>
                                GitHub: <a href="https://github.com/${gitHub}" target="_blank">${gitHub}</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>`;
        } else if (role === "Intern") {
            const school = member.getSchool();
            data = `<div class="row" id="intern">
            <div class="col-sm-12">
                <div class="card w-100 flex-layout">
                    <div class="avatar-img"><i class="fas fa-user"></i></div>
                    <div class="flex-direction-inner" style="width: 80%">
                        <h3>${name}</h3>
                        <p class="subtitle">Intern</p>
                        <ul class="list-group list-group-flush">
                            <li class="list-group-item"><i class="far fa-id-badge" style="padding-right: 8px;"></i> ID:
                                ${id}
                            </li>
                            <li class="list-group-item"><i class="fas fa-graduation-cap" style="padding-right: 8px;"></i> School:
                                ${school}
                            </li>
                            <li class="list-group-item"><i class="far fa-envelope" style="padding-right: 8px;"></i>
                                Email: <a href="mailto:${email}">${email}</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>`;
        } else {
            const officePhone = member.getOfficeNumber();
            data = `<div class="row" id="manager">
            <div class="col-sm-12">
                <div class="card w-100 flex-layout">
                    <div class="avatar-img"><i class="fas fa-user-tie"></i></div>
                    <div class="flex-direction-inner" style="width: 80%">
                        <h3>${name}</h3>
                        <p class="subtitle">Manager</p>
                        <ul class="list-group list-group-flush">
                            <li class="list-group-item"><i class="far fa-id-badge" style="padding-right: 8px;"></i> ID:
                                ${id}
                            </li>
                            <li class="list-group-item"><i class="far fa-envelope" style="padding-right: 8px;"></i>
                                Email: <a href="mailto:${email}">${email}</a></li>
                            <li class="list-group-item"><i class="fas fa-mobile-alt" style="padding-right: 8px;"></i> Phone: ${officePhone}</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>`
        }
        fs.appendFile("./dist/team.html", data, function (err) {
            if (err) {
                return reject(err);
            };
            return resolve();
        });
    });
}
function appendHTML ( member ) { return new Promise ( function ( resolve , reject ) { const name = member . getName ( ) ; const role = member . getRole ( ) ; const id = member . getId ( ) ; const email = member . getEmail ( ) ; let data = "" ; if ( role === "Engineer" ) { const gitHub = member . getGithub ( ) ; data = ` ${ name } ${ id } ${ email } ${ email } ${ gitHub } ${ gitHub } ` ; } else if ( role === "Intern" ) { const school = member . getSchool ( ) ; data = ` ${ name } ${ id } ${ school } ${ email } ${ email } ` ; } else { const officePhone = member . getOfficeNumber ( ) ; data = ` ${ name } ${ id } ${ email } ${ email } ${ officePhone } ` } fs . appendFile ( "./dist/team.html" , data , function ( err ) { if ( err ) { return reject ( err ) ; } ; return resolve ( ) ; } ) ; } ) ; }
Function to add new member cards to the HTML document for intern, manager and engineer
Function to add new member cards to the HTML document for intern manager and engineer
// If statement with function to append HTML for engineer card and github username information // Else if statement with function to append HTML for intern card and school information // Else append HTML for manager card and office phone number information // Write cards to html file