This repository has been archived on 2023-08-24. You can view files and clone it, but cannot push or open issues or pull requests.
OwlBoard/static/js/find-code.js

43 lines
1.1 KiB
JavaScript

async function fetchEntry(){
var name = document.getElementById("name")
var crs = document.getElementById("3alpha")
var nlc = document.getElementById("nlc")
var tiploc = document.getElementById("tiploc")
var stanox = document.getElementById("stanox")
var values = {
name: name.value,
crs: crs.value,
nlc: nlc.value,
tiploc: tiploc.value,
stanox: stanox.value
}
console.log(`Read values: ${JSON.stringify(values)}`)
parseData(values)
}
async function parseData(values){
if (values.crs != ""){
getData("crs", values.crs)
} else if (values.nlc != ""){
getData("nlc", values.nlc)
} else if (values.tiploc != ""){
getData("tiploc", values.tiploc)
} else if (values.stanox != ""){
getData("stanox", values.stanox)
} else if (values.station != ""){
getData("name", values.name)
} else {
errorNoData()
}
}
async function getData(type, value){
console.log(`Looking for: ${type} ${value}`)
}
async function errorNoData(){
window.alert("You haven't entered any data")
}