Initial commit
This commit is contained in:
27
lib/models/configuracion.dart
Normal file
27
lib/models/configuracion.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
class Configuracion {
|
||||
final int? id;
|
||||
final String diasRecordatorio;
|
||||
final String tema;
|
||||
final String moneda;
|
||||
|
||||
Configuracion({
|
||||
this.id,
|
||||
required this.diasRecordatorio,
|
||||
this.tema = 'claro',
|
||||
this.moneda = 'USD',
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
'id': id,
|
||||
'dias_recordatorio': diasRecordatorio,
|
||||
'tema': tema,
|
||||
'moneda': moneda,
|
||||
};
|
||||
|
||||
factory Configuracion.fromMap(Map<String, dynamic> map) => Configuracion(
|
||||
id: map['id'] as int?,
|
||||
diasRecordatorio: map['dias_recordatorio'] as String,
|
||||
tema: map['tema'] as String? ?? 'claro',
|
||||
moneda: map['moneda'] as String? ?? 'USD',
|
||||
);
|
||||
}
|
||||
64
lib/models/factura.dart
Normal file
64
lib/models/factura.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
class Factura {
|
||||
final int? id;
|
||||
final int servicioId;
|
||||
final double monto;
|
||||
final String fechaEmision;
|
||||
final String fechaVencimiento;
|
||||
final String estado;
|
||||
final String? nota;
|
||||
final String? fechaPago;
|
||||
|
||||
Factura({
|
||||
this.id,
|
||||
required this.servicioId,
|
||||
required this.monto,
|
||||
required this.fechaEmision,
|
||||
required this.fechaVencimiento,
|
||||
this.estado = 'Pendiente',
|
||||
this.nota,
|
||||
this.fechaPago,
|
||||
});
|
||||
|
||||
Factura copyWith({
|
||||
int? id,
|
||||
int? servicioId,
|
||||
double? monto,
|
||||
String? fechaEmision,
|
||||
String? fechaVencimiento,
|
||||
String? estado,
|
||||
String? nota,
|
||||
String? fechaPago,
|
||||
}) =>
|
||||
Factura(
|
||||
id: id ?? this.id,
|
||||
servicioId: servicioId ?? this.servicioId,
|
||||
monto: monto ?? this.monto,
|
||||
fechaEmision: fechaEmision ?? this.fechaEmision,
|
||||
fechaVencimiento: fechaVencimiento ?? this.fechaVencimiento,
|
||||
estado: estado ?? this.estado,
|
||||
nota: nota ?? this.nota,
|
||||
fechaPago: fechaPago ?? this.fechaPago,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
'id': id,
|
||||
'servicio_id': servicioId,
|
||||
'monto': monto,
|
||||
'fecha_emision': fechaEmision,
|
||||
'fecha_vencimiento': fechaVencimiento,
|
||||
'estado': estado,
|
||||
'nota': nota,
|
||||
'fecha_pago': fechaPago,
|
||||
};
|
||||
|
||||
factory Factura.fromMap(Map<String, dynamic> map) => Factura(
|
||||
id: map['id'] as int?,
|
||||
servicioId: map['servicio_id'] as int,
|
||||
monto: (map['monto'] as num).toDouble(),
|
||||
fechaEmision: map['fecha_emision'] as String,
|
||||
fechaVencimiento: map['fecha_vencimiento'] as String,
|
||||
estado: map['estado'] as String? ?? 'Pendiente',
|
||||
nota: map['nota'] as String?,
|
||||
fechaPago: map['fecha_pago'] as String?,
|
||||
);
|
||||
}
|
||||
35
lib/models/servicio.dart
Normal file
35
lib/models/servicio.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
class Servicio {
|
||||
final int? id;
|
||||
final String nombre;
|
||||
final String icono;
|
||||
final int color;
|
||||
final int diaVencimiento;
|
||||
final String fechaCreacion;
|
||||
|
||||
Servicio({
|
||||
this.id,
|
||||
required this.nombre,
|
||||
required this.icono,
|
||||
required this.color,
|
||||
required this.diaVencimiento,
|
||||
required this.fechaCreacion,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
'id': id,
|
||||
'nombre': nombre,
|
||||
'icono': icono,
|
||||
'color': color,
|
||||
'dia_vencimiento': diaVencimiento,
|
||||
'fecha_creacion': fechaCreacion,
|
||||
};
|
||||
|
||||
factory Servicio.fromMap(Map<String, dynamic> map) => Servicio(
|
||||
id: map['id'] as int?,
|
||||
nombre: map['nombre'] as String,
|
||||
icono: map['icono'] as String,
|
||||
color: map['color'] as int,
|
||||
diaVencimiento: map['dia_vencimiento'] as int,
|
||||
fechaCreacion: map['fecha_creacion'] as String,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user