diff --git a/lib/core/routes/app_router.dart b/lib/core/routes/app_router.dart index d48893a..d455e2d 100644 --- a/lib/core/routes/app_router.dart +++ b/lib/core/routes/app_router.dart @@ -22,7 +22,6 @@ import 'package:flux/features/master_data/products/blocs/product_cubit.dart'; import 'package:flux/features/master_data/products/ui/products_screen.dart'; import 'package:flux/features/master_data/providers/blocs/provider_cubit.dart'; import 'package:flux/features/master_data/providers/ui/providers_master_data_screen.dart'; -import 'package:flux/features/master_data/staff/blocs/staff_cubit.dart'; import 'package:flux/features/master_data/staff/models/staff_member_model.dart'; import 'package:flux/features/master_data/staff/ui/staff_screen.dart'; import 'package:flux/features/master_data/store/ui/stores_screen.dart'; diff --git a/lib/features/home/latest_store_operations/ui/latest_store_operations_card.dart b/lib/features/home/latest_store_operations/ui/latest_store_operations_card.dart index d95a4ae..6513b65 100644 --- a/lib/features/home/latest_store_operations/ui/latest_store_operations_card.dart +++ b/lib/features/home/latest_store_operations/ui/latest_store_operations_card.dart @@ -162,7 +162,7 @@ class _LatestOperationsCardContent extends StatelessWidget { Expanded( flex: 5, child: Text( - operation.reference, + operation.type, style: TextStyle( fontWeight: FontWeight.w600, color: context.primaryText, diff --git a/lib/features/tickets/models/ticket_model.dart b/lib/features/tickets/models/ticket_model.dart index 523d4b6..2ee0cfc 100644 --- a/lib/features/tickets/models/ticket_model.dart +++ b/lib/features/tickets/models/ticket_model.dart @@ -89,8 +89,10 @@ class TicketModel extends Equatable { final String? customerId; final String? targetModelId; final String? targetSn; + final String? targetPassword; final String? sourceModelId; final String? sourceSn; + final String? sourcePassword; final double customerPrice; final double internalCost; final DateTime? closedAt; @@ -124,8 +126,10 @@ class TicketModel extends Equatable { this.customerId, this.targetModelId, this.targetSn, + this.targetPassword, this.sourceModelId, this.sourceSn, + this.sourcePassword, this.customerPrice = 0.0, this.internalCost = 0.0, this.closedAt, @@ -174,8 +178,10 @@ class TicketModel extends Equatable { String? customerId, String? targetModelId, String? targetSn, + String? targetPassword, String? sourceModelId, String? sourceSn, + String? sourcePassword, double? customerPrice, double? internalCost, DateTime? closedAt, @@ -209,8 +215,10 @@ class TicketModel extends Equatable { customerId: customerId ?? this.customerId, targetModelId: targetModelId ?? this.targetModelId, targetSn: targetSn ?? this.targetSn, + targetPassword: targetPassword ?? this.targetPassword, sourceModelId: sourceModelId ?? this.sourceModelId, sourceSn: sourceSn ?? this.sourceSn, + sourcePassword: sourcePassword ?? this.sourcePassword, customerPrice: customerPrice ?? this.customerPrice, internalCost: internalCost ?? this.internalCost, closedAt: closedAt ?? this.closedAt, @@ -253,6 +261,8 @@ class TicketModel extends Equatable { targetSn: map['target_sn'] as String?, sourceModelId: map['source_model_id'] as String?, sourceSn: map['source_sn'] as String?, + targetPassword: map['target_password'] as String?, + sourcePassword: map['source_password'] as String?, // Fix per i field numerici di Postgres che potrebbero arrivare come int o double customerPrice: (map['customer_price'] as num?)?.toDouble() ?? 0.0, internalCost: (map['internal_cost'] as num?)?.toDouble() ?? 0.0, @@ -302,6 +312,9 @@ class TicketModel extends Equatable { 'target_sn': targetSn, 'source_model_id': sourceModelId, 'source_sn': sourceSn, + 'target_password': targetPassword, + 'source_password': sourcePassword, + 'customer_price': customerPrice, 'internal_cost': internalCost, if (closedAt != null) 'closed_at': closedAt!.toUtc().toIso8601String(), @@ -336,6 +349,8 @@ class TicketModel extends Equatable { targetSn, sourceModelId, sourceSn, + targetPassword, + sourcePassword, customerPrice, internalCost, closedAt, diff --git a/lib/features/tickets/ui/ticket_list_screen.dart b/lib/features/tickets/ui/ticket_list_screen.dart index d969eb0..6eed79f 100644 --- a/lib/features/tickets/ui/ticket_list_screen.dart +++ b/lib/features/tickets/ui/ticket_list_screen.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flux/core/blocs/session/session_cubit.dart'; import 'package:flux/core/routes/routes.dart'; import 'package:flux/core/widgets/staff_selector_modal.dart'; import 'package:flux/features/master_data/staff/models/staff_member_model.dart'; @@ -8,7 +7,6 @@ import 'package:flux/features/tickets/blocs/ticket_list_cubit.dart'; import 'package:flux/features/tickets/blocs/ticket_list_state.dart'; import 'package:flux/features/tickets/models/ticket_model.dart'; import 'package:flux/features/tickets/models/ticket_status_extension.dart'; -import 'package:flux/features/tickets/ui/ticket_form_screen.dart'; import 'package:go_router/go_router.dart'; class TicketListScreen extends StatefulWidget { diff --git a/lib/features/tickets/ui/ticket_workspace_screen.dart b/lib/features/tickets/ui/ticket_workspace_screen.dart index eb5967b..aac93bd 100644 --- a/lib/features/tickets/ui/ticket_workspace_screen.dart +++ b/lib/features/tickets/ui/ticket_workspace_screen.dart @@ -1,10 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -// Importa il tuo TicketModel, Cubit, ecc. +import 'package:flux/features/tickets/models/ticket_model.dart'; class TicketWorkspaceScreen extends StatelessWidget { - // Passiamo il ticket attuale per avere i dati (o il Cubit se preferisci) - final dynamic ticket; // Sostituisci con TicketModel + final TicketModel ticket; // Sostituisci con TicketModel const TicketWorkspaceScreen({super.key, required this.ticket}); @@ -67,7 +65,7 @@ class TicketWorkspaceScreen extends StatelessWidget { ), const SizedBox(height: 8), Text( - ticket.deviceModel ?? + ticket.targetModelName ?? 'Modello Sconosciuto', // Es: "iPhone 13 Pro" style: const TextStyle( fontSize: 24, @@ -88,14 +86,25 @@ class TicketWorkspaceScreen extends StatelessWidget { child: Column( children: [ const Text( - 'PIN / SBLOCCO', + 'PIN / SBLOCCO Target device', style: TextStyle(fontSize: 10, color: Colors.grey), ), const SizedBox(height: 4), Text( - ticket.unlockPassword?.isNotEmpty == true - ? ticket.unlockPassword! - : 'Nessuno', + ticket.targetPassword ?? '', + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + letterSpacing: 2, + ), + ), + const Text( + 'PIN / SBLOCCO Source device', + style: TextStyle(fontSize: 10, color: Colors.grey), + ), + const SizedBox(height: 4), + Text( + ticket.sourcePassword ?? '', style: const TextStyle( fontSize: 20, fontWeight: FontWeight.bold, @@ -138,7 +147,7 @@ class TicketWorkspaceScreen extends StatelessWidget { border: Border.all(color: theme.dividerColor), ), child: Text( - ticket.defectDescription ?? 'Nessuna descrizione inserita.', + ticket.request, style: const TextStyle(fontSize: 16, height: 1.5), ), ), diff --git a/lib/features/tracking/blocs/tracking_cubit.dart b/lib/features/tracking/blocs/tracking_cubit.dart index 3176152..1758711 100644 --- a/lib/features/tracking/blocs/tracking_cubit.dart +++ b/lib/features/tracking/blocs/tracking_cubit.dart @@ -43,7 +43,7 @@ class TrackingCubit extends Cubit { companyId: companyId, message: message, type: TrackingType.manualNote, - parentId: parentId!, + parentId: parentId, parentType: parentType, staffId: staffId, isInternal: isInternal,