sanisurcrm

byJaime Cardenas

Crea una aplicación web SaaS empresarial, responsive y en español para **SANISUR**, destinada a centralizar la gestión comercial de Mercado Público: oportunidades, evaluación, postulaciones, clientes, cotizaciones, adjudicaciones, notas de venta, documentos, facturación y cobranza. Implementa una app FUNCIONAL con autenticación, RBAC, base de datos relacional, CRUD, archivos, auditoría, cálculos, notificaciones, PDF y exportación CSV/XLSX. No usar mock data final, placeholders ni botones sin funcionalidad. ## 1. UX Diseño SaaS profesional, limpio y rápido. Sidebar izquierdo + header con búsqueda global, notificaciones y usuario. Menú: **Dashboard | Oportunidades | Clientes | Cotizaciones | Notas de Venta | Documentos | Reportes | Configuración** Tablas con búsqueda, filtros, ordenamiento y paginación. Formularios validados, badges de estado, KPI, gráficos y responsive. Idioma español. Moneda CLP `$1.234.567`. Fecha `DD-MM-AAAA`. IVA configurable. ## 2. MODELO DE DATOS Crear entidades relacionadas con PK/FK: **Users** `id,name,email,role,status,created_at,last_login` Roles: `superadmin|admin|comercial|administracion` Status: `pending|active|rejected|suspended` **Clients** `id,razon_social,nombre_fantasia,rut,tipo,direccion,comuna,region,telefono,email,contacto,cargo_contacto,telefono_contacto,email_contacto,observaciones` **Opportunities** `id,codigo_mp,nombre,tipo,client_id,organismo,rut_organismo,region,descripcion,presupuesto,monto_estimado,fecha_publicacion,fecha_cierre,url_mp,responsible_user_id,prioridad,status,probability,observaciones,created_at` Tipos: `licitacion|compra_agil|trato_directo|convenio_marco|otro` Estados: `nueva|evaluacion|postular|no_postular|preparando|postulada|evaluacion_organismo|adjudicada|perdida|desierta|cancelada` **OpportunityEvaluations** `id,opportunity_id,requisitos_admin,requisitos_tecnicos,producto_disponible,stock,proveedor,costo_conocido,plazo_viable,margen_viable,documentacion_completa,costo_estimado,precio_estimado,utilidad_estimada,margen_estimado,decision,notes` Decision: `postular|revisar|no_postular` **Quotes** `id,numero,client_id,opportunity_id,responsible_user_id,fecha,validez,forma_pago,plazo_entrega,condiciones,status,subtotal,iva,total,total_cost,profit,margin` Estados: `borrador|enviada|negociacion|aceptada|rechazada|vencida` **QuoteItems** `id,quote_id,sku,producto,descripcion,cantidad,unidad,costo_unitario,transporte,packaging,comisiones,otros_costos,margen,precio_unitario,total` **SalesNotes** `id,numero,client_id,opportunity_id,quote_id,orden_compra,fecha,fecha_entrega,responsible_user_id,status,subtotal,iva,total,observaciones` Estados: `pendiente|confirmada|preparacion|despacho|entregada|facturada|pagada|cancelada` **Billing** `id,sales_note_id,numero_factura,fecha_factura,monto,fecha_vencimiento,fecha_pago,forma_pago,status` Estados: `por_facturar|facturado|pendiente_pago|pagado|vencido` **Documents** `id,nombre,categoria,file,client_id?,opportunity_id?,quote_id?,sales_note_id?,fecha_carga,fecha_vencimiento?,uploaded_by` **Activities** `id,user_id,entity_type,entity_id,action,previous_value,new_value,timestamp` **Notifications** `id,user_id,type,entity_type,entity_id,message,read,created_at` ## 3. AUTENTICACIÓN/RBAC Configurar como **SuperAdmin principal: [cardenas.adriasola@gmail.com](mailto:cardenas.adriasola@gmail.com)**. Debe tener FULL ACCESS y no poder ser eliminado, suspendido ni degradado por otros usuarios. En **Configuración > Usuarios** permitir crear, editar, aprobar, rechazar, activar, suspender y asignar roles/permisos. Roles: * `superadmin`: acceso total. * `admin`: gestión administrativa según permisos. * `comercial`: clientes, oportunidades, cotizaciones. * `administracion`: notas de venta, documentos, facturación y cobranza. Registro público permitido pero SIN acceso automático. Workflow: `REGISTER → pending → ADMIN REVIEW → active/rejected` Usuario `pending` no accede a información interna. Mostrar: **“Tu cuenta se encuentra pendiente de aprobación por un administrador.”** Nueva inscripción debe generar notificación al SuperAdmin/Admin. Aplicar permisos sobre datos/acciones, no solo ocultar UI. ## 4. DASHBOARD KPI desde datos reales: * Oportunidades detectadas/evaluadas. * Postulaciones. * En trámite. * Adjudicadas. * Perdidas. * Desiertas. * Monto postulado. * Monto adjudicado. * Ventas. * Utilidad. * Margen promedio. * Pendiente facturación. * Pendiente cobranza. `TasaAdjudicacion = Adjudicadas/Postuladas*100` Gráficos: oportunidades por estado, postulaciones/adjudicaciones mensuales, ventas, monto adjudicado, top organismos y evolución de adjudicación. Filtros: `periodo|responsable|organismo|tipo|estado`. Mostrar próximos vencimientos y tareas críticas. ## 5. OPORTUNIDADES CRUD + tabla + Kanban. Filtros por código, organismo, tipo, estado, responsable, prioridad y fecha. Ficha: **Resumen | Evaluación | Costos/Cotización | Documentos | Actividad** Registrar automáticamente cambios en `Activities`. Alertas de cierre: `7 días|3 días|24 horas|mismo día`. Desde oportunidad permitir evaluar, crear cotización, adjuntar documentos, registrar postulación/resultado y procesar adjudicación. Evaluación mediante checklist de requisitos administrativos/técnicos, disponibilidad, stock, proveedor, costo, plazo, margen y documentación. Calcular costo, precio, utilidad y margen estimado. ## 6. COTIZACIONES Relacionar Quote con Client + Opportunity. Número correlativo automático. Permitir N QuoteItems. Cálculos: `BaseCost=(CostoUnitario*Cantidad)+Transporte+Packaging+Comisiones+Otros` `Profit=PrecioVenta-BaseCost` `Margin%=Profit/PrecioVenta*100` Permitir margen objetivo global o por item y calcular precio de venta automáticamente. Diferenciar técnicamente markup sobre costo de margen sobre venta; usar **margen sobre venta** como indicador principal. Totales: `TotalCost|Subtotal/Neto|IVA|Total|Profit|Margin%` Acciones: `Guardar|Editar|Duplicar|PDF|Imprimir|Convertir a Nota de Venta` PDF profesional con logo/datos SANISUR, cliente, productos, cantidades, precios, neto, IVA, total, condiciones, vigencia y ejecutivo. ## 7. NOTAS DE VENTA/COBRANZA Crear SalesNote desde cotización aceptada u oportunidad adjudicada, heredando cliente, oportunidad, productos, cantidades, precios y totales. No duplicar ingreso. Workflow: `ADJUDICADA → OC RECIBIDA → NV → PREPARACIÓN → DESPACHO → ENTREGA → FACTURACIÓN → COBRO → CERRADA` Generar PDF de Nota de Venta. Billing debe gestionar factura, monto, vencimiento, pago y forma de pago. Regla: `fecha_actual>fecha_vencimiento AND fecha_pago IS NULL → status=vencido` Mostrar cartera: por facturar, pendiente, vencida y pagada. Generar alertas de cobranza. ## 8. CLIENTES CRUD completo. Ficha 360°: **Oportunidades | Cotizaciones | Adjudicaciones | Notas Venta | Documentos | Facturación | Cobros** KPI: `total_vendido|total_adjudicado|operaciones|saldo_pendiente` ## 9. DOCUMENTOS Repositorio con upload/download. Categorías: `empresa|certificados|mercado_publico|fichas_tecnicas|proveedores|licitaciones|ordenes_compra|contratos|otros` Relacionar opcionalmente con Client, Opportunity, Quote o SalesNote. Alertar por fecha de vencimiento. ## 10. REPORTES Filtros: `fecha_inicio|fecha_fin|cliente|organismo|responsable|tipo|estado` Reportes: * Pipeline oportunidades. * Postulaciones/adjudicaciones. * Tasa adjudicación. * Monto postulado/adjudicado. * Ventas. * Costos/rentabilidad. * Facturación. * Cobranza. * Rendimiento por organismo. * Rendimiento por ejecutivo. Exportar datos filtrados reales a `PDF|CSV|XLSX`. ## 11. CONFIGURACIÓN Secciones: **Empresa:** `razon_social,rut,direccion,telefono,email,web,logo,datos_bancarios` **Comercial:** `iva,moneda,margen_default,vigencia_cotizacion,condiciones_pago` **Usuarios:** gestión y aprobación. **Roles/Permisos:** RBAC. Propagar configuración automáticamente a cálculos, cotizaciones, PDFs y reportes. ## 12. BÚSQUEDA GLOBAL Buscar desde header: `Clientes|RUT|Oportunidades|Código MP|Cotizaciones|Notas Venta|OC|Documentos` Resultados clickeables deben abrir el registro correspondiente. ## 13. AUTOMATIZACIONES Implementar: 1. Registro → `pending` + notificación Admin. 2. Opportunity próxima a cierre → alerta. 3. Quote supera validez → `vencida`. 4. Opportunity `adjudicada` → habilitar NV. 5. Quote `aceptada` → habilitar NV. 6. SalesNote `facturada` → crear/actualizar Billing. 7. Billing vencido → `vencido` + alerta. 8. Documento próximo a vencer → alerta. 9. Cambios críticos → registrar Activities. ## 14. REGLAS * Persistencia real Base44. * CRUD funcional. * PK/FK y relaciones correctas. * Validaciones. * Confirmación antes de eliminar. * Auditoría de cambios críticos. * Seguridad RBAC real. * Componentes reutilizables. * Estados loading/error/success/empty. * PDFs/exportaciones funcionales. * No duplicar datos. * No placeholders. * No botones sin lógica. * No mock data final. * Heredar datos entre etapas. * Priorizar velocidad operativa y pocos clics. ## FLUJO MAESTRO `MERCADO PÚBLICO → OPORTUNIDAD → EVALUACIÓN → POSTULACIÓN → RESULTADO` Si pierde: `PERDIDA|RECHAZADA|DESIERTA` Si gana: `ADJUDICADA → ORDEN DE COMPRA → NOTA DE VENTA → PREPARACIÓN → DESPACHO → ENTREGA → FACTURACIÓN → COBRANZA → CERRADA` El Dashboard debe permitir saber inmediatamente: oportunidades vigentes y próximas a cerrar, postulaciones, adjudicaciones, pérdidas, monto postulado/adjudicado, ventas, costos, utilidad, margen, entregas, facturación y saldo pendiente de cobro. Implementa la aplicación completa en Base44 priorizando **integridad de datos, trazabilidad, automatización, seguridad RBAC y velocidad operativa**. Toma decisiones técnicas menores de forma autónoma sin detener la implementación.

