src/static/js/admin-suspension.js
// Create a row in the suspended users table
Create a row in the suspended users table
Create a row in the suspended users table
function createSuspensionRow(user) {
  const suspensionID = newElement("td").text(user.suspensionID);
  const userID = newElement("td").text(user.id);
  const firstname = newElement("td").text(user.firstname);
  const lastname = newElement("td").text(user.lastname);
  const email = newElement("td").text(user.email);
  const status = newElement("td").text(user.status);
  const suspendedUntil = newElement("td").text(
    new Date(parseInt(user.suspendedUntil) * 1000).toLocaleString()
  );
  const endSuspensionButton = newElement("button")
    .addClass("btn btn-light")
    .attr({
      type: "button",
    })
    .html('<i class="fas fa-check"></i>')
    .click(() => {
      endSuspension(user.suspensionID);
    });
  const endSuspensionCell = newElement("td").append(endSuspensionButton);
  const row = newElement("tr").append(
    suspensionID,
    userID,
    firstname,
    lastname,
    email,
    status,
    suspendedUntil,
    endSuspensionCell
  );
  return row;
}
function createSuspensionRow ( user ) { const suspensionID = newElement ( "td" ) . text ( user . suspensionID ) ; const userID = newElement ( "td" ) . text ( user . id ) ; const firstname = newElement ( "td" ) . text ( user . firstname ) ; const lastname = newElement ( "td" ) . text ( user . lastname ) ; const email = newElement ( "td" ) . text ( user . email ) ; const status = newElement ( "td" ) . text ( user . status ) ; const suspendedUntil = newElement ( "td" ) . text ( new Date ( parseInt ( user . suspendedUntil ) * 1000 ) . toLocaleString ( ) ) ; const endSuspensionButton = newElement ( "button" ) . addClass ( "btn btn-light" ) . attr ( { type : "button" , } ) . html ( '<i class="fas fa-check"></i>' ) . click ( ( ) => { endSuspension ( user . suspensionID ) ; } ) ; const endSuspensionCell = newElement ( "td" ) . append ( endSuspensionButton ) ; const row = newElement ( "tr" ) . append ( suspensionID , userID , firstname , lastname , email , status , suspendedUntil , endSuspensionCell ) ; return row ; }
Create a row in the suspended users table
Create a row in the suspended users table