remove files
This commit is contained in:
parent
02ab93fc53
commit
e33c59ea9c
|
|
@ -1,12 +0,0 @@
|
||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
finfree-be:
|
|
||||||
image: finfree-be
|
|
||||||
volumes:
|
|
||||||
- .:/usr/src/app
|
|
||||||
ports:
|
|
||||||
- "8080:8080"
|
|
||||||
environment:
|
|
||||||
- RETHINKDB_URL=192.168.90.11
|
|
||||||
- RETHINKDB_PORT=40002
|
|
||||||
|
|
@ -1,126 +0,0 @@
|
||||||
<!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="stylesheet" type="text/css" href="{{ url_for('static', filename='css/styles.css') }}">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1>Conditions</h1>
|
|
||||||
<table id="dataTable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<!-- Data will be inserted here dynamically -->
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3" style="text-align: right;"> <!-- Adjust colspan as per your total columns -->
|
|
||||||
<button onclick="openModal()">Add Item</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="myModal" class="modal">
|
|
||||||
<div class="modal-content">
|
|
||||||
<span class="close" onclick="closeModal()">×</span>
|
|
||||||
<h2>Add Condition</h2>
|
|
||||||
<form id="addItemForm" method="POST" action="/conditions">
|
|
||||||
<label for="itemName">Name:</label><br>
|
|
||||||
<input type="text" id="itemName" name="itemName" required><br>
|
|
||||||
<label for="itemDescription">Description:</label><br>
|
|
||||||
<textarea id="itemDescription" name="itemDescription" required></textarea><br><br>
|
|
||||||
<button type="submit">Submit</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<dialog id="editConditionDialog">
|
|
||||||
<form id="editItemForm" method="PUT" 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>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// Sample data to populate the table
|
|
||||||
const data = `{{ data.conditions | tojson }}`;
|
|
||||||
const sampleData = JSON.parse(data)
|
|
||||||
|
|
||||||
|
|
||||||
// Function to populate the table with data
|
|
||||||
function populateTable(data) {
|
|
||||||
const tableBody = document.querySelector('#dataTable tbody');
|
|
||||||
tableBody.innerHTML = '';
|
|
||||||
data.forEach(item => {
|
|
||||||
const row = `<tr onclick="onRowClick('${item.id}')">
|
|
||||||
<td title="${item.id}">${item.id.substr(0,6)}</td>
|
|
||||||
<td>${item.itemName}</td>
|
|
||||||
<td>${item.itemDescription}</td>
|
|
||||||
</tr>`;
|
|
||||||
tableBody.insertAdjacentHTML('beforeend', row);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open modal function
|
|
||||||
function openModal() {
|
|
||||||
document.getElementById('myModal').style.display = 'block';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close modal function
|
|
||||||
function closeModal() {
|
|
||||||
document.getElementById('myModal').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function onRowClick(id) {
|
|
||||||
console.log("row id", id)
|
|
||||||
document.getElementById("editConditionDialog").showModal();
|
|
||||||
const form = document.getElementById("editItemForm");
|
|
||||||
form.action = form.action + "/" + id
|
|
||||||
document.getElementById("itemName").value = "a";
|
|
||||||
document.getElementById("itemDescription").value = "b";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle form submission
|
|
||||||
document.getElementById('addItemForm').addEventListener('submit', function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
const form = event.target.closest('form');
|
|
||||||
const formData = new FormData(form);
|
|
||||||
const json = Array.from(formData.entries()).reduce((acc, [k, v]) => ({...acc, [k]: v}), {});
|
|
||||||
|
|
||||||
const xhr = new XMLHttpRequest();
|
|
||||||
xhr.open('POST', form.action, true);
|
|
||||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
||||||
xhr.onload = console.log
|
|
||||||
xhr.onerror = console.log
|
|
||||||
xhr.send(JSON.stringify(json));
|
|
||||||
|
|
||||||
closeModal();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Initially populate the table with sample data
|
|
||||||
populateTable(sampleData);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
Loading…
Reference in New Issue