-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.html
508 lines (479 loc) · 29.7 KB
/
admin.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
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="distributions/output.css" rel="stylesheet">
<title>Admin Dashboard</title>
</head>
<body>
<head>
<meta charset="UTF-8">
<link href="dist/output.css" type="text/css" rel="stylesheet">
<title>Splash Car Wash</title>
</head>
<body>
<div class="flex flex-row min-h-screen bg-gray-100 text-gray-800">
<aside
class="sidebar w-64 md:shadow transform -translate-x-full md:translate-x-0 transition-transform duration-150 ease-in bg-amber-800">
<div class="sidebar-header flex items-center justify-center py-4">
<div class="inline-flex">
<a href="#" class="inline-flex flex-row items-center">
<img src="./assets/splash.png" alt="">
</a>
</div>
</div>
<div class="sidebar-content px-4 py-6">
<ul class="flex flex-col w-full">
<li class="my-px">
<a href="#"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-700 bg-gray-100">
<span class="flex items-center justify-center text-lg text-gray-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
</svg>
</span>
<span class="ml-3">Dashboard</span>
</a>
</li>
<li class="my-px">
<span class="flex font-medium text-sm text-gray-300 px-4 my-4 uppercase">Transactions</span>
</li>
<li class="my-px">
<a href="#" id="rollback"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-300 hover:bg-gray-100 hover:text-gray-700">
<span class="flex items-center justify-center text-lg text-green-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path d="M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</span>
<span class="ml-3">Rollback transaction</span>
</a>
</li>
<li class="my-px">
<a href="#" id="expenditure"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-300 hover:bg-gray-100 hover:text-gray-700">
<span class="flex items-center justify-center text-lg text-green-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path d="M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</span>
<span class="ml-3">Add expenditure</span>
</a>
</li>
<li class="my-px">
<span class="flex font-medium text-sm text-gray-300 px-4 my-4 uppercase">Services</span>
</li>
<li class="my-px">
<a href="#" id="services"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-300 hover:bg-gray-100 hover:text-gray-700">
<span class="flex items-center justify-center text-lg text-gray-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path
d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4" />
</svg>
</span>
<span class="ml-3">Services & Charges</span>
</a>
</li>
<li class="my-px">
<a href="#" id="add_service"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-300 hover:bg-gray-100 hover:text-gray-700">
<span class="flex items-center justify-center text-lg text-gray-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path
d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4" />
</svg>
</span>
<span class="ml-3">Add New Service</span>
</a>
</li>
<li class="my-px">
<span class="flex font-medium text-sm text-gray-300 px-4 my-4 uppercase">Employees</span>
</li>
<li class="my-px">
<a href="#" id="concerns"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-300 hover:bg-gray-100 hover:text-gray-700">
<span class="flex items-center justify-center text-lg text-gray-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path
d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4" />
</svg>
</span>
<span class="ml-3">Employee concerns</span>
</a>
</li>
<li class="my-px">
<a href="#" id="updatesalary"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-300 hover:bg-gray-100 hover:text-gray-700">
<span class="flex items-center justify-center text-lg text-gray-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path
d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" />
</svg>
</span>
<span class="ml-3">Update salary</span>
</a>
</li>
<li class="my-px">
<a href="#" id="employees"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-300 hover:bg-gray-100 hover:text-gray-700">
<span class="flex items-center justify-center text-lg text-gray-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path
d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
</svg>
</span>
<span class="ml-3">Employees</span>
</a>
</li>
<li class="my-px">
<a href="#" id="newemployee"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-300 hover:bg-gray-100 hover:text-gray-700">
<span class="flex items-center justify-center text-lg text-green-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path d="M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</span>
<span class="ml-3">Add new employee</span>
</a>
</li>
<li class="my-px">
<span class="flex font-medium text-sm text-gray-300 px-4 my-4 uppercase">Account</span>
</li>
<li class="my-px">
<a href="#" id="logout"
class="flex flex-row items-center h-10 px-3 rounded-lg text-gray-300 hover:bg-gray-100 hover:text-gray-700">
<span class="flex items-center justify-center text-lg text-red-400">
<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path
d="M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z" />
</svg>
</span>
<span class="ml-3">Logout</span>
</a>
</li>
</ul>
</div>
</aside>
<main class="main flex flex-col flex-grow -ml-64 md:ml-0 transition-all duration-150 ease-in">
<header class="header bg-white shadow py-4 px-4">
<div class="header-content flex items-center flex-row">
<form action="#">
<div class="flex">
<div class="hidden md:flex relative mr-3">
<button id="reports"
class="hover:bg-grey border-amber-800 text-grey-darkest font-bold py-2 px-4 border rounded inline-flex items-center">
<span>Reports</span>
</button>
</div>
</div>
<div class="flex md:hidden">
<a href="#" class="flex items-center justify-center h-10 w-10 border-transparent">
<svg class="h-6 w-6 text-gray-500" fill="none" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24"
stroke="currentColor">
<path d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
</a>
</div>
</form>
<div class="flex ml-auto">
<a href class="flex flex-row items-center">
<img src="./assets/splash.png" alt class="h-10 w-10 bg-gray-200 border rounded-full" />
<span class="flex flex-col ml-2">
<span id="manager"
class="truncate w-20 font-semibold tracking-wide leading-none"></span>
<span
class="truncate w-20 text-gray-500 text-xs leading-none mt-1">Administrator</span>
</span>
</a>
</div>
</div>
</header>
<div class="main-content flex flex-col flex-grow p-4">
<div class="flex flex-col flex-grow bg-transparent rounded mt-4">
<div class="flex mb-8">
<div class="min-w-0 rounded-lg overflow-hidden bg-white dark:bg-gray-800">
<div id="total_employees" class="p-4 flex items-center">
<div
class="p-3 rounded-full text-orange-500 dark:text-orange-100 bg-orange-100 dark:bg-orange-500 mr-4">
<svg fill="currentColor" viewBox="0 0 20 20" class="w-5 h-5">
<path
d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z">
</path>
</svg>
</div>
<div>
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
Total Employees
</p>
<p id="emp" class="text-lg font-semibold text-gray-700 dark:text-gray-200">
</p>
</div>
</div>
</div>
<div class="min-w-0 rounded-lg shadow-xs overflow-hidden bg-white dark:bg-gray-800">
<div class="p-4 flex items-center">
<div
class="p-3 rounded-full text-green-500 dark:text-green-100 bg-green-100 dark:bg-green-500 mr-4">
<svg fill="currentColor" viewBox="0 0 20 20" class="w-5 h-5">
<path fill-rule="evenodd"
d="M4 4a2 2 0 00-2 2v4a2 2 0 002 2V6h10a2 2 0 00-2-2H4zm2 6a2 2 0 012-2h8a2 2 0 012 2v4a2 2 0 01-2 2H8a2 2 0 01-2-2v-4zm6 4a2 2 0 100-4 2 2 0 000 4z"
clip-rule="evenodd"></path>
</svg>
</div>
<div>
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
Revenue
</p>
<p id="rev" class="text-lg font-semibold text-gray-700 dark:text-gray-200">
</p>
</div>
</div>
</div>
<a>
<div id="expense_tap"
class="min-w-0 rounded-lg shadow-xs overflow-hidden bg-white dark:bg-gray-800 hover:bg-gray-500 cursor-pointer">
<div class="p-4 flex items-center">
<div
class="p-3 rounded-full text-blue-500 dark:text-blue-100 bg-blue-100 dark:bg-blue-500 mr-4">
<svg fill="currentColor" viewBox="0 0 20 20" class="w-5 h-5">
<path
d="M3 1a1 1 0 000 2h1.22l.305 1.222a.997.997 0 00.01.042l1.358 5.43-.893.892C3.74 11.846 4.632 14 6.414 14H15a1 1 0 000-2H6.414l1-1H14a1 1 0 00.894-.553l3-6A1 1 0 0017 3H6.28l-.31-1.243A1 1 0 005 1H3zM16 16.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zM6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z">
</path>
</svg>
</div>
<div>
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
Expenses
</p>
<p id="exp" class="text-lg font-semibold text-gray-700 dark:text-gray-200">
</p>
</div>
</div>
</div>
</a>
<div id="clients"
class="min-w-0 rounded-lg shadow-xs overflow-hidden bg-white dark:bg-gray-800 cursor-pointer">
<div class="p-4 flex items-center">
<div
class="p-3 rounded-full text-gray-500 dark:text-orange-100 bg-orange-100 dark:bg-orange-500 mr-4">
<svg fill="currentColor" viewBox="0 0 20 20" class="w-5 h-5">
<path
d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z">
</path>
</svg>
</div>
<div>
<p
class=" cursor-pointer mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
Clients
</p>
</div>
</div>
</div>
</div>
<div class="flex flex-col">
<h1>Transactions</h1>
<div class="overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="py-2 inline-block min-w-full sm:px-6 lg:px-8">
<div class="overflow-hidden">
<table class="min-w-full" id="data">
<thead class="bg-white border-b">
<tr>
<th scope="col"
class="text-sm font-medium text-gray-900 px-6 py-4 text-left">
#
</th>
<th scope="col"
class="text-sm font-medium text-gray-900 px-6 py-4 text-left">
Client's Name
</th>
<th scope="col"
class="text-sm font-medium text-gray-900 px-6 py-4 text-left">
Client's car plate
</th>
<th scope="col"
class="text-sm font-medium text-gray-900 px-6 py-4 text-left">
Car Type
</th>
<th scope="col"
class="tex-sm font-medium text-gray-900 px-6 py-4 text-left">
Service Offered
</th>
<th scope="col"
class="text-sm font-medium text-gray-900 px-6 py-4 text-left">
Served by
</th>
<th scope="col"
class="text-sm font-medium text-gray-900 px-6 py-4 text-left">
Payment
</th>
<th scope="col"
class="text-sm font-medium text-gray-900 px-6 py-4 text-left">
Date
</th>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<script>
let $ = require('jquery')
let ipc = require('electron').ipcRenderer
let index = 0
let sum = 0
ipc.on('login_success', (event, args) => {
$('#manager').innerHTML = args
})
ipc.on('no_revenue', (event, args) => {
let rev = document.querySelector('#rev')
rev.innerHTML = 0
})
ipc.send('revenue')
ipc.on('all_revenue', (event, args) => {
let rev = document.querySelector('#rev')
for (let i = 0; i < args.length; i++) {
sum += args[i].amount
}
rev.innerHTML = 'Ksh ' + sum
})
ipc.send('all_expenses')
ipc.on('allexpenses', (event, args) => {
exp.innerHTML = 'Ksh ' + args
})
ipc.send('all_employees')
ipc.on('allemployees', (event, args) => {
document.querySelector("#emp").innerHTML = args.length
})
ipc.send('table_data')
ipc.on('all_transactions', (event, args) => {
let tbody = $('#tbody')
for (let i = 0; i < args.length; i++) {
let tr = document.createElement('tr')
let td_id = document.createElement('td')
let td_name = document.createElement('td')
let td_plate = document.createElement('td')
let td_type = document.createElement('td')
let td_service = document.createElement("td")
let td_served = document.createElement("td")
let td_payment = document.createElement("td")
let td_date = document.createElement("td")
tr.classList.add("bg-gray-100", "border-b")
td_id.classList.add("px-6", "py-4", "whitespace-nowrap", "text-sm", "font-medium", "text-gray-900")
td_name.classList.add("text-sm", "text-gray-900", "font-light", "px-6", "py-4", "whitespace-nowrap")
td_plate.classList.add("text-sm", "text-gray-900", "font-light", "px-6", "py-4", "whitespace-nowrap")
td_type.classList.add("text-sm", "text-gray-900", "font-light", "px-6", "py-4", "whitespace-nowrap")
td_service.classList.add("text-sm", "text-gray-900", "font-light", "px-6", "py-4", "whitespace-nowrap")
td_served.classList.add("text-sm", "text-gray-900", "font-light", "px-6", "py-4", "whitespace-nowrap")
td_payment.classList.add("text-sm", "text-gray-900", "font-light", "px-6", "py-4", "whitespace-nowrap")
td_date.classList.add("text-sm", "text-gray-900", "font-light", "px-6", "py-4", "whitespace-nowrap")
td_id.innerHTML = index++
td_name.innerHTML = args[i].client_firstname + ' ' + args[i].client_lastname
td_plate.innerHTML = args[i].car_plate
td_type.innerHTML = args[i].client_car_type
td_service.innerHTML = args[i].service_offered
td_served.innerHTML = args[i].service_employee
td_payment.innerHTML = args[i].amount
td_date.innerHTML = args[i].date
tr.append(td_id, td_name, td_plate, td_type, td_service, td_served, td_payment, td_date)
tbody.append(tr)
}
paginate()
})
$('#add_service').on('click', () => {
ipc.send('add_service')
})
$('#transaction').on('click', () => {
ipc.send('transaction')
})
$('#rollback').on('click', () => {
ipc.send('rollback')
})
$('#expenditure').on('click', () => {
ipc.send('expenditure')
})
$('#services').on('click', () => {
ipc.send('services')
})
$('#concerns').on('click', () => {
ipc.send('concerns')
})
$('#updatesalary').on('click', () => {
ipc.send('updatesalary')
})
$('#employees').on('click', () => {
ipc.send('employees')
})
$('#newemployee').on('click', () => {
ipc.send('newemployee')
})
// $('#profile').on('click', () => {
// ipc.send('profile')
// })
// $('#settings').on('click', () => {
// ipc.send('settings')
// })
$('#reports').on('click', () => {
ipc.send('reports')
})
$('#reward').on('click', () => {
ipc.send('reward')
})
$('#clients').on('click', () => {
ipc.send('clients')
})
$('#logout').on('click', () => {
ipc.send('logout_admin')
})
$('#expense_tap').on('click', () => {
ipc.send('expenses_tap')
})
function paginate() {
$(document).ready(function () {
$('#data').after('<div id="nav"></div>');
var rowsShown = 8;
var rowsTotal = $('#data tbody tr').length;
var numPages = rowsTotal / rowsShown;
for (i = 0; i < numPages; i++) {
var pageNum = i + 1;
$('#nav').append('<a href="#" rel="' + i + '">' + pageNum + '</a> ');
}
$('#data tbody tr').hide();
$('#data tbody tr').slice(0, rowsShown).show();
$('#nav a:first').addClass('active');
$('#nav a').bind('click', function () {
$('#nav a').removeClass('active');
$(this).addClass('active');
var currPage = $(this).attr('rel');
var startItem = currPage * rowsShown;
var endItem = startItem + rowsShown;
$('#data tbody tr').css('opacity', '0.0').hide().slice(startItem, endItem).
css('display', 'table-row').animate({ opacity: 1 }, 300);
});
});
}
</script>
</body>
</html>