src/static/js/admin-status.js
// Create a row in the user status change request table
Create a row in the user status change request table
Create a row in the user status change request table
function createStatusRow(user) {
  const userID = newElement("td").text(user.userID);
  const firstname = newElement("td").text(user.firstname);
  const lastname = newElement("td").text(user.lastname);
  const email = newElement("td").text(user.email);
  const currentStatus = newElement("td").text(user.status);
  const requestedStatus = newElement("td").text(user.newStatus);
  const approveButton = newElement("button")
    .addClass("btn btn-light")
    .attr({
      type: "button",
    })
    .html('<i class="fas fa-check"></i>')
    .click(() => {
      approveStatus(user.requestID, true);
    });
  const disapproveButton = newElement("button")
    .addClass("btn btn-light")
    .attr({
      type: "button",
    })
    .html('<i class="fas fa-times"></i>')
    .click(() => {
      approveStatus(user.requestID, false);
    });
  const approve = newElement("td")
    .addClass("nowrap")
    .append(approveButton, disapproveButton);
  const row = newElement("tr").append(
    userID,
    firstname,
    lastname,
    email,
    currentStatus,
    requestedStatus,
    approve
  );
  return row;
}
function createStatusRow ( user ) { const userID = newElement ( "td" ) . text ( user . userID ) ; const firstname = newElement ( "td" ) . text ( user . firstname ) ; const lastname = newElement ( "td" ) . text ( user . lastname ) ; const email = newElement ( "td" ) . text ( user . email ) ; const currentStatus = newElement ( "td" ) . text ( user . status ) ; const requestedStatus = newElement ( "td" ) . text ( user . newStatus ) ; const approveButton = newElement ( "button" ) . addClass ( "btn btn-light" ) . attr ( { type : "button" , } ) . html ( '<i class="fas fa-check"></i>' ) . click ( ( ) => { approveStatus ( user . requestID , true ) ; } ) ; const disapproveButton = newElement ( "button" ) . addClass ( "btn btn-light" ) . attr ( { type : "button" , } ) . html ( '<i class="fas fa-times"></i>' ) . click ( ( ) => { approveStatus ( user . requestID , false ) ; } ) ; const approve = newElement ( "td" ) . addClass ( "nowrap" ) . append ( approveButton , disapproveButton ) ; const row = newElement ( "tr" ) . append ( userID , firstname , lastname , email , currentStatus , requestedStatus , approve ) ; return row ; }
Create a row in the user status change request table
Create a row in the user status change request table