Volledig samengevoegd

This commit is contained in:
Atilla
2024-03-20 08:55:47 +01:00
parent be5250c413
commit a60f14853f
10 changed files with 980 additions and 563 deletions

102
app.js
View File

@@ -1,70 +1,66 @@
const { app, BrowserWindow, ipcMain } = require('electron');
const express = require('express');
const bodyParser = require('body-parser');
const { PythonShell } = require('python-shell');
const path = require('path');
const { app, BrowserWindow, ipcMain } = require("electron");
const express = require("express");
const bodyParser = require("body-parser");
const { PythonShell } = require("python-shell");
const path = require("path");
const urlElectron = path.join(__dirname, "src/index.html");
// Create an Express app
const server = express();
server.use(bodyParser.urlencoded({ extended: true }));
// Define a route for form POST requests
server.post('/submit-form', (req, res) =>
{
server.post("/submit-form", (req, res) => {
const { plant_naam, plantensoort } = req.body;
const plant_geteelt = req.body.plant_geteelt == 'true' ? 'true' : 'false';
const plant_geteelt = req.body.plant_geteelt == "true" ? "true" : "false";
let options =
{
mode: 'text',
args: [plant_naam, plantensoort, plant_geteelt]
let options = {
mode: "text",
args: [plant_naam, plantensoort, plant_geteelt],
};
// Execute Python script with plant name as an argument
PythonShell.run('src/py/script/db_connect_form.py', options, (err, results) =>
{
if (err)
{
PythonShell.run(
"src/py/script/db_connect_form.py",
options,
(err, results) => {
if (err) {
console.error(err);
res.send('Er is een fout opgetreden');
res.send("Er is een fout opgetreden");
} else {
console.log("Python script uitvoering resultaten:", results);
res.send("Formulier succesvol verwerkt");
}
else
{
console.log('Python script uitvoering resultaten:', results);
res.send('Formulier succesvol verwerkt');
}
});
);
});
// Start the server
const PORT = 3000;
server.listen(PORT, () =>
{
server.listen(PORT, () => {
console.log(`Server is listening on port ${PORT}`);
});
let mainWindow;
// Create the Electron application window
function createWindow()
{
mainWindow = new BrowserWindow(
{
function createWindow() {
mainWindow = new BrowserWindow({
width: 1280,
height: 800,
frame: false,
webPreferences:
{
icon: path.join(__dirname, "src/py/static/images/logo.png"),
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
webSecurity: true,
}
},
});
mainWindow.loadFile(path.join(__dirname, 'src', 'py', 'templates', 'index.html'));
mainWindow.loadFile(
path.join(__dirname, "src", "py", "templates", "index.html")
);
// IPC event listeners for running Python scripts and updating HTML data
setupIpcMainListeners();
@@ -74,44 +70,40 @@ function createWindow()
app.whenReady().then(createWindow);
// Close the app when all windows are closed, except on macOS
app.on('window-all-closed', () =>
{
if (process.platform !== 'darwin')
{
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});
// Re-create a window in the app when the dock icon is clicked and there are no other windows open.
app.on('activate', () =>
{
if (BrowserWindow.getAllWindows().length === 0)
{
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
function setupIpcMainListeners()
{
ipcMain.on('run-python-script', (event, args) =>
{
let options =
{
mode: 'text',
function setupIpcMainListeners() {
ipcMain.on("run-python-script", (event, args) => {
let options = {
mode: "text",
args: args,
};
// The actual script path and event replies should be tailored to your application's needs
});
ipcMain.on('request-update-data', (event, args) =>
{
const databaseData = { timestamp: "2022-01-01", gateway_receive_time: "2022-01-01", device: "Device1", value: 50 };
event.reply('update-data-result', { databaseData });
ipcMain.on("request-update-data", (event, args) => {
const databaseData = {
timestamp: "2022-01-01",
gateway_receive_time: "2022-01-01",
device: "Device1",
value: 50,
};
event.reply("update-data-result", { databaseData });
});
ipcMain.on('update-html-data', (event, data) =>
{
mainWindow.webContents.send('update-html-data', data);
ipcMain.on("update-html-data", (event, data) => {
mainWindow.webContents.send("update-html-data", data);
});
}

View File

@@ -1,8 +0,0 @@
# In calculate.py
# Doe je berekeningen hier, vervang 42 door je berekende waarde
calculated_value = 42
# Print het resultaat, dat zal worden gelezen door de PythonShell.run callback
print(calculated_value)

View File

@@ -1,16 +1,26 @@
@import url("https://fonts.googleapis.com/css2?family=Akaya+Kanadaka&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Afacad:ital,wght@0,400..700;1,400..700&display=swap");
h1, h2, h3, h4, h5 {
h1,
h2,
h3,
h4,
h5 {
font-family: "Akaya Kanadaka", system-ui;
margin: 0;
}
p, td {
p,
td {
font-family: "Afacad", sans-serif;
color: black;
}
a {
text-decoration: none;
}
body {
background-image: url("../images/achtergrond.png");
background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)), url("../images/achtergrond.png");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
@@ -24,7 +34,7 @@ body {
body .mainContainer {
width: 85vw;
height: 38rem;
background-color: rgba(255, 255, 255, 0.95);
background-color: rgba(255, 255, 255, 0.85);
border-radius: 40px;
padding: 2rem;
}
@@ -65,6 +75,7 @@ body .mainContainer .mainBorder #sectie-1 .parent-algemeen-overzicht {
border-radius: 40px;
padding: 1rem;
margin-top: 1rem;
background-color: white;
}
body .mainContainer .mainBorder #sectie-1 .parent-algemeen-overzicht .algemeen-overzicht {
border: solid 2px rgb(171, 211, 174);
@@ -85,6 +96,7 @@ body .mainContainer .mainBorder #sectie-1 .grafiek {
border-radius: 40px;
padding: 1rem;
position: relative;
background-color: white;
}
body .mainContainer .mainBorder #sectie-1 .grafiek .grafiek-innerbox {
border: solid 2px rgb(171, 211, 174);
@@ -143,7 +155,6 @@ body .mainContainer .mainBorder .content .kant-links #planten td article:hover {
}
body .mainContainer .mainBorder .content .kant-rechts {
grid-column: 3;
margin-right: 2rem;
}
body .mainContainer .mainBorder .content .kant-rechts #metingen {
border: solid 3px rgb(171, 211, 174);
@@ -166,6 +177,7 @@ body .mainContainer .mainBorder .grid-column-2 {
border-radius: 40px;
padding: 1rem;
margin: 3.25rem 1rem 1.25rem 1rem;
background-color: white;
}
body .mainContainer .mainBorder .grid-column-2 .grid-2-child {
border: solid 2px rgb(171, 211, 174);
@@ -206,7 +218,6 @@ body .mainContainer .mainBorder .grid-column-2 .grid-2-child .parent-table .kas-
top: -20px;
}
/* Divider */
.divider {
display: flex;
justify-content: center;
@@ -216,7 +227,6 @@ body .mainContainer .mainBorder .grid-column-2 .grid-2-child .parent-table .kas-
margin: 0 auto;
}
/* The Modal (background) */
.modal {
display: none;
position: fixed;
@@ -229,17 +239,168 @@ body .mainContainer .mainBorder .grid-column-2 .grid-2-child .parent-table .kas-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 30vw;
height: auto;
border: solid 2px black;
border: solid 2px #abd3ae;
border-radius: 10px;
}
.modal .close {
color: #aaa;
float: right;
font-size: 1.75rem;
font-weight: bold;
}
.modal .close:hover, .modal .close:active {
.modal .close:hover,
.modal .close:active {
color: black;
text-decoration: none;
cursor: pointer;
}
#myModal select,
#myModal input {
width: calc(100% - 20px);
padding: 10px;
margin-bottom: 15px;
border: 2px solid #abd3ae;
border-radius: 5px;
box-sizing: border-box;
}
#myModal .knop {
display: flex;
justify-content: space-between;
}
#myModal button {
width: 48%;
padding: 10px;
box-sizing: border-box;
height: 40px;
}
#myModal .knop-container {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
#myModal .knop-container input,
#myModal .knop-container button {
flex: 1;
margin: 0 5px;
padding: 10px;
box-sizing: border-box;
}
#myModal input[type=text],
#myModal select {
border: 2px solid #abd3ae;
padding: 10px;
border-radius: 17px;
box-sizing: border-box;
}
#myModal input[type=submit],
#myModal button {
color: #fff;
border: none;
border-radius: 15px;
cursor: pointer;
}
#myModal input[type=submit] {
background-color: white;
}
#myModal button {
background-color: white;
color: black;
}
.toevoeging {
background: linear-gradient(45deg, #abd3ae, #2ecc71);
}
.annulatie-knop {
background: linear-gradient(45deg, #ffcc00, #ff6600);
}
#myModal button:hover {
background: linear-gradient(45deg, #abd3ae, #fff);
color: #000;
}
.modal .close {
color: #aaa;
float: right;
font-size: 1.75rem;
font-weight: bold;
}
.modal .close:hover,
.modal .close:active {
color: black;
text-decoration: none;
cursor: pointer;
}
.switch-container {
display: flex;
align-items: end;
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 30px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
border-radius: 34px;
transition: 0.4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
border-radius: 50%;
transition: 0.4s;
}
input:checked + .slider {
background-color: #2ecc71;
}
input:checked + .slider:before {
transform: translateX(26px);
}
.rechterkant {
display: flex;
justify-content: end;
}
.plant-container,
#modalButton {
background-color: white;
}/*# sourceMappingURL=style.css.map */

View File

@@ -1 +1 @@
{"version":3,"sources":["style.scss","style.css"],"names":[],"mappings":"AAAA,iBAAA;AAKQ,mFAAA;AACA,2GAAA;AAgCR;EAEI,wCAhCU;EAiCV,SAAA;ACnCJ;;ADsCA;EAEI,iCApCQ;ACAZ;;ADuCA;EAEI,kDAAA;EACA,4BAAA;EACA,sBAAA;EACA,2BAAA;EAEA,aAAA;EACA,uBAAA;EACA,mBAAA;EACA,aAAA;EACA,SAAA;ACtCJ;ADwCI;EAEI,WAAA;EACA,aAAA;EACA,2CAAA;EACA,mBAAA;EACA,aAAA;ACvCR;ADyCQ;EAGI,kBAAA;EACA,WAAA;EACA,SAAA;EACA,WAAA;EACA,2BAAA;ACzCZ;AD4CQ;EAEI,aAAA;EACA,8BAAA;AC3CZ;AD8CQ;EAEI,uBAAA;EACA,aAAA;EACA,oCAAA;EACA,mBAAA;AC7CZ;AD+CY;EAEI,eAAA;EACA,mBAAA;AC9ChB;ADiDY;EAEI,aAAA;EACA,sBAAA;EACA,SAAA;EACA,wBAAA;EACA,kBAAA;AChDhB;ADkDgB;EAlFZ,2CAAA;EAKA,mBAAA;EAiFgB,aAAA;EACA,gBAAA;ACjDpB;ADoDoB;EA/FhB,oCAAA;EAeA,mBAAA;EAoFoB,kBAAA;EACA,oBAAA;ACnDxB;ADsDwB;EAEI,WAAA;ACrD5B;ADuD4B;EAEI,aAAA;EACA,8BAAA;EACA,gBAAA;ACtDhC;AD8DgB;EAlHZ,2CAAA;EAKA,mBAAA;EAiHgB,aAAA;EACA,kBAAA;AC7DpB;AD+DoB;EA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ADiIA;EACE,aAAA;EACA,gBAAA;AC9HF;;ADiIA;EACE,kBAAA;EACA,qBAAA;EACA,WAAA;EACA,YAAA;AC9HF;;ADiIA;EACE,UAAA;EACA,QAAA;EACA,SAAA;AC9HF;;ADiIA;EACE,kBAAA;EACA,eAAA;EACA,MAAA;EACA,OAAA;EACA,QAAA;EACA,SAAA;EACA,sBAAA;EACA,mBAAA;EACA,gBAAA;AC9HF;;ADiIA;EACE,kBAAA;EACA,WAAA;EACA,YAAA;EACA,WAAA;EACA,SAAA;EACA,WAAA;EACA,uBAAA;EACA,kBAAA;EACA,gBAAA;AC9HF;;ADiIA;EACE,yBAAA;AC9HF;;ADiIA;EACE,2BAAA;AC9HF;;ADiIA;EACE,aAAA;EACA,oBAAA;AC9HF;;ADiIE;;EAGE,uBAAA;AC/HJ","file":"style.css"}

View File

@@ -1,8 +1,8 @@
$primary-color: rgb(171, 211, 174);
$secondary-color: rgb(143, 188, 143);
@import url('https://fonts.googleapis.com/css2?family=Akaya+Kanadaka&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Afacad:ital,wght@0,400..700;1,400..700&display=swap');
@import url("https://fonts.googleapis.com/css2?family=Akaya+Kanadaka&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Afacad:ital,wght@0,400..700;1,400..700&display=swap");
$font-titels: "Akaya Kanadaka", system-ui;
@@ -34,20 +34,31 @@ $font-text: "Afacad", sans-serif;
border-radius: 35px;
}
h1, h2, h3, h4, h5
h1,
h2,
h3,
h4,
h5
{
font-family: $font-titels;
margin: 0;
}
p, td
p,
td
{
font-family: $font-text;
color: black;
}
a
{
text-decoration: none;
}
body
{
background-image: url("../images/achtergrond.png");
background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)), url("../images/achtergrond.png");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
@@ -62,7 +73,7 @@ body
{
width: 85vw;
height: 38rem;
background-color: rgb(255, 255, 255, 95%);
background-color: rgb(255, 255, 255, 85%);
border-radius: 40px;
padding: 2rem;
@@ -114,14 +125,14 @@ body
@include border-radius;
padding: 1rem;
margin-top: 1rem;
background-color: white;
.algemeen-overzicht
{
@include groene-border;
@include inner-border-radius;
font-size: 1.25rem;
padding: .5rem 1rem;
padding: 0.5rem 1rem;
.table-informatie-kas
{
@@ -143,6 +154,7 @@ body
@include border-radius;
padding: 1rem;
position: relative;
background-color: white;
.grafiek-innerbox
{
@@ -170,13 +182,8 @@ body
}
}
}
<<<<<<< HEAD:src/py/static/css/style.scss
}
=======
}
>>>>>>> main:src/css/style.scss
.content
{
display: grid;
@@ -196,16 +203,12 @@ body
td
{
<<<<<<< HEAD:src/py/static/css/style.scss
article
=======
article
>>>>>>> main:src/css/style.scss
{
height: 7rem;
width: 10rem;
padding: .6rem;
margin: .1rem;
padding: 0.6rem;
margin: 0.1rem;
margin-left: 2rem;
display: flex;
flex-direction: column;
@@ -230,55 +233,34 @@ body
{
background-color: lightgray;
}
}
}
}
}
<<<<<<< HEAD:src/py/static/css/style.scss
&-rechts
{
grid-column: 3;
// margin-right: 2rem;
=======
&-rechts
{
grid-column: 3;
margin-right: 2rem;
>>>>>>> main:src/css/style.scss
#metingen
{
border: solid 3px $primary-color;
border-radius: 40px;
#main-waardes
{
display: flex;
<<<<<<< HEAD:src/py/static/css/style.scss
justify-content: space-evenly;
=======
justify-content: space-between;
>>>>>>> main:src/css/style.scss
padding: .5rem;
padding: 0.5rem;
padding-bottom: 0;
width: 100%;
table
{
display: flex;
<<<<<<< HEAD:src/py/static/css/style.scss
justify-content: space-around;
// width: 100%;
=======
justify-content: space-between;
width: 100%;
>>>>>>> main:src/css/style.scss
}
}
}
@@ -292,6 +274,7 @@ body
@include border-radius;
padding: 1rem;
margin: 3.25rem 1rem 1.25rem 1rem;
background-color: white;
.grid-2-child
{
@@ -299,7 +282,6 @@ body
@include inner-border-radius;
height: 100%;
.parent-table
{
padding: 1.5rem 2rem;
@@ -358,16 +340,13 @@ body
top: -20px;
}
}
}
}
}
}
}
}
/* Divider */
.divider {
display: flex;
justify-content: center;
@@ -377,10 +356,7 @@ body
margin: 0 auto;
}
/* The Modal (background) */
.modal
{
.modal {
display: none;
position: fixed;
z-index: 999;
@@ -392,22 +368,167 @@ body
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 30vw;
height: auto;
border: solid 2px black;
border: solid 2px #abd3ae;
border-radius: 10px;
.close
{
}
.modal .close {
color: #aaa;
float: right;
font-size: 1.75rem;
font-weight: bold;
&:hover,
&:active
{
}
.modal .close:hover,
.modal .close:active {
color: black;
text-decoration: none;
cursor: pointer;
}
}
}
#myModal select,
#myModal input {
width: calc(100% - 20px);
padding: 10px;
margin-bottom: 15px;
border: 2px solid #abd3ae;
border-radius: 5px;
box-sizing: border-box;
}
#myModal .knop {
display: flex;
justify-content: space-between;
}
#myModal button {
width: 48%;
padding: 10px;
box-sizing: border-box;
height: 40px;
}
#myModal .knop-container {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
#myModal .knop-container input,
#myModal .knop-container button {
flex: 1;
margin: 0 5px;
padding: 10px;
box-sizing: border-box;
}
#myModal input[type="text"],
#myModal select {
border: 2px solid #abd3ae;
padding: 10px;
border-radius: 17px;
box-sizing: border-box;
}
#myModal input[type="submit"],
#myModal button {
color: #fff;
border: none;
border-radius: 15px;
cursor: pointer;
}
#myModal input[type="submit"] {
background-color: white;
}
#myModal button {
background-color: white;
color: black;
}
.toevoeging {
background: linear-gradient(45deg, #abd3ae, #2ecc71);
}
.annulatie-knop {
background: linear-gradient(45deg, #ffcc00, #ff6600);
}
#myModal button:hover {
background: linear-gradient(45deg, #abd3ae, #fff);
color: #000;
}
.modal .close {
color: #aaa;
float: right;
font-size: 1.75rem;
font-weight: bold;
}
.modal .close:hover,
.modal .close:active {
color: black;
text-decoration: none;
cursor: pointer;
}
.switch-container {
display: flex;
align-items: end;
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 30px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
border-radius: 34px;
transition: 0.4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
border-radius: 50%;
transition: 0.4s;
}
input:checked + .slider {
background-color: #2ecc71;
}
input:checked + .slider:before {
transform: translateX(26px);
}
.rechterkant {
display: flex;
justify-content: end;
}
.plant-container,
#modalButton
{
background-color: white;
}

View File

@@ -113,3 +113,7 @@ function drawLineChart()
}
drawLineChart();
/////////////////////////////////

View File

@@ -87,35 +87,47 @@ class PlantGrid {
this.grid[row][col] = plant;
});
// Display the grid in the HTML table with id "planten"
this.displayGrid();
}
displayGrid() {
displayGrid()
{
const plantenTable = document.getElementById("planten");
let itemCount = 0; // Counter for the number of items in the grid
this.grid.forEach((row, rowIndex) => {
this.grid.forEach((row, rowIndex) =>
{
const tr = document.createElement("tr");
row.forEach((plant, colIndex) => {
row.forEach((plant, colIndex) =>
{
const td = document.createElement("td");
if (itemCount < 8) {
if (plant) {
if (itemCount < 8)
{
if (plant)
{
// Handle regular plant items
const link = document.createElement("a");
link.href = `planteninfo.html?id=${plant.id}`; // Link naar de planteninfo pagina met plant id als query parameter
const article = document.createElement("article");
article.classList.add("plant-container");
link.appendChild(article); // Voeg het artikel toe aan de link
const img = article.appendChild(document.createElement("img"));
img.src = "../static/images/icon_awesome-apple-alt.png";
const h2 = article.appendChild(document.createElement("h2"));
h2.classList.add("plant-naam");
h2.textContent = plant.plantNaam;
td.appendChild(article);
td.appendChild(link); // Voeg de link toe aan de td
itemCount++;
} else if (rowIndex === this.rows -1 && colIndex === this.cols -1 && itemCount <= 7) {
}
else if (rowIndex === this.rows - 1 && colIndex === this.cols - 1 && itemCount <= 7)
{
// Handle the "Add" button
const article = document.createElement("article");
const img = article.appendChild(document.createElement("img"));
@@ -136,6 +148,7 @@ class PlantGrid {
plantenTable.appendChild(tr);
});
}
}
document.addEventListener("DOMContentLoaded", () => {

View File

@@ -3,6 +3,9 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Dashboard / Planten">
<meta name="author" content="B. Diker, A. Oomen">
<meta name="keywords" content="planten / kas">
<title>Dashboard</title>
<link rel="stylesheet" href="../static/css/style.css">
<script src="../static/js/main.js" defer></script>
@@ -11,7 +14,9 @@
<body>
<section class="mainContainer">
<article>
<a href="index.html">
<img src="../static/images/logo.png" class="goodgarden-logo">
</a>
</article>
<section class="mainBorder">
<section class="content">
@@ -24,34 +29,38 @@
<h2>Tomaat</h2>
</article>
</td>
<td>
<article id="modalButton" onclick="openModal()">
<img id="toevoegen" src="../static/images/Toevoegen.png" alt="">
</article>
</td>
</tr> -->
</table>
<div id="myModal" class="modal">
<span class="close">&times;</span>
<form action="http://localhost:3000/submit-form" method="post" onsubmit="return addplant()">
<div class="formulier">
<div id="myModal" class="modal" style="display: none;">
<h1 id="plant-id">Plant Toevoegen</h1>
<form action="http://localhost:3000/submit-form" method="post">
<label for="plantNaam">Naam van de plant</label><br>
<input type="text" name="plant_naam" id="plantNaam"><br>
<input type="text" name="plant_naam" id="plantNaam">
<label for="plantNaam">Naam van de plant</label>
<label for="plantensoort">Soort van de plant</label><br>
<input type="text" name="plantensoort" id="plantensoort"><br>
<input type="text" name="plantensoort" id="plantensoort">
<label for="plantensoort">Soort van de plant</label>
<label for="aanwezig">Aanwezig in de kas</label><br>
<select name="aanwezig_in_kas">
<option value="ja">Ja</option>
<option value="nee">Nee</option>
</select><br>
<input type="radio" name="plant_geteelt" id="aanwezig" value="true">
<label for="aanwezig">Aanwezig</label>
<input type="radio" name="plant_geteelt" id="afwezig" value="false">
<label for="afwezig">Afwezig</label>
<label for="ontvangenMeldingen">Meldingen ontvangen</label><br>
<select name="ontvangen_meldingen">
<option value="ja">Ja</option>
<option value="nee">Nee</option>
</select><br>
<section class="knop-container">
<br><button class="annulatie-knop" type="button" onclick="closeOverlay()">Annuleren</button>
<input type="submit" value="Submit">
</section>
</form>
</div>
<div id="overlay" onclick="closeOverlay"></div>
</div>
<div id="overlay" onclick="closeOverlay()"></div>
</section>
<!-- White space -->
<section>

View File

@@ -3,14 +3,19 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="../static/css/style.css">
<script src="../src/js/main.js" defer></script>
<meta name="description" content="Kas informatie / Planten" />
<meta name="author" content="B. Diker, A. Oomen" />
<meta name="keywords" content="planten / kas" />
<link rel="stylesheet" href="../static/css/style.css" />
<script src="../static/js/main.js" defer></script>
<title>Informatie Kas</title>
</head>
<body>
<section class="mainContainer">
<article>
<a href="index.html">
<img src="../static/images/logo.png" class="goodgarden-logo">
</a>
</article>
<section class="mainBorder informatie-kas-main-container">
<article>
@@ -42,7 +47,11 @@
<article class="grafiek-innerbox">
<h2>Zonlicht</h2>
<canvas
id="myCanvas" class="canvas-informatie-kas" width="275" height="275"></canvas>
id="myCanvas"
class="canvas-informatie-kas"
width="275"
height="275"
></canvas>
</article>
</article>
</section>
@@ -106,14 +115,12 @@
</section>
</section>
<script>
// JavaScript-code om gegevens op te halen van het PHP-bestand
fetch('get_data.php')
.then(response => response.json())
.then(data => {
document.getElementById('totale_planten').innerHTML = data.totale_planten;
// Voeg andere velden toe op dezelfde manier
})
.catch(error => console.error('Error:', error));
// fetch('get_data.php')
// .then(response => response.json())
// .then(data => {
// document.getElementById('totale_planten').innerHTML = data.totale_planten;
// })
// .catch(error => console.error('Error:', error));
</script>
</body>
</body>
</html>

View File

@@ -0,0 +1,118 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Planteninfo / Planten" />
<meta name="author" content="B. Diker, A. Oomen" />
<meta name="keywords" content="planten / kas" />
<link rel="stylesheet" href="../static/css/style.css" />
<script src="../static/js/main.js" defer></script>
<title>Informatie Kas</title>
</head>
<body>
<section class="mainContainer">
<article>
<a href="index.html">
<img src="../static/images/logo.png" class="goodgarden-logo">
</a>
</article>
<section class="mainBorder informatie-kas-main-container">
<article>
<h1>Informatie Kas</h1>
<section id="sectie-1">
<article class="parent-algemeen-overzicht">
<article class="algemeen-overzicht">
<table class="table-informatie-kas">
<tr class="tr-informatie-kas">
<td>Dagen tot Oogst</td>
<td>12</td>
</tr>
<tr class="tr-informatie-kas">
<td>Dagen in Kas</td>
<td>2</td>
</tr>
<tr class="tr-informatie-kas">
<td>Tevredenheid</td>
<td>80%</td>
</tr>
<tr class="tr-informatie-kas">
<td>Aandachtspunten</td>
<td>1</td>
</tr>
</table>
</article>
</article>
<article class="grafiek">
<article class="grafiek-innerbox">
<h2>Zonlicht</h2>
<canvas
id="myCanvas"
class="canvas-informatie-kas"
width="275"
height="275"
></canvas>
</article>
</article>
</section>
</article>
<article class="grid-column-2">
<article class="grid-2-child">
<section class="parent-table">
<table class="kas-table-1">
<tr>
<td>Aantal geplant:</td>
<td>2</td>
</tr>
<tr>
<td>Succesvolle Oogst:</td>
<td>2</td>
</tr>
<tr>
<td>Gefaalde Oogst:</td>
<td>2</td>
</tr>
</table>
<table class="kas-table-2">
<tr>
<td>Warmste Maand:</td>
<td>n.v.t.</td>
</tr>
<tr>
<td>koudste Maand:</td>
<td>December</td>
</tr>
<tr>
<td>Gemiddelde Bodemtemp.:</td>
<td id="bodem-temperatuur">2˚C</td>
</tr>
<tr>
<td>Gemiddelde Uren Zonlicht:</td>
<td id="battery_voltage">2u</td>
</tr>
</table>
<table class="kas-table-3">
<tr>
<td>Laatste Irrigatie:</td>
<td>2u</td>
</tr>
<tr>
<td>Aankomende Irrigatie:</td>
<td>2u</td>
</tr>
<tr>
<td>Laatste Bemesting</td>
<td>2d</td>
</tr>
<tr>
<td>Aankomende Bemesting:</td>
<td>2w</td>
</tr>
</table>
</section>
</article>
</article>
</section>
</section>
</body>
</html>