No preview

Comments (0)

No comments yet. Be the first!

System Requirements

System Requirement Document
Page 1 of 11

System Requirements Document for sanisurcrm

1. Introduction

The sanisurcrm project aims to develop a comprehensive, responsive, and Spanish-language SaaS web application for SANISUR. The application is designed to centralize the commercial management of public market opportunities, including opportunities, evaluations, applications, clients, quotes, awards, sales notes, documents, billing, and collections. The application will feature authentication, role-based access control (RBAC), a relational database, CRUD operations, file management, auditing, calculations, notifications, and PDF/CSV/XLSX export capabilities. The design will be professional, clean, and fast, with a focus on data integrity, automation, security, and operational speed.

2. System Overview

The sanisurcrm application will be delivered as a web-based SaaS platform, accessible via a responsive interface in Spanish. It will serve various user roles, including superadmins, admins, commercial users, and administration users, each with specific access and management capabilities. The application will provide a centralized platform for managing public market opportunities and related commercial activities, ensuring data integrity, traceability, and security through robust RBAC and auditing features.

Page 2 of 11

2a. Product Interpretation and Delivery Boundary

The application will be delivered as a SaaS platform, accessible via a web interface. It will include authentication and RBAC to ensure secure access and management of data. The application will not use mock data, placeholders, or non-functional buttons. It will prioritize operational speed and data integrity, with features such as real-time KPI indicators, interactive charts, and automated notifications. The application will be built using Base44 for data persistence and will include functional CRUD operations, PK/FK relationships, and validations.

