This commit is contained in:
2026-05-13 19:24:25 +02:00
parent 24004a99da
commit 3b3cfb5e43
6 changed files with 36 additions and 15 deletions

View File

@@ -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/products/ui/products_screen.dart';
import 'package:flux/features/master_data/providers/blocs/provider_cubit.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/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/models/staff_member_model.dart';
import 'package:flux/features/master_data/staff/ui/staff_screen.dart'; import 'package:flux/features/master_data/staff/ui/staff_screen.dart';
import 'package:flux/features/master_data/store/ui/stores_screen.dart'; import 'package:flux/features/master_data/store/ui/stores_screen.dart';

View File

@@ -162,7 +162,7 @@ class _LatestOperationsCardContent extends StatelessWidget {
Expanded( Expanded(
flex: 5, flex: 5,
child: Text( child: Text(
operation.reference, operation.type,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: context.primaryText, color: context.primaryText,

View File

@@ -89,8 +89,10 @@ class TicketModel extends Equatable {
final String? customerId; final String? customerId;
final String? targetModelId; final String? targetModelId;
final String? targetSn; final String? targetSn;
final String? targetPassword;
final String? sourceModelId; final String? sourceModelId;
final String? sourceSn; final String? sourceSn;
final String? sourcePassword;
final double customerPrice; final double customerPrice;
final double internalCost; final double internalCost;
final DateTime? closedAt; final DateTime? closedAt;
@@ -124,8 +126,10 @@ class TicketModel extends Equatable {
this.customerId, this.customerId,
this.targetModelId, this.targetModelId,
this.targetSn, this.targetSn,
this.targetPassword,
this.sourceModelId, this.sourceModelId,
this.sourceSn, this.sourceSn,
this.sourcePassword,
this.customerPrice = 0.0, this.customerPrice = 0.0,
this.internalCost = 0.0, this.internalCost = 0.0,
this.closedAt, this.closedAt,
@@ -174,8 +178,10 @@ class TicketModel extends Equatable {
String? customerId, String? customerId,
String? targetModelId, String? targetModelId,
String? targetSn, String? targetSn,
String? targetPassword,
String? sourceModelId, String? sourceModelId,
String? sourceSn, String? sourceSn,
String? sourcePassword,
double? customerPrice, double? customerPrice,
double? internalCost, double? internalCost,
DateTime? closedAt, DateTime? closedAt,
@@ -209,8 +215,10 @@ class TicketModel extends Equatable {
customerId: customerId ?? this.customerId, customerId: customerId ?? this.customerId,
targetModelId: targetModelId ?? this.targetModelId, targetModelId: targetModelId ?? this.targetModelId,
targetSn: targetSn ?? this.targetSn, targetSn: targetSn ?? this.targetSn,
targetPassword: targetPassword ?? this.targetPassword,
sourceModelId: sourceModelId ?? this.sourceModelId, sourceModelId: sourceModelId ?? this.sourceModelId,
sourceSn: sourceSn ?? this.sourceSn, sourceSn: sourceSn ?? this.sourceSn,
sourcePassword: sourcePassword ?? this.sourcePassword,
customerPrice: customerPrice ?? this.customerPrice, customerPrice: customerPrice ?? this.customerPrice,
internalCost: internalCost ?? this.internalCost, internalCost: internalCost ?? this.internalCost,
closedAt: closedAt ?? this.closedAt, closedAt: closedAt ?? this.closedAt,
@@ -253,6 +261,8 @@ class TicketModel extends Equatable {
targetSn: map['target_sn'] as String?, targetSn: map['target_sn'] as String?,
sourceModelId: map['source_model_id'] as String?, sourceModelId: map['source_model_id'] as String?,
sourceSn: map['source_sn'] 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 // Fix per i field numerici di Postgres che potrebbero arrivare come int o double
customerPrice: (map['customer_price'] as num?)?.toDouble() ?? 0.0, customerPrice: (map['customer_price'] as num?)?.toDouble() ?? 0.0,
internalCost: (map['internal_cost'] 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, 'target_sn': targetSn,
'source_model_id': sourceModelId, 'source_model_id': sourceModelId,
'source_sn': sourceSn, 'source_sn': sourceSn,
'target_password': targetPassword,
'source_password': sourcePassword,
'customer_price': customerPrice, 'customer_price': customerPrice,
'internal_cost': internalCost, 'internal_cost': internalCost,
if (closedAt != null) 'closed_at': closedAt!.toUtc().toIso8601String(), if (closedAt != null) 'closed_at': closedAt!.toUtc().toIso8601String(),
@@ -336,6 +349,8 @@ class TicketModel extends Equatable {
targetSn, targetSn,
sourceModelId, sourceModelId,
sourceSn, sourceSn,
targetPassword,
sourcePassword,
customerPrice, customerPrice,
internalCost, internalCost,
closedAt, closedAt,

View File

@@ -1,6 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.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/routes/routes.dart';
import 'package:flux/core/widgets/staff_selector_modal.dart'; import 'package:flux/core/widgets/staff_selector_modal.dart';
import 'package:flux/features/master_data/staff/models/staff_member_model.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/blocs/ticket_list_state.dart';
import 'package:flux/features/tickets/models/ticket_model.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/models/ticket_status_extension.dart';
import 'package:flux/features/tickets/ui/ticket_form_screen.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
class TicketListScreen extends StatefulWidget { class TicketListScreen extends StatefulWidget {

View File

@@ -1,10 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flux/features/tickets/models/ticket_model.dart';
// Importa il tuo TicketModel, Cubit, ecc.
class TicketWorkspaceScreen extends StatelessWidget { class TicketWorkspaceScreen extends StatelessWidget {
// Passiamo il ticket attuale per avere i dati (o il Cubit se preferisci) final TicketModel ticket; // Sostituisci con TicketModel
final dynamic ticket; // Sostituisci con TicketModel
const TicketWorkspaceScreen({super.key, required this.ticket}); const TicketWorkspaceScreen({super.key, required this.ticket});
@@ -67,7 +65,7 @@ class TicketWorkspaceScreen extends StatelessWidget {
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
ticket.deviceModel ?? ticket.targetModelName ??
'Modello Sconosciuto', // Es: "iPhone 13 Pro" 'Modello Sconosciuto', // Es: "iPhone 13 Pro"
style: const TextStyle( style: const TextStyle(
fontSize: 24, fontSize: 24,
@@ -88,14 +86,25 @@ class TicketWorkspaceScreen extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
const Text( const Text(
'PIN / SBLOCCO', 'PIN / SBLOCCO Target device',
style: TextStyle(fontSize: 10, color: Colors.grey), style: TextStyle(fontSize: 10, color: Colors.grey),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
ticket.unlockPassword?.isNotEmpty == true ticket.targetPassword ?? '',
? ticket.unlockPassword! style: const TextStyle(
: 'Nessuno', 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( style: const TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@@ -138,7 +147,7 @@ class TicketWorkspaceScreen extends StatelessWidget {
border: Border.all(color: theme.dividerColor), border: Border.all(color: theme.dividerColor),
), ),
child: Text( child: Text(
ticket.defectDescription ?? 'Nessuna descrizione inserita.', ticket.request,
style: const TextStyle(fontSize: 16, height: 1.5), style: const TextStyle(fontSize: 16, height: 1.5),
), ),
), ),

View File

@@ -43,7 +43,7 @@ class TrackingCubit extends Cubit<TrackingState> {
companyId: companyId, companyId: companyId,
message: message, message: message,
type: TrackingType.manualNote, type: TrackingType.manualNote,
parentId: parentId!, parentId: parentId,
parentType: parentType, parentType: parentType,
staffId: staffId, staffId: staffId,
isInternal: isInternal, isInternal: isInternal,