noncrud stuff done

This commit is contained in:
2024-05-06 17:16:17 +02:00
parent 25728ff18f
commit bcff903cd6
12 changed files with 476 additions and 27 deletions

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Get subordinates</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
<script src="./script.js"></script>
</head>
<body>
<h1>Employees</h1>
<br>
<table class="queryresults">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th colspan="2">Actions</th>
</tr>
</thead>
<tbody id="lines">
</tbody>
</table>
<div id="resultarea"></div>
<br>
</body>

View File

@@ -0,0 +1,81 @@
let employees = [];
getEmployees();
async function getEmployees()
{
await fetch('https://localhost:5001/api/Employee')
.then(x => x.json())
.then(y => {
employees = y;
console.log(employees);
display();
});
}
function display()
{
document.getElementById('lines').innerHTML = '';
employees.forEach(t => {
document.getElementById('lines').innerHTML +=
'<tr><td>'
+ t.id +
'</td><td>'
+ t.name +
'</td><td>'
+ '<button colspan="2" type="button" onclick="runQuery(' + t.id + ')">Run</button>'
+ '</td></tr>';
});
}
async function runQuery(id)
{
let results = []
document.getElementById('resultarea').innerHTML = '';
try
{
await fetch('https://localhost:5001/api/GetSubordinates?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>Manager ID</td>' +
'<td class="inputcell"><input type="text" id="in_manager_id" readonly value="' + t.manageR_ID + '"></td>' +
'</tr>' +
'<tr>' +
'<td>Maintainer ID</td>' +
'<td class="inputcell"><input type="text" id="in_maintainer_id" readonly value="' + t.maintaineR_ID + '"></td>' +
'</table>';
});
}
catch (ex)
{
console.log(ex);
document.getElementById('resultarea').innerHTML += '<h2>No results</h2>';
}
}

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Get leader responsible for service</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
<script src="./script.js"></script>
</head>
<body>
<h1>Services</h1>
<br>
<table class="queryresults">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th colspan="2">Actions</th>
</tr>
</thead>
<tbody id="lines">
</tbody>
</table>
<div id="resultarea"></div>
<br>
</body>

View File

@@ -0,0 +1,79 @@
let services = [];
getServices();
async function getServices()
{
await fetch('https://localhost:5001/api/Service')
.then(x => x.json())
.then(y => {
services = y;
console.log(services);
display();
});
}
function display()
{
document.getElementById('lines').innerHTML = '';
services.forEach(t => {
document.getElementById('lines').innerHTML +=
'<tr><td>'
+ t.id +
'</td><td>'
+ t.name +
'</td><td>'
+ '<button colspan="2" type="button" onclick="runQuery(' + t.id + ')">Run</button>'
+ '</td></tr>';
});
}
async function runQuery(id)
{
let result = null;
document.getElementById('resultarea').innerHTML = '';
try
{
await fetch('https://localhost:5001/api/WhoIsResponsibleForService?id=' + id)
.then(x => x.json())
.then(y => {
result = y;
console.log(result);
});
document.getElementById('resultarea').innerHTML += '<h2>Query result</h2>'
document.getElementById('resultarea').innerHTML +=
'<table class="inputs">' +
'<tr>' +
'<td>ID</td>' +
'<td class="inputcell"><input type="text" id="in_id" readonly value="' + result.id + '"></td>' +
'</tr>' +
'<tr>' +
'<td>Name</td>' +
'<td class="inputcell"><input type="text" id="in_name" readonly value="' + result.name + '"></td>' +
'</tr>' +
'<tr>' +
'<td>Email</td>' +
'<td class="inputcell"><input type="text" id="in_email" readonly value="' + result.email + '"></td>' +
'</tr>' +
'<tr>' +
'<td>Phone</td>' +
'<td class="inputcell"><input type="text" id="in_phone" readonly value="' + result.phone + '"></td>' +
'</tr>' +
'<tr>' +
'<td>Manager ID</td>' +
'<td class="inputcell"><input type="text" id="in_manager_id" readonly value="' + result.manageR_ID + '"></td>' +
'</tr>' +
'<tr>' +
'<td>Maintainer ID</td>' +
'<td class="inputcell"><input type="text" id="in_maintainer_id" readonly value="' + result.maintaineR_ID + '"></td>' +
'</table>';
}
catch (ex)
{
console.log(ex);
document.getElementById('resultarea').innerHTML += '<h2>No result</h2>';
}
}

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Who maintains a service</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
<script src="./script.js"></script>
</head>
<body>
<h1>Services</h1>
<br>
<table class="queryresults">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th colspan="2">Actions</th>
</tr>
</thead>
<tbody id="lines">
</tbody>
</table>
<div id="resultarea"></div>
<br>
</body>

View File