2b. Source Content Inventory

Not applicable as no content source directive was provided.

2c. Page Content and Component Coverage

Dashboard

  • Information/State: Real-time KPIs, graphs, upcoming deadlines, critical tasks.
  • Primary Actions: View detailed reports, filter data by period, responsible, organism, type, and state.
  • Supporting Actions: Access global search, notifications, and user settings.
  • Components: KPI indicators, graphs, filters, notifications.
  • States: Loading, error, success, empty.
Page 3 of 11

Oportunidades

  • Information/State: Opportunity details, evaluations, costs/quotes, documents, activity logs.
  • Primary Actions: CRUD operations, evaluate opportunities, create quotes, attach documents, register applications/results, process awards.
  • Supporting Actions: Filter opportunities by code, organism, type, state, responsible, priority, and date.
  • Components: Kanban board, checklist for evaluations, alerts for closing opportunities.
  • States: Loading, error, success, empty.

Clientes

  • Information/State: Client details, opportunities, quotes, awards, sales notes, documents, billing, collections.
  • Primary Actions: CRUD operations, view 360° client profile.
  • Supporting Actions: Access client-related KPIs.
  • Components: Client profile, KPI indicators.
  • States: Loading, error, success, empty.

Cotizaciones

  • Information/State: Quote details, related clients and opportunities, quote items.
  • Primary Actions: CRUD operations, calculate costs, profits, and margins, generate PDF.
  • Supporting Actions: Duplicate quotes, convert to sales notes.
  • Components: Quote form, calculations, PDF generation.
  • States: Loading, error, success, empty.

