-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdate.html
More file actions
151 lines (133 loc) · 3.94 KB
/
Update.html
File metadata and controls
151 lines (133 loc) · 3.94 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
// Populate form fields with data from URL parameters
function getParameterByName(name) {
const url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
const results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
window.onload = function() {
const itemCode = getParameterByName('itemCode');
const price = getParameterByName('price');
const discount = getParameterByName('discount');
document.getElementById('updateItemCode').value = itemCode;
document.getElementById('updatePrice').value = price;
document.getElementById('updateDiscount').value = discount;
}
</script>
<style>
/* General Styles */
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(to right, #ffecd2, #fcb69f);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: #333;
}
.container {
background: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 400px;
box-sizing: border-box;
text-align: left;
}
h2 {
text-align: center;
margin-bottom: 20px;
font-size: 24px;
color: #333;
}
form {
width: 100%;
}
label {
display: block;
margin-bottom: 8px;
color: #666;
font-weight: bold;
}
input[type="text"], input[type="number"] {
width: calc(100% - 20px);
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
font-size: 16px;
transition: border-color 0.3s, box-shadow 0.3s;
}
input[type="text"]:focus, input[type="number"]:focus {
border-color: #ff7e5f;
box-shadow: 0 0 5px rgba(255, 126, 95, 0.5);
}
button, input[type="button"] {
width: 100%;
padding: 12px;
background-color: #ff7e5f;
border: none;
border-radius: 5px;
color: white;
font-size: 16px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s, transform 0.3s;
}
button:hover, input[type="button"]:hover {
background-color: #feb47b;
transform: translateY(-2px);
}
button:active, input[type="button"]:active {
transform: translateY(0);
}
#message {
text-align: center;
margin-top: 20px;
color: #ff7e5f;
font-weight: bold;
font-size: 16px;
}
/* Media Queries */
@media (max-width: 400px) {
.container {
width: 90%;
padding: 20px;
}
}
</style>
</head>
<body>
<h2>Update Item</h2>
<form id="updateForm">
<label for="updateItemCode">Item Code:</label>
<input type="text" id="updateItemCode" required><br>
<label for="updatePrice">New Price:</label>
<input type="number" id="updatePrice" required><br>
<label for="updateDiscount">New Discount:</label>
<input type="text" id="updateDiscount"><br>
<button type="button" onclick="updateItem()">Update Item</button>
</form>
<input type="button" value="Homepage" onclick="location.href='OrderUI.html'">
<p id="message"></p>
<script src="app.js"></script>
</body>
</html>