start provider screens

This commit is contained in:
2026-04-16 12:13:18 +02:00
parent 5229571fa1
commit 4a3230419b
5 changed files with 284 additions and 9 deletions

View File

@@ -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