noncrud stuff done
This commit is contained in:
@@ -2,16 +2,13 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>services</title>
|
||||
<title>Who uses service</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css">
|
||||
<script src="./script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Services</h1>
|
||||
<br>
|
||||
<a href="#add" class="bookmark">Want to add a new line?</a>
|
||||
<br>
|
||||
<br>
|
||||
<table class="queryresults">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -20,8 +17,10 @@
|
||||
<th colspan="2">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="resultarea">
|
||||
<tbody id="lines">
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="resultarea"></div>
|
||||
<br>
|
||||
</body>
|
||||
@@ -14,10 +14,10 @@ async function getServices()
|
||||
|
||||
function display()
|
||||
{
|
||||
document.getElementById('resultarea').innerHTML = '';
|
||||
document.getElementById('lines').innerHTML = '';
|
||||
|
||||
services.forEach(t => {
|
||||
document.getElementById('resultarea').innerHTML +=
|
||||
document.getElementById('lines').innerHTML +=
|
||||
'<tr><td>'
|
||||
+ t.id +
|
||||
'</td><td>'
|
||||
@@ -31,24 +31,48 @@ function display()
|
||||
async function runQuery(id)
|
||||
{
|
||||
let results = []
|
||||
|
||||
await fetch('https://localhost:5001/api/WhoUsesService?id=' + id)
|
||||
.then(x => x.json())
|
||||
.then(y => {
|
||||
results = y;
|
||||
console.log(results);
|
||||
});
|
||||
|
||||
document.getElementById('resultarea').innerHTML = '';
|
||||
|
||||
results.forEach(t => {
|
||||
document.getElementById('resultarea').innerHTML +=
|
||||
'<h2>Query results</h2>' +
|
||||
'<table>' +
|
||||
'<tr>' +
|
||||
'<td>ID</td>' +
|
||||
'<td>Client</td>' +
|
||||
'</tr>';
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
await fetch('https://localhost:5001/api/WhoUsesService?id=' + id)
|
||||
.then(x => x.json())
|
||||
.then(y => {
|
||||
results = y;
|
||||
console.log(results);
|
||||
});
|
||||
|
||||
document.getElementById('resultarea').innerHTML += '<h2>Query results</h2>';
|
||||
|
||||
results.forEach(t => {
|
||||
document.getElementById('resultarea').innerHTML +=
|
||||
'<table class="inputs">' +
|
||||
'<tr>' +
|
||||
'<td>ID</td>' +
|
||||
'<td class="inputcell"><input type="text" id="in_id" readonly value="' + t.id + '"></td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td>Name</td>' +
|
||||
'<td class="inputcell"><input type="text" id="in_name" readonly value="' + t.name + '"></td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td>Email</td>' +
|
||||
'<td class="inputcell"><input type="text" id="in_email" readonly value="' + t.email + '"></td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td>Phone</td>' +
|
||||
'<td class="inputcell"><input type="text" id="in_phone" readonly value="' + t.phone + '"></td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td>Service ID</td>' +
|
||||
'<td class="inputcell"><input type="text" id="in_service_id" readonly value="' + t.service_id + '"></td>' +
|
||||
'</tr>' +
|
||||
'</table>';
|
||||
});
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
console.log(error);
|
||||
document.getElementById('resultarea').innerHTML += '<h2>No results</h2>';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user