all crud ops

This commit is contained in:
null
2024-02-27 17:54:36 +01:00
parent 741979aee5
commit 99b78c9bd1
7 changed files with 185 additions and 55 deletions
+29
View File
@@ -0,0 +1,29 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/styles.css') }}">
<style>
body {
background-color: white;
overflow: hidden;
}
</style>
</head>
<body>
<h2>Create a condition</h2>
<form method="POST" action="/conditions">
<fieldset>
<label for="itemDescription">Beschreibung</label>
<input type="text" name="itemDescription">
<label for="itemName">Name</label>
<input type="text" name="itemName">
</fieldset>
<fieldset>
<button value="cancel" formmethod="dialog" onclick="window.top.postMessage('close', '*')">Cancel</button>
<button type="submit">Submit</button>
</fieldset>
</form>
</body>
</html>
+35
View File
@@ -0,0 +1,35 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/styles.css') }}">
<style>
body {
background-color: white;
overflow: hidden;
}
</style>
</head>
<body>
<h2>Update a condition</h2>
<form method="POST" action="/conditions/{{ data.id }}">
<fieldset>
<label>ID</label>
<div>{{ data.id }}</div>
<label for="itemDescription">Beschreibung</label>
<input type="text" name="itemDescription" value="{{ data.itemDescription }}">
<label for="itemName">Name</label>
<input type="text" name="itemName" value="{{ data.itemName }}">
</fieldset>
<fieldset>
<button value="cancel" formmethod="dialog" onclick="window.top.postMessage('close', '*')">Cancel</button>
<button type="submit">Submit</button>
</fieldset>
</form>
<form method="POST" action="/conditions/delete/{{ data.id }}">
<button class="danger" type="submit">Delete</button>
</form>
</body>
</html>
+6 -14
View File
@@ -12,28 +12,20 @@
<body>
<div class="container">
<h1>Conditions</h1>
<dialog id="conditionDialog">
<form method="POST" action="/conditions">
<label for="itemName">Name:</label><br>
<input type="text" id="itemName" name="itemName"><br>
<label for="itemDescription">Description:</label><br>
<textarea id="itemDescription" name="itemDescription"></textarea><br><br>
<button value="cancel" formmethod="dialog">Cancel</button>
<button type="submit">Submit</button>
</form>
<dialog>
<iframe frameborder="0"></iframe>
</dialog>
<table id="conditionTable">
<thead>
<tr>
{% for key, items in data.conditions.model.items() %}
<th>{{ key }}</th>
{% for key, value in data.conditions.model.items() %}
<th>{{ value.name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for item in data.conditions.data %}
<tr>
<tr onclick="document.querySelector('dialog iframe').contentWindow.location='/conditions/{{ item.id }}'">
{% for key, value in item.items() %}
<td>{{ value }}</td>
{% endfor %}
@@ -43,7 +35,7 @@
<tfoot>
<tr>
<td colspan="3" style="text-align: right;"> <!-- Adjust colspan as per your total columns -->
<button onclick="openModal()">Add Item</button>
<button onclick="document.querySelector('dialog iframe').contentWindow.location='/conditions/create'">Add Item</button>
</td>
</tr>
</tfoot>