-
Notifications
You must be signed in to change notification settings - Fork 0
/
transation.html
175 lines (148 loc) · 4.1 KB
/
transation.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
/* Styling for navigation bar */
nav {
background-color: green;
text-align: center;
}
nav a {
display: inline-block;
padding: 10px;
text-decoration: none;
color: black;
border-right: 1px solid gray;
}
nav a:last-child {
border-right: none;
}
/* Styling for transaction page */
.header {
background-color: #f2f2f2;
padding: 20px;
text-align: center;
}
#myInput, #timeInput {
padding: 10px;
margin: 5px;
border: 1px solid #ccc;
border-radius: 4px;
}
.addBtn {
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
.addBtn:hover {
background-color: #45a049;
}
ul {
list-style-type: none;
padding: 0;
}
li {
padding: 10px;
margin-bottom: 5px;
background-color: #f9f9f9;
}
li.checked {
background-color: #888;
color: white;
text-decoration: line-through;
}
.close {
float: right;
cursor: pointer;
}
.close:hover {
background-color: #f44336;
color: white;
}
/* Styling for bargain request section */
.bargain-request {
margin-top: 20px;
text-align: center;
}
.accept-btn, .reject-btn {
padding: 10px 20px;
margin: 0 10px;
border-radius: 4px;
cursor: pointer;
}
.accept-btn {
background-color: green;
color: white;
}
.reject-btn {
background-color: red;
color: white;
}
</style>
</head>
<body>
<nav>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="">Contact</a>
</nav>
<div id="myDIV" class="header">
<h2>Transaction Page</h2>
<input type="text" id="myInput" placeholder="Item...">
<input type="date" id="dateInput">
<input type="number" id="priceInput" placeholder="Price...">
<span onclick="newElement()" class="addBtn">Add</span>
</div>
<ul id="myUL">
<li>Potato - 2024-04-07 - 50</li>
<li>Tomato - 2024-04-07 - 30</li>
<li>Eggs - 2024-04-07 - 10</li>
<li>Lemon - 2024-04-07 - 5</li>
</ul>
<!-- Bargain request section -->
<div class="bargain-request">
<h2>Bargain request from User "ABC"</h2>
<button class="accept-btn" onclick="acceptBargainRequest()">Accept Request</button>
<button class="reject-btn" onclick="rejectBargainRequest()">Reject Request</button>
</div>
<!-- Popup for bargain request accepted -->
<div id="acceptPopup" style="display: none;">
<h3>Request for bargain accepted</h3>
</div>
<!-- Popup for bargain request rejected -->
<div id="rejectPopup" style="display: none;">
<h3>Request for bargain rejected</h3>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
// JavaScript functionality remains the same as provided in the previous version
// Function to handle accepting bargain request
function acceptBargainRequest() {
// Show popup for bargain request accepted
document.getElementById("acceptPopup").style.display = "block";
// Disable accept and reject buttons and change their color to grey
document.querySelector(".accept-btn").disabled = true;
document.querySelector(".reject-btn").disabled = true;
document.querySelector(".accept-btn").style.backgroundColor = "grey";
document.querySelector(".reject-btn").style.backgroundColor = "grey";
}
// Function to handle rejecting bargain request
function rejectBargainRequest() {
// Show popup for bargain request rejected
document.getElementById("rejectPopup").style.display = "block";
// Disable accept and reject buttons and change their color to grey
document.querySelector(".accept-btn").disabled = true;
document.querySelector(".reject-btn").disabled = true;
document.querySelector(".accept-btn").style.backgroundColor = "grey";
document.querySelector(".reject-btn").style.backgroundColor = "grey";
}
</script>
</body>
</html>