@@ -0,0 +1,81 @@
let services = [];
getServices();
async function getServices()
{
await fetch('https://localhost:5001/api/Service')
.then(x => x.json())
.then(y => {
services = y;
console.log(services);
display();
});
}
function display()
{
document.getElementById('lines').innerHTML = '';
services.forEach(t => {
document.getElementById('lines').innerHTML +=
'<tr><td>'
+ t.id +
'</td><td>'
+ t.name +
'</td><td>'
+ '<button colspan="2" type="button" onclick="runQuery(' + t.id + ')">Run</button>'
+ '</td></tr>';
});
}
async function runQuery(id)
{
let results = []
document.getElementById('resultarea').innerHTML = '';
try
{
await fetch('https://localhost:5001/api/WhoMaintainsService?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>Manager ID</td>' +
'<td class="inputcell"><input type="text" id="in_manager_id" readonly value="' + t.manageR_ID + '"></td>' +
'</tr>' +
'<tr>' +
'<td>Maintainer ID</td>' +
'<td class="inputcell"><input type="text" id="in_maintainer_id" readonly value="' + t.maintaineR_ID + '"></td>' +
'</table>';
});
}
catch (ex)
{
console.log(ex);
document.getElementById('resultarea').innerHTML += '<h2>No results</h2>';
}
}

View File

@@ -2,16 +2,13 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>services</title> <title>Who uses service</title>
<link rel="stylesheet" type="text/css" href="../../style.css"> <link rel="stylesheet" type="text/css" href="../../style.css">
<script src="./script.js"></script> <script src="./script.js"></script>
</head> </head>
<body> <body>
<h1>Services</h1> <h1>Services</h1>
<br> <br>
<a href="#add" class="bookmark">Want to add a new line?</a>
<br>
<br>
<table class="queryresults"> <table class="queryresults">
<thead> <thead>
<tr> <tr>
@@ -20,8 +17,10 @@
<th colspan="2">Actions</th> <th colspan="2">Actions</th>
</tr> </tr>
</thead> </thead>
<tbody id="resultarea"> <tbody id="lines">
</tbody> </tbody>
</table> </table>
<div id="resultarea"></div>
<br> <br>
</body> </body>

View File

@@ -14,10 +14,10 @@ async function getServices()
function display() function display()
{ {
document.getElementById('resultarea').innerHTML = ''; document.getElementById('lines').innerHTML = '';
services.forEach(t => { services.forEach(t => {
document.getElementById('resultarea').innerHTML += document.getElementById('lines').innerHTML +=
'<tr><td>' '<tr><td>'
+ t.id + + t.id +
'</td><td>' '</td><td>'
@@ -31,7 +31,10 @@ function display()
async function runQuery(id) async function runQuery(id)
{ {
let results = [] let results = []
document.getElementById('resultarea').innerHTML = '';
try
{
await fetch('https://localhost:5001/api/WhoUsesService?id=' + id) await fetch('https://localhost:5001/api/WhoUsesService?id=' + id)
.then(x => x.json()) .then(x => x.json())
.then(y => { .then(y => {
@@ -39,16 +42,37 @@ async function runQuery(id)
console.log(results); console.log(results);
}); });
document.getElementById('resultarea').innerHTML = ''; document.getElementById('resultarea').innerHTML += '<h2>Query results</h2>';
results.forEach(t => { results.forEach(t => {
document.getElementById('resultarea').innerHTML += document.getElementById('resultarea').innerHTML +=
'<h2>Query results</h2>' + '<table class="inputs">' +
'<table>' +
'<tr>' + '<tr>' +
'<td>ID</td>' + '<td>ID</td>' +
'<td>Client</td>' + '<td class="inputcell"><input type="text" id="in_id" readonly value="' + t.id + '"></td>' +
'</tr>'; '</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>';
}
} }

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Who works in a team</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
<script src="./script.js"></script>
</head>
<body>
<h1>Teams</h1>
<br>
<table class="queryresults">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th colspan="2">Actions</th>
</tr>
</thead>
<tbody id="lines">
</tbody>
</table>
<div id="resultarea"></div>
<br>
</body>

View File

@@ -0,0 +1,81 @@
let teams = [];
getTeams();
async function getTeams()
{
await fetch('https://localhost:5001/api/MaintainerTeam')
.then(x => x.json())
.then(y => {
teams = y;
console.log(teams);
display();
});
}
function display()
{
document.getElementById('lines').innerHTML = '';
teams.forEach(t => {
document.getElementById('lines').innerHTML +=
'<tr><td>'
+ t.id +
'</td><td>'
+ t.name +
'</td><td>'
+ '<button colspan="2" type="button" onclick="runQuery(' + t.id + ')">Run</button>'
+ '</td></tr>';
});
}
async function runQuery(id)
{
let results = []
document.getElementById('resultarea').innerHTML = '';
try
{
await fetch('https://localhost:5001/api/WhoWorksInMaintainerTeam?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>Manager ID</td>' +
'<td class="inputcell"><input type="text" id="in_manager_id" readonly value="' + t.manageR_ID + '"></td>' +
'</tr>' +
'<tr>' +
'<td>Maintainer ID</td>' +
'<td class="inputcell"><input type="text" id="in_maintainer_id" readonly value="' + t.maintaineR_ID + '"></td>' +
'</table>';
});
}
catch (ex)
{
console.log(ex);
document.getElementById('resultarea').innerHTML += '<h2>No results</h2>';
}
}

View File

@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Company Manager</title> <title>Company Database Manager</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
</head> </head>
<body> <body>

View File

@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>services</title> <title>Services</title>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<script src="services.js"></script> <script src="services.js"></script>
</head> </head>