-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservices.html
119 lines (109 loc) · 5.31 KB
/
services.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="distributions/output.css" rel="stylesheet" type="text/css">
<title>Service</title>
</head>
<body>
<div class="md:flex md:justify-center mb-6">
<form class="py-5 px-5">
<div class="flex flex-wrap -mx-3 mb-6">
<div class="w-full px-3">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2"
for="service_type">
Service Type
</label>
<div class="relative">
<select
class="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="service_type" name="service_type">
</select>
<div
class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
</svg>
</div>
</div>
</div>
</div>
<div class="flex flex-wrap -mx-3 mb-6">
<div class="w-full px-3">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2"
for="vehicle_type">
Vehicle Type
</label>
<div class="relative">
<select
class="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="vehicle_type" name="vehicle_type">
<option value="saloon_car">Saloon Car</option>
<option value="four_wheel_SUVs">Four Wheel SUVs</option>
<option value="bus">Bus</option>
<option value="trailer">Trailer</option>
<option value="mini_bus">Mini Bus</option>
<option value="motorcycle">Motorcycle</option>
<option value="pickup">Pickup</option>
<option value="canter">Canter</option>
<option value="double_cabin">Double Cabin</option>
</select>
<div
class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
</svg>
</div>
</div>
</div>
</div>
<div class="flex flex-wrap -mx-3 mb-6">
<div class="w-full md:w-1/2 px-3 mb-6 md:mb-0">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="charges">
Charges
</label>
<input
class="appearance-none block w-full bg-gray-200 text-gray-700 border rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white"
id="charges" name="charges" type="number">
</div>
</div>
<button id="charge_update" class="bg-amber-800 hover:bg-gray-300 text-white font-bold py-2 px-4 rounded">
Update Service Charges
</button>
</form>
</div>
<script>
let $ = require('jquery')
let ipc = require('electron').ipcRenderer
ipc.on('error_serviceandcars', (event, args) => {
window.alert(args)
})
ipc.on('success_chargesdata', (event, args) => {
window.alert(args)
})
ipc.on('error_chargesdata', (event, args) => {
window.alert(args)
})
ipc.send('services_and_cars')
ipc.on('servicesandcars', (event, args) => {
let select = $('#service_type')
for (let i = 0; i < args.length; i++) {
let option = document.createElement('option')
option.value = args[i].service_name
option.text = args[i].service_name
select.append(option)
}
})
$('#charge_update').on('click', () => {
let service = $('#service_type').val().trim()
let car = $('#vehicle_type').val().trim()
let charge = $('#charges').val().trim()
if (!service == '' && !car == '' && !charge == '') {
ipc.send('charges_data', [service, car, charge])
} else {
window.alert('Please provide missing fields')
}
})
</script>
</body>
</html>