a
This commit is contained in:
@@ -10,7 +10,6 @@ import 'package:flux/features/attachments/ui/quick_rename_dialog.dart';
|
||||
import 'package:flux/features/attachments/blocs/attachments_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:flux/features/operations/models/operation_model.dart';
|
||||
import 'package:flux/features/attachments/models/attachment_model.dart';
|
||||
import 'package:pdf/widgets.dart' as pw;
|
||||
import 'package:pdfx/pdfx.dart' as px; // Isoliamo pdfx
|
||||
@@ -29,16 +28,24 @@ class _ExportItem {
|
||||
});
|
||||
}
|
||||
|
||||
class OperationFilesSection extends StatefulWidget {
|
||||
final OperationModel currentOp;
|
||||
class SharedAttachmentsSection extends StatefulWidget {
|
||||
final String? parentId;
|
||||
final String customerDisplayName;
|
||||
final AttachmentParentType parentType;
|
||||
|
||||
const OperationFilesSection({super.key, required this.currentOp});
|
||||
const SharedAttachmentsSection({
|
||||
super.key,
|
||||
this.parentId,
|
||||
this.customerDisplayName = 'Cliente_sconosciuto',
|
||||
required this.parentType,
|
||||
});
|
||||
|
||||
@override
|
||||
State<OperationFilesSection> createState() => _OperationFilesSectionState();
|
||||
State<SharedAttachmentsSection> createState() =>
|
||||
_SharedAttachmentsSectionState();
|
||||
}
|
||||
|
||||
class _OperationFilesSectionState extends State<OperationFilesSection> {
|
||||
class _SharedAttachmentsSectionState extends State<SharedAttachmentsSection> {
|
||||
String? _exportDirectory;
|
||||
|
||||
@override
|
||||
@@ -181,7 +188,8 @@ class _OperationFilesSectionState extends State<OperationFilesSection> {
|
||||
suggestedName = selectedFiles.first.name;
|
||||
} else {
|
||||
// Se sono più file uniti
|
||||
suggestedName = '${widget.currentOp.customerDisplayName}_Unito';
|
||||
|
||||
suggestedName = '${widget.customerDisplayName}_Unito';
|
||||
}
|
||||
|
||||
if (!mounted) return;
|
||||
@@ -497,15 +505,14 @@ class _OperationFilesSectionState extends State<OperationFilesSection> {
|
||||
},
|
||||
),
|
||||
// Bottone Associa a Cliente
|
||||
if (widget.currentOp.customerId != null &&
|
||||
widget.currentOp.customerId!.isNotEmpty)
|
||||
if (widget.parentId != null && widget.parentId != '')
|
||||
IconButton(
|
||||
icon: const Icon(Icons.person_add, color: Colors.blue),
|
||||
tooltip: 'Copia nei documenti del Cliente',
|
||||
onPressed: () {
|
||||
context.read<AttachmentsBloc>().add(
|
||||
LinkAttachmentsToEntityEvent(
|
||||
targetId: widget.currentOp.customerId!,
|
||||
targetId: widget.parentId!,
|
||||
targetType: AttachmentParentType.customer,
|
||||
),
|
||||
);
|
||||
@@ -5,11 +5,11 @@ import 'package:flux/features/customers/models/customer_model.dart';
|
||||
import 'package:flux/features/customers/ui/quick_customer_dialog.dart';
|
||||
import 'package:flux/features/operations/models/operation_model.dart';
|
||||
|
||||
class CustomerSection extends StatelessWidget {
|
||||
class SharedCustomerSection extends StatelessWidget {
|
||||
final OperationModel? currentOp;
|
||||
final ValueChanged<CustomerModel> onCustomerSelected;
|
||||
|
||||
const CustomerSection({
|
||||
const SharedCustomerSection({
|
||||
super.key,
|
||||
required this.currentOp,
|
||||
required this.onCustomerSelected,
|
||||
@@ -7,13 +7,17 @@ import 'package:flux/features/operations/models/operation_model.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
|
||||
class StaffSection extends StatelessWidget {
|
||||
final OperationModel? currentOp;
|
||||
final String? label;
|
||||
final String? staffId;
|
||||
final String? staffName;
|
||||
final ValueChanged<StaffMemberModel> onStaffSelected;
|
||||
|
||||
const StaffSection({
|
||||
super.key,
|
||||
required this.currentOp,
|
||||
required this.onStaffSelected,
|
||||
this.label,
|
||||
this.staffId,
|
||||
this.staffName,
|
||||
});
|
||||
|
||||
@override
|
||||
Reference in New Issue
Block a user