ottimo punto sembra funzionare tutto, devo solo aggiungere l'aggiunta di un cliente volante, di un modello volante e gestire i file allegati

This commit is contained in:
2026-04-18 19:03:49 +02:00
parent bbb9729ca4
commit e9f3327f31
16 changed files with 665 additions and 96 deletions

View File

@@ -1,4 +1,5 @@
import 'package:equatable/equatable.dart';
import 'package:flux/core/utils/string_extensions.dart';
import 'package:flux/features/services/models/energy_service_model.dart';
import 'package:flux/features/services/models/entertainment_service_model.dart';
import 'package:flux/features/services/models/fin_service_model.dart';
@@ -14,6 +15,7 @@ class ServiceModel extends Equatable {
final String note;
final bool resultOk;
final String? customerDisplayName;
final String companyId;
// Telefonia
final int al;
@@ -46,6 +48,7 @@ class ServiceModel extends Equatable {
this.finServices = const [],
this.entertainmentServices = const [],
this.customerDisplayName,
required this.companyId,
});
ServiceModel copyWith({
@@ -67,6 +70,7 @@ class ServiceModel extends Equatable {
List<FinServiceModel>? finServices,
List<EntertainmentServiceModel>? entertainmentServices,
String? customerDisplayName,
String? companyId,
}) {
return ServiceModel(
id: id ?? this.id,
@@ -88,6 +92,7 @@ class ServiceModel extends Equatable {
entertainmentServices:
entertainmentServices ?? this.entertainmentServices,
customerDisplayName: customerDisplayName ?? this.customerDisplayName,
companyId: companyId ?? this.companyId,
);
}
@@ -111,6 +116,7 @@ class ServiceModel extends Equatable {
finServices,
entertainmentServices,
customerDisplayName,
companyId,
];
factory ServiceModel.fromMap(Map<String, dynamic> map) {
@@ -151,9 +157,9 @@ class ServiceModel extends Equatable {
// Display name del cliente con fallback
customerDisplayName: map['customer'] != null
? "${map['customer']['name'] ?? ''} ${map['customer']['surname'] ?? ''}"
.trim()
? "${map['customer']['nome'] ?? ''}".myFormat()
: "Cliente non assegnato",
companyId: map['company_id'] as String,
);
}
@@ -172,6 +178,7 @@ class ServiceModel extends Equatable {
'nip': nip,
'unica': unica,
'telepass': telepass,
'company_id': companyId,
// Le liste non le mettiamo qui perché vanno in tabelle diverse!
};
}