-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsalaryupdate.html
80 lines (71 loc) · 3.29 KB
/
salaryupdate.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="distributions/output.css" rel="stylesheet" type="text/css">
<title>Salary Update </title>
</head>
<body>
<div class="md:flex md:justify-center mb-6">
<form class="py-5 px-6">
<div class="flex flex-wrap -m-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="phone_number">
Employee Phone Number
</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="phone_number" name="phone_number" type="number" placeholder="phone number">
</div>
</div>
<div class="flex -m-3 mb-6">
<div class="w-full md:w-1/2 px-3 mb-6 md:mb-0">
<label class="inline-flex items-center mt-3">
<input value="salary" type="radio" class="form-radio h-5 w-5 text-gray-600" name="pay_type"
checked><span class="ml-2 text-gray-700">Update Salary</span>
</label>
</div>
<div class="w-full md:w-1/2 px-3 mb-6 md:mb-0">
<label class="inline-flex items-center mt-3">
<input value="commission" type="radio" class="form-radio h-5 w-5 text-amber-800 "
name="pay_type"><span class="ml-2 text-gray-700">Update Commission</span>
</label>
</div>
</div>
<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="new_sal_com">
New Salary (ksh) / Comission(%)
</label>
<input
class="appearance-none block w-full bg-gray-200 text-amber-800 border rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white"
id="new_sal_com" name="new_sal_com" type="number">
</div>
<button id="update_salary" class="block rounded px-3 py-3 text-white bg-amber-800">Update Payment</button>
</form>
</div>
<script>
let $ = require('jquery')
let ipc = require('electron').ipcRenderer
ipc.on('success_salaryupdate', (event, args) => {
window.alert(args)
})
ipc.on('error_salaryupdate', (event, args) => {
window.alert(args)
})
ipc.on('no_suchemployee', (event, args) => {
window.alert(args)
})
$('#update_salary').on('click', () => {
var phone = $('#phone_number').val().trim()
var pay_type = $('input[name="pay_type"]:checked').val().trim()
var sal_com = $('#new_sal_com').val().trim()
if (!phone == '' && !pay_type == '' && !sal_com == '') {
ipc.send('update_salary', [phone, pay_type, sal_com])
} else {
window.alert('Provide the missing fields')
}
})
</script>
</body>
</html>