This commit is contained in:
2026-05-13 19:24:25 +02:00
parent 24004a99da
commit 3b3cfb5e43
6 changed files with 36 additions and 15 deletions

View File

@@ -89,8 +89,10 @@ class TicketModel extends Equatable {
final String? customerId;
final String? targetModelId;
final String? targetSn;
final String? targetPassword;
final String? sourceModelId;
final String? sourceSn;
final String? sourcePassword;
final double customerPrice;
final double internalCost;
final DateTime? closedAt;
@@ -124,8 +126,10 @@ class TicketModel extends Equatable {
this.customerId,
this.targetModelId,
this.targetSn,
this.targetPassword,
this.sourceModelId,
this.sourceSn,
this.sourcePassword,
this.customerPrice = 0.0,
this.internalCost = 0.0,
this.closedAt,
@@ -174,8 +178,10 @@ class TicketModel extends Equatable {
String? customerId,
String? targetModelId,
String? targetSn,
String? targetPassword,
String? sourceModelId,
String? sourceSn,
String? sourcePassword,
double? customerPrice,
double? internalCost,
DateTime? closedAt,
@@ -209,8 +215,10 @@ class TicketModel extends Equatable {
customerId: customerId ?? this.customerId,
targetModelId: targetModelId ?? this.targetModelId,
targetSn: targetSn ?? this.targetSn,
targetPassword: targetPassword ?? this.targetPassword,
sourceModelId: sourceModelId ?? this.sourceModelId,
sourceSn: sourceSn ?? this.sourceSn,
sourcePassword: sourcePassword ?? this.sourcePassword,
customerPrice: customerPrice ?? this.customerPrice,
internalCost: internalCost ?? this.internalCost,
closedAt: closedAt ?? this.closedAt,
@@ -253,6 +261,8 @@ class TicketModel extends Equatable {
targetSn: map['target_sn'] as String?,
sourceModelId: map['source_model_id'] as String?,
sourceSn: map['source_sn'] as String?,
targetPassword: map['target_password'] as String?,
sourcePassword: map['source_password'] as String?,
// Fix per i field numerici di Postgres che potrebbero arrivare come int o double
customerPrice: (map['customer_price'] as num?)?.toDouble() ?? 0.0,
internalCost: (map['internal_cost'] as num?)?.toDouble() ?? 0.0,
@@ -302,6 +312,9 @@ class TicketModel extends Equatable {
'target_sn': targetSn,
'source_model_id': sourceModelId,
'source_sn': sourceSn,
'target_password': targetPassword,
'source_password': sourcePassword,
'customer_price': customerPrice,
'internal_cost': internalCost,
if (closedAt != null) 'closed_at': closedAt!.toUtc().toIso8601String(),
@@ -336,6 +349,8 @@ class TicketModel extends Equatable {
targetSn,
sourceModelId,
sourceSn,
targetPassword,
sourcePassword,
customerPrice,
internalCost,
closedAt,