Notas de Venta/Cobranza

  • Information/State: Sales note details, billing information, workflow status.
  • Primary Actions: Create sales notes from accepted quotes or awarded opportunities, manage billing.
  • Supporting Actions: Generate PDF of sales notes, view billing alerts.
  • Components: Sales note form, billing management, alerts.
  • States: Loading, error, success, empty.
Page 4 of 11

Documentos

  • Information/State: Document repository, categories, related entities.
  • Primary Actions: Upload/download documents, manage categories.
  • Supporting Actions: Alert for document expiration.
  • Components: Document repository, category management.
  • States: Loading, error, success, empty.

Reportes

  • Information/State: Filtered reports on opportunities, applications, awards, sales, costs, billing, collections.
  • Primary Actions: Generate and export reports to PDF/CSV/XLSX.
  • Supporting Actions: Apply filters by date, client, organism, responsible, type, state.
  • Components: Report filters, export functionality.
  • States: Loading, error, success, empty.

Configuración

  • Information/State: Company settings, commercial settings, user management, roles/permissions.
  • Primary Actions: Manage company and commercial settings, user roles, and permissions.
  • Supporting Actions: Propagate settings to calculations, quotes, PDFs, and reports.
  • Components: Settings forms, role management.
  • States: Loading, error, success, empty.

Búsqueda Global

  • Information/State: Search results for clients, opportunities, quotes, sales notes, documents.
  • Primary Actions: Perform global search, access clickable results.
  • Supporting Actions: Open corresponding records from search results.
  • Components: Search bar, result list.
  • States: Loading, error, success, empty.
Page 5 of 11

