Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
807f1de774 | |||
677874a0e1 | |||
81fc7ade5f | |||
b941819b73 | |||
dcc1336d62 | |||
99bd1841cb | |||
16f8c23c38 | |||
cb84e3cdc0 | |||
ca734fda32 | |||
4f6d3de79c | |||
bf245e215a | |||
443eb9ef00 | |||
ce38d6cf24 | |||
5c8f057843 | |||
85afd501ce | |||
4dbc156439 | |||
fd3e8751fe | |||
21ea1aa56f
|
|||
eefc8d5b21
|
|||
41010b8a7b | |||
43583fb7f3 | |||
1f5b4163e7 | |||
38d3381ecd
|
|||
db769ca053
|
|||
536e933fef
|
|||
d469a7cf2c
|
|||
d308fd662a
|
|||
a9a8a36cb9
|
|||
845e4ec673
|
@ -10,10 +10,29 @@ steps:
|
||||
from_secret: container_registry_username
|
||||
password:
|
||||
from_secret: container_registry_password
|
||||
build_args:
|
||||
- VERSION_ID1=${CI_COMMIT_SHA}
|
||||
- VERSION_ID2=${CI_COMMIT_TAG}
|
||||
dockerfile: Dockerfile
|
||||
when:
|
||||
- event: [push, tag]
|
||||
|
||||
deploytest:
|
||||
image: portainer/kubectl-shell:latest
|
||||
secrets:
|
||||
- source: kube_config
|
||||
target: KUBE_CONFIG_CONTENT
|
||||
- source: encryption_key
|
||||
target: ENCRYPTION_KEY
|
||||
- source: secrets_checksum
|
||||
target: MD5_CHECKSUM
|
||||
commands:
|
||||
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
|
||||
- export KUBECONFIG=/tmp/kubeconfig
|
||||
- ./deployment/deploy.sh test
|
||||
when:
|
||||
- event: [push, tag]
|
||||
|
||||
deploy:
|
||||
image: portainer/kubectl-shell:latest
|
||||
secrets:
|
||||
|
@ -1,6 +1,8 @@
|
||||
FROM python:3.12-alpine3.19
|
||||
|
||||
ARG APP_DIR="/opt/app"
|
||||
ARG VERSION_ID1="x"
|
||||
ARG VERSION_ID2="alpha"
|
||||
|
||||
COPY ./src/ ${APP_DIR}/
|
||||
COPY start.sh ${APP_DIR}/
|
||||
@ -9,7 +11,10 @@ WORKDIR ${APP_DIR}
|
||||
|
||||
RUN \
|
||||
apk add --no-cache build-base libpq-dev && \
|
||||
pip install -r requirements.txt
|
||||
pip install -r requirements.txt && \
|
||||
if [ "${VERSION_ID2}" != "" ]; then VERSION_ID=${VERSION_ID2}; else VERSION_ID=${VERSION_ID1}; fi && \
|
||||
sed -i -e 's/VERSION_ID/'$VERSION_ID'/' ${APP_DIR}/templates/index.html && \
|
||||
sed -i -e 's/VERSION_ID/'"$VERSION_ID"'/' ${APP_DIR}/templates/nutrition.html
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
|
||||
if [ "$ENCRYPTION_KEY" = "" ]; then
|
||||
echo "ENCRYPTION_KEY not set"
|
||||
exit 1
|
||||
@ -10,6 +12,7 @@ if [ "$MD5_CHECKSUM" = "" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
SECRETS_CIPHERTEXT_FILE=secrets.enc
|
||||
SECRETS_PLAINTEXT_FILE=/tmp/secrets
|
||||
TMP_FILE=`mktemp`
|
||||
|
@ -46,10 +46,10 @@ metadata:
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- nutri.hottis.de
|
||||
- nutri%POSTFIX%.hottis.de
|
||||
secretName: nutri-cert
|
||||
rules:
|
||||
- host: nutri.hottis.de
|
||||
- host: nutri%POSTFIX%.hottis.de
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
|
@ -1,13 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" == "test" ]; then
|
||||
POSTFIX="-test"
|
||||
IMAGE_TAG=${CI_COMMIT_SHA}
|
||||
else
|
||||
POSTFIX=""
|
||||
fi
|
||||
|
||||
if [ "$IMAGE_TAG" == "" ]; then
|
||||
echo "Make sure IMAGE_TAG is set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
IMAGE_NAME=gitea.hottis.de/moerp/elo-rezept-rechner
|
||||
NAMESPACE=moerp
|
||||
NAMESPACE=moerp${POSTFIX}
|
||||
DEPLOYMENT_DIR=$PWD/deployment
|
||||
|
||||
pushd $DEPLOYMENT_DIR > /dev/null
|
||||
@ -15,7 +21,7 @@ pushd $DEPLOYMENT_DIR > /dev/null
|
||||
. /tmp/secrets
|
||||
rm /tmp/secrets
|
||||
|
||||
CLIENT_SECRETS=`cat oidc-config.json | sed -e's!%CLIENT_SECRET%!'$CLIENT_SECRET'!'`
|
||||
CLIENT_SECRETS=`cat oidc-config${POSTFIX}.json | sed -e's!%CLIENT_SECRET%!'$CLIENT_SECRET'!'`
|
||||
|
||||
kubectl create namespace $NAMESPACE \
|
||||
--dry-run=client \
|
||||
@ -37,6 +43,7 @@ kubectl create secret generic nutri-secrets \
|
||||
|
||||
cat $DEPLOYMENT_DIR/deploy-yml.tmpl | \
|
||||
sed -e 's,%IMAGE%,'$IMAGE_NAME':'$IMAGE_TAG','g | \
|
||||
sed -e 's,%POSTFIX%,'$POSTFIX','g | \
|
||||
kubectl apply -f - -n $NAMESPACE
|
||||
|
||||
popd > /dev/null
|
||||
|
13
deployment/oidc-config-test.json
Normal file
13
deployment/oidc-config-test.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"web": {
|
||||
"issuer": "https://auth2.hottis.de/realms/hottis",
|
||||
"auth_uri": "https://auth2.hottis.de/ealms/hottis/protocol/openid-connect/auth",
|
||||
"client_id": "nutri",
|
||||
"client_secret": "%CLIENT_SECRET%",
|
||||
"redirect_uris": [
|
||||
"https://nutri-test.hottis.de/*"
|
||||
],
|
||||
"userinfo_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/userinfo",
|
||||
"token_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/token"
|
||||
}
|
||||
}
|
30
src/Run.py
30
src/Run.py
@ -19,7 +19,7 @@ app.config.update({
|
||||
})
|
||||
|
||||
oidc = OpenIDConnect(app)
|
||||
|
||||
app.logger.handlers = logging.getLogger('gunicorn.error').handlers
|
||||
|
||||
def calculate_nutrition(food, weight):
|
||||
try:
|
||||
@ -65,7 +65,7 @@ def get_products():
|
||||
try:
|
||||
conn = psycopg2.connect()
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute('SELECT name FROM nutrition_table')
|
||||
cursor.execute('SELECT name FROM nutrition_table ORDER BY name')
|
||||
products = cursor.fetchall()
|
||||
return {'products': [product[0] for product in products]}
|
||||
finally:
|
||||
@ -107,6 +107,8 @@ def convert_decimal(value):
|
||||
@app.route('/add_nutrition', methods=['POST'])
|
||||
@oidc.accept_token(['openid'])
|
||||
def add_nutrition():
|
||||
app.logger.info("add_nutrition")
|
||||
|
||||
food = request.form.get('food')
|
||||
kcal = convert_decimal(request.form.get('kcal'))
|
||||
ew = convert_decimal(request.form.get('ew'))
|
||||
@ -173,8 +175,30 @@ def get_database_entries():
|
||||
if conn:
|
||||
conn.close()
|
||||
|
||||
app = ProxyFix(app, x_for=1, x_host=1)
|
||||
|
||||
@app.route('/delete_nutrition', methods=['POST'])
|
||||
@oidc.accept_token(['openid'])
|
||||
def delete_nutrition():
|
||||
data = request.get_json()
|
||||
foodNames = data['foodNames']
|
||||
|
||||
if not foodNames:
|
||||
return jsonify({'error': 'Keine Lebensmittel zum Löschen angegeben'}), 400
|
||||
|
||||
try:
|
||||
conn = psycopg2.connect()
|
||||
with conn.cursor() as cursor:
|
||||
query = "DELETE FROM nutrition_table WHERE name = ANY(%s)"
|
||||
cursor.execute(query, (foodNames,))
|
||||
conn.commit()
|
||||
return jsonify({'message': 'Erfolgreich gelöscht'}), 200
|
||||
except Exception as e:
|
||||
return jsonify({'error': str(e)}), 500
|
||||
finally:
|
||||
if conn:
|
||||
conn.close()
|
||||
|
||||
|
||||
exposed_app = ProxyFix(app, x_for=1, x_host=1)
|
||||
|
||||
|
||||
|
@ -46,13 +46,30 @@ button#remove-button:not(:disabled):hover {
|
||||
background-color: #490000; /* Dunkleres Rot */
|
||||
}
|
||||
|
||||
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-collapse: separate; /* Erlaubt die Anwendung von border-radius */
|
||||
border-spacing: 0;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
table th:first-child {
|
||||
border-top-left-radius: 10px;
|
||||
}
|
||||
|
||||
table th:last-child {
|
||||
border-top-right-radius: 10px;
|
||||
}
|
||||
|
||||
table tr:last-child td:first-child {
|
||||
border-bottom-left-radius: 10px;
|
||||
}
|
||||
|
||||
table tr:last-child td:last-child {
|
||||
border-bottom-right-radius: 10px;
|
||||
}
|
||||
|
||||
|
||||
table, th, td {
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
@ -72,7 +89,7 @@ tr:nth-child(even) {
|
||||
}
|
||||
|
||||
.selected, tr.selected {
|
||||
background-color: #e5b5b5; /* Hervorhebung der Auswahl */
|
||||
background-color: #efcccc; /* Hervorhebung der Auswahl */
|
||||
}
|
||||
|
||||
tr:hover:not(.selected) {
|
||||
@ -89,9 +106,20 @@ tr:hover:not(.selected) {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#navbar .navbar-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#navbar h1 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#navbar .versionid {
|
||||
margin-left: 20px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#navbar ul {
|
||||
@ -113,13 +141,10 @@ tr:hover:not(.selected) {
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
#navbar a:hover {
|
||||
#navbar a:hover, #navbar a.active {
|
||||
background-color: #007344; /* Etwas helleres Grün */
|
||||
}
|
||||
|
||||
#navbar a.active {
|
||||
background-color: #008C50; /* Mittleres Grün */
|
||||
}
|
||||
|
||||
|
||||
.content {
|
||||
@ -130,10 +155,8 @@ tr:hover:not(.selected) {
|
||||
}
|
||||
|
||||
|
||||
#nutrition-input-table {
|
||||
width: 100%; /* Tabelle nimmt die volle Breite ein */
|
||||
border-collapse: collapse; /* Entfernt doppelte Ränder */
|
||||
}
|
||||
|
||||
|
||||
|
||||
#nutrition-input-table th, #nutrition-input-table td {
|
||||
border: 1px solid #ddd; /* Fügt Ränder hinzu */
|
||||
@ -153,16 +176,17 @@ tr:hover:not(.selected) {
|
||||
}
|
||||
}
|
||||
|
||||
#table-container {
|
||||
.table-container {
|
||||
overflow-y: auto;
|
||||
max-height: 400px; /* Passen Sie die Höhe nach Bedarf an */
|
||||
max-height: 500px; /* Passen Sie die Höhe nach Bedarf an */
|
||||
border-radius: 10px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#database-nutrition-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-collapse: separate; /* Erlaubt die Anwendung von border-radius */
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
#database-nutrition-table th, #database-nutrition-table td {
|
||||
@ -172,7 +196,7 @@ tr:hover:not(.selected) {
|
||||
}
|
||||
|
||||
#database-nutrition-table tr.selected {
|
||||
background-color: #f0e68c;
|
||||
background-color: #efcccc;
|
||||
}
|
||||
|
||||
|
||||
@ -183,34 +207,28 @@ tr:hover:not(.selected) {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#password-prompt input[type="password"] {
|
||||
padding: 8px;
|
||||
margin-right: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#password-prompt button {
|
||||
padding: 8px 15px;
|
||||
margin-right: 10px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#password-prompt button[type="submit"] {
|
||||
background-color: #008C50; /* Helles Grün */
|
||||
}
|
||||
|
||||
#password-prompt button[type="submit"]:hover {
|
||||
background-color: #007344; /* Dunkleres Grün */
|
||||
}
|
||||
|
||||
#password-prompt button[type="button"] {
|
||||
button#delete-row-button {
|
||||
background-color: #640000; /* Helles Rot */
|
||||
}
|
||||
|
||||
#password-prompt button[type="button"]:hover {
|
||||
button#delete-row-button:disabled {
|
||||
background-color: #cccccc;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
button#delete-row-button:not(:disabled):hover {
|
||||
background-color: #490000; /* Dunkleres Rot */
|
||||
}
|
||||
|
||||
button#cancel-button {
|
||||
background-color: #640000; /* Helles Rot */
|
||||
}
|
||||
|
||||
button#cancel-button:disabled {
|
||||
background-color: #cccccc;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
button#cancel-button:not(:disabled):hover {
|
||||
background-color: #490000; /* Dunkleres Rot */
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Nährwertberechnungs-App</title>
|
||||
<title>Elo's Rezept Rechner</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
|
||||
<link rel="shortcut icon" href="../static/images/favicon.ico">
|
||||
|
||||
@ -175,7 +175,10 @@ function updateTotalNutrition() {
|
||||
</head>
|
||||
<body>
|
||||
<nav id="navbar">
|
||||
<h1>Elo's Rezept Rechner</h1>
|
||||
<div class="navbar-header">
|
||||
<h1>Elo's Rezept Rechner</h1>
|
||||
<li class="versionid">VERSION_ID</li>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="/" class="active">Rechner</a></li>
|
||||
<li><a href="/nutrition">Neue Lebensmittel</a></li>
|
||||
@ -232,4 +235,4 @@ function updateTotalNutrition() {
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Neue Lebensmittel hinzufügen</title>
|
||||
<title>Elo's Rezept Rechner</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
|
||||
<link rel="shortcut icon" href="../static/images/favicon.ico">
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
// Beispielsweise das Formular zurücksetzen
|
||||
form.reset();
|
||||
updateSubmitButtonState();
|
||||
loadDatabaseEntries();
|
||||
}).catch(error => {
|
||||
console.error('Fehler:', error);
|
||||
});
|
||||
@ -69,14 +70,34 @@
|
||||
|
||||
function deleteSelectedRows() {
|
||||
const table = document.getElementById('database-nutrition-table');
|
||||
Array.from(table.rows).forEach(row => {
|
||||
if (row.classList.contains('selected')) {
|
||||
// Logik zum Löschen der Zeile aus der Datenbank
|
||||
table.deleteRow(row.rowIndex);
|
||||
}
|
||||
});
|
||||
const selectedRows = Array.from(table.querySelectorAll('tr.selected'));
|
||||
const foodNames = selectedRows.map(row => row.cells[0].innerText); // Annahme, der Name des Lebensmittels befindet sich in der ersten Zelle
|
||||
|
||||
if (foodNames.length > 0) {
|
||||
// Holen des Tokens und Senden einer Anfrage an das Backend, um die Einträge zu löschen
|
||||
getBearerToken(token => {
|
||||
fetch('/delete_nutrition', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token
|
||||
},
|
||||
body: JSON.stringify({foodNames: foodNames})
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
// Erfolgreich gelöscht, entferne Zeilen aus der Tabelle
|
||||
selectedRows.forEach(row => {
|
||||
table.deleteRow(row.rowIndex);
|
||||
});
|
||||
} else {
|
||||
console.error('Fehler beim Löschen der Datenbank-Einträge');
|
||||
}
|
||||
}).catch(error => console.error('Fehler:', error));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function showPasswordPrompt() {
|
||||
document.getElementById('delete-row-button').style.display = 'none';
|
||||
document.getElementById('password-prompt').style.display = 'block';
|
||||
@ -89,7 +110,7 @@
|
||||
|
||||
function deleteRowsIfPasswordCorrect() {
|
||||
const password = document.getElementById('password-input').value;
|
||||
if (password === 'wowmuchsecurity') {
|
||||
if (password === 'geheim') {
|
||||
deleteSelectedRows(); // Funktion, die die ausgewählten Zeilen löscht
|
||||
hidePasswordPrompt();
|
||||
} else {
|
||||
@ -98,7 +119,7 @@
|
||||
}
|
||||
|
||||
function updateDeleteButtonState() {
|
||||
const selectedRows = document.querySelectorAll('#nutrition-table .selected').length;
|
||||
const selectedRows = document.querySelectorAll('#database-nutrition-table .selected').length;
|
||||
const deleteButton = document.getElementById('delete-row-button');
|
||||
deleteButton.disabled = selectedRows === 0;
|
||||
if (selectedRows === 0) {
|
||||
@ -107,11 +128,13 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
function loadDatabaseEntries() {
|
||||
fetch('/get_database_entries') // Pfad zur entsprechenden Flask-Route
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const tableBody = document.getElementById('database-nutrition-table').getElementsByTagName('tbody')[0];
|
||||
tableBody.innerHTML = '';
|
||||
data.forEach(entry => {
|
||||
const row = tableBody.insertRow();
|
||||
row.insertCell(0).innerHTML = entry.food;
|
||||
@ -128,46 +151,74 @@
|
||||
.catch(error => console.error('Fehler:', error));
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', loadDatabaseEntries);
|
||||
document.addEventListener('DOMContentLoaded', loadDatabaseEntries);
|
||||
|
||||
function filterTable() {
|
||||
const searchInput = document.getElementById('search-input');
|
||||
const filterText = searchInput.value.toUpperCase();
|
||||
const table = document.getElementById('database-nutrition-table');
|
||||
const rows = table.getElementsByTagName('tr');
|
||||
|
||||
for (let i = 1; i < rows.length; i++) { // Beginnen bei 1, um die Kopfzeile auszulassen
|
||||
const cell = rows[i].getElementsByTagName('td')[0]; // Angenommen, der zu suchende Text befindet sich in der ersten Spalte
|
||||
if (cell) {
|
||||
const textValue = cell.textContent || cell.innerText;
|
||||
if (textValue.toUpperCase().indexOf(filterText) > -1) {
|
||||
rows[i].style.display = ""; // Zeile anzeigen
|
||||
} else {
|
||||
rows[i].style.display = "none"; // Zeile verstecken
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<nav id="navbar">
|
||||
<h1>Elo's Rezept Rechner</h1>
|
||||
<div class="navbar-header">
|
||||
<h1>Elo's Rezept Rechner</h1>
|
||||
<li class="versionid">VERSION_ID</li>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="/">Rechner</a></li>
|
||||
<li><a href="/nutrition" class="active">Neue Lebensmittel</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="content">
|
||||
<form onsubmit="event.preventDefault(); addNutritionEntry();" method="POST" id="nutrition-form">
|
||||
<table id="nutrition-input-table">
|
||||
<tr>
|
||||
<th>Lebensmittel</th>
|
||||
<th>kcal</th>
|
||||
<th>EW</th>
|
||||
<th>Fett</th>
|
||||
<th>KH</th>
|
||||
<th>BST</th>
|
||||
<th>CA</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" name="food" placeholder="Lebensmittel" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="kcal" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="ew" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="fett" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="kh" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="bst" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="ca" pattern="\d+([.,]\d{1,2})?" placeholder="mg" oninput="updateSubmitButtonState()"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="nutrition-input-table">
|
||||
<tr>
|
||||
<th>Lebensmittel</th>
|
||||
<th>kcal</th>
|
||||
<th>EW</th>
|
||||
<th>Fett</th>
|
||||
<th>KH</th>
|
||||
<th>BST</th>
|
||||
<th>CA</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" name="food" placeholder="Lebensmittel" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="kcal" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="ew" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="fett" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="kh" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="bst" pattern="\d+([.,]\d{1,2})?" placeholder="g" oninput="updateSubmitButtonState()"></td>
|
||||
<td><input <input type="text" name="ca" pattern="\d+([.,]\d{1,2})?" placeholder="mg" oninput="updateSubmitButtonState()"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="submit" id="submit-button" disabled>Hinzufügen</button>
|
||||
</form>
|
||||
|
||||
<div id="table-container">
|
||||
<div class="search-container">
|
||||
<input type="text" id="search-input" placeholder="Lebensmittel suchen..." oninput="filterTable()">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="table-container">
|
||||
<table id="database-nutrition-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -189,8 +240,8 @@ document.addEventListener('DOMContentLoaded', loadDatabaseEntries);
|
||||
|
||||
<div id="password-prompt" style="display: none;">
|
||||
<input type="password" id="password-input" placeholder="Passwort">
|
||||
<button onclick="deleteRowsIfPasswordCorrect()">OK</button>
|
||||
<button onclick="hidePasswordPrompt()">Abbrechen</button>
|
||||
<button id="ok-button" onclick="deleteRowsIfPasswordCorrect()">OK</button>
|
||||
<button id="cancel-button" onclick="hidePasswordPrompt()">Abbrechen</button>
|
||||
</div>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user