fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flux/core/widgets/shared_forms/attachments_section.dart';
|
||||
import 'package:flux/features/attachments/blocs/attachments_bloc.dart';
|
||||
import 'package:flux/features/operations/blocs/operation_form_cubit.dart';
|
||||
import 'package:flux/features/operations/models/operation_model.dart';
|
||||
@@ -39,7 +40,7 @@ class _OperationFormScreenState extends State<OperationFormScreen> {
|
||||
'Energy',
|
||||
'Fin',
|
||||
'Entertainment',
|
||||
'Custom',
|
||||
'Altro',
|
||||
];
|
||||
|
||||
bool _isInitialized = false;
|
||||
@@ -113,9 +114,10 @@ class _OperationFormScreenState extends State<OperationFormScreen> {
|
||||
Future<String?> _generateIdForQr() async {
|
||||
if (!_formKey.currentState!.validate()) return null;
|
||||
_flushControllersToCubit();
|
||||
|
||||
// Lo leggiamo pulito pulito dal context, perché c'è!
|
||||
final attachmentsBloc = context.read<AttachmentsBloc>();
|
||||
|
||||
// Assicurati che questo metodo esista nel Cubit (come per il Ticket)
|
||||
final newId = await context.read<OperationFormCubit>().saveOperationDraft();
|
||||
if (newId != null && context.mounted) {
|
||||
attachmentsBloc.add(ParentEntitySavedEvent(newId));
|
||||
@@ -602,8 +604,10 @@ class _OperationFormScreenState extends State<OperationFormScreen> {
|
||||
icon: Icons.attach_file,
|
||||
themeColor: Colors.deepPurple,
|
||||
children: [
|
||||
SharedFilesSection(
|
||||
titleNameForUpload: state.operation.customer?.name ?? 'Nuova Pratica',
|
||||
SharedAttachmentsSection(
|
||||
parentType: AttachmentParentType.operation,
|
||||
parentId: state.operation.id,
|
||||
titleForUpload: state.operation.customer?.name ?? 'Nuova Pratica',
|
||||
onGenerateIdForQr: _generateIdForQr,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user