-
Notifications
You must be signed in to change notification settings - Fork 0
/
risks.html
91 lines (90 loc) · 4.17 KB
/
risks.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
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lista de Riscos</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/alpine.min.js" defer></script>
</head>
<body class="flex">
<div x-data="{ open: true }" class="flex flex-col min-h-screen w-64 bg-gray-800 text-white">
<div class="flex items-center justify-between p-4">
<h1 class="text-xl font-bold" x-show="open">Menu</h1>
<button @click="open = !open" class="text-gray-500 focus:outline-none">
<svg x-show="open" class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
<svg x-show="!open" class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
</button>
</div>
<nav :class="{'hidden': !open, 'block': open}" class="flex-1 px-4 py-2 space-y-2">
<!--<a href="edit.html" class="flex items-center px-4 py-2 rounded hover:bg-gray-700">
<svg class="w-6 h-6 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
</svg>
<span x-show="open">Novo Risco</span>
</a>-->
<a href="processes.html" class="flex items-center px-4 py-2 rounded hover:bg-gray-700">
<svg class="w-6 h-6 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7h18M3 12h18m-9 5h9"></path>
</svg>
<span x-show="open">Processos</span>
</a>
<a href="risks.html" class="flex items-center px-4 py-2 rounded hover:bg-gray-700">
<svg class="w-6 h-6 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7h18M3 12h18m-9 5h9"></path>
</svg>
<span x-show="open">Riscos</span>
</a>
</nav>
</div>
<div class="flex-1 p-6">
<h1 class="text-2xl font-bold mb-4">Lista de Riscos</h1>
<table class="min-w-full bg-white">
<thead>
<tr>
<th class="py-2 px-4 border-b">ID</th>
<th class="py-2 px-4 border-b">Descrição</th>
<th class="py-2 px-4 border-b">Probabilidade</th>
<th class="py-2 px-4 border-b">Impacto</th>
<th class="py-2 px-4 border-b">Status</th>
</tr>
</thead>
<tbody id="risckTable">
<!-- As linhas dos processos serão preenchidas pelo JavaScript -->
</tbody>
</table>
</div>
<script>
document.addEventListener('DOMContentLoaded', async () => {
const loadRisks = async () => {
const response = await fetch('/api/risks');
if (response.ok) {
const risks = await response.json();
const risckTable = document.getElementById('risckTable');
risckTable.innerHTML = risks.map(risk => `
<tr>
<td class="py-2 px-4 border-b">${risk.id}</td>
<td class="py-2 px-4 border-b">${risk.description}</td>
<td class="py-2 px-4 border-b">${risk.probability}</td>
<td class="py-2 px-4 border-b">${risk.impact}</td>
<td class="py-2 px-4 border-b">${risk.status}</td>
<td class="py-2 px-4 border-b">
<a href="edit.html?id=${risk.id}" class="text-blue-600 hover:underline">Editar</a>
</td>
</tr>
`).join('');
} else {
console.error('Falha ao buscar riscos');
}
};
if (document.getElementById('risckTable')) {
loadRisks();
}
});
</script>
</body>
</html>