Skip to content

Commit

Permalink
Merge pull request #116 from Sparx-Robotics-1126/tableCentering
Browse files Browse the repository at this point in the history
Table centering
  • Loading branch information
fuddster authored Jan 11, 2025
2 parents 9b35e68 + 9f083de commit 0bf0022
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions resources/js/scoutingPASS.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var slide = 0;
var enableGoogleSheets = false;
var pitScouting = false;
var checkboxAs = 'YN';
var ColWidth = '200px';

// Options
var options = {
Expand Down Expand Up @@ -151,12 +152,14 @@ function addTimer(table, idx, name, data) {
function addCounter(table, idx, name, data) {
var row = table.insertRow(idx);
var cell1 = row.insertCell(0);
cell1.style.width = ColWidth;
cell1.classList.add("title");
if (!data.hasOwnProperty('code')) {
cell1.innerHTML = `Error: No code specified for ${name}`;
return idx + 1;
}
var cell2 = row.insertCell(1);
cell2.style.width = ColWidth;
cell1.innerHTML = name + ' ';
if (data.hasOwnProperty('tooltip')) {
cell1.setAttribute("title", data.tooltip);
Expand Down Expand Up @@ -402,12 +405,14 @@ function addClickableImage(table, idx, name, data) {
function addText(table, idx, name, data) {
var row = table.insertRow(idx);
var cell1 = row.insertCell(0);
cell1.style.width = ColWidth;
cell1.classList.add("title");
if (!data.hasOwnProperty('code')) {
cell1.innerHTML = `Error: No code specified for ${name}`;
return idx + 1;
}
var cell2 = row.insertCell(1);
cell2.style.width = ColWidth;
cell1.innerHTML = name + ' ';
if (data.hasOwnProperty('tooltip')) {
cell1.setAttribute("title", data.tooltip);
Expand Down Expand Up @@ -455,12 +460,14 @@ function addText(table, idx, name, data) {
function addNumber(table, idx, name, data) {
var row = table.insertRow(idx);
var cell1 = row.insertCell(0);
cell1.style.width = ColWidth;
cell1.classList.add("title");
if (!data.hasOwnProperty('code')) {
cell1.innerHTML = `Error: No code specified for ${name}`;
return idx + 1;
}
var cell2 = row.insertCell(1);
cell2.style.width = ColWidth;
cell1.innerHTML = name + ' ';
if (data.hasOwnProperty('tooltip')) {
cell1.setAttribute("title", data.tooltip);
Expand Down Expand Up @@ -518,12 +525,14 @@ function addNumber(table, idx, name, data) {
function addRadio(table, idx, name, data) {
var row = table.insertRow(idx);
var cell1 = row.insertCell(0);
cell1.style.width = ColWidth;
cell1.classList.add("title");
if (!data.hasOwnProperty('code')) {
cell1.innerHTML = `Error: No code specified for ${name}`;
return idx + 1;
}
var cell2 = row.insertCell(1);
cell2.style.width = ColWidth;
cell1.innerHTML = name + ' ';
if (data.hasOwnProperty('tooltip')) {
cell1.setAttribute("title", data.tooltip);
Expand Down Expand Up @@ -577,13 +586,15 @@ function addRadio(table, idx, name, data) {
function addCheckbox(table, idx, name, data) {
var row = table.insertRow(idx);
var cell1 = row.insertCell(0);
cell1.style.width = ColWidth;
cell1.classList.add("title");
if (!data.hasOwnProperty('code')) {
cell1.innerHTML = `Error: No code specified for ${name}`;
return idx + 1;
}
var cell2 = row.insertCell(1);
cell1.innerHTML = name + ' ';
cell2.style.width = ColWidth;
if (data.hasOwnProperty('tooltip')) {
cell1.setAttribute("title", data.tooltip);
}
Expand Down Expand Up @@ -675,6 +686,7 @@ function configure() {
var table = document.getElementById("prematch_table")
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
cell1.style.width = ColWidth;
cell1.innerHTML = `Error parsing configuration file: ${err.message}<br><br>Use a tool like <a href="http://jsonlint.com/">http://jsonlint.com/</a> to help you debug your config file`
return -1
}
Expand Down Expand Up @@ -786,16 +798,16 @@ function validateData() {
var errStr = "";
for (rf of requiredFields) {
var thisRF = document.forms.scoutingForm[rf];
if (thisRF.value == "[]" || thisRF.value.length == 0) {
if (rf == "as") {
rftitle = "Auto Start Position"
} else {
thisInputEl = thisRF instanceof RadioNodeList ? thisRF[0] : thisRF;
rftitle = thisInputEl.parentElement.parentElement.children[0].innerHTML.replace("&nbsp;","");
}
errStr += rf + ": " + rftitle + "\n";
ret = false;
}
if (thisRF.value == "[]" || thisRF.value.length == 0) {
if (rf == "as") {
rftitle = "Auto Start Position"
} else {
thisInputEl = thisRF instanceof RadioNodeList ? thisRF[0] : thisRF;
rftitle = thisInputEl.parentElement.parentElement.children[0].innerHTML.replace("&nbsp;","");
}
errStr += rf + ": " + rftitle + "\n";
ret = false;
}
}
if (ret == false) {
alert("Enter all required values\n" + errStr);
Expand Down

0 comments on commit 0bf0022

Please sign in to comment.