Skip to main content

Overview

The Service Ticket model represents a repair service request in the Luis IT Repair system. It tracks devices from intake through completion, supporting laptops, PCs, printers, and monitors with device-specific fields.

Firestore Collection

Collection Name: servicios Index Collection: folios (for unique folio lookups)

Core Fields

folio
string
required
Unique identifier for the service ticket (e.g., “HP/001”). Generated automatically based on device brand. Stored in the folios collection for fast lookups.
clienteId
string
Reference to the client document ID in the clientes collection. Used to link services to customer records.
nombre
string
required
Customer name for this service ticket.
telefono
string
required
Customer phone number. Used for duplicate detection and customer lookup.
direccion
string
Customer address for service delivery or contact purposes.

Device Information

tipoDispositivo
string
required
Type of device being serviced. Determines which device-specific fields are populated.Possible values:
  • laptop
  • pc
  • impresora (printer)
  • monitor
marca
string
required
Device brand/manufacturer (e.g., “HP”, “Dell”, “Lenovo”). Used in folio generation.
modelo
string
required
Device model name or number.
numeroSerie
string
Device serial number. Can be omitted if omitirNumeroSerie is true.
omitirNumeroSerie
boolean
default:false
Flag indicating whether serial number was intentionally omitted.

Service Details

trabajo
string
required
Description of the work to be performed or issue to be diagnosed.
trabajoNorm
string
Normalized version of trabajo for duplicate detection (lowercase, no accents).
costo
string
Service cost. Empty if precioDespues is true.
precioDespues
boolean
default:false
Indicates if pricing will be determined after diagnosis.
caracteristicasPendientes
boolean
default:false
Flag indicating that device characteristics need to be filled in later.

Status Tracking

status
string
default:"pendiente"
Current service status. Normalized to lowercase with underscores.Common values:
  • pendiente - Initial state
  • en_proceso - Work in progress
  • esperando_refacciones - Waiting for parts
  • listo - Ready for pickup
  • entregado - Delivered (final state)
  • cancelado - Cancelled (final state)
  • no_reparable - Cannot be repaired (final state)
entregado
boolean
default:false
Deprecated field. Use status === "entregado" instead.
fechaEntregado
timestamp
Timestamp when service was marked as delivered. Set automatically when status changes to “entregado”.
locked
boolean
Set to true when service reaches a final state (entregado, cancelado, no_reparable).
lockedReason
string
The final status that caused the service to be locked.

POS Integration

cobradoEnPOS
boolean
Indicates if this service was paid through the POS system.
fechaCobro
timestamp
Timestamp when payment was processed in POS.
boletaStockAjustado
boolean
Flag indicating that inventory has been adjusted for parts used in this service (boleta items).
boletaStockAjustadoAt
timestamp
Timestamp when inventory adjustment was made.

Device-Specific Fields

Laptop/PC (tipoDispositivo: "laptop" or "pc")

Printer (tipoDispositivo: "impresora")

Monitor (tipoDispositivo: "monitor")

Duplicate Detection

dedupeKey
string
Composite key for duplicate detection. Format: {telefono}|{tipoDispositivo}|{marca}|{modelo}Prevents creating multiple active services for the same device from the same customer.

Timestamps

createdAt
timestamp
required
Service creation timestamp. Set automatically by Firestore.
updatedAt
timestamp
required
Last update timestamp. Updated automatically on every change.

Example JSON

{
  "id": "abc123def456",
  "folio": "HP/042",
  "clienteId": "client_xyz789",
  "nombre": "Juan Pérez",
  "telefono": "5551234567",
  "direccion": "Av. Reforma 123, CDMX",
  "tipoDispositivo": "laptop",
  "marca": "HP",
  "modelo": "Pavilion 15",
  "numeroSerie": "5CD12345AB",
  "omitirNumeroSerie": false,
  "trabajo": "No enciende, revisar fuente de poder",
  "trabajoNorm": "no enciende revisar fuente de poder",
  "costo": "800",
  "precioDespues": false,
  "caracteristicasPendientes": false,
  "status": "en_proceso",
  "entregado": false,
  "fechaEntregado": null,
  "laptopPc": {
    "procesador": "Intel Core i5-8250U",
    "ram": "8 GB",
    "disco": "256 GB",
    "estadoPantalla": "Bueno",
    "estadoTeclado": "Falta tecla ESC",
    "estadoMouse": "Funcional",
    "funciona": "No",
    "enciendeEquipo": "LED parpadea, no arranca",
    "contrasenaEquipo": ""
  },
  "dedupeKey": "5551234567|laptop|hp|pavilion15",
  "cobradoEnPOS": false,
  "createdAt": { "_seconds": 1678901234, "_nanoseconds": 567000000 },
  "updatedAt": { "_seconds": 1678905678, "_nanoseconds": 890000000 }
}
  • guardarServicio() - Create new service ticket with duplicate checking
  • buscarServicioPorFolio() - Find service by folio (uses index)
  • actualizarServicioPorId() - Update service status and details
  • listarServiciosPendientes() - Get all non-final services
  • listarServiciosHistorial() - Get completed services
  • listarServiciosPorClienteId() - Get all services for a client
See Servicios Firestore for detailed function documentation.

Build docs developers (and LLMs) love