fixes
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flux/core/routes/routes.dart';
|
import 'package:flux/core/routes/routes.dart';
|
||||||
|
import 'package:flux/features/customers/blocs/customer_form_cubit.dart';
|
||||||
import 'package:flux/features/customers/blocs/customers_list_cubit.dart';
|
import 'package:flux/features/customers/blocs/customers_list_cubit.dart';
|
||||||
import 'package:flux/features/customers/models/customer_model.dart';
|
import 'package:flux/features/customers/models/customer_model.dart';
|
||||||
import 'package:flux/features/customers/ui/quick_customer_dialog.dart';
|
import 'package:flux/features/customers/ui/quick_customer_dialog.dart';
|
||||||
@@ -279,10 +280,13 @@ class SharedCustomerSection extends StatelessWidget {
|
|||||||
builder: (dialogContext) {
|
builder: (dialogContext) {
|
||||||
return BlocProvider.value(
|
return BlocProvider.value(
|
||||||
value: context.read<CustomersListCubit>(),
|
value: context.read<CustomersListCubit>(),
|
||||||
|
child: BlocProvider<CustomerFormCubit>(
|
||||||
|
create: (context) => CustomerFormCubit(),
|
||||||
child: QuickCustomerDialog(
|
child: QuickCustomerDialog(
|
||||||
initialQuery:
|
initialQuery:
|
||||||
currentSearchQuery, // <-- Passiamo quello che ha digitato!
|
currentSearchQuery, // <-- Passiamo quello che ha digitato!
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
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/blocs/session/session_cubit.dart';
|
||||||
|
import 'package:flux/core/widgets/image_upload/blocs/image_upload_cubit.dart';
|
||||||
import 'package:flux/core/widgets/image_upload/ui/image_upload_screen.dart';
|
import 'package:flux/core/widgets/image_upload/ui/image_upload_screen.dart';
|
||||||
import 'package:flux/core/widgets/qr_upload_dialog.dart';
|
import 'package:flux/core/widgets/qr_upload_dialog.dart';
|
||||||
import 'package:flux/features/attachments/blocs/attachments_bloc.dart';
|
import 'package:flux/features/attachments/blocs/attachments_bloc.dart';
|
||||||
@@ -98,6 +99,8 @@ class SharedFilesSection extends StatelessWidget {
|
|||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (_) => BlocProvider.value(
|
builder: (_) => BlocProvider.value(
|
||||||
value: bloc,
|
value: bloc,
|
||||||
|
child: BlocProvider<ImageUploadCubit>(
|
||||||
|
create: (context) => ImageUploadCubit(),
|
||||||
child: ImageUploadScreen(
|
child: ImageUploadScreen(
|
||||||
title: titleNameForUpload,
|
title: titleNameForUpload,
|
||||||
companyId: GetIt.I
|
companyId: GetIt.I
|
||||||
@@ -108,6 +111,7 @@ class SharedFilesSection extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ class _QuickCustomerDialogState extends State<QuickCustomerDialog> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
ChoiceChip(
|
ChoiceChip(
|
||||||
label: const Text('Privato (Domestico)'),
|
label: const Text('Privato (Domestico)'),
|
||||||
@@ -98,6 +100,7 @@ class _QuickCustomerDialogState extends State<QuickCustomerDialog> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const Divider(height: 32),
|
const Divider(height: 32),
|
||||||
TextField(
|
TextField(
|
||||||
controller: _nameCtrl,
|
controller: _nameCtrl,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
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/widgets/shared_forms/attachments_section.dart';
|
||||||
import 'package:flux/features/attachments/blocs/attachments_bloc.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/blocs/operation_form_cubit.dart';
|
||||||
import 'package:flux/features/operations/models/operation_model.dart';
|
import 'package:flux/features/operations/models/operation_model.dart';
|
||||||
@@ -39,7 +40,7 @@ class _OperationFormScreenState extends State<OperationFormScreen> {
|
|||||||
'Energy',
|
'Energy',
|
||||||
'Fin',
|
'Fin',
|
||||||
'Entertainment',
|
'Entertainment',
|
||||||
'Custom',
|
'Altro',
|
||||||
];
|
];
|
||||||
|
|
||||||
bool _isInitialized = false;
|
bool _isInitialized = false;
|
||||||
@@ -113,9 +114,10 @@ class _OperationFormScreenState extends State<OperationFormScreen> {
|
|||||||
Future<String?> _generateIdForQr() async {
|
Future<String?> _generateIdForQr() async {
|
||||||
if (!_formKey.currentState!.validate()) return null;
|
if (!_formKey.currentState!.validate()) return null;
|
||||||
_flushControllersToCubit();
|
_flushControllersToCubit();
|
||||||
|
|
||||||
|
// Lo leggiamo pulito pulito dal context, perché c'è!
|
||||||
final attachmentsBloc = context.read<AttachmentsBloc>();
|
final attachmentsBloc = context.read<AttachmentsBloc>();
|
||||||
|
|
||||||
// Assicurati che questo metodo esista nel Cubit (come per il Ticket)
|
|
||||||
final newId = await context.read<OperationFormCubit>().saveOperationDraft();
|
final newId = await context.read<OperationFormCubit>().saveOperationDraft();
|
||||||
if (newId != null && context.mounted) {
|
if (newId != null && context.mounted) {
|
||||||
attachmentsBloc.add(ParentEntitySavedEvent(newId));
|
attachmentsBloc.add(ParentEntitySavedEvent(newId));
|
||||||
@@ -602,8 +604,10 @@ class _OperationFormScreenState extends State<OperationFormScreen> {
|
|||||||
icon: Icons.attach_file,
|
icon: Icons.attach_file,
|
||||||
themeColor: Colors.deepPurple,
|
themeColor: Colors.deepPurple,
|
||||||
children: [
|
children: [
|
||||||
SharedFilesSection(
|
SharedAttachmentsSection(
|
||||||
titleNameForUpload: state.operation.customer?.name ?? 'Nuova Pratica',
|
parentType: AttachmentParentType.operation,
|
||||||
|
parentId: state.operation.id,
|
||||||
|
titleForUpload: state.operation.customer?.name ?? 'Nuova Pratica',
|
||||||
onGenerateIdForQr: _generateIdForQr,
|
onGenerateIdForQr: _generateIdForQr,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class OperationDetailsSection extends StatelessWidget {
|
|||||||
ProviderModel provider,
|
ProviderModel provider,
|
||||||
String operationType,
|
String operationType,
|
||||||
) {
|
) {
|
||||||
if (operationType == 'Custom') return true;
|
if (operationType == 'Altro') return true;
|
||||||
|
|
||||||
// Controlliamo che il fornitore abbia il ruolo specifico nel suo array
|
// Controlliamo che il fornitore abbia il ruolo specifico nel suo array
|
||||||
switch (operationType) {
|
switch (operationType) {
|
||||||
@@ -241,7 +241,7 @@ class OperationDetailsSection extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
|
|
||||||
// 3. SCENARIO ENTERTAINMENT O CUSTOM (Testo libero)
|
// 3. SCENARIO ENTERTAINMENT O CUSTOM (Testo libero)
|
||||||
if (currentType == 'Entertainment' || currentType == 'Custom') ...[
|
if (currentType == 'Entertainment' || currentType == 'Altro') ...[
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: freeTextSubtypeController,
|
controller: freeTextSubtypeController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -258,7 +258,7 @@ class OperationDetailsSection extends StatelessWidget {
|
|||||||
'Energy',
|
'Energy',
|
||||||
'Fin',
|
'Fin',
|
||||||
'Entertainment',
|
'Entertainment',
|
||||||
'Custom',
|
'Altro',
|
||||||
].contains(currentType)) ...[
|
].contains(currentType)) ...[
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
durationQuickPicks, // Passiamo i chips dall'esterno
|
durationQuickPicks, // Passiamo i chips dall'esterno
|
||||||
|
|||||||
Reference in New Issue
Block a user