inital commit
This commit is contained in:
89
public/index.html
Normal file
89
public/index.html
Normal file
@@ -0,0 +1,89 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>IKEA Stock Checker</title>
|
||||
<style>
|
||||
html {
|
||||
background: #000000ab;
|
||||
color: white;
|
||||
}
|
||||
td {
|
||||
padding: 1%;
|
||||
}
|
||||
body { font-family: Arial; padding: 20px; }
|
||||
input { padding: 8px; margin: 5px; }
|
||||
button { padding: 10px; }
|
||||
#result { margin-top: 20px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>IKEA Tools</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td><h2>Store stock checker</h2></td>
|
||||
<td><h2>Store finder</h2></td>
|
||||
<td><h2>Country stock checker</h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label>Product ID:</label>
|
||||
<input id="product" placeholder="e.g. 30457915"><br>
|
||||
<label>Store ID:</label>
|
||||
<input id="store" placeholder="e.g. 088 (Amsterdam)"><br>
|
||||
<button onclick="checkStock()">Check Stock</button>
|
||||
</td>
|
||||
<td>
|
||||
<label>Country code:</label>
|
||||
<input id="countryCode" placeholder="e.g. nl"><br>
|
||||
<button onclick="GetStores()">Get stores</button>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<label>Product ID:</label>
|
||||
<input id="product2" placeholder="e.g. 30457915"><br>
|
||||
<label>Country code:</label>
|
||||
<input id="countryCode2" placeholder="e.g. nl"><br>
|
||||
<button onclick="checkCountryStock()">Check Stock</button>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="result"></div>
|
||||
|
||||
<script>
|
||||
async function checkStock() {
|
||||
const product = document.getElementById("product").value;
|
||||
const store = document.getElementById("store").value;
|
||||
|
||||
const res = await fetch(`/api/stock?product=${product}&store=${store}`);
|
||||
const data = await res.json();
|
||||
|
||||
document.getElementById("result").innerHTML =
|
||||
`<pre>${JSON.stringify(data, null, 2)}</pre>`;
|
||||
}
|
||||
|
||||
async function GetStores() {
|
||||
const countryCode = document.getElementById("countryCode").value;
|
||||
|
||||
const res = await fetch(`/api/stores?countryCode=${countryCode}}`);
|
||||
const data = await res.json();
|
||||
|
||||
document.getElementById("result").innerHTML =
|
||||
`<pre>${JSON.stringify(data, null, 2)}</pre>`;
|
||||
}
|
||||
|
||||
async function checkCountryStock() {
|
||||
const product = document.getElementById("product2").value;
|
||||
const countryCode = document.getElementById("countryCode2").value;
|
||||
|
||||
const res = await fetch(`/api/countrystock?countryCode=${countryCode}&product=${product}`);
|
||||
const data = await res.json();
|
||||
|
||||
document.getElementById("result").innerHTML =
|
||||
`<pre>${JSON.stringify(data, null, 2)}</pre>`;
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user