Files
Central_monitoreo/lib/db/dao/incidentes_dao.dart
T
PablinuxandClaude Sonnet 4.6 21d2c20525 feat: commit inicial — Central Monitoreo v1.0.0
- OperadorLoginPage con auth WebControl 2 pasos (empresas → login)
- ShellPage: sidebar 220px + IndexedStack + header con estado API
- DashboardPage: stat cards, feed alarmas, clientes, incidentes (timer 30s)
- ApiAuthService: flujo real con email + paswd + dba → token + apiKey
- DB SQLite v1: 7 tablas + 7 DAOs completos
- theme.dart: AppColors, appHeadline (Manrope), appLabel (Inter)
- Logo app: escudo radar neón (SVG + PNG 512px) en lib/recursos/
- desplegar.sh: build release Linux + upload a siax-system.net
- agents.md: estado completo + objetivos futuros documentados

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 22:11:12 -05:00

48 lines
1.2 KiB
Dart

import '../database_helper.dart';
class IncidentesDao {
final _db = DatabaseHelper.instance;
Future<int> registrar({
int? alarmaId,
int? clienteId,
String? clienteNombre,
required String tipo,
required String operador,
String? notas,
}) async {
final db = await _db.db;
return db.insert('incidentes', {
'alarma_id': alarmaId,
'cliente_id': clienteId,
'cliente_nombre': clienteNombre,
'tipo': tipo,
'operador': operador,
'notas': notas,
'timestamp': DateTime.now().toIso8601String(),
'resuelto': 0,
'sincronizado': 0,
});
}
Future<List<Map<String, dynamic>>> getRecientes({int limit = 50}) async {
final db = await _db.db;
return db.query('incidentes', orderBy: 'timestamp DESC', limit: limit);
}
Future<List<Map<String, dynamic>>> getPendientes() async {
final db = await _db.db;
return db.query('incidentes', where: 'sincronizado = 0');
}
Future<int> marcarResuelto(int id, String notas) async {
final db = await _db.db;
return db.update(
'incidentes',
{'resuelto': 1, 'notas': notas, 'sincronizado': 0},
where: 'id = ?',
whereArgs: [id],
);
}
}