start provider screens
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class ProviderModel extends Equatable {
|
||||
final String id;
|
||||
final String? id;
|
||||
final String nome;
|
||||
final bool telefoniaFissa;
|
||||
final bool telefoniaMobile;
|
||||
@@ -13,7 +13,7 @@ class ProviderModel extends Equatable {
|
||||
final String companyId;
|
||||
|
||||
const ProviderModel({
|
||||
required this.id,
|
||||
this.id,
|
||||
required this.nome,
|
||||
required this.telefoniaFissa,
|
||||
required this.telefoniaMobile,
|
||||
@@ -41,7 +41,7 @@ class ProviderModel extends Equatable {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
final map = {
|
||||
'nome': nome,
|
||||
'telefonia_fissa': telefoniaFissa,
|
||||
'telefonia_mobile': telefoniaMobile,
|
||||
@@ -52,6 +52,12 @@ class ProviderModel extends Equatable {
|
||||
'is_active': isActive,
|
||||
'company_id': companyId,
|
||||
};
|
||||
// AGGIUNGIAMO L'ID SOLO SE NON È NULLO
|
||||
// Senza questo, l'upsert non sa dove andare a parare
|
||||
if (id != null) {
|
||||
map['id'] = id!;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user