function loadController(rooms, roomTypes, numRooms) {
  const numPages = parseInt(numRooms/MAX_ROOM_NUMBERS) + ONE;
  uPage.setTitle('Refocus Rooms');
  uPage.setSubtitle(`Number of rooms: ${numRooms}`);
  const subtitle = document.getElementById('subTitle');
  const filterDiv = document.createElement('div');
  const pageSelectDiv = document.createElement('div');
  pageSelectDiv.className = 'slds-m-top--x-small';
  filterDiv.className = 'slds-m-top--x-small slds-m-bottom--x-small';

  const typeArr = ['All'];
  roomTypes.forEach((rt) => {
    typeArr.push(rt.name);
  });

  const typeDrop = createSelectEl(typeArr, filterType);
  typeDrop.onchange = ((e) => {
    window.location.href = constructListFilterUrl('type', e.target.value);
  });

  const activeDrop = createSelectEl(['All', 'true', 'false'], filterActive);
  activeDrop.onchange = ((e) => {
    window.location.href = constructListFilterUrl('active', e.target.value);
  });

  const pageArr = [];

  for (let i = ONE; i < numPages + ONE; i++) {
    pageArr.push(i.toString());
  }

  const pageDrop = createSelectEl(pageArr, currentPage.toString());
  pageDrop.onchange = ((e) => {
    window.location.href = constructListFilterUrl('page', e.target.value);
  });

  pageSelectDiv.appendChild(document.createTextNode("Page: "));
  pageSelectDiv.appendChild(pageDrop);
  filterDiv.appendChild(document.createTextNode("Type: "));
  filterDiv.appendChild(typeDrop);
  filterDiv.appendChild(document.createTextNode('Active: '));
  filterDiv.appendChild(activeDrop);
  filterDiv.appendChild(pageSelectDiv);
  subtitle.appendChild(filterDiv);

  const createNewBotton = `<div class="slds-form-element" style="float: right;">
    <button
      class="slds-button slds-button_neutral"
      onClick="window.location.href = '/rooms/new';">
      New
    </button>
  </div>`;

  header.insertAdjacentHTML('afterbegin', createNewBotton);

  const headers = ['ID', 'Name', 'Type', 'Active', 'Created At', 'Updated At'];
  const rows = rooms.map((room) => {
    const roomType = roomTypes.filter((rt) => rt.id === room.type);
    const { id } = room;
    room.id =`<a href=/rooms/${id} target='_blank' rel='noopener noreferrer'>
      ${id}
    </a>`;
    room.name = `<a href=/rooms/${id} target='_blank' rel='noopener noreferrer'>
      ${room.name}
    </a>`;
    room.type = `<a href=/rooms/types/${roomType[ZERO].id}>
      ${roomType[ZERO].name}
    </a>`;
    room.active = room.active ? 'True' : 'False';
    room.createdAt = moment(room.createdAt).format('lll');
    room.updatedAt = moment(room.updatedAt).format('lll');
    return room;
  });

  uPage.removeSpinner();
  ReactDOM.render(
    <div>
    { rows.length > 0 ?
      <ListController
        tableHeaders={ headers }
        tableRows={ rows }
      />
      :
      <div className="slds-text-align--center">
        <h1 className="slds-page-header__title slds-p-around--small">
          No Rooms Match Current Filter..
        </h1>
        <img src="./static/images/empty-state-events.svg"/>
      </div>
    }
    </div>,
    roomsListContainer
  );
}
/**
 * Passes data on to Controller to pass onto renderers.
 *
 * @param {Object} values Data returned from AJAX.
 */
