-
Notifications
You must be signed in to change notification settings - Fork 0
/
processes.html
90 lines (89 loc) · 4.18 KB
/
processes.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
<!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 Processos</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/alpinejs@2.8.2/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="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="editProcess.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 Processo</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 Processos</h1>
<table class="min-w-full bg-white">
<thead>
<tr class="text-left">
<th class="py-2 px-4 border-b-2">ID</th>
<th class="py-2 px-4 border-b-2">Nome</th>
<th class="py-2 px-4 border-b-2">Versão</th>
<th class="py-2 px-4 border-b-2">Objetivo</th>
<th class="py-2 px-4 border-b-2">Ações</th>
</tr>
</thead>
<tbody id="processTable">
<!-- As linhas dos processos serão preenchidas pelo JavaScript -->
</tbody>
</table>
</div>
<script>
document.addEventListener('DOMContentLoaded', async () => {
const loadProcesses = async () => {
const response = await fetch('/api/processes');
if (response.ok) {
const processes = await response.json();
const processTable = document.getElementById('processTable');
processTable.innerHTML = processes.map(process => `
<tr>
<td class="py-2 px-4 border-b">${process.id}</td>
<td class="py-2 px-4 border-b">${process.name}</td>
<td class="py-2 px-4 border-b">${process.version}</td>
<td class="py-2 px-4 border-b">${process.objective}</td>
<td class="py-2 px-4 border-b">
<a href="editProcess.html?id=${process.id}" class="text-blue-600 hover:underline">Editar</a>
</td>
</tr>
`).join('');
} else {
console.error('Falha ao buscar processos');
}
};
if (document.getElementById('processTable')) {
loadProcesses();
}
});
</script>
</body>
</html>