-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
252 lines (216 loc) · 7.01 KB
/
Copy pathindex.html
File metadata and controls
252 lines (216 loc) · 7.01 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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<!DOCTYPE html>
<html>
<head>
<title> FASTTRACK EXPRESS </title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f9f9f9;
color: #333;
margin: 20px;
}
h1 {
text-align: center;
color: #2c3e50;
}
#note {
text-align: center;
font-size: 12px;
color: #555;
margin-top: 10px;
}
form {
max-width: 600px;
margin: 0 auto;
background-color: #ffffff;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease-in-out;
}
.centered {
display: flex;
justify-content: center;
align-items: center;
height: 80vh;
}
.moved-up {
position: relative;
top: 0;
transform: none;
margin-top: 20px;
}
textarea {
width: 100%;
height: 120px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 14px;
margin-bottom: 10px;
}
button {
display: inline-block;
background-color: #3498db;
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
text-align: center;
}
button:hover {
background-color: #2980b9;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
font-size: 14px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
th, td {
border: 1px solid #ddd;
padding: 10px;
text-align: left;
}
th {
background-color: #2c3e50;
color: white;
text-transform: uppercase;
}
tbody tr:nth-child(even) {
background-color: #f2f2f2;
}
.copy-button {
display: inline-block;
background-color: #27ae60;
color: white;
border: none;
padding: 5px 10px;
font-size: 12px;
margin: 5px 0;
border-radius: 3px;
cursor: pointer;
text-align: center;
}
.copy-button:hover {
background-color: #229954;
}
.column-copy {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
#loading {
display: none;
text-align: center;
margin-top: 20px;
font-size: 16px;
color: #3498db;
}
#loading img {
width: 50px;
height: 50px;
}
footer {
text-align: center;
font-size: 12px;
color: #555;
margin-top: 20px;
}
</style>
</head>
<body>
<h1> FAST TRACK EXPRESS </h1>
<div id="note"> 369 & 403 MASTER INFO </div>
<div id="formContainer" class="centered">
<form id="awbForm">
<textarea name="awb_input" placeholder="COPY MASTER FROM CHECKBOOK AND PASTE "></textarea>
<button type="Submit">GET DETAILS </button>
</form>
</div>
<div id="loading">
<img src="https://static.vecteezy.com/system/resources/previews/010/754/321/original/loading-icon-logo-design-template-illustration-free-vector.jpg" alt="Loading...">
<p>Fetching results, please wait...</p>
</div>
<div class="column-copy" style="display: none;">
<button class="copy-button" onclick="copyColumn(4)">Copy Total Weight</button>
<button class="copy-button" onclick="copyColumn(5)">Copy ULD INFO</button>
</div>
<table id="resultsTable" style="display: none;">
<thead>
<tr>
<th>AWB Number</th>
<th>Flight Number</th>
<th>Flight Date</th>
<th>Total Pieces</th>
<th>Total Weight</th>
<th>ULD Info</th>
<th>Route</th>
</tr>
</thead>
<tbody></tbody>
</table>
<footer>
idea and implemented by the JFK team, developed by Bilal.
</footer>
<script>
const formContainer = document.getElementById('formContainer');
const loadingIndicator = document.getElementById('loading');
const resultsTable = document.getElementById('resultsTable');
const columnCopy = document.querySelector('.column-copy');
document.getElementById('awbForm').addEventListener('submit', function(e) {
e.preventDefault();
// Move form to top
formContainer.classList.remove('centered');
formContainer.classList.add('moved-up');
// Show loading indicator
loadingIndicator.style.display = 'block';
const formData = new FormData(this);
fetch('/process', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
// Hide loading indicator
loadingIndicator.style.display = 'none';
// Populate table
const tbody = resultsTable.querySelector('tbody');
tbody.innerHTML = ''; // Clear previous data
data.forEach(row => {
const tr = document.createElement('tr');
tr.innerHTML = `
<td>${row['AWB Number']}</td>
<td>${row['Flight Number']}</td>
<td>${row['Flight Date']}</td>
<td>${row['Total Pieces']}</td>
<td>${parseInt(row['Total Weight']) || ''}</td>
<td>${row['ULD Info'].join('; ')}</td>
<td>${row['Route']}</td>
`;
tbody.appendChild(tr);
});
// Show table and copy buttons
resultsTable.style.display = 'table';
columnCopy.style.display = 'flex';
})
.catch(error => {
// Hide loading indicator
loadingIndicator.style.display = 'none';
console.error('Error:', error);
});
});
function copyColumn(index) {
const rows = resultsTable.querySelectorAll('tbody tr');
const columnData = Array.from(rows).map(row => row.cells[index].innerText).join('\n');
navigator.clipboard.writeText(columnData)
.then(() => alert('Column copied to clipboard!'))
.catch(() => alert('Failed to copy column.'));
}
</script>
</body>
</html>