App Flutter 2.11 para vendedores de ruta de Telcotronics. Incluye ruta del día con mapa custom, catálogo, pedidos CRUD, firma digital, scanner QR/barcode, selector de clientes escalable, notificaciones in-app y soporte multiplataforma (Android + Linux desktop). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
1.6 KiB
Dart
61 lines
1.6 KiB
Dart
class Cliente {
|
|
final String id;
|
|
final String nombre;
|
|
final String razonSocial;
|
|
final String direccion;
|
|
final String telefono;
|
|
final String nit;
|
|
final double lat;
|
|
final double lng;
|
|
final String categoria;
|
|
|
|
const Cliente({
|
|
required this.id,
|
|
required this.nombre,
|
|
required this.razonSocial,
|
|
required this.direccion,
|
|
required this.telefono,
|
|
required this.nit,
|
|
required this.lat,
|
|
required this.lng,
|
|
required this.categoria,
|
|
});
|
|
|
|
Map<String, dynamic> toMap() => {
|
|
'id': id,
|
|
'nombre': nombre,
|
|
'razon_social': razonSocial,
|
|
'direccion': direccion,
|
|
'telefono': telefono,
|
|
'nit': nit,
|
|
'lat': lat,
|
|
'lng': lng,
|
|
'categoria': categoria,
|
|
};
|
|
|
|
factory Cliente.fromMap(Map<String, dynamic> m) => Cliente(
|
|
id: m['id'] as String,
|
|
nombre: m['nombre'] as String,
|
|
razonSocial: m['razon_social'] as String? ?? '',
|
|
direccion: m['direccion'] as String? ?? '',
|
|
telefono: m['telefono'] as String? ?? '',
|
|
nit: m['nit'] as String? ?? '',
|
|
lat: (m['lat'] as num?)?.toDouble() ?? 0.0,
|
|
lng: (m['lng'] as num?)?.toDouble() ?? 0.0,
|
|
categoria: m['categoria'] as String? ?? 'Minorista',
|
|
);
|
|
|
|
Cliente copyWith({
|
|
String? nombre, String? razonSocial, String? direccion,
|
|
String? telefono, String? nit, String? categoria,
|
|
}) => Cliente(
|
|
id: id, lat: lat, lng: lng,
|
|
nombre: nombre ?? this.nombre,
|
|
razonSocial: razonSocial ?? this.razonSocial,
|
|
direccion: direccion ?? this.direccion,
|
|
telefono: telefono ?? this.telefono,
|
|
nit: nit ?? this.nit,
|
|
categoria: categoria ?? this.categoria,
|
|
);
|
|
}
|