This commit is contained in:
devdatt 2026-01-21 04:05:24 +05:30
parent 06a8a01a50
commit ba867487fd
1 changed files with 68 additions and 38 deletions

View File

@ -500,9 +500,13 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
<input type="hidden" name="action" id="action">
</form>
</div>
<form method="post" id="bulkForm">
<input type="hidden" name="action" id="bulkAction">
<table>
<tr>
<th>No</th>
<th>
<input type="checkbox" onclick="toggleAll(this)">No
</th>
<th>ID</th>
<th>Service Name</th>
<th>Input</th>
@ -520,7 +524,12 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
<?php foreach ($data as $row): ?>
<tr>
<td><?= $i++ ?></td>
<td><?= $row["id"] ?></td>
<td>
<input type="checkbox"
class="rowCheckbox"
name="ids[]"
value="<?= $row['id'] ?>">
</td>
<td><?= $row["service_name"] ?></td>
<td><?= $row["input_udp"] ?></td>
<td><?= $row["output_udp"] ?></td>
@ -540,7 +549,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
</tr>
<?php endforeach; ?>
</table>
</form>
<!-- POPUP -->
<div id="overlay"></div>
<div id="popup">
@ -601,6 +610,27 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
</div>
<script>
function toggleAll(master) {
document.querySelectorAll('.rowCheckbox')
.forEach(cb => cb.checked = master.checked);
}
function submitBulk(action) {
const checked = document.querySelectorAll('.rowCheckbox:checked');
if (checked.length === 0) {
alert('No services selected');
return;
}
if (!confirm('Are you sure?')) {
return;
}
document.getElementById('bulkAction').value = action;
document.getElementById('bulkForm').submit();
}
function openAddPopup() {
document.getElementById("popup_title").innerText = "Add Service";
document.getElementById("saveBtn").setAttribute("onclick", "saveService()");