-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.html
114 lines (98 loc) · 4.31 KB
/
admin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--
Copyrights Nexthope 2022
Coded by Dijey (RAZAFIMAHATRATRA Lionnel)
Stagiaire Nexthope Sept-Dec 2022
-->
<!DOCTYPE html>
<html lang="mg">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sokola - Admin</title>
<link href="static/style/style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="static/img/logo.png"/>
<link rel="stylesheet" type="text/css" media="screen and (max-width: 1300px)" href="static/style/tablet.css">
<link rel="stylesheet" type="text/css" media="screen and (max-width: 600px)" href="static/style/phone.css">
</head>
<body>
<div class="welcome_img" align="center">
<img src="static/img/logo-title.png" class="welcome_imgs" alt="Sokola Logo" />
</div>
<div align="center">
<div id="welcome">
<h1 align="center">Tongasoa ianao Tompon'andraikitra</h1>
</div>
<div class="contenue_principale" id="contenue_principale">
<form action="/add" method="post">
<p>Anarana sokola: <input type="text" name="sokola-name" required /> <input type="submit" value="Alefa" class="act-btn" /></p>
<p><i>{{ message }}</i></p>
</form>
<div class="table-container">
<table summary="Sokola List">
<tr>
<th>ID</th>
<th>Anarana</th>
<th>Asa</th>
</tr>
{% for sokola in sokola_names %}
<tr>
<td>{{ sokola[0] }}</td>
<td>{{ sokola[1] }}</td>
<td>
<button class="act-btn" onclick="deleteRow({{ sokola[0] }})">Delete</button>
<button class="act-btn" onclick="editRow({{ sokola[0] }}, '{{ sokola[1] }}')">Update</button>
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
<script>
async function deleteRow(id) {
const url = `https://sokola-mada.duckdns.org/delete?id=${id}`;
try {
const response = await fetch(url, {
method: 'POST'
});
if (response.status === 200) {
alert("voafafa")
location.reload();
} else {
alert("Tsy voafafa")
}
} catch (error) {
console.error('Error deleting row:', error);
alert("Tsy voafafa fa nisy olana");
}
}
async function editRow(id, name) {
var newName = prompt("Anarana vaovao:", name);
const url = `https://sokola-mada.duckdns.org/update?id=${id}&name=${newName}`;
try {
const response = await fetch(url, {
method: 'POST'
});
if (response.status === 200) {
alert("Vitaaa!");
window.location.href = 'https://sokola-mada.duckdns.org/admin';
} else {
alert("Tsy tafa");
}
} catch (error) {
console.error('Error updating row:', error);
alert("Tsy tafa fa nisy olana");
}
}
</script>
</body>
<footer style="position: relative;">
<div style="position: absolute; top: 0; left: 50%; transform: translateX(-50%);">
<img id="nxt-10" src="static/img/footer.png" alt="Image Sokola">
</div>
<div style="text-align: center; position: relative; color: white; padding: 10px;">
<p>Copyrights 2023 | Dijey</p>
<a href="https://fb.me/d1j3y"><img src="static/img/fb.png" alt="Logo Facebook" title="Dijey Facebook" width="50" height="50" /></a><br>
<img src="static/img/foot.png" alt="NextHope Facebook page" title="sary sokola" width="300" height="250" />
</div>
</footer>
</html>