3. Functional Requirements

  1. As a SuperAdmin, I should have full access to all features and data, and my account should not be deletable, suspendable, or demotable by other users.

    • Provenance: Explicit
    • Lifecycle Facts: SuperAdmin account creation, full access verification, account protection.
    • Observable Acceptance: SuperAdmin can access all features without restrictions.
  2. As an Admin, I should be able to manage users, approve/reject registrations, and assign roles/permissions.

    • Provenance: Explicit
    • Lifecycle Facts: User registration, role assignment, approval/rejection process.
    • Observable Acceptance: Admin can manage user accounts and roles.
  3. As a Comercial user, I should be able to manage clients, opportunities, and quotes.

    • Provenance: Explicit
    • Lifecycle Facts: CRUD operations on clients, opportunities, and quotes.
    • Observable Acceptance: Comercial user can perform all necessary operations on assigned entities.
  4. As an Administracion user, I should be able to manage sales notes, documents, billing, and collections.

    • Provenance: Explicit
    • Lifecycle Facts: CRUD operations on sales notes, document management, billing processes.
    • Observable Acceptance: Administracion user can perform all necessary operations on assigned entities.
  5. As a user, I should be able to perform a global search from the header to find clients, opportunities, quotes, sales notes, and documents.

    • Provenance: Explicit
    • Lifecycle Facts: Search initiation, result retrieval, record access.
    • Observable Acceptance: User can search and access records from search results.
  6. As a user, I should receive notifications for critical actions such as registration approval, opportunity closure alerts, and billing alerts.

    • Provenance: Explicit
    • Lifecycle Facts: Notification generation, user alerting.
    • Observable Acceptance: User receives timely notifications for critical actions.
  7. As a user, I should be able to generate and export reports in PDF, CSV, and XLSX formats.

    • Provenance: Explicit
    • Lifecycle Facts: Report generation, export initiation, file download.
    • Observable Acceptance: User can generate and download reports in specified formats.
  8. As a user, I should be able to view and interact with a dashboard displaying real-time KPIs and graphs.

    • Provenance: Explicit
    • Lifecycle Facts: Dashboard access, KPI display, graph interaction.
    • Observable Acceptance: User can view and interact with dashboard elements.
  9. As a user, I should be able to manage documents by uploading, downloading, and categorizing them.

    • Provenance: Explicit
    • Lifecycle Facts: Document upload/download, category assignment.
    • Observable Acceptance: User can manage documents effectively.
  10. As a user, I should be able to configure company and commercial settings, including IVA, currency, and default margins.

    • Provenance: Explicit
    • Lifecycle Facts: Settings configuration, propagation to related calculations and documents.
    • Observable Acceptance: User can configure and see the effect of settings changes.
Page 6 of 11

4. User Personas

SuperAdmin

  • Product Context: Oversees the entire application, ensuring all features and data are accessible and secure.
  • Primary Goal: Maintain full control over the application and user management.
  • Distinct Responsibilities: Full access to all features, protection from account changes by others.
  • Interactions: Manages user roles and permissions, oversees application security.
  • Observable Success: Full access without restrictions, secure user management.

Admin

  • Product Context: Manages user accounts and roles, ensuring proper access and permissions.
  • Primary Goal: Efficiently manage user registrations and role assignments.
  • Distinct Responsibilities: Approve/reject registrations, assign roles, manage user accounts.
  • Interactions: Interacts with user registration workflows, role management.
  • Observable Success: Smooth user management and role assignment process.

Comercial User

  • Product Context: Manages clients, opportunities, and quotes to drive business growth.
  • Primary Goal: Efficiently manage and convert opportunities into sales.
  • Distinct Responsibilities: CRUD operations on clients, opportunities, and quotes.
  • Interactions: Engages with client and opportunity management workflows.
  • Observable Success: Successful management and conversion of opportunities.
Page 7 of 11

Administracion User

  • Product Context: Manages sales notes, documents, billing, and collections to ensure financial accuracy.
  • Primary Goal: Ensure accurate and timely billing and collections.
  • Distinct Responsibilities: Manage sales notes, documents, billing processes.
  • Interactions: Engages with billing and document management workflows.
  • Observable Success: Accurate billing and effective document management.

5. Core User Flows

5.1 SuperAdmin User Flow

  1. Starting Context: SuperAdmin logs into the application.
  2. Dashboard Access: Views the dashboard with full access to all KPIs and features.
  3. User Management: Navigates to the "Configuración > Usuarios" section.
  4. Role Assignment: Assigns roles and permissions to new users.
  5. Account Protection: Verifies that their account cannot be altered by others.
  6. Completion: Logs out, ensuring all changes are saved.

5.2 Admin User Flow

  1. Starting Context: Admin logs into the application.
  2. User Registration: Receives notification of new user registration.
  3. Approval Process: Navigates to the "Configuración > Usuarios" section.
  4. Role Assignment: Approves or rejects user registrations and assigns roles.
  5. Completion: Confirms changes and logs out.
Page 8 of 11

