Fixed sales invoice issues in Ecommerce

This commit is contained in:
2026-09-03 08:34:23 +05:30
parent b4772ccf19
commit b123a34e8f
18 changed files with 2275 additions and 453 deletions

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../../providers/business_provider.dart';
import '../../../sales/presentation/sales_channels_screen.dart';
class BusinessSettingsScreen extends ConsumerStatefulWidget {
const BusinessSettingsScreen({super.key});
@@ -176,6 +177,58 @@ class _BusinessSettingsScreenState
}
},
),
const SizedBox(height: 16),
Builder(
builder: (context) {
final businessProfile = ref.watch(businessProfileProvider).value;
final nature = (businessProfile?.natureOfBusiness ?? businessProfile?.industry ?? 'JEWELLERY').toUpperCase();
final isJewellery = nature == 'JEWELLERY';
final isChannelEnabled = featureState.value?.enableEcommerceChannels ?? (!isJewellery);
return SwitchListTile(
title: const Text('Enable E-Commerce & Marketplace Channels'),
subtitle: const Text(
'Track multi-channel sales across Amazon, Flipkart, Shopify, etc. in Invoices.',
),
value: isChannelEnabled,
secondary: const Icon(LucideIcons.shoppingBag),
onChanged: (val) {
if (featureState.value != null) {
final updated = featureState.value!.copyWith(
enableEcommerceChannels: val,
);
ref
.read(businessFeatureProvider.notifier)
.updateFeatures(updated);
}
},
);
},
),
Consumer(
builder: (context, ref, child) {
final featureState = ref.watch(businessFeatureProvider);
final businessProfile = ref.watch(businessProfileProvider).value;
final nature = (businessProfile?.natureOfBusiness ?? businessProfile?.industry ?? 'JEWELLERY').toUpperCase();
final isJewellery = nature == 'JEWELLERY';
final isChannelEnabled = featureState.value?.enableEcommerceChannels ?? (!isJewellery);
if (!isChannelEnabled) return const SizedBox.shrink();
return ListTile(
leading: const Icon(LucideIcons.store, color: Colors.blue),
title: const Text('Manage Sales Channels', style: TextStyle(fontWeight: FontWeight.w600)),
subtitle: const Text('Configure marketplace channels and custom platforms'),
trailing: const Icon(LucideIcons.chevronRight, size: 18),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => const SalesChannelsScreen()),
);
},
);
},
),
],
);
},