translator seats

by Laurel Bruggeman

HTML

<textarea id="result" style="height: 400px"/>

JavaScript

function fromLetter(letter) {
 return letter.charCodeAt(0) - 64;
}

function prints(se){
  var str = 'seats: [';
  for(var i=0; i<se.length; i++) {
  	var s = se[i];
  	str += `\n{ id: ${i+1}, label: '${s.id}', row: ${s.row || 0}, column: ${s.column ? fromLetter(s.column) : 0}, columnLetter: '${s.column || 0}' },`;
  }
   for(var i=0; i<5; i++) {
    str += `\n{ id: ${i+se.length+1}, label: 'R', row: 1, column: ${i + 7} }`;
   }
  str += '\n];';
  return str;
}

var seats = [];
seats.push({id: 11,  column: "L",  row:9});
seats.push({id: 12,  column: "K",  row:8});
seats.push({id: 13,  column: "J",  row:7});
seats.push({id: 14,  column: "I",  row:6});
seats.push({id: 15,  column: "H",  row:5});
seats.push({id: 16,  column: "G",  row:4});
seats.push({id: 17});
seats.push({id: 18});
seats.push({id: 19});
seats.push({id: 20});
seats.push({id: 21});
seats.push({id: 22,  column: "G",  row:5});
seats.push({id: 23,  column: "H",  row:6});
seats.push({id: 24,  column: "I",  row:7});
seats.push({id: 25,  column: "J",  row:8});
seats.push({id: 26,  column: "K",  row:9});
seats.push({id: 27,  column: "L",  row:10});
seats.push({id: 28,  column: "L",  row:12});
seats.push({id: 29,  column: "K",  row:11});
seats.push({id: 30,  column: "J",  row:10});
seats.push({id: 31,  column: "I",  row:9});
seats.push({id: 32,  column: "H",  row:8});
seats.push({id: 33,  column: "G",  row:7});
seats.push({id: 34,  column: "E",  row:5});
seats.push({id: 35,  column: "D",  row:4});
seats.push({id: 36,  column: "C",  row:3});
seats.push({id: 37,  column: "B",  row:2});
seats.push({id: 38,  column: "A",  row:1});
seats.push({id: 39,  column: "A",  row:2});
seats.push({id: 40,  column: "B",  row:3});
seats.push({id: 41,  column: "C",  row:4});
seats.push({id: 42,  column: "D",  row:5});
seats.push({id: 43,  column: "E",  row:6});
seats.push({id: 44,  column: "G",  row:8});
seats.push({id: 45,  column: "H",  row:9});
seats.push({id: 46,  column: "I",  row:10});
seats.push({id: 47,  column: "J", ...