Finish Opfer Page
This commit is contained in:
@@ -665,7 +665,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script>
|
||||
<!---<script>
|
||||
fetch("/api/opfer/list.php")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
@@ -691,7 +691,8 @@
|
||||
<div class="flex items-center gap-3">
|
||||
<div>
|
||||
<span
|
||||
@click="isOpferAdd = true"
|
||||
@click="isOpferEdit = true"
|
||||
onclick="opferEdit(` + opfer.id + `)"
|
||||
class="block font-medium text-gray-800 text-theme-sm dark:text-white/90"
|
||||
>
|
||||
` + opfer.name + `
|
||||
@@ -727,7 +728,53 @@
|
||||
document.getElementById("opfer_table").innerHTML = list;
|
||||
})
|
||||
.catch(error => console.error("API Error: " + error))
|
||||
</script>
|
||||
|
||||
function opferEdit(id) {
|
||||
console.log(document.getElementById("opfer_name"));
|
||||
fetch("/api/opfer/info.php", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
body: "id=" + id
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.status == 500) {
|
||||
console.error("API Error: " + data.error);
|
||||
}
|
||||
|
||||
const opfer = data.opfer;
|
||||
|
||||
document.getElementById("opfer_id").value = id;
|
||||
document.getElementById("opfer_name").value = opfer.name;
|
||||
document.getElementById("opfer_mail").value = opfer.mail;
|
||||
document.getElementById("opfer_number").value = opfer.number;
|
||||
|
||||
|
||||
if (data.status == 1) {
|
||||
const toogle_el = document.querySelector('#toggle2');
|
||||
const toogle_data = Alpine.$data(document.getElementById("toogle2_div"));
|
||||
|
||||
toogle_data.switcherToggle = data.status;
|
||||
toogle_el.checked = data.status;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function removeOpfer() {
|
||||
const id = document.getElementById("opfer_id").value;
|
||||
|
||||
fetch("/api/opfer/delete.php", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
body: "id=" + id
|
||||
})
|
||||
window.location.reload();
|
||||
}
|
||||
</script>--->
|
||||
</div>
|
||||
<!-- ====== Table Six End -->
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user