read and create generic strategy

This commit is contained in:
null
2024-03-08 09:37:27 +01:00
parent 0122e9ed54
commit 1c22fb7b34
4 changed files with 150 additions and 48 deletions
+40
View File
@@ -0,0 +1,40 @@
<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 {{ data.name }}</h2>
<form method="POST" action="{{ data.prefix }}/create?submitted">
<fieldset>
{% for key, value in data.fields.items() %}
{% if key is not in data.computed %}
<label for="{{ key }}">{{ key }}</label>
{% if value == "str" %}
<input type="text" name="{{ key }}">
{% elif value == "float" %}
<input type="number" step="any" name="{{ key }}">
{% elif value == "bool" %}
<input type="checkbox" name="{{ key }}">
{% endif %}
{% endif %}
{% endfor %}
</fieldset>
<fieldset>
<button value="cancel" formmethod="dialog" onclick="window.top.postMessage('close', '*')">Cancel</button>
<button type="submit">Submit</button>
</fieldset>
</form>
</body>
</html>
+46 -40
View File
@@ -1,51 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Trading Zone Website</title>
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/styles.css') }}">
<script type="text/javascript" src="{{ url_for('static', filename='js/main.js') }}" ></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Trading Zone Website</title>
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/styles.css') }}">
<script type="text/javascript" src="{{ url_for('static', filename='js/main.js') }}"></script>
</head>
<body>
<div class="container">
<table id="conditionTable">
<thead>
<tr>
<td colspan="{{ data.headers | length }}"><h2>{{ data.title }}</h2></td>
</tr>
{% if data.items %}
<tr>
{% for header in data.headers %}
<th>{{ header }}</th>
<div class="container">
<dialog>
<iframe frameborder="0"></iframe>
</dialog>
<table>
<thead>
<tr>
<td colspan="{{ data.order | length }}">
<h2>{{ data.title }}</h2>
</td>
</tr>
{% if data.fields %}
<tr>
{% for key in data.order %}
<th>{{ key }}</th>
{% endfor %}
</tr>
{% else %}
<tr>
<th class="nodata">No Data</th>
</tr>
{% endif %}
</thead>
<tbody>
{% for field in data.fields %}
<tr onclick="onOpenDialog('{{ data.prefix }}/{{ field.id }}')">
{% for key in data.order%}
<td>{{ field[key] }}</td>
{% endfor %}
</tr>
{% endfor %}
</tr>
{% else %}
<tr>
<th class="nodata">No Data</th>
</tr>
{% endif %}
</thead>
<tbody>
{% for item in data["items"] %}
<tr onclick="onOpenDialog('{{ data.prefix }}/{{ item.id }}')">
<td>{{ item }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="{{ data.headers | length }}" style="text-align: right;"> <!-- Adjust colspan as per your total columns -->
<button onclick="onOpenDialog('{{ data.prefix }}/create')">Add Item</button>
</td>
</tr>
</tfoot>
</table>
</div>
</tbody>
<tfoot>
<tr>
<td colspan="{{ data.order | length }}" style="text-align: right;">
<button onclick="onOpenDialog('{{ data.prefix }}/create')">Add Item</button>
</td>
</tr>
</tfoot>
</table>
</div>
</body>
</html>