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">
<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>

View File

@@ -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>';
}
}

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">
<head>
<meta charset="UTF-8">
<title>Company Manager</title>
<title>Company Database Manager</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>

View File

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