compliance CFP #7: portal + fluxo de assinatura no SharedDocumentPage
ROADMAP #1.2 #7 — Assinatura eletronica no portal. Migration 20260521000007 cria RPC list_my_signatures (SECURITY DEFINER) que cruza auth.uid() por 3 caminhos (signatario_id, signatario_email, patient.user_id) e devolve solicitacoes pendentes + share_token pra link de assinatura. service.listMySignatures wrappa a RPC. Composable useDocumentSignatures ganha loadMine(). PortalDocumentos.vue (nova) — lista signatures do paciente logado com KPIs (total/pendentes/assinados/recusados), filtro, e botao "Assinar agora" que navega pra /shared/document/:token. Item no portal.menu "Documentos > Para assinar". SharedDocumentPage.vue estendida: agora chama getSignableDocumentBy Token primeiro (RPC nova). Quando o documento tem signatures pendentes, mostra painel azul abaixo do preview com: - Aviso LGPD/CFP explicando o que sera registrado (IP/UA/timestamp/hash) - Checkbox aceite obrigatorio - Selecao de signatario quando multi-signatario - Botoes Assinar/Recusar com loading state - Computacao SHA-256 server-fetched antes do click Fluxo: terapeuta gera doc -> cria signature + share_link -> link e listado em /portal/documentos -> paciente clica -> /shared/document/ :token mostra doc + painel -> aceite -> assinatura registrada via RPC sign_document_by_token (IP/UA capturados server-side). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
signByPortal,
|
||||
signByToken,
|
||||
getSignableDocumentByToken,
|
||||
listMySignatures,
|
||||
hashDocument
|
||||
} from '@/services/DocumentSignatures.service';
|
||||
|
||||
@@ -110,6 +111,22 @@ export function useDocumentSignatures() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadMine(statusFilter = null) {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const rows = await listMySignatures(statusFilter);
|
||||
signatures.value = Array.isArray(rows) ? rows : [];
|
||||
return signatures.value;
|
||||
} catch (e) {
|
||||
error.value = e?.message || 'Falha ao carregar minhas assinaturas.';
|
||||
signatures.value = [];
|
||||
throw e;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadByToken(token) {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
@@ -144,6 +161,7 @@ export function useDocumentSignatures() {
|
||||
refuse,
|
||||
signWithToken,
|
||||
loadByToken,
|
||||
loadMine,
|
||||
hashDocument
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user