feat: Kanban profiles, a Usuários page, and machines that route orders

Every operator could do everything, and accounts were made from the
console. Each account now has a profile, checked by the server on every
action: Administrador (everything, plus users and machines), Gestão
(everything but users), Operador (moves cards and handles artwork) and
Vendedor (reads orders, quotes and Números, changes nothing). The
superadmin is the system's own account, set from the console and kept by
the account OPERATOR_EMAIL seeds; administrators cannot change it, and
nobody can delete, disable or demote themselves.

The Usuários tab creates, edits, disables and deletes users with a first
password (there is no e-mail yet), and registers machines with the
products each prints. An order goes to the first active machine that
prints its product, or to the one chosen in its panel; an operator tied
to machines sees and downloads only their orders. Everyone changes their
own password in the account menu, which now holds the name and Sair too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-07 15:00:00 -03:00
parent 6c2dcc77b0
commit c75c40ff28
12 changed files with 719 additions and 66 deletions

View File

@@ -22,6 +22,7 @@
<button type="button" data-tab="payments" aria-selected="false">Pagamentos <span class="badge warn" id="badge-payments"></span></button>
<button type="button" data-tab="stats" aria-selected="false">Números</button>
<button type="button" data-tab="integrations" aria-selected="false">Integrações</button>
<button type="button" data-tab="users" aria-selected="false" hidden>Usuários</button>
</nav>
<div class="searchbox">
<label class="search">
@@ -32,7 +33,7 @@
<div id="search-results" class="results" role="listbox" aria-label="Resultados da busca" hidden></div>
</div>
<span id="tiny" class="tinydot"></span>
<span id="who" class="who"></span>
<div class="refresh">
<button class="btn ghost" id="refresh" type="button"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-2.64-6.36"></path><path d="M21 3v6h-6"></path></svg>Atualizar</button>
<select id="refresh-every" aria-label="Atualizar sozinho a cada">
@@ -40,7 +41,14 @@
<option value="60">1 min</option><option value="300">5 min</option><option value="900">15 min</option>
</select>
</div>
<button class="btn ghost" id="logout" type="button">Sair</button>
<div class="morewrap account">
<button class="btn ghost" id="account" type="button" aria-haspopup="menu" aria-label="Minha conta"><span id="initials">·</span></button>
<div class="menu" id="account-menu" role="menu" hidden>
<div class="menu-head"><b id="who"></b><span id="who-role"></span></div>
<button class="menuitem" id="my-password" type="button">Minha senha</button>
<button class="menuitem" id="logout" type="button">Sair</button>
</div>
</div>
</header>
<p id="status" role="status"></p>
<main>
@@ -77,6 +85,16 @@
<table class="log"><thead><tr><th scope="col">Etapa</th><th scope="col">Tempo mediano</th><th scope="col">Pedidos que passaram</th><th scope="col">Agora</th></tr></thead><tbody id="stats-stages"></tbody></table>
</section>
</section>
<section id="tab-users" class="page" hidden>
<div class="pagehead"><h1>Usuários</h1><button class="btn primary" id="new-user" type="button">Novo usuário</button></div>
<p class="faint stats-note">Quem entra no Kanban e o que cada perfil pode fazer. Administrador: tudo, inclusive esta página.
Gestão: tudo, menos usuários. Operador: move pedidos e aprova arquivos. Vendedor: só consulta.</p>
<section class="statbox"><table class="log"><thead><tr><th scope="col">Nome</th><th scope="col">Perfil</th><th scope="col">Máquinas</th><th scope="col">Último acesso</th><th scope="col"></th></tr></thead><tbody id="users-list"></tbody></table></section>
<div class="pagehead"><h2>Máquinas</h2><button class="btn" id="new-machine" type="button">Nova máquina</button></div>
<p class="faint stats-note">Cada pedido vai para a primeira máquina ativa que imprime o produto dele; no pedido dá para escolher outra.
Um operador ligado a máquinas vê só os pedidos delas.</p>
<section class="statbox"><table class="log"><thead><tr><th scope="col">Máquina</th><th scope="col">Produtos</th><th scope="col">Situação</th><th scope="col"></th></tr></thead><tbody id="machines-list"></tbody></table></section>
</section>
<section id="tab-integrations" class="page" hidden>
<h1>Integrações</h1>
<section><div class="grid4" id="integrations"></div></section>