Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AdriP-maker/JAAR_Antigravity/llms.txt
Use this file to discover all available pages before exploring further.
puntosService powers SIMAP Digital’s gamification layer. It writes every transaction (earned or redeemed) to the local Dexie puntos_historial table, making the ledger available fully offline. Points are used to reward residents for timely payments and can be exchanged for discounts on their water bill at a fixed 1 point = B/.0.01 rate.
Points ledger record shape
Every call tootorgarPuntos or canjearPuntos appends one record to puntos_historial:
Auto-incremented primary key assigned by Dexie.
Resident ID coerced to a string (e.g.,
'3').Point quantity for this transaction (always positive).
Either
'ganancia' (points earned) or 'canje' (points redeemed).Human-readable description of why points were awarded or spent.
ISO 8601 timestamp of when the transaction was recorded.
otorgarPuntos(usuarioId, cantidad, motivo)
Awards points to a resident by appending a 'ganancia' transaction to puntos_historial. Silently no-ops if cantidad is 0 or negative, preventing accidental zero-point entries.
pagosService calls this function automatically when registrarPago processes a mensual, multi_mes, or adelanto payment.
The resident’s ID. Internally coerced to
String before storage.Number of points to award. Must be greater than 0; any value ≤ 0 is silently ignored.
Short description of the reward reason. Displayed in the resident’s points history screen.
void. Resolves once the record has been written to Dexie.
Example
pagosService calls otorgarPuntos automatically: 5 points for mensual, 10 points per month for multi_mes and adelanto. You only need to call this directly for custom reward events.canjearPuntos(usuarioId, cantidad, motivo?)
Redeems points from a resident’s balance by appending a 'canje' transaction to puntos_historial. Throws an error if the resident does not have enough points to cover the redemption.
The resident’s ID.
Number of points to redeem. Must not exceed the resident’s current balance (see
obtenerSaldoPuntos).Optional description of what the points were redeemed for. Defaults to
'Descuento en cobro'.void. Resolves once the redemption record has been written.
Throws
Error('No hay suficientes puntos para canjear') — if cantidad exceeds the resident’s current point balance.
Example
obtenerSaldoPuntos(usuarioId)
Calculates the current point balance for a resident by replaying all entries in puntos_historial: summing 'ganancia' transactions and subtracting 'canje' transactions.
The resident’s ID.
number — the net point balance. Returns 0 if the resident has no history records.
Example
calcularDescuentoBalboas(puntos)
Converts a point quantity to its equivalent monetary value in Panamanian balboas.
Exchange rate: 1 point = B/.0.01 (1 centavo). 100 points = B/.1.00.
The number of points to convert.
number — the equivalent value in balboas (puntos / 100).
Example
balboasAPuntos(balboas)
Converts a balboa amount to its equivalent point value. The inverse of calcularDescuentoBalboas. Fractional centavos are discarded with Math.floor.
The amount in balboas to convert.
number — the equivalent point value (Math.floor(balboas * 100)).
Example