5.3 Comercial User Flow

  1. Starting Context: Comercial user logs into the application.
  2. Client Management: Accesses the "Clientes" section to manage client information.
  3. Opportunity Management: Navigates to "Oportunidades" to view and manage opportunities.
  4. Quote Creation: Creates quotes related to opportunities.
  5. Completion: Saves changes and logs out.

5.4 Administracion User Flow

  1. Starting Context: Administracion user logs into the application.
  2. Sales Note Management: Accesses the "Notas de Venta" section to manage sales notes.
  3. Billing Process: Navigates to "Cobranza" to manage billing and collections.
  4. Document Management: Uploads and categorizes documents in the "Documentos" section.
  5. Completion: Confirms all changes and logs out.

5.5 Global Search Flow

  1. Starting Context: User logs into the application.
  2. Search Initiation: Uses the global search bar in the header.
  3. Result Retrieval: Views clickable search results.
  4. Record Access: Clicks on a result to open the corresponding record.
  5. Completion: Reviews the record and logs out.
Page 9 of 11

6. Visuals Colors and Theme

  • Muse: Erik Spiekermann
  • Palette:
    • Background: #F6F6F6
    • Surface: #FFFFFF
    • Text: #333333
    • Primary: #D72323
    • Accent: #F2C14E
    • Muted: #B0B0B0
  • Typography:
    • Headings: Fira Sans, strong weights, medium tracking, sentence case
    • Body: Source Sans Pro
    • Scale: 1.333 modular, 48/36/24/18/16
  • Shape Language: Clear columns, generous margins, numbered systems, iconography with type
  • Layout: Structured grid with sidebar navigation, header with global search and action items
  • Motion: Functional transitions with short, purposeful animations

7. Signature Design Concept

The public entry page will feature a structured grid dashboard with real-time KPI indicators and interactive charts. The sidebar navigation will provide clear icons and labels for rapid access to different sections. A global search bar will be prominently placed in the header for quick access to data across the CRM. The design will use a light background with primary and accent highlights to emphasize key data points and actions.

Page 10 of 11

8. Interaction Model & Motion Direction

  • Interaction Model: Static
  • Motion Tempo: Restrained
  • Hero Dimensionality: Flat
  • Landing Hero Motion Brief: The hero section will display a full-width structured grid of key data points and visual indicators. The motion will be minimal, focusing on functional transitions that enhance clarity and user experience. In reduced-motion settings, animations will be disabled to ensure accessibility.

9. Non-Functional Requirements

  1. Performance: The application must load quickly and respond to user interactions with minimal delay.
  2. Security: Implement robust RBAC to ensure secure access and data protection.
  3. Scalability: The application should support a growing number of users and data without performance degradation.
  4. Reliability: Ensure high availability and fault tolerance to minimize downtime.
  5. Usability: The interface should be intuitive and easy to navigate for all user roles.

10. Tech Stack

  • Frontend: React
  • Backend: Python/FastAPI
  • Database: PostgreSQL
  • Storage: AWS S3 for file management
  • Deployment: Docker, Kubernetes for container orchestration
  • Authentication: OAuth 2.0 for secure login
  • Notifications: WebSockets for real-time updates
Page 11 of 11

11. Assumptions and Constraints

  1. Assumption: All users will have internet access to use the web-based application.
  2. Constraint: The application must be developed in Spanish and support the CLP currency format.
  3. Assumption: Users will have basic computer literacy to navigate the application.
  4. Constraint: The application must comply with data protection regulations applicable to the public market sector.

12. Glossary

  • CRUD: Create, Read, Update, Delete - basic operations for managing data.
  • RBAC: Role-Based Access Control - a method of regulating access to resources based on user roles.
  • KPI: Key Performance Indicator - a measurable value that demonstrates how effectively a company is achieving key business objectives.
  • PDF/CSV/XLSX: File formats for document and data export.
  • SaaS: Software as a Service - a software distribution model in which applications are hosted by a service provider and made available to customers over the internet.

No completed page designs yet.

Completed design pages will appear here when they are ready to preview.

Dashboard: View pending notifications
Configuración: Review new registration
Configuración: Approve user account
Configuración: Reject user account
Configuración: Assign user role

No completed page designs yet.

Completed design pages will appear here when they are ready to preview.

Dashboard: View pending notifications
Configuración: Review new registration
Configuración: Approve user account
Configuración: Reject user account
Configuración: Assign user role