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