-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewemployee.html
129 lines (118 loc) · 6.45 KB
/
newemployee.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="distributions/output.css" rel="stylesheet" type="text/css">
<title>Add New Employee</title>
</head>
<body>
<div class="md:flex md:justify-center mb-6">
<form class="py-5">
<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="e_firstname">
Employee First Name
</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="e_firstname" name="e_firstname" type="text" required>
</div>
<div class="w-full md:w-1/2 px-3">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="e_lastname">
Employee Last Name
</label>
<input
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="e_lastname" name="e_lastname" type="text" required>
</div>
</div>
<div class="flex flex-wrap -mx-3 mb-6">
<div class="w-full md:w-1/2 px-3">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="e_phone">
Phone Number
</label>
<input
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="e_phone" name="e_phone" type="number" required>
</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="car-type">
Employee 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="e_type" name="e_type">
<option selected value="support staff">Support Staff</option>
<option value="car wash attendant">Car Wash Attendant</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="e_payment">
Payment
</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="e_payment" name="e_payment">
<option value="salary">Fixed Salary</option>
<option value="commission">Commission</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 class="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="e_salary">
Salary (Ksh)/Comission(%)
</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="e_salary" name="e_salary" type="number" required>
</div>
</div>
<button id="add_employee" class="bg-amber-800 hover:bg-amber-300 text-white font-bold py-2 px-4 rounded">
Add Employee
</button>
</form>
</div>
<script>
let $ = require('jquery')
let ipc = require('electron').ipcRenderer
ipc.on('success_addemployee', (event, args) => {
window.alert(args)
})
ipc.on('error_addemployee', (event, args) => {
window.alert(args)
})
$('#add_employee').on('click', () => {
var e_firstname = $('#e_firstname').val().trim()
var e_lastname = $('#e_lastname').val().trim()
var e_phone = $('#e_phone').val().trim()
var e_type = $('#e_type').val().trim()
var e_payment = $('#e_payment').val().trim()
var e_salary = $('#e_salary').val().trim()
if (!e_firstname == '' && !e_lastname == '' && !e_phone == '' && !e_type == '' && !e_payment == '' && !e_salary == '') {
ipc.send('add_employee', [e_firstname, e_lastname, e_phone, e_type, e_payment, e_salary])
} else {
window.alert('Please provide the missing fields')
}
})
</script>
</body>
</html>