-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconcerns.html
154 lines (137 loc) · 6.68 KB
/
concerns.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="distributions/output.css" type="text/css">
<title>Employee Concerns</title>
</head>
<body>
<div class="flex py-3 w-full justify-items-stretch">
<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="complainant">
Employee 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="complainant" name="complainant" type="text">
</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="complain">
Complain
</label>
<textarea rows="1"
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="complain" name="complain" type="text"></textarea>
</div>
</div>
<div class="flex">
<div class="w-full md:w-1/2 px-3 mb-3">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="date">
Date
</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="date" name="date" type="datetime-local" placeholder="Doe">
</div>
<div class="w-full md:w-1/2 px-3 py-6 mb-6 md:mb-0 ">
<button id="complain_btn" class="bg-amber-800 hover:bg-gray-300 text-white font-bold py-2 px-4 rounded">
Add Complain
</button>
</div>
</div>
<div class="flex w-full">
<div class="container mx-auto px-3 sm:px-8">
<div class="py-8">
<div class="-mx-4 sm:-mx-8 px-4 sm:px-3 py-4 overflow-x-auto">
<div class="inline-block min-w-full shadow rounded-lg overflow-hidden">
<table class="min-w-full leading-normal">
<thead>
<tr>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Employee Name
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Complain
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Date
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Status
</th>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
let $ = require('jquery')
let ipc = require('electron').ipcRenderer
ipc.on('success_addcomplain', (event, args) => {
window.alert(args)
})
ipc.on('error_addcomplain', (event, args) => {
window.alert(args)
})
ipc.send('all_complains')
ipc.on('allcomplains', (event, args) => {
let tbody = $('#tbody')
for (let i = 0; i < args.length; i++) {
let tr = document.createElement('tr')
let td = document.createElement('td')
let div = document.createElement('div')
let div2 = document.createElement('div')
let p = document.createElement('p')
let td2 = document.createElement('td')
let p2 = document.createElement('p')
let td3 = document.createElement('td')
let p3 = document.createElement('p')
let td4 = document.createElement('td')
let span = document.createElement('span')
p.classList.add('text-gray-900', 'whitespace-no-wrap')
div.classList.add('flex', 'items-center')
div2.classList.add('ml-3')
td.classList.add('px-5', 'py-5', 'border-b', 'border-gray-200', 'bg-white', 'text-sm')
p.innerHTML = args[i].employee_name
div2.appendChild(p)
div.appendChild(div2)
td.appendChild(div)
td2.classList.add('px-5', 'py-5', 'border-b', 'border-gray-200', 'bg-white', 'text-sm')
p2.classList.add('text-gray-900', 'whitespace-no-wrap')
p2.innerHTML = args[i].complain
td2.appendChild(p2)
td3.classList.add('px-5', 'py-5', 'border-b', 'border-gray-300', 'bg-white', 'text-sm')
p3.classList.add('text-gray-900', 'whitespace-no-wrap')
p3.innerHTML = args[i].date
td3.appendChild(p3)
td4.classList.add('px-5', 'py-5', 'border-b', 'border-gray-300', 'bg-white', 'text-sm')
span.classList.add('relative', 'text-red-600')
span.innerHTML = args[i].status
td4.appendChild(span)
tr.append(td, td2, td3, td4)
tbody.append(tr)
}
})
$('#complain_btn').on('click', () => {
let complainant = $('#complainant').val()
let complain = $('#complain').val()
let date = $('#date').val()
if (!complainant == '' && !complain == '' && !date == '') {
ipc.send('new_complain', [complainant, complain, date])
} else {
window.alert('Please prvide the missing fields')
}
})
</script>
</body>
</html>