-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathService.html
More file actions
257 lines (228 loc) · 11.7 KB
/
Copy pathService.html
File metadata and controls
257 lines (228 loc) · 11.7 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
253
254
255
256
257
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Emolyee list with Education</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css">
</head>
<body>
<!-- header section start here -->
<header class="relative h-24 sm:h-28 md:h-32 lg:h-36 w-full overflow-hidden">
<!-- Background Image -->
<img src="image.png" alt="DACO Header" class="absolute inset-0 w-full h-full object-cover opacity-90" />
<!-- Overlay -->
<div class="absolute inset-0 bg-black bg-opacity-40"></div>
<!-- Header Content -->
<div class="relative z-10 flex items-center justify-between h-full px-4 sm:px-8 text-white">
<!-- Logo -->
<div class="flex items-center gap-2">
<img src="./img/logo.jpg" alt="DACO Logo" class="h-10 sm:h-12" />
<div class="text-xs sm:text-sm leading-tight">
<strong class="block text-lg sm:text-xl font-bold">Nabatat Co. Compnay</strong>
<span class="block text-[10px]">Dammam Airports Company</span>
</div>
</div>
<!-- Title -->
<div class="text-center flex-1">
<h1 class="text-md sm:text-lg md:text-xl font-semibold">Landeside Servicer – Information Web</h1>
<p class="text-xs sm:text-sm">Contractor Inputs – Nabatat</p>
</div>
<!-- Empty right section to balance layout -->
<div class="w-12 sm:w-16"></div>
</div>
</header>
<!-- header section ends here -->
<!-- main section start here -->
<main>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Table Example</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.16.9/xlsx.full.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.3.1/jspdf.umd.min.js"></script>
</head>
<body class="bg-white text-gray-800">
<div class="container mx-auto p-4">
<div class="flex justify-between items-center mb-4">
<div class="flex items-center">
<label for="entries" class="mr-2">Show</label>
<select id="entries" class="border border-gray-300 rounded p-1" onchange="changeEntries()">
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
<span class="ml-2">entries</span>
</div>
<div class="flex items-center">
<button class="text-gray-600 mr-4" onclick="exportToExcel()"><i class="fas fa-file-excel"></i> Excel</button>
<button class="text-gray-600 mr-4" onclick="exportToPDF()"><i class="fas fa-file-pdf"></i> PDF</button>
<div class="relative">
<input type="text" id="searchInput" class="border border-gray-300 rounded p-1" placeholder="Search" onkeyup="searchTable()">
</div>
</div>
</div>
<div class="overflow-x-auto">
<table id="dataTable" class="min-w-full bg-white border border-gray-300">
<thead>
<tr class="bg-gray-100 text-gray-600 uppercase text-sm leading-normal">
<th class="py-3 px-6 text-left">Package ID <i class="fas fa-sort"></i></th>
<th class="py-3 px-6 text-left">Job Code <i class="fas fa-sort"></i></th>
<th class="py-3 px-6 text-left">Nationality <i class="fas fa-sort"></i></th>
<th class="py-3 px-6 text-left">Job Name <i class="fas fa-sort"></i></th>
<th class="py-3 px-6 text-left">Required <i class="fas fa-sort"></i></th>
<th class="py-3 px-6 text-left">Manhour Rate <i class="fas fa-sort"></i></th>
<th class="py-3 px-6 text-left">Entry Date <i class="fas fa-sort"></i></th>
</tr>
</thead>
<tbody id="tableBody" class="text-gray-600 text-sm font-light">
<!-- Table rows will be dynamically generated -->
</tbody>
</table>
</div>
<div class="flex justify-between items-center mt-4">
<div id="entriesInfo" class="text-gray-600 text-sm">
Showing 1 to 10 of 85 entries
</div>
<div class="flex items-center">
<button class="border border-gray-300 rounded p-1 mx-1" onclick="prevPage()"><i class="fas fa-chevron-left"></i></button>
<div id="pagination" class="flex items-center">
<!-- Pagination buttons will be dynamically generated -->
</div>
<button class="border border-gray-300 rounded p-1 mx-1" onclick="nextPage()"><i class="fas fa-chevron-right"></i></button>
</div>
</div>
</div>
<script>
const data = [
{ packageId: 'PK200', jobCode: 'Nabikat-001', nationality: 'Nationality', jobName: 'Accountant', required: 2, manhourRate: 30.00, entryDate: 'Nov 11, 2024 01:51 PM' },
{ packageId: 'PK200', jobCode: 'Nabikat-002', nationality: 'Nationality', jobName: 'Applicator', required: 4, manhourRate: 18.00, entryDate: 'Nov 11, 2024 01:51 PM' },
{ packageId: 'PK200', jobCode: 'Nabikat-003', nationality: 'Nationality', jobName: 'Asphalt specialist', required: 1, manhourRate: 18.00, entryDate: 'Nov 11, 2024 01:51 PM' },
{ packageId: 'PK200', jobCode: 'Nabikat-004', nationality: 'Nationality', jobName: 'Asphalt Technician', required: 1, manhourRate: 18.00, entryDate: 'Nov 11, 2024 01:51 PM' },
{ packageId: 'PK200', jobCode: 'Nabikat-005', nationality: 'Nationality', jobName: 'Buyer', required: 1, manhourRate: 18.00, entryDate: 'Nov 11, 2024 01:51 PM' },
{ packageId: 'PK200', jobCode: 'Nabikat-006', nationality: 'Nationality', jobName: 'Camp Boss', required: 1, manhourRate: 14.00, entryDate: 'Nov 11, 2024 01:51 PM' },
{ packageId: 'PK200', jobCode: 'Nabikat-007', nationality: 'Nationality', jobName: 'Camp Janitor', required: 1, manhourRate: 16.00, entryDate: 'Nov 11, 2024 01:51 PM' },
{ packageId: 'PK200', jobCode: 'Nabikat-008', nationality: 'Nationality', jobName: 'Chief Section Head', required: 2, manhourRate: 18.00, entryDate: 'Nov 11, 2024 01:51 PM' },
{ packageId: 'PK200', jobCode: 'Nabikat-009', nationality: 'Nationality', jobName: 'Chief Section Head', required: 1, manhourRate: 50.00, entryDate: 'Nov 11, 2024 01:51 PM' },
{ packageId: 'PK200', jobCode: 'Nabikat-010', nationality: 'Nationality', jobName: 'Cook', required: 2, manhourRate: 18.00, entryDate: 'Nov 11, 2024 01:51 PM' },
// Add more data as needed
];
let currentPage = 1;
let entriesPerPage = 10;
let filteredData = data;
function renderTable() {
const tableBody = document.getElementById('tableBody');
tableBody.innerHTML = '';
const start = (currentPage - 1) * entriesPerPage;
const end = start + entriesPerPage;
const paginatedData = filteredData.slice(start, end);
paginatedData.forEach(row => {
const tr = document.createElement('tr');
tr.classList.add('border-b', 'border-gray-200', 'hover:bg-gray-100');
tr.innerHTML = `
<td class="py-3 px-6 text-left">${row.packageId}</td>
<td class="py-3 px-6 text-left">${row.jobCode}</td>
<td class="py-3 px-6 text-left">${row.nationality}</td>
<td class="py-3 px-6 text-left">${row.jobName}</td>
<td class="py-3 px-6 text-left">${row.required}</td>
<td class="py-3 px-6 text-left">${row.manhourRate}</td>
<td class="py-3 px-6 text-left">${row.entryDate}</td>
`;
tableBody.appendChild(tr);
});
renderPagination();
updateEntriesInfo();
}
function renderPagination() {
const pagination = document.getElementById('pagination');
pagination.innerHTML = '';
const totalPages = Math.ceil(filteredData.length / entriesPerPage);
for (let i = 1; i <= totalPages; i++) {
const button = document.createElement('button');
button.classList.add('border', 'border-gray-300', 'rounded', 'p-1', 'mx-1');
button.textContent = i;
button.onclick = () => goToPage(i);
if (i === currentPage) {
button.classList.add('bg-gray-300');
}
pagination.appendChild(button);
}
}
function updateEntriesInfo() {
const entriesInfo = document.getElementById('entriesInfo');
const start = (currentPage - 1) * entriesPerPage + 1;
const end = Math.min(start + entriesPerPage - 1, filteredData.length);
entriesInfo.textContent = `Showing ${start} to ${end} of ${filteredData.length} entries`;
}
function goToPage(page) {
currentPage = page;
renderTable();
}
function prevPage() {
if (currentPage > 1) {
currentPage--;
renderTable();
}
}
function nextPage() {
const totalPages = Math.ceil(filteredData.length / entriesPerPage);
if (currentPage < totalPages) {
currentPage++;
renderTable();
}
}
function changeEntries() {
const entriesSelect = document.getElementById('entries');
entriesPerPage = parseInt(entriesSelect.value);
currentPage = 1;
renderTable();
}
function searchTable() {
const searchInput = document.getElementById('searchInput').value.toLowerCase();
filteredData = data.filter(row => {
return Object.values(row).some(value => value.toString().toLowerCase().includes(searchInput));
});
currentPage = 1;
renderTable();
}
function exportToExcel() {
var wb = XLSX.utils.table_to_book(document.getElementById('dataTable'), {sheet: "Sheet JS"});
XLSX.writeFile(wb, 'table_data.xlsx');
}
async function exportToPDF() {
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
doc.autoTable({ html: '#dataTable' });
doc.save('table_data.pdf');
}
document.addEventListener('DOMContentLoaded', () => {
renderTable();
});
</script>
</body>
</html>
</main>
<!-- main section ends here -->
<!-- footer section start here -->
<footer>
</footer>
<!-- footer section ends here -->
<script>
function exportToExcel() {
var wb = XLSX.utils.table_to_book(document.getElementById('dataTable'), {sheet: "Sheet JS"});
XLSX.writeFile(wb, 'table_data.xlsx');
}
async function exportToPDF() {
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
doc.autoTable({ html: '#dataTable' });
doc.save('table_data.pdf');
}
</script>
</body>
</html>