feat(protese): agenda & coleta do laboratório (integrada à custódia)
Novo módulo de logística do lab (doc/AGENDA-COLETA-LAB): - protese_coleta: agendamento de coleta (lab busca) / entrega (lab leva), com data/hora, endereço, responsável, status. Ligado à OS. - POST /protese/os/:id/coleta (agendar), GET /protese/lab/agenda (cronológica), POST /protese/coleta/:id/status. 'realizada' MOVE a custódia automaticamente (coleta→laboratorio, entrega→clinica) — fonte única do movimento físico. GET detalhe traz coletas[]. - UI: tela AGENDA (lab-agenda) agrupada por dia com "marcar realizada"; seção Coleta/entrega na aba Monitoramento da OS (clínica e lab). Validado em DEV: agenda coleta → realizada → custódia=laboratorio; lab vê na agenda. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1124,6 +1124,21 @@ export const HybridBackend = {
|
||||
const res = await apiFetch(`${API_URL}/protese/lab/indicadores`);
|
||||
return await res.json().catch(() => ({}));
|
||||
},
|
||||
// Agenda & Coleta do laboratório
|
||||
agendarColeta: async (osId: string, body: { tipo: 'coleta' | 'entrega'; data_hora?: string; endereco?: string; responsavel?: string; observacao?: string }) => {
|
||||
const res = await apiFetch(`${API_URL}/protese/os/${osId}/coleta`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
||||
if (!res.ok) throw new Error((await res.json().catch(() => ({}))).error || 'Erro ao agendar');
|
||||
return await res.json();
|
||||
},
|
||||
getLabAgenda: async (): Promise<any[]> => {
|
||||
const res = await apiFetch(`${API_URL}/protese/lab/agenda`);
|
||||
return await res.json().catch(() => []);
|
||||
},
|
||||
statusColeta: async (coletaId: string, status: 'realizada' | 'cancelada') => {
|
||||
const res = await apiFetch(`${API_URL}/protese/coleta/${coletaId}/status`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status }) });
|
||||
if (!res.ok) throw new Error((await res.json().catch(() => ({}))).error || 'Erro ao atualizar');
|
||||
return await res.json();
|
||||
},
|
||||
// Fatia 4: a clínica avalia o laboratório ao final da OS
|
||||
avaliarProteseOS: async (osId: string, body: { estrelas: number; comentario?: string }) => {
|
||||
const res = await apiFetch(`${API_URL}/protese/os/${osId}/avaliar`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
||||
|
||||
Reference in New Issue
Block a user