-
Notifications
You must be signed in to change notification settings - Fork 0
/
deletePackage.html
187 lines (168 loc) · 7.02 KB
/
deletePackage.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">
<style>
/* Style the font of the header */
#language {
position: absolute;
top: 0;
left: 0;
font-size: 20px;
font-weight: bold;
padding: 5px;
background-color: #f9daff;
}
h1 {
font-size: 55px; /* Change the font size to 36px */
font-family: "Comic Sans MS", cursive, sans-serif;
margin-top: 5px; /* Add some margin to the top */
margin-bottom: 5px; /* Add some margin to the bottom */
text-align: center; /* Center the text */
}
h2{
font-size: 35px; /* Change the font size to 36px */
font-family: "Comic Sans MS", cursive, sans-serif;
margin-top: 50px; /* Add some margin to the top */
margin-bottom: 20px; /* Add some margin to the bottom */
text-align: left; /* Center the text */
}
a{
display: inline-block;
padding: 10px;
border-radius: 20px;
background-color: white;
border: 2px solid black;
font-size: 35px; /* Change the font size to 36px */
font-family: "Comic Sans MS", cursive, sans-serif;
margin-top: 10px; /* Add some margin to the top */
margin-bottom: 10px; /* Add some margin to the bottom */
text-align: left; /* Center the text */
}
/* Style the logo */
#logo {
display: block; /* Set the display property to block */
margin: 0 auto; /* Center the image horizontally */
width: 150px; /* Set the width to 100px */
height: 150px; /* Set the height to 100px */
margin-bottom: 40px; /* Add some margin to the bottom */
}
/* Style the header container */
header {
text-align: center; /* Center the header text */
}
input {
font-size: 24px; /* Change the font size to 24px or any other size you prefer */
font-family: "Comic Sans MS", cursive, sans-serif; /* Change the font family to Comic Sans */
}
label {
font-size: 34px; /* Change the font size to 24px or any other size you prefer */
font-family: "Comic Sans MS", cursive, sans-serif; /* Change the font family to Comic Sans */
}
div {
font-size: 22px; /* Change the font size to 24px or any other size you prefer */
font-family: "Comic Sans MS", cursive, sans-serif; /* Change the font family to Comic Sans */
}
body {
background-color: #f9daff; /* Update background color to be the 4.5:1 per compliance */
color: #000000;
}
button {
background-color: #ffffff; /* Green */
border: none;
color: rgb(0, 0, 0);
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 35px; /* Change the font size to 36px */
font-family: "Comic Sans MS", cursive, sans-serif;
margin: 4px 2px;
margin-bottom: 40px; /* Add some margin to the bottom */
cursor: pointer;
}
/* Style the footer container */
footer {
position: absolute; /* Set the position property to absolute */
left: 0; /* Set the left property to 0 */
bottom: 0; /* Set the bottom property to 0 */
width: 100%; /* Set the width to 100% */
text-align: center; /* Center the text */
margin-top: 100px; /* Add some margin to the top */
margin-bottom: 100px; /* Add some margin to the bottom */
margin-left: 400px; /* Add some margin to the top */
margin-right: 100px; /* Add some margin to the bottom */
}
/* Style the GIF */
#gif {
display: block; /* Set the display property to block */
margin: 0 auto; /* Center the image horizontally */
width: 200px; /* Set the width to 200px */
height: 200px; /* Set the height to 200px */
margin-top: 100px; /* Add some margin to the top */
margin-bottom: 100px; /* Add some margin to the bottom */
}
</style>
<body>
<img src="languageFlag.png" alt="English language icon" title="English language icon" width="16" height="16">
<span style="font-size: 20px">English</span>
<main role="main">
<h2>Delete a Package</h2>
<form action="https://purdue-soft-eng-384818-6x33ng5huq-uc.a.run.app/package/{id}" method="delete">
<label for="text-input-1">Package ID:</label>
<input type="text" id="text-input-1" name="text-input-1"><br>
<div id="update-desc">Please enter a field to delete a package.</div> <!-- labels to associate text descriptions with form elements like input fields and buttons -->
<button type="submit">Delete</button>
</form>
<form action="https://purdue-soft-eng-384818-6x33ng5huq-uc.a.run.app/package/byName{name}" method="delete">
<label for="text-input-2">Package Name:</label>
<input type="text" id="text-input-2" name="text-input-2"><br>
<div id="update-desc">Please enter a field to delete a package.</div> <!-- labels to associate text descriptions with form elements like input fields and buttons -->
<button type="submit">Delete</button>
</form>
<a href="index.html" class="back-button">Back</a>
</main>
</body>
<script>
const form1 = document.querySelector('form[action="https://purdue-soft-eng-384818-6x33ng5huq-uc.a.run.app/package/{id}"]');
const form2 = document.querySelector('form[action="https://purdue-soft-eng-384818-6x33ng5huq-uc.a.run.app/package/byName{name}"]');
form1.addEventListener('submit', function(event) {
event.preventDefault();
const input1 = document.getElementById('text-input-1');
const value1 = input1.value;
fetch(`https://purdue-soft-eng-384818-6x33ng5huq-uc.a.run.app/package/${value1}`, {
method: 'DELETE'
})
.then(response => {
if (response.ok) {
alert(`Package with ID ${value1} deleted successfully.`);
} else {
throw new Error('An error occurred while deleting the package.');
}
})
.catch(error => {
console.error(error);
alert('An error occurred while deleting the package.');
});
input1.value = '';
});
form2.addEventListener('submit', function(event) {
event.preventDefault();
const input2 = document.getElementById('text-input-2');
const value2 = input2.value;
fetch(`https://purdue-soft-eng-384818-6x33ng5huq-uc.a.run.app/package/byName/${value2}`, {
method: 'DELETE'
})
.then(response => {
if (response.ok) {
alert(`Package with name ${value2} deleted successfully.`);
} else {
throw new Error('An error occurred while deleting the package.');
}
})
.catch(error => {
console.error(error);
alert('An error occurred while deleting the package.');
});
input2.value = '';
});
</script>
</html>