feat(7-mejoras): notas persisten + soporte + captura visible
1. Notas propagan entre etapas (convertirLead/apartar updateMany) 2. Afluencia: conexión → aviso amarillo 3. Escrituración: click nombre abre bitácora 4. Co-acreditado: opción 'no tiene' 5. Nota del alta de lead → bitácora 6. Módulo Soporte: formulario + listado solicitudes 7. Captura visible para todos
This commit is contained in:
73
apps/landing/src/services/soporte.ts
Normal file
73
apps/landing/src/services/soporte.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { API_URL, conAuth, manejar401 } from './auth'
|
||||
|
||||
/** Departamentos a los que se puede dirigir una solicitud de soporte */
|
||||
export const DEPARTAMENTOS_SOPORTE = [
|
||||
'Sistemas',
|
||||
'Administración',
|
||||
'Ventas',
|
||||
'Cobranza',
|
||||
'Escrituración',
|
||||
'Dirección',
|
||||
] as const
|
||||
|
||||
/** Prioridades de una solicitud */
|
||||
export const PRIORIDADES_SOPORTE = ['Baja', 'Media', 'Alta', 'Urgente'] as const
|
||||
|
||||
export type DepartamentoSoporte = (typeof DEPARTAMENTOS_SOPORTE)[number]
|
||||
export type PrioridadSoporte = (typeof PRIORIDADES_SOPORTE)[number]
|
||||
|
||||
export interface SolicitudSoporte {
|
||||
id: string
|
||||
titulo: string
|
||||
descripcion: string
|
||||
departamento: string
|
||||
prioridad: string
|
||||
responsable: string | null
|
||||
fechaSolicitud: string
|
||||
fechaLimite: string | null
|
||||
notas: string | null
|
||||
archivos: string[]
|
||||
solicitante: string
|
||||
solicitanteEmail: string | null
|
||||
estado: string
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
/** POST /api/soporte — crear solicitud de soporte */
|
||||
export async function crearSolicitudSoporte(payload: {
|
||||
titulo: string
|
||||
descripcion: string
|
||||
departamento: DepartamentoSoporte
|
||||
prioridad: PrioridadSoporte
|
||||
responsable?: string
|
||||
fechaSolicitud: string
|
||||
fechaLimite?: string
|
||||
notas?: string
|
||||
solicitante?: string
|
||||
email?: string
|
||||
archivos?: string[]
|
||||
}): Promise<SolicitudSoporte> {
|
||||
const resp = await fetch(`${API_URL}/soporte`, conAuth({
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
}))
|
||||
manejar401(resp)
|
||||
if (!resp.ok) {
|
||||
const body = (await resp.json().catch(() => null)) as { error?: string } | null
|
||||
throw new Error(body?.error ?? `HTTP ${resp.status}`)
|
||||
}
|
||||
return (await resp.json()) as SolicitudSoporte
|
||||
}
|
||||
|
||||
/** GET /api/soporte — solicitudes propias (admin: todas) */
|
||||
export async function listarSolicitudesSoporte(): Promise<SolicitudSoporte[]> {
|
||||
const resp = await fetch(`${API_URL}/soporte`, conAuth())
|
||||
manejar401(resp)
|
||||
if (!resp.ok) {
|
||||
const body = (await resp.json().catch(() => null)) as { error?: string } | null
|
||||
throw new Error(body?.error ?? `HTTP ${resp.status}`)
|
||||
}
|
||||
return (await resp.json()) as SolicitudSoporte[]
|
||||
}
|
||||
Reference in New Issue
Block a user