update inventory bug solved
This commit is contained in:
parent
60ae618071
commit
aa04f39fca
@ -1,3 +1,4 @@
|
||||
import 'package:cheminova/models/pd_rd_response_model.dart';
|
||||
import 'package:cheminova/provider/pd_rd_provider.dart';
|
||||
import 'package:cheminova/screens/add_products_screen.dart';
|
||||
import 'package:cheminova/widgets/common_background.dart';
|
||||
@ -16,7 +17,7 @@ class UpdateInventoryScreen extends StatefulWidget {
|
||||
|
||||
class _UpdateInventoryScreenState extends State<UpdateInventoryScreen> {
|
||||
String? selectedDistributorType;
|
||||
String? selectedDistributor;
|
||||
PdRdResponseModel? selectedDistributor;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -83,14 +84,12 @@ class _UpdateInventoryScreenState extends State<UpdateInventoryScreen> {
|
||||
return const Center(child: Text('No distributors available.'));
|
||||
}
|
||||
|
||||
List<String> principalDistributors = provider.pdRdList
|
||||
List<PdRdResponseModel> principalDistributors = provider.pdRdList
|
||||
.where((item) => item.userType == 'SalesCoOrdinator')
|
||||
.map((item) => item.name)
|
||||
.toList();
|
||||
|
||||
List<String> retailerDistributors = provider.pdRdList
|
||||
List<PdRdResponseModel> retailerDistributors = provider.pdRdList
|
||||
.where((item) => item.userType != 'SalesCoOrdinator')
|
||||
.map((item) => item.name)
|
||||
.toList();
|
||||
|
||||
return Stack(
|
||||
@ -126,10 +125,11 @@ class _UpdateInventoryScreenState extends State<UpdateInventoryScreen> {
|
||||
),
|
||||
),
|
||||
// Dropdown for selecting distributor name based on type
|
||||
if (selectedDistributorType != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 15.0, vertical: 25),
|
||||
child: DropdownButtonFormField<String>(
|
||||
child: DropdownButtonFormField<PdRdResponseModel>(
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Select Distributor Name',
|
||||
fillColor: Colors.white,
|
||||
@ -137,14 +137,14 @@ class _UpdateInventoryScreenState extends State<UpdateInventoryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
value: selectedDistributor,
|
||||
items:
|
||||
(selectedDistributorType == 'Principal Distributor'
|
||||
items: (selectedDistributorType ==
|
||||
'Principal Distributor'
|
||||
? principalDistributors
|
||||
: retailerDistributors)
|
||||
.map((String distributor) {
|
||||
return DropdownMenuItem<String>(
|
||||
.map((PdRdResponseModel distributor) {
|
||||
return DropdownMenuItem<PdRdResponseModel>(
|
||||
value: distributor,
|
||||
child: Text(distributor),
|
||||
child: Text(distributor.name),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
|
Loading…
Reference in New Issue
Block a user