New Changes
This commit is contained in:
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
@@ -64,6 +64,7 @@
|
||||
font-size: 14px;
|
||||
}
|
||||
.edit-btn {
|
||||
|
||||
background-color: #28a745;
|
||||
color: white;
|
||||
}
|
||||
|
@@ -1,12 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="utf-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>Helium Output</title>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" />
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" rel="stylesheet"/>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
@@ -123,34 +124,18 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="d-flex justify-content-start mb-2">
|
||||
<!-- "Go to Clients" button at top-left -->
|
||||
<a href="{% url 'clients_list' %}" class="btn btn-outline-primary">
|
||||
⇦ Go to Clients
|
||||
<a class="btn btn-outline-primary" href="{% url 'clients_list' %}">
|
||||
⇦ Go to Clients
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<h2>Helium Output</h2>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Second Table -->
|
||||
<div class="table-container">
|
||||
<button class="add-row-btn" id="add-row-two">Add Row</button>
|
||||
<table id="table-two">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>ID</th>
|
||||
<th>Client</th>
|
||||
<th>Entry 1</th>
|
||||
<th>Entry 2</th>
|
||||
<th>Date Joined</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<thead><tr><th>#</th><th>ID</th><th>Client</th><th>Date</th><th>Warm</th><th>LHe Anlieferung</th><th>LHe Ausgabe</th><th>Comments</th><th>Actions</th></tr></thead>
|
||||
<tbody>
|
||||
{% for entry in entries_table2 %}
|
||||
<tr data-id="{{ entry.id }}">
|
||||
@@ -169,37 +154,59 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add Entry Popup -->
|
||||
<div id="add-popup-two" class="popup">
|
||||
<div id="add-popup-two" class="popup" style="display:none;">
|
||||
<span class="close-btn">×</span>
|
||||
<h3>Add Entry</h3>
|
||||
<label for="add-client-id">Kunde:</label>
|
||||
<select id="add-client-id">
|
||||
{% for client in clients %}
|
||||
<option value="{{ client.id }}">{{ client.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="number" id="add-age" placeholder="Age">
|
||||
<input type="email" id="add-email" placeholder="Email">
|
||||
<button id="save-add-two">Add</button>
|
||||
|
||||
<label for="add-date">Datum:</label>
|
||||
<input type="date" id="add-date">
|
||||
|
||||
<label><input type="checkbox" id="add-warm"> warm</label>
|
||||
|
||||
<label for="add-lhe-anlieferung">LHe Anlieferung:</label>
|
||||
<input type="text" id="add-lhe-anlieferung" placeholder="LHe Anlieferung">
|
||||
|
||||
<label for="add-lhe-ausgabe">LHe Ausgabe:</label>
|
||||
<input type="text" id="add-lhe-ausgabe" placeholder="LHe Ausgabe">
|
||||
|
||||
<label for="add-comment">Kommentar:</label>
|
||||
<textarea id="add-comment" rows="4"></textarea>
|
||||
|
||||
<div style="margin-top: 10px;">
|
||||
<button id="save-add-two">💾 Save</button>
|
||||
<button class="close-btn">❌ Cancel</button>
|
||||
<button id="help-btn">❓ Help</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Edit Entry Popup -->
|
||||
<div id="edit-popup-two" class="popup">
|
||||
<span class="close-btn">×</span>
|
||||
<div class="popup" id="edit-popup-two">
|
||||
<span class="close-btn">×</span>
|
||||
<h3>Edit Entry</h3>
|
||||
<input type="hidden" id="edit-id">
|
||||
<input id="edit-id" type="hidden"/>
|
||||
<label for="edit-client-id">Kunde:</label>
|
||||
<select id="edit-client-id">
|
||||
{% for client in clients %}
|
||||
<option value="{{ client.id }}">{{ client.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="number" id="edit-age" placeholder="Age">
|
||||
<input type="email" id="edit-email" placeholder="Email">
|
||||
<label><input id="edit-warm" type="checkbox"/> warm</label>
|
||||
<input id="edit-anlieferung" placeholder="LHe Anlieferung" type="text"/>
|
||||
<input id="edit-ausgabe" placeholder="LHe Ausgabe" type="text"/>
|
||||
<textarea id="edit-comments" placeholder="Comments" rows="4"></textarea>
|
||||
<button id="save-edit-two">Save</button>
|
||||
<button class="close-btn">Cancel</button>
|
||||
<button id="help-btn-edit-two">Help</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
let currentTableId = null; // To track which table is being edited
|
||||
@@ -219,40 +226,50 @@
|
||||
|
||||
// Save Add Entry
|
||||
$('#save-add-two').on('click', function () {
|
||||
let client_id = $('#add-client-id').val(); // ✅ Correct variable
|
||||
let age = $('#add-age').val();
|
||||
let email = $('#add-email').val();
|
||||
let client_id = $('#add-client-id').val();
|
||||
let date = $('#add-date').val();
|
||||
let warm = $('#add-warm').is(':checked') ? 1 : 0;
|
||||
let lhe_anlieferung = $('#add-lhe-anlieferung').val();
|
||||
let lhe_ausgabe = $('#add-lhe-ausgabe').val();
|
||||
let comment = $('#add-comment').val();
|
||||
|
||||
$.ajax({
|
||||
url: `/add-entry/${currentModelName}/`,
|
||||
url: '/add-entry/SecondTableEntry/',
|
||||
method: 'POST',
|
||||
data: {
|
||||
'client_id': client_id, // ✅ REPLACE 'name' with this
|
||||
'age': age,
|
||||
'email': email,
|
||||
'client_id': client_id,
|
||||
'date': date,
|
||||
'warm': warm,
|
||||
'lhe_anlieferung': lhe_anlieferung,
|
||||
'lhe_ausgabe': lhe_ausgabe,
|
||||
'comment': comment,
|
||||
'csrfmiddlewaretoken': '{{ csrf_token }}'
|
||||
},
|
||||
success: function (response) {
|
||||
let rowCount = $('#table-two tbody tr').length + 1;
|
||||
let rowCount = $('tbody tr').length + 1;
|
||||
let newRow = `
|
||||
<tr data-id="${response.id}">
|
||||
<td>${rowCount}</td> <!-- Serial # -->
|
||||
<td>${response.id}</td> <!-- ID -->
|
||||
<td>${response.client_name}</td> <!-- Name -->
|
||||
<td>${response.age}</td> <!-- Age -->
|
||||
<td>${response.email}</td> <!-- Email -->
|
||||
<td>${response.date_joined}</td> <!-- Date Joined -->
|
||||
<td class="actions"> <!-- Actions -->
|
||||
<td>${rowCount}</td>
|
||||
<td>${response.id}</td>
|
||||
<td>${response.name}</td>
|
||||
<td>${response.warm}</td>
|
||||
<td>${response.lhe_anlieferung}</td>
|
||||
<td>${response.lhe_ausgabe}</td>
|
||||
<td>${response.date}</td>
|
||||
<td class="actions">
|
||||
<button class="edit-btn-two">Edit</button>
|
||||
<button class="delete-btn-two">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
$(`#${currentTableId} tbody`).append(newRow);
|
||||
</tr>`;
|
||||
$('tbody').append(newRow);
|
||||
$('#add-popup-two').fadeOut();
|
||||
},
|
||||
error: function (xhr) {
|
||||
alert('Failed to add entry: ' + xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Open Edit Popup
|
||||
$(document).on('click', '.edit-btn-two', function () {
|
||||
@@ -330,6 +347,5 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user