j
This commit is contained in:
@@ -143,6 +143,10 @@ class SessionCubit extends Cubit<SessionState> {
|
||||
}
|
||||
}
|
||||
|
||||
void updateCurrentCompany(CompanyModel newCompany) {
|
||||
emit(state.copyWith(company: newCompany));
|
||||
}
|
||||
|
||||
// --- FUNZIONE EXTRA: CAMBIO NEGOZIO DALLA DASHBOARD ---
|
||||
Future<void> changeStore(StoreModel newStore) async {
|
||||
if (newStore.id != null) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:flux/core/widgets/set_password_screen.dart';
|
||||
import 'package:flux/core/widgets/shared_forms/mobile_upload_screen.dart';
|
||||
import 'package:flux/core/widgets/shared_forms/upload_success_screen.dart';
|
||||
import 'package:flux/features/auth/ui/auth_screen.dart';
|
||||
import 'package:flux/features/company/ui/company_settings_screen.dart';
|
||||
import 'package:flux/features/customers/blocs/customers_cubit.dart';
|
||||
import 'package:flux/features/customers/models/customer_model.dart';
|
||||
import 'package:flux/features/customers/ui/customer_detail_screen.dart';
|
||||
@@ -25,9 +26,10 @@ import 'package:flux/features/master_data/store/ui/stores_screen.dart';
|
||||
import 'package:flux/features/onboarding/blocs/onboarding_cubit.dart';
|
||||
import 'package:flux/features/onboarding/ui/onboarding_screen.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';
|
||||
import 'package:flux/features/operations/ui/operation_form_screen.dart';
|
||||
import 'package:flux/features/operations/ui/operations_screen.dart';
|
||||
import 'package:flux/features/operations/ui/operation_list_screen.dart';
|
||||
import 'package:flux/features/tickets/blocs/ticket_form_cubit.dart';
|
||||
import 'package:flux/features/tickets/blocs/ticket_list_cubit.dart';
|
||||
import 'package:flux/features/tickets/models/ticket_model.dart';
|
||||
@@ -128,6 +130,10 @@ class AppRouter {
|
||||
return const ProductsScreen();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: 'company_settings',
|
||||
builder: (context, state) => const CompanySettingsScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: 'staff', // Diventa /master-data/staff
|
||||
builder: (context, state) => const StaffScreen(),
|
||||
@@ -160,7 +166,7 @@ class AppRouter {
|
||||
),
|
||||
GoRoute(
|
||||
path: '/operations',
|
||||
builder: (context, state) => const OperationsScreen(),
|
||||
builder: (context, state) => const OperationListScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/customers',
|
||||
@@ -235,7 +241,6 @@ class AppRouter {
|
||||
|
||||
GoRoute(
|
||||
path: '/operations/form/:id',
|
||||
name: 'operation-form',
|
||||
builder: (context, state) {
|
||||
final String pathId = state.pathParameters['id'] ?? 'new';
|
||||
final OperationModel? operationFromExtra =
|
||||
@@ -254,14 +259,19 @@ class AppRouter {
|
||||
context.read<ProductsCubit>().loadBrands();
|
||||
context.read<StaffCubit>().loadStaffForStore(currentStoreId);
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) => AttachmentsBloc(
|
||||
parentId: realOperationId,
|
||||
parentType: AttachmentParentType.operation,
|
||||
),
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider(
|
||||
create: (context) => AttachmentsBloc(
|
||||
parentId: realOperationId,
|
||||
parentType: AttachmentParentType.operation,
|
||||
),
|
||||
),
|
||||
BlocProvider(create: (context) => OperationFormCubit()),
|
||||
],
|
||||
child: OperationFormScreen(
|
||||
operationId: operationId ?? existingOperation?.id,
|
||||
existingOperation: existingOperation,
|
||||
operationId: realOperationId,
|
||||
existingOperation: operationFromExtra,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user