Begin PIS Finder page

This commit is contained in:
Fred Boniface 2023-06-25 00:26:12 +01:00
parent f5302b58d8
commit a754c9d051
2 changed files with 49 additions and 5 deletions

View File

@ -21,6 +21,9 @@
async function processData(data) {
//console.log("data",JSON.stringify(data))
if (data.ERROR == "Offline") {
return;
};
val = {
crs: data[0]['3ALPHA'] || "None",
tiploc: data[0]['TIPLOC'] || "None",

View File

@ -3,10 +3,51 @@
import Nav from '$lib/navigation/nav.svelte'
const title = "PIS Finder"
</script>
let entryPIS;
let entryStartCRS = "";
let entryEndCRS = "";
let data = [];
<Header {title} />
async function findByStartEnd() {
return;
}
<p></p>
async function findByPis() {
data = [
{"one": 1},
{"two": 2}
]
return;
}
</script>
<Nav />
<Header {title} />
<p>To search by headcode use the Train Finder on the homepage</p>
<p class="label">Find By Start/End CRS:</p>
<form on:submit={findByStartEnd}>
<input type="text" maxlength="3" autocomplete="off" placeholder="Start" bind:value={entryStartCRS}>
<input type="text" maxlength="3" autocomplete="off" placeholder="End" bind:value={entryEndCRS}>
<br>
<button type="submit">Search</button><button type="reset">Reset</button>
</form>
<p class="label">Find By PIS Code:</p>
<form on:submit={findByPis}>
<input type="number" max="9999" autocomplete="off" placeholder="PIS" bind:value={entryPIS}>
<br>
<button type="submit">Search</button>
</form>
{#if data.length}
{#each data as entry}
<p>{JSON.stringify(entry)}</p>
{/each}
{/if}
<Nav />
<style>
.label {
font-weight: 600;
}
</style>