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