aaaaaaaaaaaa

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-02 10:22:47 +02:00
parent ac97e47771
commit 1721b2ff89
32 changed files with 454 additions and 1031 deletions

View File

@@ -1,4 +1,5 @@
import 'package:equatable/equatable.dart';
import 'package:flux/core/utils/extensions.dart';
import 'package:flux/features/attachments/models/attachment_model.dart';
enum OperationStatus {
@@ -27,7 +28,9 @@ class OperationModel extends Equatable {
final DateTime? createdAt;
final String type;
final String? providerId;
final String? providerDisplayName;
final String? modelId;
final String? modelDisplayName;
final String? description;
final DateTime? expirationDate;
final String note;
@@ -35,13 +38,14 @@ class OperationModel extends Equatable {
final String batchUuid;
final String companyId;
final String storeId;
final String? storeDisplayName;
final int quantity;
final String? staffId;
final String staffDisplayName;
final String? staffDisplayName;
final String? lastCampaignId;
final OperationStatus status;
final String? customerId;
final String customerDisplayName;
final String? customerDisplayName;
final String reference;
// ALLEGATI (Aggiunto)
@@ -52,7 +56,9 @@ class OperationModel extends Equatable {
this.createdAt,
this.type = '',
this.providerId,
this.providerDisplayName,
this.modelId,
this.modelDisplayName,
this.description,
this.expirationDate,
this.note = '',
@@ -60,13 +66,14 @@ class OperationModel extends Equatable {
this.batchUuid = '',
required this.companyId,
this.storeId = '',
this.storeDisplayName,
this.quantity = 1,
this.staffId,
this.staffDisplayName = '',
this.staffDisplayName,
this.lastCampaignId,
this.status = OperationStatus.draft,
this.customerId,
this.customerDisplayName = '',
this.customerDisplayName,
this.reference = '',
this.attachments = const [],
});
@@ -76,7 +83,9 @@ class OperationModel extends Equatable {
DateTime? createdAt,
String? type,
String? providerId,
String? providerDisplayName,
String? modelId,
String? modelDisplayName,
String? description,
DateTime? expirationDate,
String? note,
@@ -84,6 +93,7 @@ class OperationModel extends Equatable {
String? batchUuid,
String? companyId,
String? storeId,
String? storeDisplayName,
int? quantity,
String? staffId,
String? staffDisplayName,
@@ -98,7 +108,9 @@ class OperationModel extends Equatable {
createdAt: createdAt ?? this.createdAt,
type: type ?? this.type,
providerId: providerId ?? this.providerId,
providerDisplayName: providerDisplayName ?? this.providerDisplayName,
modelId: modelId ?? this.modelId,
modelDisplayName: modelDisplayName ?? this.modelDisplayName,
description: description ?? this.description,
expirationDate: expirationDate ?? this.expirationDate,
note: note ?? this.note,
@@ -106,6 +118,7 @@ class OperationModel extends Equatable {
batchUuid: batchUuid ?? this.batchUuid,
companyId: companyId ?? this.companyId,
storeId: storeId ?? this.storeId,
storeDisplayName: storeDisplayName ?? this.storeDisplayName,
quantity: quantity ?? this.quantity,
staffId: staffId ?? this.staffId,
staffDisplayName: staffDisplayName ?? this.staffDisplayName,
@@ -123,7 +136,9 @@ class OperationModel extends Equatable {
createdAt,
type,
providerId,
providerDisplayName,
modelId,
modelDisplayName,
description,
expirationDate,
note,
@@ -131,6 +146,7 @@ class OperationModel extends Equatable {
batchUuid,
companyId,
storeId,
storeDisplayName,
quantity,
staffId,
staffDisplayName,
@@ -154,7 +170,9 @@ class OperationModel extends Equatable {
: null,
type: map['type'] as String? ?? '',
providerId: map['provider_id'] as String? ?? '',
providerDisplayName: "${map['provider']['name']}".myFormat(),
modelId: map['model_id'] as String? ?? '',
modelDisplayName: "${map['model']['name_with_brand'] ?? ''}".myFormat(),
description: map['description'] as String? ?? '',
expirationDate: map['expiration_date'] != null
? DateTime.parse(map['expiration_date'])
@@ -164,13 +182,22 @@ class OperationModel extends Equatable {
batchUuid: map['batch_uuid'] as String,
companyId: map['company_id'] as String,
storeId: map['store_id'] as String? ?? '',
storeDisplayName: "${map['store']['name']}".myFormat(),
quantity: map['quantity'] is int
? map['quantity']
: int.tryParse(map['quantity']?.toString() ?? '0') ?? 0,
staffId: map['staff_id'] as String? ?? '',
staffDisplayName: "${map['staff_member']['name'] ?? ''}".myFormat(),
lastCampaignId: map['last_campaign_id'] as String? ?? '',
status: OperationStatus.fromString(map['status']),
customerId: map['customer_id'] as String? ?? '',
customerDisplayName: "${map['customer']['name'] ?? ''}".myFormat(),
attachments:
(map['attachment'] as List?)
?.map((x) => AttachmentModel.fromMap(x))
.toList() ??
const [],
reference: map['reference'] as String? ?? '',
);
}