reworked operation (#12)
Reviewed-on: #12 Co-authored-by: Mark M2 Macbook <marco@catelli.it> Co-committed-by: Mark M2 Macbook <marco@catelli.it>
This commit is contained in:
@@ -3,28 +3,30 @@ import 'package:flux/features/master_data/store/models/store_model.dart';
|
||||
|
||||
class ProviderModel extends Equatable {
|
||||
final String? id;
|
||||
final String nome;
|
||||
final bool telefoniaFissa;
|
||||
final bool telefoniaMobile;
|
||||
final bool energia;
|
||||
final bool assicurazioni;
|
||||
final bool intrattenimento;
|
||||
final bool finanziamenti;
|
||||
final bool altro;
|
||||
final String name;
|
||||
final bool landline;
|
||||
final bool mobile;
|
||||
final bool energy;
|
||||
final bool insurance;
|
||||
final bool entertainment;
|
||||
final bool financing;
|
||||
final bool telepass;
|
||||
final bool other;
|
||||
final bool isActive;
|
||||
final String companyId;
|
||||
final List<StoreModel> associatedStores;
|
||||
|
||||
const ProviderModel({
|
||||
this.id,
|
||||
required this.nome,
|
||||
required this.telefoniaFissa,
|
||||
required this.telefoniaMobile,
|
||||
required this.energia,
|
||||
required this.assicurazioni,
|
||||
required this.intrattenimento,
|
||||
required this.finanziamenti,
|
||||
required this.altro,
|
||||
required this.name,
|
||||
required this.landline,
|
||||
required this.mobile,
|
||||
required this.energy,
|
||||
required this.insurance,
|
||||
required this.entertainment,
|
||||
required this.financing,
|
||||
required this.telepass,
|
||||
required this.other,
|
||||
required this.isActive,
|
||||
required this.companyId,
|
||||
this.associatedStores = const [],
|
||||
@@ -44,14 +46,15 @@ class ProviderModel extends Equatable {
|
||||
}
|
||||
return ProviderModel(
|
||||
id: map['id'],
|
||||
nome: map['nome'],
|
||||
telefoniaFissa: map['telefonia_fissa'] ?? false,
|
||||
telefoniaMobile: map['telefonia_mobile'] ?? false,
|
||||
energia: map['energia'] ?? false,
|
||||
assicurazioni: map['assicurazioni'] ?? false,
|
||||
intrattenimento: map['intrattenimento'] ?? false,
|
||||
finanziamenti: map['finanziamenti'] ?? false,
|
||||
altro: map['altro'] ?? false,
|
||||
name: map['name'],
|
||||
landline: map['landline'] ?? false,
|
||||
mobile: map['mobile'] ?? false,
|
||||
energy: map['energy'] ?? false,
|
||||
insurance: map['insurance'] ?? false,
|
||||
entertainment: map['entertainment'] ?? false,
|
||||
financing: map['financing'] ?? false,
|
||||
telepass: map['telepass'] ?? false,
|
||||
other: map['other'] ?? false,
|
||||
isActive: map['is_active'] ?? true,
|
||||
companyId: map['company_id'],
|
||||
associatedStores: stores,
|
||||
@@ -60,14 +63,15 @@ class ProviderModel extends Equatable {
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
final map = {
|
||||
'nome': nome,
|
||||
'telefonia_fissa': telefoniaFissa,
|
||||
'telefonia_mobile': telefoniaMobile,
|
||||
'energia': energia,
|
||||
'assicurazioni': assicurazioni,
|
||||
'intrattenimento': intrattenimento,
|
||||
'finanziamenti': finanziamenti,
|
||||
'altro': altro,
|
||||
'name': name,
|
||||
'landline': landline,
|
||||
'mobile': mobile,
|
||||
'energy': energy,
|
||||
'insurance': insurance,
|
||||
'entertainment': entertainment,
|
||||
'financing': financing,
|
||||
'telepass': telepass,
|
||||
'other': other,
|
||||
'is_active': isActive,
|
||||
'company_id': companyId,
|
||||
};
|
||||
@@ -82,14 +86,15 @@ class ProviderModel extends Equatable {
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
id,
|
||||
nome,
|
||||
telefoniaFissa,
|
||||
telefoniaMobile,
|
||||
energia,
|
||||
assicurazioni,
|
||||
intrattenimento,
|
||||
finanziamenti,
|
||||
altro,
|
||||
name,
|
||||
landline,
|
||||
mobile,
|
||||
energy,
|
||||
insurance,
|
||||
entertainment,
|
||||
financing,
|
||||
telepass,
|
||||
other,
|
||||
isActive,
|
||||
companyId,
|
||||
associatedStores,
|
||||
@@ -97,28 +102,30 @@ class ProviderModel extends Equatable {
|
||||
|
||||
ProviderModel copyWith({
|
||||
String? id,
|
||||
String? nome,
|
||||
bool? telefoniaFissa,
|
||||
bool? telefoniaMobile,
|
||||
bool? energia,
|
||||
bool? assicurazioni,
|
||||
bool? intrattenimento,
|
||||
bool? finanziamenti,
|
||||
bool? altro,
|
||||
String? name,
|
||||
bool? landline,
|
||||
bool? mobile,
|
||||
bool? energy,
|
||||
bool? insurance,
|
||||
bool? entertainment,
|
||||
bool? financing,
|
||||
bool? telepass,
|
||||
bool? other,
|
||||
bool? isActive,
|
||||
String? companyId,
|
||||
List<StoreModel>? associatedStores,
|
||||
}) {
|
||||
return ProviderModel(
|
||||
id: id ?? this.id,
|
||||
nome: nome ?? this.nome,
|
||||
telefoniaFissa: telefoniaFissa ?? this.telefoniaFissa,
|
||||
telefoniaMobile: telefoniaMobile ?? this.telefoniaMobile,
|
||||
energia: energia ?? this.energia,
|
||||
assicurazioni: assicurazioni ?? this.assicurazioni,
|
||||
intrattenimento: intrattenimento ?? this.intrattenimento,
|
||||
finanziamenti: finanziamenti ?? this.finanziamenti,
|
||||
altro: altro ?? this.altro,
|
||||
name: name ?? this.name,
|
||||
landline: landline ?? this.landline,
|
||||
mobile: mobile ?? this.mobile,
|
||||
energy: energy ?? this.energy,
|
||||
insurance: insurance ?? this.insurance,
|
||||
entertainment: entertainment ?? this.entertainment,
|
||||
financing: financing ?? this.financing,
|
||||
telepass: telepass ?? this.telepass,
|
||||
other: other ?? this.other,
|
||||
isActive: isActive ?? this.isActive,
|
||||
companyId: companyId ?? this.companyId,
|
||||
associatedStores: associatedStores ?? this.associatedStores,
|
||||
|
||||
Reference in New Issue
Block a user