Passes data on to Controller to pass onto renderers.
@param {Object} values Data returned from AJAX.
Passes data on to Controller to pass onto renderers . @param { Object } values Data returned from AJAX .
function loadController(rooms, roomTypes, numRooms) {
  const numPages = parseInt(numRooms/MAX_ROOM_NUMBERS) + ONE;
  uPage.setTitle('Refocus Rooms');
  uPage.setSubtitle(`Number of rooms: ${numRooms}`);
  const subtitle = document.getElementById('subTitle');
  const filterDiv = document.createElement('div');
  const pageSelectDiv = document.createElement('div');
  pageSelectDiv.className = 'slds-m-top--x-small';
  filterDiv.className = 'slds-m-top--x-small slds-m-bottom--x-small';
  const typeArr = ['All'];
  roomTypes.forEach((rt) => {
    typeArr.push(rt.name);
  });
  const typeDrop = createSelectEl(typeArr, filterType);
  typeDrop.onchange = ((e) => {
    window.location.href = constructListFilterUrl('type', e.target.value);
  });
  const activeDrop = createSelectEl(['All', 'true', 'false'], filterActive);
  activeDrop.onchange = ((e) => {
    window.location.href = constructListFilterUrl('active', e.target.value);
  });
  const pageArr = [];
  for (let i = ONE; i < numPages + ONE; i++) {
    pageArr.push(i.toString());
  }
  const pageDrop = createSelectEl(pageArr, currentPage.toString());
  pageDrop.onchange = ((e) => {
    window.location.href = constructListFilterUrl('page', e.target.value);
  });
  pageSelectDiv.appendChild(document.createTextNode("Page: "));
  pageSelectDiv.appendChild(pageDrop);
  filterDiv.appendChild(document.createTextNode("Type: "));
  filterDiv.appendChild(typeDrop);
  filterDiv.appendChild(document.createTextNode('Active: '));
  filterDiv.appendChild(activeDrop);
  filterDiv.appendChild(pageSelectDiv);
  subtitle.appendChild(filterDiv);
  const createNewBotton = `<div class="slds-form-element" style="float: right;">
    <button
      class="slds-button slds-button_neutral"
      onClick="window.location.href = '/rooms/new';">
      New
    </button>
  </div>`;
  header.insertAdjacentHTML('afterbegin', createNewBotton);
  const headers = ['ID', 'Name', 'Type', 'Active', 'Created At', 'Updated At'];
  const rows = rooms.map((room) => {
    const roomType = roomTypes.filter((rt) => rt.id === room.type);
    const { id } = room;
    room.id =`<a href=/rooms/${id} target='_blank' rel='noopener noreferrer'>
      ${id}
    </a>`;
    room.name = `<a href=/rooms/${id} target='_blank' rel='noopener noreferrer'>
      ${room.name}
    </a>`;
    room.type = `<a href=/rooms/types/${roomType[ZERO].id}>
      ${roomType[ZERO].name}
    </a>`;
    room.active = room.active ? 'True' : 'False';
    room.createdAt = moment(room.createdAt).format('lll');
    room.updatedAt = moment(room.updatedAt).format('lll');
    return room;
  });
  uPage.removeSpinner();
  ReactDOM.render(
    <div>
    { rows.length > 0 ?
      <ListController
        tableHeaders={ headers }
        tableRows={ rows }
      />
      :
      <div className="slds-text-align--center">
        <h1 className="slds-page-header__title slds-p-around--small">
          No Rooms Match Current Filter..
        </h1>
        <img src="./static/images/empty-state-events.svg"/>
      </div>
    }
    </div>,
    roomsListContainer
  );
}
function loadController ( rooms , roomTypes , numRooms ) { const numPages = parseInt ( numRooms / MAX_ROOM_NUMBERS ) + ONE ; uPage . setTitle ( 'Refocus Rooms' ) ; uPage . setSubtitle ( ` ${ numRooms } ` ) ; const subtitle = document . getElementById ( 'subTitle' ) ; const filterDiv = document . createElement ( 'div' ) ; const pageSelectDiv = document . createElement ( 'div' ) ; pageSelectDiv . className = 'slds-m-top--x-small' ; filterDiv . className = 'slds-m-top--x-small slds-m-bottom--x-small' ; const typeArr = [ 'All' ] ; roomTypes . forEach ( ( rt ) => { typeArr . push ( rt . name ) ; } ) ; const typeDrop = createSelectEl ( typeArr , filterType ) ; typeDrop . onchange = ( ( e ) => { window . location . href = constructListFilterUrl ( 'type' , e . target . value ) ; } ) ; const activeDrop = createSelectEl ( [ 'All' , 'true' , 'false' ] , filterActive ) ; activeDrop . onchange = ( ( e ) => { window . location . href = constructListFilterUrl ( 'active' , e . target . value ) ; } ) ; const pageArr = [ ] ; for ( let i = ONE ; i < numPages + ONE ; i ++ ) { pageArr . push ( i . toString ( ) ) ; } const pageDrop = createSelectEl ( pageArr , currentPage . toString ( ) ) ; pageDrop . onchange = ( ( e ) => { window . location . href = constructListFilterUrl ( 'page' , e . target . value ) ; } ) ; pageSelectDiv . appendChild ( document . createTextNode ( "Page: " ) ) ; pageSelectDiv . appendChild ( pageDrop ) ; filterDiv . appendChild ( document . createTextNode ( "Type: " ) ) ; filterDiv . appendChild ( typeDrop ) ; filterDiv . appendChild ( document . createTextNode ( 'Active: ' ) ) ; filterDiv . appendChild ( activeDrop ) ; filterDiv . appendChild ( pageSelectDiv ) ; subtitle . appendChild ( filterDiv ) ; const createNewBotton = ` ` ; header . insertAdjacentHTML ( 'afterbegin' , createNewBotton ) ; const headers = [ 'ID' , 'Name' , 'Type' , 'Active' , 'Created At' , 'Updated At' ] ; const rows = rooms . map ( ( room ) => { const roomType = roomTypes . filter ( ( rt ) => rt . id === room . type ) ; const { id } = room ; room . id = ` ${ id } ${ id } ` ; room . name = ` ${ id } ${ room . name } ` ; room . type = ` ${ roomType [ ZERO ] . id } ${ roomType [ ZERO ] . name } ` ; room . active = room . active ? 'True' : 'False' ; room . createdAt = moment ( room . createdAt ) . format ( 'lll' ) ; room . updatedAt = moment ( room . updatedAt ) . format ( 'lll' ) ; return room ; } ) ; uPage . removeSpinner ( ) ; ReactDOM . render ( < div > { rows . length > 0 ? < ListController tableHeaders = { headers } tableRows = { rows } / > : < div className = "slds-text-align--center" > < h1 className = "slds-page-header__title slds-p-around--small" > 
          No Rooms Match Current Filter..
         < / h1 > < img src = "./static/images/empty-state-events.svg" / > < / div > } < / div > , roomsListContainer ) ; }
Passes data on to Controller to pass onto renderers.
Passes data on to Controller to pass onto renderers .