Commit 8cdaca01 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

29-07-2025 By Sai Srinivas

CRM test cases
parent e079c6e8
...@@ -207,6 +207,8 @@ class MyApp extends StatelessWidget { ...@@ -207,6 +207,8 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (_) => Addpaymentprovider()), ChangeNotifierProvider(create: (_) => Addpaymentprovider()),
ChangeNotifierProvider(create: (_) => Addorderprovider()), ChangeNotifierProvider(create: (_) => Addorderprovider()),
ChangeNotifierProvider(create: (_) => Editpaymentprovider()), ChangeNotifierProvider(create: (_) => Editpaymentprovider()),
///crm
ChangeNotifierProvider(create: (_) => Crmdashboardprovider()), ChangeNotifierProvider(create: (_) => Crmdashboardprovider()),
ChangeNotifierProvider(create: (_) => Leadlistprovider()), ChangeNotifierProvider(create: (_) => Leadlistprovider()),
ChangeNotifierProvider(create: (_) => crmLeadDetailsProvider()), ChangeNotifierProvider(create: (_) => crmLeadDetailsProvider()),
...@@ -222,6 +224,7 @@ class MyApp extends StatelessWidget { ...@@ -222,6 +224,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (_) => Dispatchorderprovider()), ChangeNotifierProvider(create: (_) => Dispatchorderprovider()),
ChangeNotifierProvider(create: (_) => followUpUpdateProvider()), ChangeNotifierProvider(create: (_) => followUpUpdateProvider()),
ChangeNotifierProvider(create: (_) => Appointmentcalendarprovider()), ChangeNotifierProvider(create: (_) => Appointmentcalendarprovider()),
ChangeNotifierProvider(create: (_) => Addnewleadsandprospectsprovider()),
], ],
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -297,6 +300,12 @@ class MyApp extends StatelessWidget { ...@@ -297,6 +300,12 @@ class MyApp extends StatelessWidget {
AppColors.grey_semi.withOpacity(0.6), AppColors.grey_semi.withOpacity(0.6),
), ),
), ),
checkboxTheme: CheckboxThemeData(
side: BorderSide(width: 0.5),
checkColor: WidgetStatePropertyAll(AppColors.white),
),
useMaterial3: true, useMaterial3: true,
// inputDecorationTheme: InputDecorationTheme( // inputDecorationTheme: InputDecorationTheme(
// hintStyle: TextStyle( // hintStyle: TextStyle(
......
...@@ -87,7 +87,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -87,7 +87,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return (connection == "Online") return (connection == "Online")
? Platform.isAndroid ? Platform.isAndroid
? WillPopScope( ? WillPopScope(
onWillPop: () => onBackPressed(context), onWillPop: () async {
Provider.of<Editproductlistprovider>(
context,
listen: false,
).resetForm();
return onBackPressed(context);
},
child: SafeArea( child: SafeArea(
top: false, top: false,
bottom: true, bottom: true,
...@@ -138,6 +144,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -138,6 +144,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
// totalSubHeadings = [...subHeadings2]; // totalSubHeadings = [...subHeadings2];
// } // }
var productsNotEmpty = provider.leadProducts.isNotEmpty;
var contactsNotEmpty = provider.contactDetails.isNotEmpty;
var followupNotEmpty = provider.followupDetails.isNotEmpty;
var appointmentNotEmpty = provider.appointmentDetails.isNotEmpty;
var quotationNotEmpty = provider.quotationsDetails.isNotEmpty;
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
// appBar: appbar2New( // appBar: appbar2New(
...@@ -154,12 +166,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -154,12 +166,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
// //
// ), // ),
appBar: AppBar( appBar: AppBar(
toolbarHeight: provider.showMoreDetails ? 25 : 40, // toolbarHeight: provider.showMoreDetails ? 25 : 40,
backgroundColor: Colors.white, backgroundColor: Colors.white,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
centerTitle: false, centerTitle: false,
elevation: 2.0, // elevation: 2.0,
title: SizedBox( title: SizedBox(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
...@@ -168,6 +180,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -168,6 +180,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
InkResponse( InkResponse(
onTap: () { onTap: () {
provider.resetAll(); provider.resetAll();
editProvider.resetForm();
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
...@@ -181,6 +194,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -181,6 +194,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child: InkResponse( child: InkResponse(
onTap: () { onTap: () {
provider.resetAll(); provider.resetAll();
editProvider.resetForm();
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
child: Text( child: Text(
...@@ -196,33 +210,26 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -196,33 +210,26 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
), ),
// Spacer(),
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset(
// "assets/svg/ic_more.svg",
// height: 30,
// ),
// ),
], ],
), ),
), ),
bottom: PreferredSize( ),
preferredSize: backgroundColor: AppColors.scaffold_bg_color,
provider.showMoreDetails body: Column(
? Size.fromHeight(
MediaQuery.of(context).size.height * 0.8,
)
: Size.fromHeight(120),
child: Column(
children: [ children: [
Padding( Card(
padding: const EdgeInsets.symmetric(horizontal: 8), shape: RoundedRectangleBorder(
child: Divider(thickness: 0.5, color: Color(0xFFD7D7D7)), borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
), ),
elevation: 2,
child: Column(
children: [
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
...@@ -231,7 +238,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -231,7 +238,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
// margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10), // margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
child: Column( child: Column(
children: [ children: [
Row( Row(
...@@ -251,7 +261,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -251,7 +261,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
flex: 5, flex: 5,
child: SizedBox( child: SizedBox(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Text( Text(
leadDetails.name ?? "-", leadDetails.name ?? "-",
...@@ -351,7 +362,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -351,7 +362,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
...List.generate(subHeadings1.length, (j) { ...List.generate(subHeadings1.length, (j) {
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 7), padding: EdgeInsets.symmetric(
vertical: 7,
),
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
...@@ -410,7 +423,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -410,7 +423,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
...List.generate(subHeadings2.length, (j) { ...List.generate(subHeadings2.length, (j) {
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 7), padding: EdgeInsets.symmetric(
vertical: 7,
),
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
...@@ -469,7 +484,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -469,7 +484,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
...List.generate(subHeadings3.length, (j) { ...List.generate(subHeadings3.length, (j) {
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 7), padding: EdgeInsets.symmetric(
vertical: 7,
),
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
...@@ -528,7 +545,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -528,7 +545,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
...List.generate(subHeadings4.length, (j) { ...List.generate(subHeadings4.length, (j) {
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 7), padding: EdgeInsets.symmetric(
vertical: 7,
),
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
...@@ -549,7 +568,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -549,7 +568,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
subHeadings4[j] == "Lead Age" subHeadings4[j] == "Lead Age"
? Tooltip( ? Tooltip(
triggerMode: triggerMode:
TooltipTriggerMode.tap, TooltipTriggerMode
.tap,
message: message:
"${provider.leadDetails.createdDatetime}", "${provider.leadDetails.createdDatetime}",
...@@ -563,7 +583,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -563,7 +583,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
0xFF818181, 0xFF818181,
), ),
decorationColor: decorationColor:
AppColors.grey_semi, AppColors
.grey_semi,
decoration: decoration:
TextDecoration TextDecoration
.underline, .underline,
...@@ -576,7 +597,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -576,7 +597,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
: subHeadings4[j], : subHeadings4[j],
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF818181), color: Color(
0xFF818181,
),
), ),
), ),
), ),
...@@ -612,7 +635,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -612,7 +635,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
Transform.flip( Transform.flip(
flipY: flipY:
provider.showMoreDetails ? true : false, provider.showMoreDetails
? true
: false,
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/svg/arrow_dropdown.svg", "assets/svg/arrow_dropdown.svg",
height: 25, height: 25,
...@@ -630,18 +655,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -630,18 +655,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
], ],
), ),
), ),
shape: RoundedRectangleBorder( Expanded(
borderRadius: BorderRadius.vertical( child: SingleChildScrollView(
bottom: Radius.circular(30), // Adjust the radius as needed physics: AlwaysScrollableScrollPhysics(),
),
),
),
backgroundColor: AppColors.scaffold_bg_color,
body: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
///product details ///product details
if(provider.leadProducts.isNotEmpty)...[
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10), padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row( child: Row(
...@@ -657,12 +676,22 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -657,12 +676,22 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
), ),
if (productsNotEmpty) ...[
Expanded( Expanded(
child: InkResponse( child: InkResponse(
onTap: () async { onTap: () async {
editProvider.resetForm(); editProvider.resetForm();
await editProvider.crmLeadDetailsEditProductsViewAPIFunction(context, provider.leadDetails.id!); await editProvider
_showAddEditProductsSheet(context,widget.mode, "add", ""); .crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
);
_showAddEditProductsSheet(
context,
widget.mode,
"add",
"",
);
}, },
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
...@@ -676,8 +705,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -676,8 +705,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
], ],
],
), ),
), ),
if (productsNotEmpty) ...[
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 130, height: 130,
...@@ -685,7 +716,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -685,7 +716,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
physics: AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
itemCount: provider.leadProducts.length, itemCount: provider.leadProducts.length,
itemBuilder: (context, lp) { itemBuilder: (context, lp) {
return InkResponse( return InkResponse(
...@@ -699,16 +733,35 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -699,16 +733,35 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
// ), // ),
// ), // ),
// ); // );
await editProvider.crmLeadDetailsEditProductsViewAPIFunction(context, provider.leadDetails.id!); await editProvider
editProvider.addEditProductPriceController.text = provider.leadProducts[lp].price!; .crmLeadDetailsEditProductsViewAPIFunction(
editProvider.addEditQuantityController.text = provider.leadProducts[lp].qty!; context,
editProvider.addEditTotalAmountController.text = provider.leadProducts[lp].prodTotalPrice!; provider.leadDetails.id!,
editProvider.selectedProducts = editProvider.productsList.firstWhere( );
(product) => product.id == provider.leadProducts[lp].productId editProvider
.addEditProductPriceController
.text = provider.leadProducts[lp].price!;
editProvider.addEditQuantityController.text =
provider.leadProducts[lp].qty!;
editProvider.addEditTotalAmountController.text =
provider.leadProducts[lp].prodTotalPrice!;
editProvider.selectedProducts = editProvider
.productsList
.firstWhere(
(product) =>
product.id ==
provider.leadProducts[lp].productId,
);
editProvider.selectedAddEditProductId =
provider.leadProducts[lp].productId!;
editProvider.selectedAddEditProductName =
provider.leadProducts[lp].productName!;
_showAddEditProductsSheet(
context,
widget.mode,
"edit",
provider.leadProducts[lp].id,
); );
editProvider.selectedAddEditProductId = provider.leadProducts[lp].productId!;
editProvider.selectedAddEditProductName = provider.leadProducts[lp].productName!;
_showAddEditProductsSheet(context,widget.mode, "edit", provider.leadProducts[lp].id);
}, },
child: Container( child: Container(
height: 130, height: 130,
...@@ -745,7 +798,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -745,7 +798,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
// mainAxisAlignment: MainAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
...@@ -757,11 +811,14 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -757,11 +811,14 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
.productName ?? .productName ??
"-", "-",
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow:
TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily:
"JakartaMedium",
fontSize: 14, fontSize: 14,
color: AppColors.semi_black, color:
AppColors.semi_black,
), ),
), ),
), ),
...@@ -771,9 +828,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -771,9 +828,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
textAlign: TextAlign.right, textAlign: TextAlign.right,
"₹${provider.leadProducts[lp].price ?? "-"}", "₹${provider.leadProducts[lp].price ?? "-"}",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily:
"JakartaMedium",
fontSize: 14, fontSize: 14,
color: AppColors.semi_black, color:
AppColors.semi_black,
), ),
), ),
), ),
...@@ -815,10 +874,48 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -815,10 +874,48 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
}, },
), ),
), ),
] else ...[
InkResponse(
onTap: () async {
editProvider.resetForm();
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
);
_showAddEditProductsSheet(
context,
widget.mode,
"add",
"",
);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"+ Add Product",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
),
),
),
], ],
///contact details ///contact details
if(provider.contactDetails.isNotEmpty)...[
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10), padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row( child: Row(
...@@ -834,6 +931,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -834,6 +931,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
), ),
if (contactsNotEmpty) ...[
Expanded( Expanded(
child: InkResponse( child: InkResponse(
onTap: () { onTap: () {
...@@ -851,12 +949,17 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -851,12 +949,17 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
], ],
],
), ),
), ),
if (contactsNotEmpty) ...[
ListView.builder( ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
itemCount: provider.contactDetails.length, itemCount: provider.contactDetails.length,
itemBuilder: (context, lp) { itemBuilder: (context, lp) {
return InkResponse( return InkResponse(
...@@ -902,15 +1005,19 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -902,15 +1005,19 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child: SizedBox( child: SizedBox(
child: Column( child: Column(
// mainAxisAlignment: MainAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
mainAxisAlignment: MainAxisAlignment.start, CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
Expanded( Expanded(
flex: 4, flex: 4,
child: Text( child: Text(
provider.contactDetails[lp].name ?? provider
.contactDetails[lp]
.name ??
"-", "-",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
...@@ -951,10 +1058,37 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -951,10 +1058,37 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
); );
}, },
), ),
] else ...[
InkResponse(
onTap: () async {
_showAddContactSheet(context);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"+ Add Contact",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
),
),
),
], ],
///Followup details ///Followup details
if (provider.followupDetails.isNotEmpty) ...[
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10), padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row( child: Row(
...@@ -970,13 +1104,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -970,13 +1104,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
), ),
if (followupNotEmpty) ...[
Expanded( Expanded(
child: InkResponse( child: InkResponse(
onTap: () async { onTap: () async {
var res = await Navigator.push( var res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => Followupupdatescreen( builder:
(context) => Followupupdatescreen(
leadID: provider.leadDetails.id, leadID: provider.leadDetails.id,
mode: widget.mode, mode: widget.mode,
), ),
...@@ -998,8 +1134,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -998,8 +1134,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
], ],
],
), ),
), ),
if (followupNotEmpty) ...[
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 250, height: 250,
...@@ -1030,7 +1168,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1030,7 +1168,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
...@@ -1055,7 +1194,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1055,7 +1194,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
flex: 4, flex: 4,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
Text( Text(
provider provider
...@@ -1081,7 +1221,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1081,7 +1221,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium", "JakartaMedium",
fontSize: 14, fontSize: 14,
color: color:
AppColors.grey_semi, AppColors
.grey_semi,
), ),
), ),
], ],
...@@ -1095,9 +1236,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1095,9 +1236,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
BorderRadius.circular( BorderRadius.circular(
8, 8,
), ),
color: Color(0xFFF3FFD5), color: Color(
0xFFF3FFD5,
),
), ),
padding: EdgeInsets.symmetric( padding:
EdgeInsets.symmetric(
horizontal: 5, horizontal: 5,
vertical: 10, vertical: 10,
), ),
...@@ -1156,11 +1300,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1156,11 +1300,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...List.generate(2, (j) { ...List.generate(2, (j) {
final heads = ["In Time", "Out Time"]; final heads = ["In Time", "Out Time"];
final subHeads = [ final subHeads = [
provider.followupDetails[lp].finTime ?? "-", provider.followupDetails[lp].finTime ??
provider.followupDetails[lp].foutTime ?? "-", "-",
provider.followupDetails[lp].foutTime ??
"-",
]; ];
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 3), padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
...@@ -1179,7 +1327,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1179,7 +1327,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded( Expanded(
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
subHeads[j] == "" ? "-" : subHeads[j], subHeads[j] == ""
? "-"
: subHeads[j],
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF818181), color: Color(0xFF818181),
...@@ -1220,7 +1370,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1220,7 +1370,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Container( Container(
padding: EdgeInsets.symmetric(vertical: 3), padding: EdgeInsets.symmetric(vertical: 3),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
...@@ -1261,10 +1412,49 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1261,10 +1412,49 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
}, },
), ),
), ),
] else ...[
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Followupupdatescreen(
leadID: provider.leadDetails.id,
mode: widget.mode,
),
settings: RouteSettings(
name: 'Followupupdatescreen',
),
),
);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"+ Follow up Update",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
),
),
),
], ],
///Appointment details ///Appointment details
if(provider.appointmentDetails.isNotEmpty)...[
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10), padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row( child: Row(
...@@ -1280,6 +1470,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1280,6 +1470,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
), ),
if (appointmentNotEmpty) ...[
Expanded( Expanded(
child: InkResponse( child: InkResponse(
onTap: () { onTap: () {
...@@ -1297,8 +1488,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1297,8 +1488,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
], ],
],
), ),
), ),
if (appointmentNotEmpty) ...[
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 250, height: 250,
...@@ -1306,7 +1499,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1306,7 +1499,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
physics: AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
itemCount: provider.appointmentDetails.length, itemCount: provider.appointmentDetails.length,
itemBuilder: (context, lp) { itemBuilder: (context, lp) {
return Container( return Container(
...@@ -1326,7 +1522,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1326,7 +1522,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
...@@ -1351,7 +1548,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1351,7 +1548,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
flex: 4, flex: 4,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
Text( Text(
provider provider
...@@ -1363,7 +1561,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1363,7 +1561,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium", "JakartaMedium",
fontSize: 14, fontSize: 14,
color: color:
AppColors.semi_black, AppColors
.semi_black,
), ),
), ),
Text( Text(
...@@ -1376,7 +1575,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1376,7 +1575,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium", "JakartaMedium",
fontSize: 14, fontSize: 14,
color: color:
AppColors.grey_semi, AppColors
.grey_semi,
), ),
), ),
], ],
...@@ -1420,13 +1620,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1420,13 +1620,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...List.generate(2, (j) { ...List.generate(2, (j) {
final headsa = ["Type", "Executed"]; final headsa = ["Type", "Executed"];
final subHeadsa = [ final subHeadsa = [
provider.appointmentDetails[lp].atype ?? "-", provider.appointmentDetails[lp].atype ??
provider.appointmentDetails[lp].astatus ?? "-", "-",
provider.appointmentDetails[lp].astatus ??
"-",
]; ];
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 3), padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
...@@ -1442,7 +1647,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1442,7 +1647,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded( Expanded(
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
subHeadsa[j] == "" ? "-" : subHeadsa[j], subHeadsa[j] == ""
? "-"
: subHeadsa[j],
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF818181), color: Color(0xFF818181),
...@@ -1483,7 +1690,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1483,7 +1690,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Container( Container(
padding: EdgeInsets.symmetric(vertical: 3), padding: EdgeInsets.symmetric(vertical: 3),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
...@@ -1499,7 +1707,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1499,7 +1707,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded( Expanded(
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
provider.appointmentDetails[lp].anote == provider
.appointmentDetails[lp]
.anote ==
"" ""
? "-" ? "-"
: provider : provider
...@@ -1522,10 +1732,37 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1522,10 +1732,37 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
}, },
), ),
), ),
] else ...[
InkResponse(
onTap: () {
_showAddAppointmentSheet(context);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"+ Add Appointment",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
),
),
),
], ],
///Quotation details ///Quotation details
if(provider.quotationsDetails.isNotEmpty)...[
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10), padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row( child: Row(
...@@ -1541,6 +1778,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1541,6 +1778,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
), ),
if (quotationNotEmpty) ...[
Expanded( Expanded(
child: InkResponse( child: InkResponse(
onTap: () async { onTap: () async {
...@@ -1573,8 +1811,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1573,8 +1811,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
], ],
],
), ),
), ),
if (quotationNotEmpty) ...[
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 200, height: 200,
...@@ -1582,8 +1822,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1582,8 +1822,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
physics: AlwaysScrollableScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: EdgeInsets.symmetric(
itemCount: provider.appointmentDetails.length, vertical: 10,
horizontal: 10,
),
itemCount: provider.quotationsDetails.length,
itemBuilder: (context, lp) { itemBuilder: (context, lp) {
return Container( return Container(
height: 200, height: 200,
...@@ -1602,7 +1845,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1602,7 +1845,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
...@@ -1627,7 +1871,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1627,7 +1871,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
flex: 4, flex: 4,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
Text( Text(
provider provider
...@@ -1639,7 +1884,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1639,7 +1884,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium", "JakartaMedium",
fontSize: 14, fontSize: 14,
color: color:
AppColors.semi_black, AppColors
.semi_black,
), ),
), ),
Text( Text(
...@@ -1652,7 +1898,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1652,7 +1898,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium", "JakartaMedium",
fontSize: 14, fontSize: 14,
color: color:
AppColors.grey_semi, AppColors
.grey_semi,
), ),
), ),
], ],
...@@ -1697,12 +1944,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1697,12 +1944,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
final headsa = ["File Attached", "Info"]; final headsa = ["File Attached", "Info"];
final subHeadsa = [ final subHeadsa = [
"View", "View",
provider.quotationsDetails[lp].info ?? "-", provider.quotationsDetails[lp].info ??
"-",
]; ];
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 3), padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
...@@ -1725,7 +1976,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1725,7 +1976,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: AppColors.app_blue, color: AppColors.app_blue,
decorationColor: AppColors.app_blue, decorationColor:
AppColors.app_blue,
decoration: decoration:
TextDecoration.underline, TextDecoration.underline,
), ),
...@@ -1755,11 +2007,57 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1755,11 +2007,57 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
}, },
), ),
), ),
] else ...[
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Generatequotationscreen(
leadId: provider.leadDetails.id,
),
),
);
if (res == true) {
provider.crmLeadDetailsAPIFunction(
context,
provider.leadDetails.id,
widget.mode,
);
}
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"+ Generate Quotation",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
),
),
),
], ],
SizedBox(height: 75), SizedBox(height: 75),
], ],
), ),
), ),
),
],
),
); );
}, },
); );
...@@ -1856,7 +2154,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1856,7 +2154,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
errorWidget(context, provider.dateError), errorWidget(context, provider.dateError),
TextWidget(context, "Account"),
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
child: Row( child: Row(
children: [ children: [
...@@ -1972,7 +2270,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1972,7 +2270,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
}, },
); );
}, },
).whenComplete(() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmLeadDetailsProvider>(
context,
listen: false,
); );
provider.crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode);
},);
},);
} }
Future<void> _showAddContactSheet(BuildContext context) { Future<void> _showAddContactSheet(BuildContext context) {
...@@ -2021,10 +2328,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2021,10 +2328,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.nameController, provider.nameController,
"Name", "Name",
"Enter Name", "Enter Name",
provider.onChangeName, (p0) {
TextInputType.number, provider.crmCheckFields(context, provider.nameController.text, "name");
provider.onChangeName(p0);
},
TextInputType.text,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.nameError), errorWidget(context, provider.nameError),
textControllerWidget( textControllerWidget(
...@@ -2033,9 +2343,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2033,9 +2343,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Designation", "Designation",
"Enter Designation", "Enter Designation",
provider.onChangeDesignation, provider.onChangeDesignation,
TextInputType.number, TextInputType.text,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.designationError), errorWidget(context, provider.designationError),
textControllerWidget( textControllerWidget(
...@@ -2043,10 +2353,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2043,10 +2353,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.mobileNumberController, provider.mobileNumberController,
"Mobile Number", "Mobile Number",
"Enter Mobile Number", "Enter Mobile Number",
provider.onChangeMobile, (p0){
provider.crmCheckFields(context, provider.mobileNumberController.text, "mob1");
provider.onChangeMobile(p0);
},
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10
), ),
errorWidget(context, provider.mobileNumError), errorWidget(context, provider.mobileNumError),
textControllerWidget( textControllerWidget(
...@@ -2054,10 +2372,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2054,10 +2372,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.alternativeMobileController, provider.alternativeMobileController,
"Alternative Mobile Number", "Alternative Mobile Number",
"Enter Alternative Mobile Number", "Enter Alternative Mobile Number",
provider.onChangeAltMobile, (p0) {
provider.crmCheckFields(context, provider.alternativeMobileController.text, "mob2");
provider.onChangeAltMobile(p0);
},
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10
), ),
errorWidget(context, provider.altMobError), errorWidget(context, provider.altMobError),
textControllerWidget( textControllerWidget(
...@@ -2077,9 +2403,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2077,9 +2403,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Email ID", "Email ID",
"Enter Email ID", "Enter Email ID",
provider.onChangeEmailId, provider.onChangeEmailId,
TextInputType.number, TextInputType.emailAddress,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.emailError), errorWidget(context, provider.emailError),
InkWell( InkWell(
...@@ -2133,7 +2459,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2133,7 +2459,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
}, },
); );
}, },
).whenComplete(() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmLeadDetailsProvider>(
context,
listen: false,
); );
provider.crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode);
},);
},);
} }
Future<void> _showEditContactSheet(BuildContext context, index) { Future<void> _showEditContactSheet(BuildContext context, index) {
...@@ -2181,10 +2516,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2181,10 +2516,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.editNameController, provider.editNameController,
"Name", "Name",
"Enter Name", "Enter Name",
provider.onChangeEditName, (p0) {
TextInputType.number, provider.crmCheckFields(context, provider.editNameController.text, "name");
provider.onChangeEditName(p0);
},
TextInputType.text,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.editNameError), errorWidget(context, provider.editNameError),
textControllerWidget( textControllerWidget(
...@@ -2193,9 +2531,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2193,9 +2531,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Designation", "Designation",
"Enter Designation", "Enter Designation",
provider.onChangeEditDesignation, provider.onChangeEditDesignation,
TextInputType.number, TextInputType.text,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.editDesignationError), errorWidget(context, provider.editDesignationError),
textControllerWidget( textControllerWidget(
...@@ -2203,10 +2541,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2203,10 +2541,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.editMobileNumberController, provider.editMobileNumberController,
"Mobile Number", "Mobile Number",
"Enter Mobile Number", "Enter Mobile Number",
provider.onChangeEditMobile, (p0) {
provider.crmCheckFields(context, provider.editMobileNumberController.text, "mob1");
provider.onChangeEditMobile(p0);
},
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10
), ),
errorWidget(context, provider.editMobileNumError), errorWidget(context, provider.editMobileNumError),
...@@ -2215,10 +2561,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2215,10 +2561,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.editAlternativeMobileController, provider.editAlternativeMobileController,
"Alternative Mobile Number", "Alternative Mobile Number",
"Enter Alternative Mobile Number", "Enter Alternative Mobile Number",
provider.onChangeEditAltMobile, (p0) {
provider.crmCheckFields(context, provider.editAlternativeMobileController.text, "mob2");
provider.onChangeEditAltMobile(p0);
},
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10
), ),
errorWidget(context, provider.editAltMobError), errorWidget(context, provider.editAltMobError),
textControllerWidget( textControllerWidget(
...@@ -2239,9 +2593,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2239,9 +2593,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Email ID", "Email ID",
"Enter Email ID", "Enter Email ID",
provider.onChangeEditEmailId, provider.onChangeEditEmailId,
TextInputType.number, TextInputType.emailAddress,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.editEmailError), errorWidget(context, provider.editEmailError),
...@@ -2296,7 +2650,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2296,7 +2650,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
}, },
); );
}, },
).whenComplete(() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmLeadDetailsProvider>(
context,
listen: false,
); );
provider.crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode);
},);
},);
} }
Future<void> _showOptionsSheet(BuildContext context) { Future<void> _showOptionsSheet(BuildContext context) {
...@@ -2454,7 +2817,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2454,7 +2817,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return SafeArea( return SafeArea(
child: Consumer2<crmLeadDetailsProvider, Editproductlistprovider>( child: Consumer2<crmLeadDetailsProvider, Editproductlistprovider>(
builder: (context, provider, editProvider, child) { builder: (context, provider, editProvider, child) {
void updatedAmountfun(value){ void updatedAmountfun(value) {
final price = final price =
double.tryParse( double.tryParse(
editProvider.addEditProductPriceController.text, editProvider.addEditProductPriceController.text,
...@@ -2468,6 +2831,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2468,6 +2831,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
editProvider.addEditTotalAmountController.text = editProvider.addEditTotalAmountController.text =
(price * qty).toString(); (price * qty).toString();
} }
return Container( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
bottom: 15, bottom: 15,
...@@ -2491,7 +2855,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2491,7 +2855,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
), ),
), ),
SizedBox(height: 10,), SizedBox(height: 10),
TextWidget(context, "Product"), TextWidget(context, "Product"),
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
child: Row( child: Row(
...@@ -2537,6 +2901,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2537,6 +2901,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
editProvider editProvider
.selectedAddEditProductName = .selectedAddEditProductName =
value.name; value.name;
editProvider.crmSelectedProductDetailsApiFunction(context,value.id.toString());
// editProvider.updateSelectedProductIds(j, value); // editProvider.updateSelectedProductIds(j, value);
// editProvider.selectedProductIds[j] = // editProvider.selectedProductIds[j] =
// value.id?.toString() ?? ''; // value.id?.toString() ?? '';
...@@ -2554,7 +2919,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2554,7 +2919,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
], ],
), ),
), ),
const SizedBox(height: 10), if (editProvider.productError != null) ...[
errorWidget(context, editProvider.productError),
],
Row( Row(
children: [ children: [
Expanded( Expanded(
...@@ -2572,7 +2939,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2572,7 +2939,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
], ],
), ),
const SizedBox(height: 10), if (editProvider.priceError != null) ...[
errorWidget(context, editProvider.priceError),
],
Row( Row(
children: [ children: [
Expanded( Expanded(
...@@ -2590,10 +2959,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2590,10 +2959,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
], ],
), ),
errorWidget( // Text(
context, // "Note: Submit Quantity as Zero (0) to delete Product",
"Note: Submit Quantity as Zero (0) to delete Product", // style: TextStyle(
), // color: AppColors.app_blue,
// fontSize: 12,
// ),
// ),
if (editProvider.qtyError != null) ...[
errorWidget(context, editProvider.qtyError),
],
const SizedBox(height: 10), const SizedBox(height: 10),
Row( Row(
children: [ children: [
...@@ -2678,8 +3053,14 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -2678,8 +3053,14 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
); );
}, },
).whenComplete(() { ).whenComplete(() {
Provider.of<crmLeadDetailsProvider>(context).crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode); WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
Provider.of<Editproductlistprovider>(context).resetForm(); final provider = Provider.of<crmLeadDetailsProvider>(
context,
listen: false,
);
provider.crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode);
},);
},); },);
} }
} }
...@@ -57,16 +57,13 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -57,16 +57,13 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
provider.crmLeadListAPIFunction( provider.crmLeadListAPIFunction(
context, context,
widget.mode, widget.mode,
"",
widget.filter!.status, widget.filter!.status,
widget.filter!.openStatus, widget.filter!.openStatus,
"", "",
"", "",
"", "",
"", "",
"", "A",
"",
"",
); );
} else { } else {
provider.crmLeadListAPIFunction( provider.crmLeadListAPIFunction(
...@@ -78,10 +75,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -78,10 +75,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
"", "",
"", "",
"", "",
"", "A",
"",
"",
"",
); );
} }
}); });
...@@ -135,7 +129,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -135,7 +129,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
children: [ children: [
InkResponse( InkResponse(
onTap: () async { onTap: () async {
_showFilterSheet(context); _showFilterSheetNew(context);
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/svg/filter_ic.svg", "assets/svg/filter_ic.svg",
...@@ -144,7 +138,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -144,7 +138,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
], ],
), ),
0xFFFFFFFF 0xFFFFFFFF,
), ),
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: body:
...@@ -177,13 +171,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -177,13 +171,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => LeadDetailsByMode( (context) => LeadDetailsByMode(
pageTitleName: pageTitleName: widget.pageTitleName,
widget.pageTitleName,
mode: widget.mode, mode: widget.mode,
leadId: leadId:
provider provider.crmLeadList[index].leadid,
.crmLeadList[index]
.leadid,
), ),
), ),
); );
...@@ -234,7 +225,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -234,7 +225,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
), ),
Text( Text(
crmLists[index].product??"-", crmLists[index].product ?? "-",
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
...@@ -266,7 +257,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -266,7 +257,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
], ],
), ),
], ],
), ),
), ),
...@@ -281,7 +271,689 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -281,7 +271,689 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
); );
} }
Future<void> _showFilterSheet(BuildContext context) { // Future<void> _showFilterSheet(BuildContext context) {
// return showModalBottomSheet(
// useSafeArea: true,
// isDismissible: true,
// isScrollControlled: true,
// showDragHandle: true,
// backgroundColor: Colors.white,
// enableDrag: true,
// context: context,
// builder: (context) {
// return StatefulBuilder(
// builder: (context, setState) {
// return SafeArea(
// child: Consumer<Leadlistprovider>(
// builder: (context, provider, child) {
// return Container(
// margin: EdgeInsets.only(
// bottom: 15,
// left: 15,
// right: 15,
// top: 10,
// ),
// padding: EdgeInsets.only(
// bottom: MediaQuery.of(context).viewInsets.bottom,
// ),
// child: SingleChildScrollView(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// SizedBox(height: 15),
// Row(
// children: [
// Expanded(
// child: Text(
// "Filter",
// style: TextStyle(
// color: AppColors.app_blue,
// fontSize: 14,
// ),
// ),
// ),
// ],
// ),
// textControllerWidget(
// context,
// provider.sLeadIDController,
// "Lead ID",
// "Enter Lead ID",
// provider.onChangedLeadId,
// TextInputType.text,
// false,
// null,
// ),
// if (widget.mode != "executive") ...[
// TextWidget(context, "Employee"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Employees>(
// hint: Text(
// "Select Source",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.employeesList
// .map(
// (slist) =>
// DropdownMenuItem<Employees>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value:
// provider.employeesList.contains(
// provider.selectedEmployee,
// )
// ? provider.selectedEmployee
// : null,
//
// // value: provider.selectedEmployees,
// onChanged: (Employees? value) {
// if (value != null) {
// if (provider
// .employeesList
// .isNotEmpty) {
// provider.selectedEmployee = value;
// provider.selectedEmployeeId =
// value!.id!;
// provider.selectedEmployeeValue =
// value!.name!;
// provider
// .crmLeadListSourceOnReferenceAPIFunction(
// context,
// widget.mode,
// provider.selectedSourceId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
// ],
// TextWidget(context, "Lead Status"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<String>(
// hint: Text(
// "Select Lead Status",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.leadStatusList
// .map(
// (leadStatus) =>
// DropdownMenuItem<String>(
// value: leadStatus,
// child: Text(
// leadStatus!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedLeadStatus,
// onChanged: (String? value) {
// if (value != null) {
// provider.selectedLeadStatus = value;
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Open/Close Status"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<String>(
// hint: Text(
// "Select Open/Close Status",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.openStatusList
// .map(
// (leadStatus) =>
// DropdownMenuItem<String>(
// value: leadStatus,
// child: Text(
// leadStatus!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedOpenStatus,
// onChanged: (String? value) {
// if (value != null) {
// provider.selectedOpenStatus = value;
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
// textControllerWidget(
// context,
// provider.mobileNumberController,
// "Mobile Number",
// "Enter Mobile Number",
// provider.onChangedMobileNum,
// TextInputType.number,
// false,
// FilteringTextInputFormatter.digitsOnly,
// ),
// textControllerWidget(
// context,
// provider.companyNameController,
// "Company Name",
// "Enter Company Name",
// provider.onChangedCompanyName,
// TextInputType.text,
// false,
// null,
// ),
//
// TextWidget(context, "Source"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Sources>(
// hint: Text(
// "Select Source",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.sourcesList
// .map(
// (slist) =>
// DropdownMenuItem<Sources>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedSource,
// onChanged: (Sources? value) {
// if (value != null) {
// if (provider.sourcesList.isNotEmpty) {
// provider.selectedSource = value;
// provider.selectedSourceId =
// value!.id!;
// provider.selectedSourceValue =
// value!.name!;
// provider
// .crmLeadListSourceOnReferenceAPIFunction(
// context,
// widget.mode,
// provider.selectedSourceId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Reference"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<References>(
// hint: Text(
// "Select Reference",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.referencesList
// .map(
// (slist) =>
// DropdownMenuItem<References>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedReference,
// onChanged: (References? value) {
// if (value != null) {
// if (provider
// .referencesList
// .isNotEmpty) {
// provider.selectedReference = value;
// provider.selectedReferenceId =
// value!.id!;
// provider.selectedReferenceValue =
// value!.name!;
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Team"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Teams>(
// hint: Text(
// "Select Team",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.teamsList
// .map(
// (slist) =>
// DropdownMenuItem<Teams>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedTeam,
// onChanged: (Teams? value) {
// if (value != null) {
// if (provider.teamsList.isNotEmpty) {
// provider.selectedTeam = value;
// provider.selectedTeamId = value!.id!;
// provider.selectedTeamValue =
// value!.name!;
// provider
// .crmLeadListSegmentOnTeamAPIFunction(
// context,
// widget.mode,
// provider.selectedTeamId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Segment"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Segments>(
// hint: Text(
// "Select Segment",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.segmentsList
// .map(
// (slist) =>
// DropdownMenuItem<Segments>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedSegment,
// onChanged: (Segments? value) {
// if (value != null) {
// if (provider.segmentsList.isNotEmpty) {
// provider.selectedSegment = value;
// provider.selectedSegmentId =
// value!.id!;
// provider.selectedSegmentValue =
// value!.name!;
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "State"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<States>(
// hint: Text(
// "Select State",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.statesList
// .map(
// (slist) =>
// DropdownMenuItem<States>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedStates,
// onChanged: (States? value) {
// if (value != null) {
// if (provider.statesList.isNotEmpty) {
// provider.selectedStates = value;
// provider.selectedStateId = value!.id!;
// provider.selectedStateValue =
// value!.name!;
// if (provider
// .districtsList
// .isNotEmpty) {
// provider.districtsList.clear();
// // provider.selectedDistricts = null;
// provider.selectedDistrictId = null;
// provider.selectedDistrictValue = "";
// }
// provider
// .crmLeadListDistrictsOnStateAPIFunction(
// context,
// widget.mode,
// provider.selectedStateId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "District"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Districts>(
// hint: Text(
// "Select District",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.districtsList
// .map(
// (slist) =>
// DropdownMenuItem<Districts>(
// value: slist,
// child: Text(
// slist.district!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedDistricts,
// onChanged: (Districts? value) {
// if (value != null) {
// if (provider.districtsList.isNotEmpty) {
// provider.selectedDistricts = value;
// provider.selectedDistrictId =
// value!.id!;
// provider.selectedDistrictValue =
// value!.district!;
// if (provider
// .subLocationsList
// .isNotEmpty) {
// provider.subLocationsList.clear();
// // provider.selectedSubLocations =
// // null;
// provider.selectedSubLocationId =
// null;
// provider.selectedSubLocationValue =
// "";
// }
// provider
// .crmLeadListSubLocOnDistrictAPIFunction(
// context,
// widget.mode,
// provider.selectedDistrictId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Sub Location"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<SubLocations>(
// hint: Text(
// "Select Sub Location",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.subLocationsList
// .map(
// (slist) => DropdownMenuItem<
// SubLocations
// >(
// value: slist,
// child: Text(
// slist.subLocality!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedSubLocations,
// onChanged: (SubLocations? value) {
// if (value != null) {
// if (provider
// .subLocationsList
// .isNotEmpty) {
// provider.selectedSubLocations = value;
// provider.selectedSubLocationId =
// value!.id!;
// provider.selectedSubLocationValue =
// value!.subLocality!;
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// InkResponse(
// onTap: () {
// // provider.crmLeadListAPIFunction(
// // context,
// // widget.mode,
// // provider.selectedEmployeeId,
// // provider.selectedLeadStatus,
// // provider.selectedOpenStatus,
// // provider.selectedSourceId,
// // provider.selectedReferenceId,
// // provider.selectedTeamId,
// // provider.selectedSegmentId,
// // provider.selectedStateId,
// // provider.selectedDistrictId,
// // provider.selectedSubLocationId,
// // );
// Navigator.pop(context);
// },
// child: Container(
// height: 45,
// alignment: Alignment.center,
// margin: EdgeInsets.symmetric(horizontal: 10),
// padding: EdgeInsets.symmetric(
// horizontal: 10,
// vertical: 5,
// ),
// decoration: BoxDecoration(
// color: AppColors.app_blue,
// borderRadius: BorderRadius.circular(15),
// ),
// child: Text(
// "Submit",
// style: TextStyle(
// fontSize: 15,
// fontFamily: "JakartaMedium",
// color: Colors.white,
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// );
// },
// ),
// );
// },
// );
// },
// );
// }
Future<void> _showFilterSheetNew(BuildContext context) {
List<bool> isSelected = List.generate(
9,
(index) => index == 0 ? true : false,
);
return showModalBottomSheet( return showModalBottomSheet(
useSafeArea: true, useSafeArea: true,
isDismissible: true, isDismissible: true,
...@@ -294,200 +966,243 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -294,200 +966,243 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
return StatefulBuilder( return StatefulBuilder(
builder: (context, setState) { builder: (context, setState) {
return SafeArea( return SafeArea(
child: Consumer<Leadlistprovider>( child: Padding(
builder: (context, provider, child) {
return Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 10,
),
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom, bottom: MediaQuery.of(context).viewInsets.bottom,
), ),
child: SingleChildScrollView( child: Consumer<Leadlistprovider>(
builder: (context, provider, child) {
int selectedIndex = isSelected.indexWhere(
(element) => element == true,
);
final headings = [
"Alphabet",
"Lead Status",
"Open/Close Status",
"Mobile Number",
"Company Name",
"Source",
"Reference",
"Team",
"Segment",
];
if(widget.mode!="executive"){
headings.add("Employee");
}
return Container(
height: MediaQuery.of(context).size.height * 0.7,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 15),
Row(
children: [ children: [
Expanded(
Padding(
padding: EdgeInsets.only(left: 15),
child: Text( child: Text(
"Filter", "Filter",
style: TextStyle( style: TextStyle(
color: AppColors.app_blue, color: AppColors.app_blue,
fontSize: 14, fontSize: 18,
fontFamily: "JakartaSemiBold",
), ),
), ),
), ),
], const SizedBox(height: 20),
// Two-Column Layout
Expanded(
child: Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: const Color(0xFFA5DAF9)),
bottom: BorderSide(
color: const Color(0xFFA5DAF9),
),
), ),
textControllerWidget(
context,
provider.sLeadIDController,
"Lead ID",
"Enter Lead ID",
provider.onChangedLeadId,
TextInputType.text,
false,
null,
), ),
if (widget.mode != "executive") ...[
TextWidget(context, "Employee"),
DropdownButtonHideUnderline(
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Left Column: Headings
Expanded( Expanded(
child: DropdownButton2<Employees>( flex: 3,
hint: Text( child: Column(
"Select Source", children: List.generate(headings.length, (jj) {
style: TextStyle(fontSize: 14),
),
items:
provider.employeesList
.map(
(slist) =>
DropdownMenuItem<Employees>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value:
provider.employeesList.contains(
provider.selectedEmployees,
)
? provider.selectedEmployees
: null,
// value: provider.selectedEmployees, return Expanded(
onChanged: (Employees? value) { child: InkResponse(
if (value != null) { onTap: () {
if (provider setState(() {
.employeesList // Reset all to false
.isNotEmpty) { isSelected = List.generate(
provider.selectedEmployees = value; headings.length,
provider.selectedEmployeeId = (index) => false,
value!.id!;
provider.selectedEmployeeValue =
value!.name!;
provider
.crmLeadListSourceOnReferenceAPIFunction(
context,
widget.mode,
provider.selectedSourceId,
); );
} // Set the clicked item to true
} isSelected[jj] = true;
});
}, },
isExpanded: true, child: Container(
buttonStyleData: ddtheme.buttonStyleData, padding: const EdgeInsets.symmetric(
iconStyleData: ddtheme.iconStyleData, vertical: 7.5,
menuItemStyleData: horizontal: 10,
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
decoration: BoxDecoration(
border: Border(
left:
isSelected[jj]
? BorderSide(
color:
AppColors
.app_blue,
width: 5.0,
)
: const BorderSide(
color:
Colors
.transparent,
),
bottom:
jj == headings.length - 1
? const BorderSide(
color:
Colors
.transparent,
)
: const BorderSide(
color: Color(
0xFFA5DAF9,
), ),
],
), ),
), ),
], color: const Color(0xFFE6F6FF),
TextWidget(context, "Lead Status"), ),
DropdownButtonHideUnderline( child: Center(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
hint: Text(
"Select Lead Status",
style: TextStyle(fontSize: 14),
),
items:
provider.leadStatusList
.map(
(leadStatus) =>
DropdownMenuItem<String>(
value: leadStatus,
child: Text( child: Text(
leadStatus!, headings[jj],
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontFamily: "JakartaRegular",
color: AppColors.semi_black,
), ),
), ),
), ),
)
.toList(),
value: provider.selectedLeadStatus,
onChanged: (String? value) {
if (value != null) {
provider.selectedLeadStatus = value;
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], );
}),
), ),
), ),
// Right Column: Dynamic Input Fields
TextWidget(context, "Open/Close Status"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded( Expanded(
child: DropdownButton2<String>( flex: 5,
hint: Text( child: SingleChildScrollView(
"Select Open/Close Status", padding: const EdgeInsets.symmetric(
style: TextStyle(fontSize: 14), horizontal: 10,
), vertical: 5,
items: ),
provider.openStatusList child: Column(
.map( crossAxisAlignment:
(leadStatus) => CrossAxisAlignment.start,
DropdownMenuItem<String>( mainAxisSize: MainAxisSize.min,
value: leadStatus, children: [
child: Text( if (selectedIndex == 0) ...[
leadStatus!, ...provider.alphabetList.map((
style: TextStyle( status,
) {
return SizedBox(
height: 35,
child: CheckboxListTile(
activeColor: AppColors.app_blue,
controlAffinity: ListTileControlAffinity.leading,
checkboxShape: CircleBorder(side: BorderSide(width:0.5)),
title: Text(
status!,
style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
value:
provider.selectedAlphabet ==
status,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedAlphabet =
status;
}
});
},
contentPadding: EdgeInsets.zero,
), ),
) );
.toList(), }).toList(),
value: provider.selectedOpenStatus, ] else if (selectedIndex == 1) ...[
onChanged: (String? value) { ...provider.leadStatusList.map((
if (value != null) { status,
provider.selectedOpenStatus = value; ) {
return SizedBox(
height: 35,
child: CheckboxListTile(
activeColor: AppColors.app_blue,
controlAffinity: ListTileControlAffinity.leading,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
title: Text(
status!,
style: const TextStyle(
fontSize: 14,
),
),
value:
provider.selectedLeadStatus ==
status,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedLeadStatus =
status;
} }
});
}, },
isExpanded: true, contentPadding: EdgeInsets.zero,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
);
}).toList(),
] else if (selectedIndex == 2) ...[
...provider.openStatusList.map((
status,
) {
return SizedBox(
height: 35,
child: CheckboxListTile(
activeColor: AppColors.app_blue,
controlAffinity: ListTileControlAffinity.leading,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
title: Text(
status!,
style: const TextStyle(
fontSize: 14,
), ),
],
), ),
value:
provider.selectedOpenStatus ==
status,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedOpenStatus =
status;
}
});
},
contentPadding: EdgeInsets.zero,
), ),
);
}).toList(),
] else if (selectedIndex == 3) ...[
textControllerWidget( textControllerWidget(
context, context,
provider.mobileNumberController, provider.mobileNumberController,
...@@ -496,8 +1211,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -496,8 +1211,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
provider.onChangedMobileNum, provider.onChangedMobileNum,
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter
.digitsOnly,
), ),
] else if (selectedIndex == 4) ...[
textControllerWidget( textControllerWidget(
context, context,
provider.companyNameController, provider.companyNameController,
...@@ -508,435 +1225,246 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -508,435 +1225,246 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
false, false,
null, null,
), ),
] else if (selectedIndex == 5) ...[
TextWidget(context, "Source"), ...provider.sourcesList.map((source) {
DropdownButtonHideUnderline( return SizedBox(
child: Row( height: 35,
children: [ child: CheckboxListTile(
Expanded( activeColor: AppColors.app_blue,
child: DropdownButton2<Sources>( controlAffinity: ListTileControlAffinity.leading,
hint: Text( checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
"Select Source", title: Text(
style: TextStyle(fontSize: 14), source.name!,
), style: const TextStyle(
items:
provider.sourcesList
.map(
(slist) =>
DropdownMenuItem<Sources>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), value:
) provider.selectedSource ==
.toList(), source,
value: provider.selectedSources, onChanged: (bool? value) {
onChanged: (Sources? value) { setState(() {
if (value != null) { if (value == true) {
if (provider.sourcesList.isNotEmpty) { provider.selectedSource =
provider.selectedSources = value; source!;
provider.selectedSourceId = provider.selectedSourceId =
value!.id!; source.id!;
provider.selectedSourceValue = provider.selectedSourceValue =
value!.name!; source.name!;
}
// Call API if needed
provider provider
.crmLeadListSourceOnReferenceAPIFunction( .crmLeadListSourceOnReferenceAPIFunction(
context, context,
widget.mode, widget.mode,
provider.selectedSourceId, provider
.selectedSourceId,
); );
} });
}
}, },
isExpanded: true, contentPadding: EdgeInsets.zero,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
), ),
), );
}).toList(),
TextWidget(context, "Reference"), ] else if (selectedIndex == 6) ...[
DropdownButtonHideUnderline( if(provider.referencesList.isEmpty)...[
child: Row( errorWidget(context, "Please Select Source First"),
children: [ ]else...[
Expanded( ...provider.referencesList.map((
child: DropdownButton2<References>( reference,
hint: Text( ) {
"Select Reference", return SizedBox(
style: TextStyle(fontSize: 14), height: 35,
), child: CheckboxListTile(
items: activeColor: AppColors.app_blue,
provider.referencesList controlAffinity: ListTileControlAffinity.leading,
.map( checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
(slist) => title: Text(
DropdownMenuItem<References>( reference.name!,
value: slist, style: const TextStyle(
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), value:
) provider.selectedReference ==
.toList(), reference,
value: provider.selectedReferences, onChanged: (bool? value) {
onChanged: (References? value) { setState(() {
if (value != null) { if (value == true) {
if (provider provider.selectedReference =
.referencesList reference;
.isNotEmpty) {
provider.selectedReferences = value;
provider.selectedReferenceId = provider.selectedReferenceId =
value!.id!; reference.id!;
provider.selectedReferenceValue = provider.selectedReferenceValue =
value!.name!; reference.name!;
}
} }
});
}, },
isExpanded: true, contentPadding: EdgeInsets.zero,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), );
], }).toList(),
), ]
), ] else if (selectedIndex == 7) ...[
...provider.teamsList.map((team) {
TextWidget(context, "Team"), return SizedBox(
DropdownButtonHideUnderline( height: 35,
child: Row( child: CheckboxListTile(
children: [ activeColor: AppColors.app_blue,
Expanded( title: Text(
child: DropdownButton2<Teams>( team.name!,
hint: Text( style: const TextStyle(
"Select Team",
style: TextStyle(fontSize: 14),
),
items:
provider.teamsList
.map(
(slist) =>
DropdownMenuItem<Teams>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), controlAffinity: ListTileControlAffinity.leading,
) checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
.toList(), value:
value: provider.selectedTeams, provider.selectedTeam == team,
onChanged: (Teams? value) { onChanged: (bool? value) {
if (value != null) { setState(() {
if (provider.teamsList.isNotEmpty) { if (value == true) {
provider.selectedTeams = value; provider.selectedTeam =
provider.selectedTeamId = value!.id!; team;
provider.selectedTeamId =
team.id!;
provider.selectedTeamValue = provider.selectedTeamValue =
value!.name!; team.name!;
}
provider provider
.crmLeadListSegmentOnTeamAPIFunction( .crmLeadListSegmentOnTeamAPIFunction(
context, context,
widget.mode, widget.mode,
provider.selectedTeamId, provider.selectedTeamId,
); );
} });
}
}, },
isExpanded: true, contentPadding: EdgeInsets.zero,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
), ),
), );
}).toList(),
TextWidget(context, "Segment"), ] else if (selectedIndex == 8) ...[
DropdownButtonHideUnderline( if(provider.segmentsList.isEmpty)...[
child: Row( errorWidget(context, "Please Select Team ID First"),
children: [ ]else...[
Expanded( ...provider.segmentsList.map((
child: DropdownButton2<Segments>( segment,
hint: Text( ) {
"Select Segment", return SizedBox(
style: TextStyle(fontSize: 14), height: 35,
), child: CheckboxListTile(
items: activeColor: AppColors.app_blue,
provider.segmentsList controlAffinity: ListTileControlAffinity.leading,
.map( checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
(slist) => title: Text(
DropdownMenuItem<Segments>( segment.name!,
value: slist, style: const TextStyle(
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), value:
) provider.selectedSegment ==
.toList(), segment,
value: provider.selectedSegments, onChanged: (bool? value) {
onChanged: (Segments? value) { setState(() {
if (value != null) { if (value == true) {
if (provider.segmentsList.isNotEmpty) { provider.selectedSegment =
provider.selectedSegments = value; segment;
provider.selectedSegmentId = provider.selectedSegmentId =
value!.id!; segment.id!;
provider.selectedSegmentValue = provider.selectedSegmentValue =
value!.name!; segment.name!;
}
} }
});
}, },
isExpanded: true, contentPadding: EdgeInsets.zero,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
TextWidget(context, "State"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<States>(
hint: Text(
"Select State",
style: TextStyle(fontSize: 14),
),
items:
provider.statesList
.map(
(slist) =>
DropdownMenuItem<States>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
), ),
),
)
.toList(),
value: provider.selectedStates,
onChanged: (States? value) {
if (value != null) {
if (provider.statesList.isNotEmpty) {
provider.selectedStates = value;
provider.selectedStateId = value!.id!;
provider.selectedStateValue =
value!.name!;
if (provider
.districtsList
.isNotEmpty) {
provider.districtsList.clear();
// provider.selectedDistricts = null;
provider.selectedDistrictId = null;
provider.selectedDistrictValue = "";
}
provider
.crmLeadListDistrictsOnStateAPIFunction(
context,
widget.mode,
provider.selectedStateId,
); );
} }).toList(),
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
], ],
), ] else if (widget.mode != "executive") ...[
), ...provider.employeesList.map((
employee,
TextWidget(context, "District"), ) {
DropdownButtonHideUnderline( return SizedBox(
child: Row( height: 35,
children: [ child: CheckboxListTile(
Expanded( activeColor: AppColors.app_blue,
child: DropdownButton2<Districts>( controlAffinity: ListTileControlAffinity.leading,
hint: Text( checkboxShape: CircleBorder(
"Select District", side: BorderSide(width:0.5 )
style: TextStyle(fontSize: 14), ),
), title: Text(
items: employee.name!,
provider.districtsList style: const TextStyle(
.map(
(slist) =>
DropdownMenuItem<Districts>(
value: slist,
child: Text(
slist.district!,
style: TextStyle(
fontSize: 14, fontSize: 14,
), ),
), ),
), value:
) provider.selectedEmployee ==
.toList(), employee,
value: provider.selectedDistricts, onChanged: (bool? value) {
onChanged: (Districts? value) { setState(() {
if (value != null) { if (value == true) {
if (provider.districtsList.isNotEmpty) { provider.selectedEmployee =
provider.selectedDistricts = value; employee;
provider.selectedDistrictId = provider.selectedEmployeeId =
value!.id!; employee.id!;
provider.selectedDistrictValue = provider.selectedEmployeeValue =
value!.district!; employee.name!;
if (provider
.subLocationsList
.isNotEmpty) {
provider.subLocationsList.clear();
// provider.selectedSubLocations =
// null;
provider.selectedSubLocationId =
null;
provider.selectedSubLocationValue =
"";
} }
provider provider
.crmLeadListSubLocOnDistrictAPIFunction( .crmLeadListSourceOnReferenceAPIFunction(
context, context,
widget.mode, widget.mode,
provider.selectedDistrictId, provider
.selectedSourceId,
); );
} });
}
}, },
isExpanded: true, contentPadding: EdgeInsets.zero,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
), ),
);
}).toList(),
],
], ],
),
),
TextWidget(context, "Sub Location"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<SubLocations>(
hint: Text(
"Select Sub Location",
style: TextStyle(fontSize: 14),
),
items:
provider.subLocationsList
.map(
(slist) => DropdownMenuItem<
SubLocations
>(
value: slist,
child: Text(
slist.subLocality!,
style: TextStyle(
fontSize: 14,
), ),
), ),
), ),
) ],
.toList(),
value: provider.selectedSubLocations,
onChanged: (SubLocations? value) {
if (value != null) {
if (provider
.subLocationsList
.isNotEmpty) {
provider.selectedSubLocations = value;
provider.selectedSubLocationId =
value!.id!;
provider.selectedSubLocationValue =
value!.subLocality!;
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
],
), ),
// Search Button
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15,
vertical: 20,
), ),
child: InkResponse(
InkResponse(
onTap: () { onTap: () {
provider.crmLeadListAPIFunction( provider.crmLeadListAPIFunction(
context, context,
widget.mode, widget.mode,
provider.selectedEmployeeId,
provider.selectedLeadStatus, provider.selectedLeadStatus,
provider.selectedOpenStatus, provider.selectedOpenStatus,
provider.selectedSourceId, provider.selectedSourceId,
provider.selectedReferenceId, provider.selectedReferenceId,
provider.selectedTeamId, provider.selectedTeamId,
provider.selectedSegmentId, provider.selectedSegmentId,
provider.selectedStateId, provider.selectedAlphabet,
provider.selectedDistrictId,
provider.selectedSubLocationId,
); );
Navigator.pop(context); Navigator.pop(context);
}, },
child: Container( child: Container(
height: 45, height: 45,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.app_blue, color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
child: Text( child: const Text(
"Submit", "Search",
style: TextStyle( style: TextStyle(
fontSize: 15, fontSize: 15,
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
...@@ -945,12 +1473,13 @@ class _LeadlistbymodeState extends State<Leadlistbymode> { ...@@ -945,12 +1473,13 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
), ),
), ),
), ),
],
), ),
],
), ),
); );
}, },
), ),
),
); );
}, },
); );
......
...@@ -18,7 +18,8 @@ import 'package:provider/provider.dart'; ...@@ -18,7 +18,8 @@ import 'package:provider/provider.dart';
import '../../Models/crmModels/GetDistrictOnStateResponse.dart'; import '../../Models/crmModels/GetDistrictOnStateResponse.dart';
import '../../Models/crmModels/GetSubLocOnDistrictResponse.dart'; import '../../Models/crmModels/GetSubLocOnDistrictResponse.dart';
import '../../Models/crmModels/LeadListViewResponse.dart' show Employees; import '../../Models/crmModels/LeadListViewResponse.dart' show Employees;
import '../../Models/crmModels/crmProspectDetailsAddLeadsResponse.dart' show LeadEmployees, Products; import '../../Models/crmModels/crmProspectDetailsAddLeadsResponse.dart'
show LeadEmployees, Products;
import '../../Models/crmModels/crmProspectDetailsEditAccountViewResponse.dart'; import '../../Models/crmModels/crmProspectDetailsEditAccountViewResponse.dart';
import '../../Notifiers/crmProvider/addProspectLeadsProvider.dart'; import '../../Notifiers/crmProvider/addProspectLeadsProvider.dart';
import '../../Notifiers/crmProvider/crmProspectDetailsProvider.dart'; import '../../Notifiers/crmProvider/crmProspectDetailsProvider.dart';
...@@ -194,7 +195,13 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -194,7 +195,13 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
return (connection == "Online") return (connection == "Online")
? Platform.isAndroid ? Platform.isAndroid
? WillPopScope( ? WillPopScope(
onWillPop: () => onBackPressed(context), onWillPop: () async {
Provider.of<Addprospectleadsprovider>(
context,
listen: false,
).resetForm();
return onBackPressed(context);
},
child: SafeArea( child: SafeArea(
top: false, top: false,
bottom: true, bottom: true,
...@@ -211,7 +218,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -211,7 +218,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
Crmeditprospectaccountprovider, Crmeditprospectaccountprovider,
Addprospectleadsprovider Addprospectleadsprovider
>( >(
builder: (context, provider, editProvider,addleadProvider, child) { builder: (context, provider, editProvider, addleadProvider, child) {
var leadDetails = provider.accountDetails; var leadDetails = provider.accountDetails;
final leadsList = provider.leadList; final leadsList = provider.leadList;
final orderList = provider.ordersList; final orderList = provider.ordersList;
...@@ -246,15 +253,19 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -246,15 +253,19 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
]; ];
var headings4 = ["Lead Age"]; var headings4 = ["Lead Age"];
var subHeadings4 = ["${leadDetails!.aage ?? "-"} days old"]; var subHeadings4 = ["${leadDetails!.aage ?? "-"} days old"];
var leadListNotEmpty = leadsList.isNotEmpty;
var contactNotEmpty = provider.contactList.isNotEmpty;
var orderNotEmpty = orderList.isNotEmpty;
var paymentsNotEmpty = paymentList.isNotEmpty;
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: AppBar( appBar: AppBar(
toolbarHeight: provider.showMoreDetails ? 25 : 40,
backgroundColor: Colors.white, backgroundColor: Colors.white,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
centerTitle: false, centerTitle: false,
elevation: 2.0, // elevation: 2.0,
title: SizedBox( title: SizedBox(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
...@@ -263,6 +274,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -263,6 +274,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
InkResponse( InkResponse(
onTap: () { onTap: () {
provider.resetAll(); provider.resetAll();
addleadProvider.resetForm();
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
...@@ -276,6 +288,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -276,6 +288,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
child: InkResponse( child: InkResponse(
onTap: () { onTap: () {
provider.resetAll(); provider.resetAll();
addleadProvider.resetForm();
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
child: Text( child: Text(
...@@ -304,13 +317,33 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -304,13 +317,33 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
], ],
), ),
), ),
bottom: PreferredSize( // bottom: PreferredSize(
preferredSize: // preferredSize:
provider.showMoreDetails // provider.showMoreDetails
? Size.fromHeight( // ? Size.fromHeight(
MediaQuery.of(context).size.height * 0.72, // MediaQuery.of(context).size.height * 0.72,
) // )
: Size.fromHeight(120), // : Size.fromHeight(120),
// child:
// ),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.vertical(
// bottom: Radius.circular(30), // Adjust the radius as needed
// ),
// ),
),
backgroundColor: AppColors.scaffold_bg_color,
body: Column(
children: [
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
),
elevation: 2,
child: Column( child: Column(
children: [ children: [
Padding( Padding(
...@@ -325,7 +358,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -325,7 +358,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
// margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10), // margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
child: Column( child: Column(
children: [ children: [
Row( Row(
...@@ -345,7 +381,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -345,7 +381,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 4, flex: 4,
child: SizedBox( child: SizedBox(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"${leadDetails.salutationName ?? "-"} ${leadDetails.name ?? "-"}", "${leadDetails.salutationName ?? "-"} ${leadDetails.name ?? "-"}",
...@@ -637,7 +674,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -637,7 +674,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
subHeadings4[j] == "Lead Age" subHeadings4[j] == "Lead Age"
? Tooltip( ? Tooltip(
triggerMode: triggerMode:
TooltipTriggerMode.tap, TooltipTriggerMode
.tap,
message: message:
"${leadDetails.createdDatetime}", "${leadDetails.createdDatetime}",
...@@ -651,7 +689,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -651,7 +689,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
0xFF818181, 0xFF818181,
), ),
decorationColor: decorationColor:
AppColors.grey_semi, AppColors
.grey_semi,
decoration: decoration:
TextDecoration TextDecoration
.underline, .underline,
...@@ -664,7 +703,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -664,7 +703,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
: subHeadings4[j], : subHeadings4[j],
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Color(0xFF818181), color: Color(
0xFF818181,
),
), ),
), ),
), ),
...@@ -718,20 +759,12 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -718,20 +759,12 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
], ],
), ),
), ),
shape: RoundedRectangleBorder( Expanded(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30), // Adjust the radius as needed
),
),
),
backgroundColor: AppColors.scaffold_bg_color,
body: Container(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( physics: AlwaysScrollableScrollPhysics(),
child: Column( child: Column(
children: [ children: [
///Lead Details ///Lead Details
if (leadsList.isNotEmpty) ...[
Container( Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 10, left: 10,
...@@ -752,14 +785,16 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -752,14 +785,16 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
if (leadListNotEmpty) ...[
Expanded( Expanded(
child: InkResponse( child: InkResponse(
onTap: () async { onTap: () async {
await addleadProvider.crmProspectDetailsAddLeadsViewAPIFunction( await addleadProvider
.crmProspectDetailsAddLeadsViewAPIFunction(
context, context,
widget.mode, widget.mode,
); );
_showAddLeadsSheet(context,widget.mode); _showAddLeadsSheet(context, widget.mode);
}, },
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
...@@ -773,8 +808,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -773,8 +808,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
], ],
],
), ),
), ),
if (leadListNotEmpty) ...[
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 250, height: 250,
...@@ -804,7 +841,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -804,7 +841,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
...@@ -851,9 +889,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -851,9 +889,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 2, flex: 2,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular( borderRadius:
8, BorderRadius.circular(8),
),
color: Color(0xFFF3FFD5), color: Color(0xFFF3FFD5),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
...@@ -875,9 +912,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -875,9 +912,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
], ],
), ),
SizedBox(height: 5,), SizedBox(height: 5),
Container( Container(
padding: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric(
vertical: 4,
),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -946,7 +985,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -946,7 +985,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
}), }),
Container( Container(
padding: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric(
vertical: 4,
),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -1069,10 +1110,42 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1069,10 +1110,42 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
}, },
), ),
), ),
] else ...[
InkResponse(
onTap: () async {
await addleadProvider
.crmProspectDetailsAddLeadsViewAPIFunction(
context,
widget.mode,
);
_showAddLeadsSheet(context, widget.mode);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"+ Add Lead",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
),
),
),
], ],
///Contact Details ///Contact Details
if (provider.contactList.isNotEmpty) ...[
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10), padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row( child: Row(
...@@ -1088,6 +1161,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1088,6 +1161,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
if (contactNotEmpty) ...[
Expanded( Expanded(
child: InkResponse( child: InkResponse(
onTap: () { onTap: () {
...@@ -1108,8 +1182,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1108,8 +1182,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
], ],
],
), ),
), ),
if (contactNotEmpty) ...[
ListView.builder( ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
...@@ -1181,9 +1257,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1181,9 +1257,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
.name ?? .name ??
"-", "-",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily:
"JakartaMedium",
fontSize: 14, fontSize: 14,
color: AppColors.semi_black, color:
AppColors.semi_black,
), ),
), ),
), ),
...@@ -1193,18 +1271,24 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1193,18 +1271,24 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
textAlign: TextAlign.right, textAlign: TextAlign.right,
"${provider.contactList[lp].mob1 ?? "-"}", "${provider.contactList[lp].mob1 ?? "-"}",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily:
"JakartaMedium",
fontSize: 14, fontSize: 14,
color: AppColors.semi_black, color:
AppColors.semi_black,
), ),
), ),
), ),
], ],
), ),
Text( Text(
provider.contactList[lp].email == "" provider.contactList[lp].email ==
""
? "-" ? "-"
: provider.contactList[lp].email ?? "-", : provider
.contactList[lp]
.email ??
"-",
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
fontSize: 14, fontSize: 14,
...@@ -1221,12 +1305,47 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1221,12 +1305,47 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
); );
}, },
), ),
] else ...[
InkResponse(
onTap: () {
_showAddContactSheet(
context,
provider.accountDetails.id!,
);
},
child: Container(
height: 50,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Center(
child: Text(
textAlign: TextAlign.right,
"+ Add Contact",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
),
),
),
], ],
///Order Details ///Order Details
if (orderList.isNotEmpty) ...[ if (orderNotEmpty) ...[
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10), padding: EdgeInsets.only(
left: 10,
right: 10,
top: 10,
),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -1240,7 +1359,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1240,7 +1359,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
], ],
), ),
), ),
...@@ -1274,7 +1392,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1274,7 +1392,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
...@@ -1321,9 +1440,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1321,9 +1440,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 2, flex: 2,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular( borderRadius:
8, BorderRadius.circular(8),
),
color: Color(0xFFF3FFD5), color: Color(0xFFF3FFD5),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
...@@ -1346,7 +1464,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1346,7 +1464,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
], ],
), ),
Container( Container(
padding: EdgeInsets.symmetric(vertical: 3), padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -1415,7 +1535,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1415,7 +1535,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
}), }),
Container( Container(
padding: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric(
vertical: 4,
),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -1442,12 +1564,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1442,12 +1564,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
...List.generate(1, (j) { ...List.generate(1, (j) {
final textheads = [ final textheads = ["View Details"];
"View Details", final textSubheads = ["View"];
];
final textSubheads = [
"View",
];
return Container( return Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 7, vertical: 7,
...@@ -1511,7 +1629,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1511,7 +1629,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
], ],
), ),
); );
...@@ -1525,9 +1642,13 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1525,9 +1642,13 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
], ],
///Payment Details ///Payment Details
if (paymentList.isNotEmpty) ...[ if (paymentsNotEmpty) ...[
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10), padding: EdgeInsets.only(
left: 10,
right: 10,
top: 10,
),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -1541,7 +1662,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1541,7 +1662,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
], ],
), ),
), ),
...@@ -1576,7 +1696,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1576,7 +1696,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
...@@ -1623,9 +1744,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1623,9 +1744,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 2, flex: 2,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular( borderRadius:
8, BorderRadius.circular(8),
),
color: Color(0xFFF3FFD5), color: Color(0xFFF3FFD5),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
...@@ -1647,9 +1767,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1647,9 +1767,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
], ],
), ),
SizedBox(height: 5,), SizedBox(height: 5),
Container( Container(
padding: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric(
vertical: 4,
),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -1723,7 +1845,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1723,7 +1845,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
}), }),
Container( Container(
padding: EdgeInsets.symmetric(vertical: 3), padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -1750,12 +1874,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1750,12 +1874,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
...List.generate(1, (j) { ...List.generate(1, (j) {
final textheads = [ final textheads = ["Action"];
"Action", final textSubheads = ["View Details"];
];
final textSubheads = [
"View Details",
];
return Container( return Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 3, vertical: 3,
...@@ -1789,7 +1909,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1789,7 +1909,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
pageTitleName: pageTitleName:
"Payment Details", "Payment Details",
paymentId: paymentId:
paymentList[index].id, paymentList[index]
.id,
), ),
), ),
); );
...@@ -1819,7 +1940,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1819,7 +1940,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
], ],
), ),
); );
...@@ -1836,6 +1956,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1836,6 +1956,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
), ),
), ),
), ),
],
), ),
); );
}, },
...@@ -1888,10 +2009,17 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1888,10 +2009,17 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.nameController, provider.nameController,
"Name", "Name",
"Enter Name", "Enter Name",
provider.onChangeName, (p0) {
TextInputType.number, provider.crmCheckFields(
context,
provider.nameController.text,
"name",
);
provider.onChangeName(p0);
},
TextInputType.text,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.nameError), errorWidget(context, provider.nameError),
textControllerWidget( textControllerWidget(
...@@ -1900,9 +2028,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1900,9 +2028,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
"Designation", "Designation",
"Enter Designation", "Enter Designation",
provider.onChangeDesignation, provider.onChangeDesignation,
TextInputType.number, TextInputType.text,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.designationError), errorWidget(context, provider.designationError),
textControllerWidget( textControllerWidget(
...@@ -1910,10 +2038,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1910,10 +2038,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.mobileNumberController, provider.mobileNumberController,
"Mobile Number", "Mobile Number",
"Enter Mobile Number", "Enter Mobile Number",
provider.onChangeMobile, (p0) {
provider.crmCheckFields(
context,
provider.mobileNumberController.text,
"mob1",
);
provider.onChangeMobile(p0);
},
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10,
), ),
errorWidget(context, provider.mobileNumError), errorWidget(context, provider.mobileNumError),
textControllerWidget( textControllerWidget(
...@@ -1921,10 +2060,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1921,10 +2060,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.alternativeMobileController, provider.alternativeMobileController,
"Alternative Mobile Number", "Alternative Mobile Number",
"Enter Alternative Mobile Number", "Enter Alternative Mobile Number",
provider.onChangeAltMobile, (p0) {
provider.crmCheckFields(
context,
provider.alternativeMobileController.text,
"mob2",
);
provider.onChangeAltMobile(p0);
},
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10,
), ),
errorWidget(context, provider.altMobError), errorWidget(context, provider.altMobError),
textControllerWidget( textControllerWidget(
...@@ -1944,9 +2094,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -1944,9 +2094,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
"Email ID", "Email ID",
"Enter Email ID", "Enter Email ID",
provider.onChangeEmailId, provider.onChangeEmailId,
TextInputType.number, TextInputType.emailAddress,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.emailError), errorWidget(context, provider.emailError),
InkWell( InkWell(
...@@ -2048,10 +2198,17 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2048,10 +2198,17 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.editNameController, provider.editNameController,
"Name", "Name",
"Enter Name", "Enter Name",
provider.onChangeEditName, (p0) {
TextInputType.number, provider.crmCheckFields(
context,
provider.editNameController.text,
"name",
);
provider.onChangeEditName(p0);
},
TextInputType.text,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.editNameError), errorWidget(context, provider.editNameError),
textControllerWidget( textControllerWidget(
...@@ -2060,9 +2217,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2060,9 +2217,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
"Designation", "Designation",
"Enter Designation", "Enter Designation",
provider.onChangeEditDesignation, provider.onChangeEditDesignation,
TextInputType.number, TextInputType.text,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.editDesignationError), errorWidget(context, provider.editDesignationError),
textControllerWidget( textControllerWidget(
...@@ -2070,10 +2227,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2070,10 +2227,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.editMobileNumberController, provider.editMobileNumberController,
"Mobile Number", "Mobile Number",
"Enter Mobile Number", "Enter Mobile Number",
provider.onChangeEditMobile, (p0) {
provider.crmCheckFields(
context,
provider.editMobileNumberController.text,
"mob1",
);
provider.onChangeEditMobile(p0);
},
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10,
), ),
errorWidget(context, provider.editMobileNumError), errorWidget(context, provider.editMobileNumError),
...@@ -2082,10 +2250,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2082,10 +2250,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.editAlternativeMobileController, provider.editAlternativeMobileController,
"Alternative Mobile Number", "Alternative Mobile Number",
"Enter Alternative Mobile Number", "Enter Alternative Mobile Number",
provider.onChangeEditAltMobile, (p0) {
provider.crmCheckFields(
context,
provider.editAlternativeMobileController.text,
"mob2",
);
provider.onChangeEditAltMobile(p0);
},
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10,
), ),
errorWidget(context, provider.editAltMobError), errorWidget(context, provider.editAltMobError),
textControllerWidget( textControllerWidget(
...@@ -2106,9 +2285,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2106,9 +2285,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
"Email ID", "Email ID",
"Enter Email ID", "Enter Email ID",
provider.onChangeEditEmailId, provider.onChangeEditEmailId,
TextInputType.number, TextInputType.emailAddress,
false, false,
FilteringTextInputFormatter.digitsOnly, null,
), ),
errorWidget(context, provider.editEmailError), errorWidget(context, provider.editEmailError),
...@@ -2882,10 +3061,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2882,10 +3061,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
); );
} }
Future<void> _showAddLeadsSheet( Future<void> _showAddLeadsSheet(BuildContext context, mode) {
BuildContext context,
mode,
) {
return showModalBottomSheet( return showModalBottomSheet(
useSafeArea: true, useSafeArea: true,
isDismissible: true, isDismissible: true,
...@@ -2898,11 +3074,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2898,11 +3074,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
return StatefulBuilder( return StatefulBuilder(
builder: (context, setState) { builder: (context, setState) {
return SafeArea( return SafeArea(
child:Consumer2< child: Consumer2<
crmProspectDetailsProvider, crmProspectDetailsProvider,
Addprospectleadsprovider Addprospectleadsprovider
>( >(
builder: (context, provider,addleadProvider, child) { builder: (context, provider, addleadProvider, child) {
final price = final price =
double.tryParse( double.tryParse(
addleadProvider.addLeadProductPriceController.text, addleadProvider.addLeadProductPriceController.text,
...@@ -2915,7 +3091,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2915,7 +3091,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
0; 0;
addleadProvider.addLeadProductTotalPriceController.text = addleadProvider.addLeadProductTotalPriceController.text =
(price * qty).toString(); (price * qty).toString();
void updatedAmountfun(value){ void updatedAmountfun(value) {
final price = final price =
double.tryParse( double.tryParse(
addleadProvider.addLeadProductPriceController.text, addleadProvider.addLeadProductPriceController.text,
...@@ -2929,6 +3105,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2929,6 +3105,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
addleadProvider.addLeadProductTotalPriceController.text = addleadProvider.addLeadProductTotalPriceController.text =
(price * qty).toString(); (price * qty).toString();
} }
return Container( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
bottom: 15, bottom: 15,
...@@ -2952,90 +3129,108 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -2952,90 +3129,108 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
), ),
), ),
SizedBox(height: 10,), SizedBox(height: 10),
TextWidget(context, "Employee"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<LeadEmployees>(
hint: Text(
"Select Source",
style: TextStyle(fontSize: 14),
),
items:
addleadProvider.employeeList
.map(
(slist) => DropdownMenuItem<LeadEmployees>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(fontSize: 14),
),
),
)
.toList(),
value:
addleadProvider.employeeList.contains(
addleadProvider.selectedEmployee,
)
? addleadProvider.selectedEmployee
: null,
// value: provider.selectedEmployees,
onChanged: (LeadEmployees? value) {
if (value != null) {
if (addleadProvider.employeeList.isNotEmpty) {
addleadProvider.selectedEmployee = value;
addleadProvider.selectedEmployeeId = value!.id!;
addleadProvider.selectedEmployeeValue =
value!.name!;
}
}
},
isExpanded: true,
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController: addleadProvider.searchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller: addleadProvider.searchController,
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name?.toLowerCase().contains(
searchValue.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
addleadProvider.searchController.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
],
),
),
// TextWidget(context, "Employee"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<LeadEmployees>(
// hint: Text(
// "Select Source",
// style: TextStyle(fontSize: 14),
// ),
// items:
// addleadProvider.employeeList
// .map(
// (slist) => DropdownMenuItem<
// LeadEmployees
// >(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value:
// addleadProvider.employeeList.contains(
// addleadProvider.selectedEmployee,
// )
// ? addleadProvider.selectedEmployee
// : null,
//
// // value: provider.selectedEmployees,
// onChanged: (LeadEmployees? value) {
// if (value != null) {
// if (addleadProvider
// .employeeList
// .isNotEmpty) {
// addleadProvider.selectedEmployee =
// value;
// addleadProvider.selectedEmployeeId =
// value!.id!;
// addleadProvider
// .selectedEmployeeValue =
// value!.name!;
// }
// }
// },
// isExpanded: true,
// dropdownSearchData: DropdownSearchData(
// searchInnerWidgetHeight: 50,
// searchController:
// addleadProvider.searchController,
// searchInnerWidget: Padding(
// padding: const EdgeInsets.all(8),
// child: TextFormField(
// controller:
// addleadProvider.searchController,
// decoration: InputDecoration(
// isDense: true,
// contentPadding:
// const EdgeInsets.symmetric(
// horizontal: 10,
// vertical: 8,
// ),
// hintText: 'Search account...',
// border: OutlineInputBorder(
// borderRadius:
// BorderRadius.circular(8),
// ),
// ),
// ),
// ),
// searchMatchFn: (item, searchValue) {
// return item.value?.name
// ?.toLowerCase()
// .contains(
// searchValue.toLowerCase(),
// ) ??
// false;
// },
// ),
// onMenuStateChange: (isOpen) {
// if (!isOpen) {
// addleadProvider.searchController
// .clear();
// }
// },
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
TextWidget(context, "Product"), TextWidget(context, "Product"),
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
child: Row( child: Row(
...@@ -3051,9 +3246,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -3051,9 +3246,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
items: items:
addleadProvider.leadProductsList addleadProvider.leadProductsList
.map( .map(
(ord) => DropdownMenuItem< (
Products ord,
>( ) => DropdownMenuItem<Products>(
value: ord, value: ord,
child: Text( child: Text(
"(Product Name: ${ord.name})", "(Product Name: ${ord.name})",
...@@ -3067,14 +3262,14 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -3067,14 +3262,14 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
) )
.toList(), .toList(),
value: value:
addleadProvider.selectedProductIds != addleadProvider.selectedProducts !=
null null
? addleadProvider.leadProductsList ? addleadProvider.leadProductsList
.firstWhere( .firstWhere(
(ord) => (ord) =>
ord.id == ord.id ==
addleadProvider addleadProvider
.selectedProductIds, .selectedProductsID,
orElse: orElse:
() => () =>
addleadProvider addleadProvider
...@@ -3082,19 +3277,30 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -3082,19 +3277,30 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
) )
: null, : null,
onChanged: (Products? value) { onChanged: (Products? value) {
// if (value != null) { if (value != null) {
// addleadProvider // addleadProvider
// .updateSelectedProductIds( // .updateSelectedProductIds(
// j, // j,
// value, // value,
// ); // // );
// addleadProvider.selectedProductIds[j] = // addleadProvider.selectedProductIds[j] =
// value.id?.toString() ?? ''; // value.id?.toString() ?? '';
// addleadProvider.updateTotalAmount(j); // addleadProvider.updateTotalAmount(j);
// } addleadProvider.selectedProducts =
value;
addleadProvider.selectedProductsName =
value.id;
addleadProvider.selectedProductsID =
value.name;
addleadProvider
.crmSelectedProductDetailsApiFunction(
context,
value.id.toString(),
);
}
}, },
buttonStyleData: buttonStyleData: ddtheme.buttonStyleData,
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: menuItemStyleData:
ddtheme.menuItemStyleData, ddtheme.menuItemStyleData,
...@@ -3111,28 +3317,41 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -3111,28 +3317,41 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
addleadProvider.addLeadProductPriceController, addleadProvider.addLeadProductPriceController,
"Product Price", "Product Price",
"Enter Product Price", "Enter Product Price",
(value) => (p0) {
updatedAmountfun(value), updatedAmountfun(p0);
addleadProvider.onChnageProductPrice(p0);
},
TextInputType.number, TextInputType.number,
false, false,
null, null,
), ),
const SizedBox(height: 10), if (addleadProvider.priceError != null) ...[
errorWidget(context, addleadProvider.priceError),
],
textControllerWidget( textControllerWidget(
context, context,
addleadProvider.addLeadProductQtyController, addleadProvider.addLeadProductQtyController,
"Quantity", "Quantity",
"Enter Quantity", "Enter Quantity",
(value) => (p0) {
updatedAmountfun(value), updatedAmountfun(p0);
addleadProvider.onChnageProductQty(p0);
},
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
), ),
errorWidget( if (addleadProvider.qtyError != null) ...[
context, errorWidget(context, addleadProvider.qtyError),
"Note: Submit Quantity as Zero (0) to delete Product", ],
),
// Text(
// "Note: Submit Quantity as Zero (0) to delete Product",
// style: TextStyle(
// color: AppColors.app_blue,
// fontSize: 12,
// ),
// ),
const SizedBox(height: 10), const SizedBox(height: 10),
Row( Row(
children: [ children: [
...@@ -3140,12 +3359,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -3140,12 +3359,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 2, flex: 2,
child: textControllerWidget( child: textControllerWidget(
context, context,
addleadProvider.addLeadProductTotalPriceController, addleadProvider
.addLeadProductTotalPriceController,
"Amount", "Amount",
"Total Amount", "Total Amount",
(p0) { (p0) {},
},
TextInputType.number, TextInputType.number,
true, true,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
...@@ -3166,11 +3384,14 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -3166,11 +3384,14 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
items: items:
addleadProvider.statusList addleadProvider.statusList
.map( .map(
(slist) => DropdownMenuItem<String>( (slist) =>
DropdownMenuItem<String>(
value: slist, value: slist,
child: Text( child: Text(
slist, slist,
style: TextStyle(fontSize: 14), style: TextStyle(
fontSize: 14,
),
), ),
), ),
) )
...@@ -3178,34 +3399,51 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -3178,34 +3399,51 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
value: addleadProvider.selectedStatus, value: addleadProvider.selectedStatus,
onChanged: (String? value) { onChanged: (String? value) {
if (value != null) { if (value != null) {
if (addleadProvider.statusList.isNotEmpty) { if (addleadProvider
addleadProvider.selectedStatus = value; .statusList
.isNotEmpty) {
addleadProvider.selectedStatus =
value;
} }
} }
}, },
isExpanded: true, isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData, iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.dropdownStyleData, ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
], ],
), ),
), ),
if (addleadProvider.statusError != null) ...[
errorWidget(context, addleadProvider.statusError),
],
InkResponse( InkResponse(
onTap: onTap:
addleadProvider.submitLoading addleadProvider.submitLoading
? null ? null
: () { : () {
// addleadProvider
// .crmProspectDetailsAddLeadsSubmitAPIFunction(
// context,
// widget.mode,
// provider.accountDetails.id,
// addleadProvider.selectedEmployeeId,
// {},
// addleadProvider.selectedStatus,
// );
addleadProvider addleadProvider
.crmProspectDetailsAddLeadsSubmitAPIFunction( .crmProspectDetailsAddLeadsSubmitAPIFunctionNew(
context, context,
widget.mode, mode,
widget.leadId,
provider.accountDetails.id, provider.accountDetails.id,
addleadProvider.selectedEmployeeId, addleadProvider.selectedProductsID,
{},
addleadProvider.selectedStatus, addleadProvider.selectedStatus,
); );
}, },
...@@ -3253,8 +3491,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -3253,8 +3491,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
); );
}, },
).whenComplete(() { ).whenComplete(() {
Provider.of<crmProspectDetailsProvider>(context).crmProspectDetailsAPIFunction(context, widget.leadId); Provider.of<crmProspectDetailsProvider>(
context,
).crmProspectDetailsAPIFunction(context, widget.leadId);
Provider.of<Addprospectleadsprovider>(context).resetForm(); Provider.of<Addprospectleadsprovider>(context).resetForm();
},); });
} }
} }
...@@ -323,6 +323,11 @@ class _ProspectListByModeState extends State<ProspectListByMode> { ...@@ -323,6 +323,11 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
} }
Future<void> _showFilterSheet(BuildContext context) { Future<void> _showFilterSheet(BuildContext context) {
List<bool> isSelected = List.generate(
2,
(index) => index == 0 ? true : false,
);
return showModalBottomSheet( return showModalBottomSheet(
useSafeArea: true, useSafeArea: true,
isDismissible: true, isDismissible: true,
...@@ -335,160 +340,227 @@ class _ProspectListByModeState extends State<ProspectListByMode> { ...@@ -335,160 +340,227 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
return StatefulBuilder( return StatefulBuilder(
builder: (context, setState) { builder: (context, setState) {
return SafeArea( return SafeArea(
child: Consumer<ProspectListProvider>( child: Padding(
builder: (context, provider, child) {
return Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 10,
),
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom, bottom: MediaQuery.of(context).viewInsets.bottom,
), ),
child: Consumer<ProspectListProvider>(
builder: (context, provider, child) {
int selectedIndex = isSelected.indexWhere(
(element) => element == true,
);
List<String> headings = [
"Mobile Number",
"Company Name",
];
if(widget.mode!="executive"){
headings.add("Employee");
}
return Container(
child: SingleChildScrollView( height: MediaQuery.of(context).size.height*0.3,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox(height: 15),
Row( Padding(
children: [ padding: EdgeInsets.only(left: 15),
Expanded(
child: Text( child: Text(
"Filter", "Filter",
style: TextStyle( style: TextStyle(
color: AppColors.app_blue, color: AppColors.app_blue,
fontSize: 14, fontSize: 18,
fontFamily: "JakartaSemiBold",
), ),
), ),
), ),
], const SizedBox(height: 20),
),
if (widget.mode != "executive") ...[
TextWidget(context, "Employee"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded( Expanded(
child: DropdownButton2<Employees>( flex:4,
hint: Text( child: Container(
"Select Source", decoration: BoxDecoration(
style: TextStyle(fontSize: 14), border: Border(
), top: BorderSide(color: const Color(0xFFA5DAF9)),
items: bottom: BorderSide(
provider.employeesList color: const Color(0xFFA5DAF9),
.map(
(slist) =>
DropdownMenuItem<Employees>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
), ),
), ),
), ),
) child: Row(
.toList(), crossAxisAlignment: CrossAxisAlignment.start,
value: children: [
provider.employeesList.contains( Expanded(
provider.selectedEmployees, flex: 3,
) child: Column(
? provider.selectedEmployees children: List.generate(headings.length, (jj) {
: null,
// value: provider.selectedEmployees, return Expanded(
onChanged: (Employees? value) { child: InkResponse(
if (value != null) { onTap: () {
if (provider setState(() {
.employeesList // Reset all to false
.isNotEmpty) { isSelected = List.generate(
provider.selectedEmployees = value; headings.length,
provider.selectedEmployeeId = (index) => false,
value!.id!; );
provider.selectedEmployeeValue = // Set the clicked item to true
value!.name!; isSelected[jj] = true;
} });
}
}, },
isExpanded: true, child: Container(
dropdownSearchData: DropdownSearchData( padding: const EdgeInsets.symmetric(
searchInnerWidgetHeight: 50, vertical: 7.5,
searchController:
provider.searchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider.searchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
vertical: 8,
), ),
hintText: 'Search account...', decoration: BoxDecoration(
border: OutlineInputBorder( border: Border(
borderRadius: left:
BorderRadius.circular(8), isSelected[jj]
? BorderSide(
color:
AppColors
.app_blue,
width: 5.0,
)
: const BorderSide(
color:
Colors
.transparent,
),
bottom:
jj == headings.length - 1
? const BorderSide(
color:
Colors
.transparent,
)
: const BorderSide(
color: Color(
0xFFA5DAF9,
), ),
), ),
), ),
color: const Color(0xFFE6F6FF),
), ),
searchMatchFn: (item, searchValue) { child: Center(
return item.value?.name child: Text(
?.toLowerCase() headings[jj],
.contains( textAlign: TextAlign.center,
searchValue.toLowerCase(), style: TextStyle(
) ?? fontSize: 14,
false; fontFamily: "JakartaRegular",
}, color: AppColors.semi_black,
), ),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.searchController.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
), ),
), ),
],
), ),
), ),
], );
}),
),
),
Expanded(
flex: 5,
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
if (selectedIndex == 0) ...[
SizedBox(height: 10,),
textControllerWidget( textControllerWidget(
context, context,
provider.mobileNumberController, provider.mobileNumberController,
"Mobile Number", "",
"Enter Mobile Number", "Enter Mobile Number",
provider.onChangedMobileNum, provider.onChangedMobileNum,
TextInputType.number, TextInputType.number,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter
.digitsOnly,
), ),
] else if (selectedIndex == 1) ...[
SizedBox(height: 10,),
textControllerWidget( textControllerWidget(
context, context,
provider.companyNameController, provider.companyNameController,
"Company Name", "",
"Enter Company Name", "Enter Company Name",
provider.onChangedCompanyName, provider.onChangedCompanyName,
TextInputType.text, TextInputType.text,
false, false,
null, null,
), ),
]else if (widget.mode != "executive") ...[
...provider.employeesList.map((
employee,
) {
return SizedBox(
height: 35,
child: CheckboxListTile(
activeColor: AppColors.app_blue,
controlAffinity: ListTileControlAffinity.leading,
checkboxShape: CircleBorder(
side: BorderSide(width:0.5 )
),
title: Text(
employee.name!,
style: const TextStyle(
fontSize: 14,
),
),
value:
provider.selectedEmployees ==
employee,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedEmployees =
employee;
provider.selectedEmployeeId =
employee.id!;
provider.selectedEmployeeValue =
employee.name!;
}
provider
.crmProspectListAPIFunction(
context,
widget.mode,
provider
.selectedEmployeeId,
);
});
},
contentPadding: EdgeInsets.zero,
),
);
}).toList(),
]
InkResponse( ],
),
),
),
],
),
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15,
vertical: 20,
),
child: InkResponse(
onTap: () { onTap: () {
provider.crmProspectListAPIFunction( provider.crmProspectListAPIFunction(
context, context,
...@@ -500,17 +572,12 @@ class _ProspectListByModeState extends State<ProspectListByMode> { ...@@ -500,17 +572,12 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
child: Container( child: Container(
height: 45, height: 45,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.app_blue, color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
child: Text( child: const Text(
"Submit", "Search",
style: TextStyle( style: TextStyle(
fontSize: 15, fontSize: 15,
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
...@@ -519,16 +586,227 @@ class _ProspectListByModeState extends State<ProspectListByMode> { ...@@ -519,16 +586,227 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
), ),
), ),
), ),
],
), ),
],
), ),
); );
}, },
), ),
),
); );
}, },
); );
}, },
); );
} }
// Future<void> _showFilterSheet11(BuildContext context) {
// return showModalBottomSheet(
// useSafeArea: true,
// isDismissible: true,
// isScrollControlled: true,
// showDragHandle: true,
// backgroundColor: Colors.white,
// enableDrag: true,
// context: context,
// builder: (context) {
// return StatefulBuilder(
// builder: (context, setState) {
// return SafeArea(
// child: Consumer<ProspectListProvider>(
// builder: (context, provider, child) {
// return Container(
// margin: EdgeInsets.only(
// bottom: 15,
// left: 15,
// right: 15,
// top: 10,
// ),
// padding: EdgeInsets.only(
// bottom: MediaQuery.of(context).viewInsets.bottom + 50,
// ),
//
// child: SingleChildScrollView(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// SizedBox(height: 15),
// Row(
// children: [
// Expanded(
// child: Text(
// "Filter",
// style: TextStyle(
// color: AppColors.app_blue,
// fontSize: 14,
// ),
// ),
// ),
// ],
// ),
//
// if (widget.mode != "executive") ...[
// TextWidget(context, "Employee"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Employees>(
// hint: Text(
// "Select Source",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.employeesList
// .map(
// (slist) =>
// DropdownMenuItem<Employees>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value:
// provider.employeesList.contains(
// provider.selectedEmployees,
// )
// ? provider.selectedEmployees
// : null,
//
// // value: provider.selectedEmployees,
// onChanged: (Employees? value) {
// if (value != null) {
// if (provider
// .employeesList
// .isNotEmpty) {
// provider.selectedEmployees = value;
// provider.selectedEmployeeId =
// value!.id!;
// provider.selectedEmployeeValue =
// value!.name!;
// }
// }
// },
// isExpanded: true,
// dropdownSearchData: DropdownSearchData(
// searchInnerWidgetHeight: 50,
// searchController:
// provider.searchController,
// searchInnerWidget: Padding(
// padding: const EdgeInsets.all(8),
// child: TextFormField(
// controller:
// provider.searchController,
// decoration: InputDecoration(
// isDense: true,
// contentPadding:
// const EdgeInsets.symmetric(
// horizontal: 10,
// vertical: 8,
// ),
// hintText: 'Search account...',
// border: OutlineInputBorder(
// borderRadius:
// BorderRadius.circular(8),
// ),
// ),
// ),
// ),
// searchMatchFn: (item, searchValue) {
// return item.value?.name
// ?.toLowerCase()
// .contains(
// searchValue.toLowerCase(),
// ) ??
// false;
// },
// ),
// onMenuStateChange: (isOpen) {
// if (!isOpen) {
// provider.searchController.clear();
// }
// },
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
// ],
//
// textControllerWidget(
// context,
// provider.mobileNumberController,
// "Mobile Number",
// "Enter Mobile Number",
// provider.onChangedMobileNum,
// TextInputType.number,
// false,
// FilteringTextInputFormatter.digitsOnly,
// ),
// textControllerWidget(
// context,
// provider.companyNameController,
// "Company Name",
// "Enter Company Name",
// provider.onChangedCompanyName,
// TextInputType.text,
// false,
// null,
// ),
//
// InkResponse(
// onTap: () {
// provider.crmProspectListAPIFunction(
// context,
// widget.mode,
// provider.selectedEmployeeId,
// );
// Navigator.pop(context);
// },
// child: Container(
// height: 45,
// alignment: Alignment.center,
// margin: EdgeInsets.symmetric(horizontal: 10),
// padding: EdgeInsets.symmetric(
// horizontal: 10,
// vertical: 5,
// ),
// decoration: BoxDecoration(
// color: AppColors.app_blue,
// borderRadius: BorderRadius.circular(15),
// ),
// child: Text(
// "Submit",
// style: TextStyle(
// fontSize: 15,
// fontFamily: "JakartaMedium",
// color: Colors.white,
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// );
// },
// ),
// );
// },
// );
// },
// );
// }
} }
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:generp/Models/crmModels/crmNewLeadsProspectsViewResponse.dart';
import 'package:generp/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart';
import 'package:provider/provider.dart';
import '../../Utils/app_colors.dart';
import '../../Utils/commonServices.dart';
import '../../Utils/commonWidgets.dart';
import '../../Utils/dropdownTheme.dart';
class Addleadproductscreen extends StatefulWidget {
const Addleadproductscreen({
super.key,
});
@override
State<Addleadproductscreen> createState() =>
_AddleadproductscreenState();
}
class _AddleadproductscreenState
extends State<Addleadproductscreen> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
Dropdowntheme ddtheme = Dropdowntheme();
@override
void initState() {
// TODO: implement initState
super.initState();
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<Addnewleadsandprospectsprovider>(
context,
listen: false,
);
// provider.addEditInitializeForm(context);
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_connectivity.disposeStream();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
case ConnectivityResult.mobile:
connection = 'Online';
break;
case ConnectivityResult.wifi:
connection = 'Online';
break;
case ConnectivityResult.none:
default:
connection = 'Offline';
}
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Addnewleadsandprospectsprovider>(
builder: (context, provider, child) {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbarNew(context, "Generate Quotation", 0xFFFFFFFF),
backgroundColor: AppColors.scaffold_bg_color,
body: SingleChildScrollView(
child: Column(
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
margin: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Product"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Products>(
isExpanded: true,
hint: const Text(
'Select Product',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.productsList
.map(
(
ord,
) => DropdownMenuItem<Products>(
value: ord,
child: Text(
"(Product Name: ${ord.name})",
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
// provider.selectedOrderIds[index] != null?
// provider
// .orderList
// .firstWhere(
// (product) =>
// product
// .orderId ==
// provider
// .selectedOrderIds[index],
// )
value:
provider.selectedProducts != null
? provider.productsList.firstWhere(
(element) =>
element.id ==
provider
.selectedProductsId,
)
: null,
onChanged: (Products? value) {
if (value != null) {
provider.selectedProducts = value;
provider.selectedProductsId =
value!.id!;
provider.selectedProductsValue =
value.name;
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
],
),
),
const SizedBox(height: 10),
textControllerWidget(
context,
provider.addProductPriceController,
"Product Price",
"Enter Product Price",
provider.addEditUpdateTotalAmount,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
const SizedBox(height: 10),
textControllerWidget(
context,
provider.addQuantityController,
"Quantity",
"Enter Quantity",
provider.addEditUpdateTotalAmount,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
const SizedBox(height: 10),
Row(
children: [
Expanded(
flex: 2,
child: textControllerWidget(
context,
provider.addTotalAmountController,
"Amount",
"Total Amount",
(_) {},
TextInputType.number,
true,
FilteringTextInputFormatter.digitsOnly,
),
),
],
),
// IconButton(
// icon: const Icon(Icons.delete),
// onPressed: provider.editProductPriceControllers.length > 1
// ? () => provider.editRemoveRow(j)
// : null,
// ),
],
),
),
],
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
floatingActionButton: InkWell(
onTap: () {
if (provider.selectedProducts != null) {
provider.productRows.add({
"product_id": provider.selectedProductsId!,
"price": provider.addProductPriceController.text,
"qty": provider.addQuantityController.text,
"net_price": provider.addTotalAmountController.text,
});
}
},
child: Container(
alignment: Alignment.center,
height: 45,
decoration: BoxDecoration(
color: AppColors.app_blue, //1487C9
borderRadius: BorderRadius.circular(14.0),
),
margin: EdgeInsets.symmetric(horizontal: 10),
child: Center(
child: Text(
"Submit",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
),
),
);
},
);
}
}
import 'dart:io';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:generp/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart';
import 'package:generp/Utils/app_colors.dart';
import 'package:generp/Utils/commonWidgets.dart';
import 'package:generp/Utils/dropdownTheme.dart';
import 'package:provider/provider.dart';
import '../../Models/crmModels/GetDistrictOnStateResponse.dart';
import '../../Models/crmModels/GetSegmentOnTeamResponse.dart';
import '../../Models/crmModels/GetSourceOnReferenceResponse.dart';
import '../../Models/crmModels/GetSubLocOnDistrictResponse.dart';
import '../../Models/crmModels/crmNewLeadsProspectsViewResponse.dart';
import 'addLeadProductScreen.dart';
class Addleadsprospectsscreen extends StatefulWidget {
const Addleadsprospectsscreen({super.key});
@override
State<Addleadsprospectsscreen> createState() =>
_AddleadsprospectsscreenState();
}
class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
Dropdowntheme ddtheme = Dropdowntheme();
int _currentStep = 0;
final _formKey = GlobalKey<FormState>();
// Controllers to store form data
final _nameController = TextEditingController();
final _emailController = TextEditingController();
final _addressController = TextEditingController();
@override
void dispose() {
_nameController.dispose();
_emailController.dispose();
_addressController.dispose();
super.dispose();
}
void _nextStep() {
if (_formKey.currentState!.validate()) {
if (_currentStep < 2) {
setState(() {
_currentStep += 1;
});
} else {
// Submit form data
_submitForm();
}
}
}
void _previousStep() {
if (_currentStep > 0) {
setState(() {
_currentStep -= 1;
});
}
}
void _submitForm() {
// Simulate form submission (e.g., print data or send to server)
print('Form Submitted:');
print('Name: ${_nameController.text}');
print('Email: ${_emailController.text}');
print('Address: ${_addressController.text}');
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Form submitted successfully!')),
);
}
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
final provider = Provider.of<Addnewleadsandprospectsprovider>(
context,
listen: false,
);
provider.crmAddLeadsView(context, "team");
});
}
@override
Widget build(BuildContext context) {
return Consumer<Addnewleadsandprospectsprovider>(
builder: (context, provider, child) {
return WillPopScope(
onWillPop: () async {
provider.resetForm();
return true;
},
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar2New(
context,
"Add Leads and Prospect",
provider.resetForm,
const SizedBox(width: 0),
0xFFFFFFFF,
),
//
body: Form(
key: _formKey,
child: Stepper(
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 0),
type: StepperType.horizontal,
currentStep: _currentStep,
onStepContinue: _nextStep,
onStepCancel: _previousStep,
onStepTapped: (value) {
print(value);
setState(() {
_currentStep = value;
});
},
connectorColor: WidgetStatePropertyAll(AppColors.app_blue),
stepIconBuilder: (stepIndex, stepState) {
return CircleAvatar(
radius: 12,
backgroundColor: stepIndex <= _currentStep
? AppColors.app_blue
: Colors.grey[300],
);
},
steps: [
Step(
label: Text("Step 1",style: TextStyle(
fontSize: 12
)),
title: const Text(''),
isActive: _currentStep >= 0,
content: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Salutation"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
isExpanded: true,
hint: const Row(
children: [
Expanded(
child: Text(
'Select Salutation',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
],
),
items:
provider.salutationList
.map(
(slist) =>
DropdownMenuItem<String>(
value: slist,
child: Text(
slist ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectedSalutation,
onChanged: (value) {
if (value != null) {
provider.selectedSalutation = value;
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.salutationError),
textControllerWidget(
context,
provider.companyNameController,
"Company Name",
"Enter Company Name",
provider.onChangeCompanyName,
TextInputType.name,
false,
null,
),
errorWidget(context, provider.companynameError),
textControllerWidget(
context,
provider.contactPersonNameController,
"Contact Person Name",
"Enter Name",
provider.onChangeContactPersonName,
TextInputType.name,
false,
null,
),
errorWidget(context, provider.nameError),
textControllerWidget(
context,
provider.mobileController,
"Mobile Number",
"Enter Mobile Number",
provider.onChangemobile,
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.mobileError),
textControllerWidget(
context,
provider.customerMailIdController,
"Customer Email Id",
"Enter Email Id",
provider.onChangemailId,
TextInputType.emailAddress,
false,
null,
),
errorWidget(context, provider.mailIdError),
textControllerWidget(
context,
provider.designationController,
"Customer Designation",
"Enter Designation",
provider.onChangedesignation,
TextInputType.text,
false,
null,
),
errorWidget(context, provider.designationError),
],
),
),
),
Step(
label: Text("Step 2",style: TextStyle(
fontSize: 12
)),
title: const Text(''),
isActive: _currentStep >= 1,
content: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
textControllerWidget(
context,
provider.alternateMobileController,
"Alternate Mobile Number",
"Enter Alternate Mobile Number",
provider.onChangeAlternatemobile,
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.AlternatemobileError),
textControllerWidget(
context,
provider.telephoneController,
"Telephone Number",
"Enter Telephone Number",
provider.onChangeTelephone,
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.TelephoneError),
TextWidget(context, "Source"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Sources>(
hint: Text(
"Select Source",
style: TextStyle(fontSize: 14),
),
items:
provider.sourcesList
.map(
(slist) =>
DropdownMenuItem<Sources>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedSources,
onChanged: (Sources? value) {
if (value != null) {
if (provider.sourcesList.isNotEmpty) {
provider.selectedSources = value;
provider.selectedSourcesId =
value!.id!;
provider.selectedSourcesValue =
value!.name!;
provider
.crmLeadListSourceOnReferenceAPIFunction(
context,
"",
provider.selectedSourcesId,
);
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.sourceError),
TextWidget(context, "Reference"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<References>(
hint: Text(
"Select Reference",
style: TextStyle(fontSize: 14),
),
items:
provider.referencesList
.map(
(slist) =>
DropdownMenuItem<References>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedReference,
onChanged: (References? value) {
if (value != null) {
if (provider
.referencesList
.isNotEmpty) {
provider.selectedReference = value;
provider.selectedReferenceId =
value!.id!;
provider.selectedReferenceValue =
value!.name!;
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.referenceError),
TextWidget(context, "Team"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Teams>(
hint: Text(
"Select Team",
style: TextStyle(fontSize: 14),
),
items:
provider.teamsList
.map(
(slist) =>
DropdownMenuItem<Teams>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedTeams,
onChanged: (Teams? value) {
if (value != null) {
if (provider.teamsList.isNotEmpty) {
provider.selectedTeams = value;
provider.selectedTeamsId = value!.id!;
provider.selectedTeamsValue =
value!.name!;
provider
.crmLeadListSegmentOnTeamAPIFunction(
context,
"",
provider.selectedTeamsId,
);
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.teamsError),
TextWidget(context, "Segment"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Segments>(
hint: Text(
"Select Segment",
style: TextStyle(fontSize: 14),
),
items:
provider.segmentsList
.map(
(slist) =>
DropdownMenuItem<Segments>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedSegment,
onChanged: (Segments? value) {
if (value != null) {
if (provider.segmentsList.isNotEmpty) {
provider.selectedSegment = value;
provider.selectedSegmentId =
value!.id!;
provider.selectedSegmentValue =
value!.name!;
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.segmentsError),
],
),
),
),
Step(
label: Text("Step 3",style: TextStyle(
fontSize: 12
),),
title: const Text(''),
isActive: _currentStep >= 2,
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Addleadproductscreen(
),
settings: RouteSettings(
name: 'Generatequotationaddeditproduct',
),
),
);
if (res != null) {
print("result ${res}");
}
},
child: Container(
margin: const EdgeInsets.symmetric(
vertical: 10,
),
height: 45,
width: MediaQuery
.of(context)
.size
.width,
decoration: BoxDecoration(
color: const Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
),
),
child: Center(
child: Text(
"+ Add Product",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
),
),
),
),
],
),
),
SizedBox(height: 10),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "State"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<States>(
hint: Text(
"Select State",
style: TextStyle(fontSize: 14),
),
items:
provider.statesList
.map(
(slist) =>
DropdownMenuItem<States>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedStates,
onChanged: (States? value) {
if (value != null) {
if (provider
.statesList
.isNotEmpty) {
provider.selectedStates = value;
provider.selectedStatesId =
value!.id!;
provider.selectedStatesValue =
value!.name!;
if (provider
.districtsList
.isNotEmpty) {
provider.districtsList.clear();
// provider.selectedDistricts = null;
provider.selectedDistrictId =
null;
provider.selectedDistrictValue =
"";
}
provider
.crmLeadListDistrictsOnStateAPIFunction(
context,
"",
provider.selectedStatesId,
);
}
}
},
isExpanded: true,
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.statesError),
TextWidget(context, "District"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Districts>(
hint: Text(
"Select District",
style: TextStyle(fontSize: 14),
),
items:
provider.districtsList
.map(
(slist) =>
DropdownMenuItem<
Districts
>(
value: slist,
child: Text(
slist.district!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedDistricts,
onChanged: (Districts? value) {
if (value != null) {
if (provider
.districtsList
.isNotEmpty) {
provider.selectedDistricts =
value;
provider.selectedDistrictId =
value!.id!;
provider.selectedDistrictValue =
value!.district!;
if (provider
.subLocationsList
.isNotEmpty) {
provider.subLocationsList
.clear();
// provider.selectedSubLocations =
// null;
provider.selectedSubLocationId =
null;
provider
.selectedSubLocationValue =
"";
}
provider
.crmLeadListSubLocOnDistrictAPIFunction(
context,
"",
provider.selectedDistrictId,
);
}
}
},
isExpanded: true,
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.districtsError),
TextWidget(context, "Sub Location"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<SubLocations>(
hint: Text(
"Select Sub Location",
style: TextStyle(fontSize: 14),
),
items:
provider.subLocationsList
.map(
(slist) =>
DropdownMenuItem<
SubLocations
>(
value: slist,
child: Text(
slist.subLocality!,
style: TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedSubLocations,
onChanged: (SubLocations? value) {
if (value != null) {
if (provider
.subLocationsList
.isNotEmpty) {
provider.selectedSubLocations =
value;
provider.selectedSubLocationId =
value!.id!;
provider
.selectedSubLocationValue =
value!.subLocality!;
}
}
},
isExpanded: true,
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.subLocError),
TextWidget(context, "Lead Status"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
isExpanded: true,
hint: const Row(
children: [
Expanded(
child: Text(
'Select Lead Status',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
],
),
items:
<String>['Cold', 'Hot', 'Warm']
.map(
(value) =>
DropdownMenuItem<String>(
value: value,
child: Text(
value ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectedLeadStatus,
onChanged: (String? newValue) {
setState(() {
provider.selectedLeadStatus = newValue!;
});
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.leadStatusError),
textControllerWidget(
context,
provider.addressController,
"Address",
"Enter Address ",
provider.onChangeaddress,
TextInputType.streetAddress,
false,
null,
),
errorWidget(context, provider.addressError),
],
),
),
],
),
),
],
controlsBuilder: (context, details) {
// return Row(
// children: [
// ElevatedButton(
// onPressed: () {
// setState(() {
// if (_currentStep == 0) {
// _currentStep = 1;
// } else if (_currentStep == 1) {
// _currentStep = 2;
// } else {
// _currentStep = 0;
// }
// });
// details.onStepContinue;
// },
// child: Text(_currentStep == 2 ? 'Submit' : 'Next'),
// ),
// const SizedBox(width: 10),
// if (_currentStep > 0)
// TextButton(
// onPressed: () {
// setState(() {
// if (_currentStep == 2) {
// _currentStep = 1;
// } else if (_currentStep == 1) {
// _currentStep = 0;
// } else {
// _currentStep = 2;
// }
// });
// details.onStepCancel;
// },
// child: const Text('Back'),
// ),
// ],
// );
return Column(
children: [
if (_currentStep == 2) ...[
InkResponse(
onTap: () {
setState(() {
if (_currentStep == 0) {
_currentStep = 1;
} else if (_currentStep == 1) {
_currentStep = 2;
} else {
_currentStep = 0;
}
});
provider.crmAddNewLeadsAndProspectsAPIFunction(
context,
"",
provider.selectedEmployeesId,
provider.selectedSalutation,
provider.selectedDistrictId,
provider.selectedStatesId,
provider.selectedSegmentId,
provider.selectedSourcesId,
provider.selectedReferenceId,
provider.selectedReferenceId,
provider.selectedSubLocationId,
provider.selectedLeadStatus,
{});
details.onStepContinue;
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child: Text(
"Submit",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
] else
...[
InkResponse(
onTap: () {
setState(() {
if (_currentStep == 0) {
_currentStep = 1;
} else if (_currentStep == 1) {
_currentStep = 2;
} else {
_currentStep = 0;
}
});
details.onStepContinue;
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child: Text(
"Proceed to Next Step",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
],
if (_currentStep > 0) ...[
TextButton(
onPressed: () {
setState(() {
if (_currentStep == 2) {
_currentStep = 1;
} else if (_currentStep == 1) {
_currentStep = 0;
} else {
_currentStep = 2;
}
});
details.onStepCancel;
},
child: Text(
'Back',
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
),
),
),
],
],
);
},
),
),
),
),
);
},
);
}
}
...@@ -5,6 +5,8 @@ import 'package:dotted_line/dotted_line.dart'; ...@@ -5,6 +5,8 @@ import 'package:dotted_line/dotted_line.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:generp/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart';
import 'package:generp/screens/crm/addLeadsProspectsScreen.dart';
import 'package:generp/screens/crm/appointmentCalendar.dart'; import 'package:generp/screens/crm/appointmentCalendar.dart';
import 'package:generp/screens/crm/pendingTasksDetails.dart'; import 'package:generp/screens/crm/pendingTasksDetails.dart';
import 'package:generp/screens/crm/pendingTasksList.dart'; import 'package:generp/screens/crm/pendingTasksList.dart';
...@@ -490,7 +492,8 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> { ...@@ -490,7 +492,8 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
), ),
), ),
Text( Text(
"Product and \nservice orders", "Leads",
// "Product and \nservice orders",
style: TextStyle( style: TextStyle(
color: AppColors.grey_semi, color: AppColors.grey_semi,
fontSize: 12, fontSize: 12,
...@@ -556,7 +559,8 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> { ...@@ -556,7 +559,8 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
), ),
), ),
Text( Text(
"Assigned agents, \nperformance", "Accounts",
// "Assigned agents, \nperformance",
style: TextStyle( style: TextStyle(
color: AppColors.grey_semi, color: AppColors.grey_semi,
fontSize: 12, fontSize: 12,
...@@ -589,10 +593,9 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> { ...@@ -589,10 +593,9 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => Appointmentcalendar(), builder: (context) => Appointmentcalendar(),
settings: RouteSettings( settings: RouteSettings(
name: 'Appointmentcalendar' name: 'Appointmentcalendar',
) ),
), ),
); );
}, },
...@@ -625,7 +628,8 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> { ...@@ -625,7 +628,8 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
), ),
), ),
Text( Text(
"Records,\nLedger", "Calendar",
// "Records,\nLedger",
style: TextStyle( style: TextStyle(
color: AppColors.grey_semi, color: AppColors.grey_semi,
fontSize: 12, fontSize: 12,
...@@ -788,9 +792,11 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> { ...@@ -788,9 +792,11 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: AppColors.semi_black.withAlpha(10) color: AppColors.semi_black.withAlpha(
10,
), ),
borderRadius: BorderRadius.circular(16) ),
borderRadius: BorderRadius.circular(16),
), ),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
...@@ -1028,13 +1034,21 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> { ...@@ -1028,13 +1034,21 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
floatingActionButtonLocation: floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat, FloatingActionButtonLocation.centerFloat,
floatingActionButton: InkResponse( floatingActionButton: InkResponse(
onTap: () { onTap: () async {
if (provider.accessPages // if (provider.accessPages
.where((page) => [8, 9].contains(page.id)) // .where((page) => [8, 9].contains(page.id))
.toList() // .toList()
.contains([8, 9])) { // .contains([8, 9])) {
_showPaymentOptionsSheet(context); await Navigator.push(
} context,
MaterialPageRoute(
builder: (context) => Addleadsprospectsscreen(),
settings: RouteSettings(
name: 'Addleadsprospectsscreen'
)
),
);
// }
}, },
child: Container( child: Container(
height: 45, height: 45,
......
...@@ -623,6 +623,7 @@ class _FollowupupdatescreenState extends State<Followupupdatescreen> { ...@@ -623,6 +623,7 @@ class _FollowupupdatescreenState extends State<Followupupdatescreen> {
if (provider.selectNextAppointmentType == if (provider.selectNextAppointmentType ==
"Visit") ...[ "Visit") ...[
CheckboxListTile( CheckboxListTile(
activeColor: AppColors.app_blue,
checkboxShape: CircleBorder(), checkboxShape: CircleBorder(),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
value: provider.checked, value: provider.checked,
......
...@@ -53,7 +53,6 @@ class _GeneratequotationaddeditproductState ...@@ -53,7 +53,6 @@ class _GeneratequotationaddeditproductState
context, context,
listen: false, listen: false,
); );
provider.crmLeadDetailsGenerateQuoteViewAPIFunction( provider.crmLeadDetailsGenerateQuoteViewAPIFunction(
context, context,
widget.leadId, widget.leadId,
...@@ -135,7 +134,7 @@ class _GeneratequotationaddeditproductState ...@@ -135,7 +134,7 @@ class _GeneratequotationaddeditproductState
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: DropdownButton2<LeadProducts>( child: DropdownButton2<Products>(
isExpanded: true, isExpanded: true,
hint: const Text( hint: const Text(
'Select Product', 'Select Product',
...@@ -143,14 +142,14 @@ class _GeneratequotationaddeditproductState ...@@ -143,14 +142,14 @@ class _GeneratequotationaddeditproductState
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
items: items:
provider.leadProductsList provider.productsList
.map( .map(
( (
ord, ord,
) => DropdownMenuItem<LeadProducts>( ) => DropdownMenuItem<Products>(
value: ord, value: ord,
child: Text( child: Text(
"(Product Name: ${ord.productName})", "(Product Name: ${ord.name})",
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
...@@ -169,22 +168,24 @@ class _GeneratequotationaddeditproductState ...@@ -169,22 +168,24 @@ class _GeneratequotationaddeditproductState
// provider // provider
// .selectedOrderIds[index], // .selectedOrderIds[index],
// ) // )
value: value:
provider.selectedLeadProducts != null provider.selectedProducts != null
? provider.leadProductsList.firstWhere( ? provider.productsList.firstWhere(
(element) => (element) =>
element.id == element.id ==
provider provider
.selectedAddEditLeadProductId, .selectedAddEditProductId,
) )
: null, : null,
onChanged: (LeadProducts? value) { onChanged: (Products? value) {
if (value != null) { if (value != null) {
provider.selectedLeadProducts = value; provider.selectedProducts = value;
provider.selectedAddEditLeadProductId = provider.selectedAddEditProductId =
value!.productId!; value!.id!;
provider.selectedAddEditLeadProductName = provider.selectedAddEditProductName =
value.productName; value.name;
provider.crmSelectedProductDetailsApiFunction(context, value.id.toString());
} }
}, },
buttonStyleData: ddtheme.buttonStyleData, buttonStyleData: ddtheme.buttonStyleData,
......
...@@ -558,16 +558,56 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> { ...@@ -558,16 +558,56 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
textControllerWidget( TextWidget(context, "Taxes"),
context, DropdownButtonHideUnderline(
provider.taxesController, child: Row(
"Taxes", children: [
"Enter Taxes", Expanded(
provider.onChangetaxes, child: DropdownButton2<String>(
TextInputType.text, isExpanded: true,
false, hint: const Row(
null, children: [
Expanded(
child: Text(
'Select Lead Status',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
],
),
items:
<String>["Extra","Including"]
.map(
(value) =>
DropdownMenuItem<String>(
value: value,
child: Text(
value ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectedTaxes,
onChanged: (String? newValue) {
setState(() {
provider.selectedTaxes = newValue!;
});
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
],
),
), ),
errorWidget(context, provider.taxesError), errorWidget(context, provider.taxesError),
......
...@@ -55,3 +55,4 @@ export 'package:generp/Notifiers/crmProvider/crmEditProspectAccountProvider.dart ...@@ -55,3 +55,4 @@ export 'package:generp/Notifiers/crmProvider/crmEditProspectAccountProvider.dart
export 'package:generp/Notifiers/crmProvider/addProspectLeadsProvider.dart'; export 'package:generp/Notifiers/crmProvider/addProspectLeadsProvider.dart';
export 'package:generp/Notifiers/crmProvider/followUpUpdateProvider.dart'; export 'package:generp/Notifiers/crmProvider/followUpUpdateProvider.dart';
export 'package:generp/Notifiers/crmProvider/appointmentCalendarProvider.dart'; export 'package:generp/Notifiers/crmProvider/appointmentCalendarProvider.dart';
export 'package:generp/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart';
...@@ -63,9 +63,6 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> { ...@@ -63,9 +63,6 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
"", "",
"", "",
"", "",
"",
"",
"",
); );
} else { } else {
provider.crmLeadListAPIFunction( provider.crmLeadListAPIFunction(
...@@ -78,9 +75,6 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> { ...@@ -78,9 +75,6 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
"", "",
"", "",
"", "",
"",
"",
"",
); );
} }
}); });
...@@ -434,9 +428,9 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> { ...@@ -434,9 +428,9 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
.toList(), .toList(),
value: value:
provider.employeesList.contains( provider.employeesList.contains(
provider.selectedEmployees, provider.selectedEmployee,
) )
? provider.selectedEmployees ? provider.selectedEmployee
: null, : null,
// value: provider.selectedEmployees, // value: provider.selectedEmployees,
...@@ -445,7 +439,7 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> { ...@@ -445,7 +439,7 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
if (provider if (provider
.employeesList .employeesList
.isNotEmpty) { .isNotEmpty) {
provider.selectedEmployees = value; provider.selectedEmployee = value;
provider.selectedEmployeeId = provider.selectedEmployeeId =
value!.id!; value!.id!;
provider.selectedEmployeeValue = provider.selectedEmployeeValue =
...@@ -605,11 +599,11 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> { ...@@ -605,11 +599,11 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
), ),
) )
.toList(), .toList(),
value: provider.selectedSources, value: provider.selectedSource,
onChanged: (Sources? value) { onChanged: (Sources? value) {
if (value != null) { if (value != null) {
if (provider.sourcesList.isNotEmpty) { if (provider.sourcesList.isNotEmpty) {
provider.selectedSources = value; provider.selectedSource = value;
provider.selectedSourceId = provider.selectedSourceId =
value!.id!; value!.id!;
provider.selectedSourceValue = provider.selectedSourceValue =
...@@ -661,13 +655,13 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> { ...@@ -661,13 +655,13 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
), ),
) )
.toList(), .toList(),
value: provider.selectedReferences, value: provider.selectedReference,
onChanged: (References? value) { onChanged: (References? value) {
if (value != null) { if (value != null) {
if (provider if (provider
.referencesList .referencesList
.isNotEmpty) { .isNotEmpty) {
provider.selectedReferences = value; provider.selectedReference = value;
provider.selectedReferenceId = provider.selectedReferenceId =
value!.id!; value!.id!;
provider.selectedReferenceValue = provider.selectedReferenceValue =
...@@ -713,11 +707,11 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> { ...@@ -713,11 +707,11 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
), ),
) )
.toList(), .toList(),
value: provider.selectedTeams, value: provider.selectedTeam,
onChanged: (Teams? value) { onChanged: (Teams? value) {
if (value != null) { if (value != null) {
if (provider.teamsList.isNotEmpty) { if (provider.teamsList.isNotEmpty) {
provider.selectedTeams = value; provider.selectedTeam = value;
provider.selectedTeamId = value!.id!; provider.selectedTeamId = value!.id!;
provider.selectedTeamValue = provider.selectedTeamValue =
value!.name!; value!.name!;
...@@ -768,11 +762,11 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> { ...@@ -768,11 +762,11 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
), ),
) )
.toList(), .toList(),
value: provider.selectedSegments, value: provider.selectedSegment,
onChanged: (Segments? value) { onChanged: (Segments? value) {
if (value != null) { if (value != null) {
if (provider.segmentsList.isNotEmpty) { if (provider.segmentsList.isNotEmpty) {
provider.selectedSegments = value; provider.selectedSegment = value;
provider.selectedSegmentId = provider.selectedSegmentId =
value!.id!; value!.id!;
provider.selectedSegmentValue = provider.selectedSegmentValue =
...@@ -981,16 +975,13 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> { ...@@ -981,16 +975,13 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
provider.crmLeadListAPIFunction( provider.crmLeadListAPIFunction(
context, context,
widget.mode, widget.mode,
provider.selectedEmployeeId,
provider.selectedLeadStatus, provider.selectedLeadStatus,
provider.selectedOpenStatus, provider.selectedOpenStatus,
provider.selectedSourceId, provider.selectedSourceId,
provider.selectedReferenceId, provider.selectedReferenceId,
provider.selectedTeamId, provider.selectedTeamId,
provider.selectedSegmentId, provider.selectedSegmentId,
provider.selectedStateId, ""
provider.selectedDistrictId,
provider.selectedSubLocationId,
); );
Navigator.pop(context); Navigator.pop(context);
}, },
......
...@@ -16,6 +16,7 @@ import 'package:generp/Models/crmModels/LeadListViewResponse.dart'; ...@@ -16,6 +16,7 @@ import 'package:generp/Models/crmModels/LeadListViewResponse.dart';
import 'package:generp/Models/crmModels/ProspectListViewResponse.dart'; import 'package:generp/Models/crmModels/ProspectListViewResponse.dart';
import 'package:generp/Models/crmModels/SubmitLeadListFilterResponse.dart'; import 'package:generp/Models/crmModels/SubmitLeadListFilterResponse.dart';
import 'package:generp/Models/crmModels/crmLeadDetailsGenerateQuotationSubmitResponse.dart'; import 'package:generp/Models/crmModels/crmLeadDetailsGenerateQuotationSubmitResponse.dart';
import 'package:generp/Models/crmModels/crmNewLeadsProspectsViewResponse.dart';
import 'package:generp/Models/crmModels/crmProspectDetailsAddFollowUpAppointmentResponse.dart'; import 'package:generp/Models/crmModels/crmProspectDetailsAddFollowUpAppointmentResponse.dart';
import 'package:generp/Models/crmModels/crmProspectDetailsAddLeadsResponse.dart'; import 'package:generp/Models/crmModels/crmProspectDetailsAddLeadsResponse.dart';
import 'package:generp/Models/crmModels/crmProspectDetailsResponse.dart'; import 'package:generp/Models/crmModels/crmProspectDetailsResponse.dart';
...@@ -65,6 +66,7 @@ import '../Models/crmModels/appointmentCalendarResponse.dart'; ...@@ -65,6 +66,7 @@ import '../Models/crmModels/appointmentCalendarResponse.dart';
import '../Models/crmModels/crmAddFollowUpResponse.dart'; import '../Models/crmModels/crmAddFollowUpResponse.dart';
import '../Models/crmModels/crmDashboardResponse.dart'; import '../Models/crmModels/crmDashboardResponse.dart';
import '../Models/crmModels/crmPendingTasksResponse.dart'; import '../Models/crmModels/crmPendingTasksResponse.dart';
import '../Models/crmModels/crmSelectedProductDetailsResponse.dart';
import '../Models/crmModels/crmUniversalSearchResponse.dart'; import '../Models/crmModels/crmUniversalSearchResponse.dart';
import '../Models/financeModels/paymentRequestionBankDetailsResponse.dart'; import '../Models/financeModels/paymentRequestionBankDetailsResponse.dart';
import '../Models/commonModels/commonAccountLedgerFilterResponse.dart'; import '../Models/commonModels/commonAccountLedgerFilterResponse.dart';
...@@ -3306,7 +3308,7 @@ class ApiCalling { ...@@ -3306,7 +3308,7 @@ class ApiCalling {
final res = await post(data, crmAccessiblePagesUrl, {}); final res = await post(data, crmAccessiblePagesUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("Accessibl pages: ${res.body}");
return AccessiblePagesResponse.fromJson(jsonDecode(res.body)); return AccessiblePagesResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3318,6 +3320,97 @@ class ApiCalling { ...@@ -3318,6 +3320,97 @@ class ApiCalling {
} }
} }
static Future<crmNewLeadsProspectsViewResponse?> crmNewLeadsProspectsViewAPI(
empId,
session,
mode,
) async {
try {
Map<String, String> data = {
'emp_id': (empId).toString(),
'session_id': (session).toString(),
'mode': (mode).toString(),
};
final res = await post(data, crmNewProspectLeadViewUrl, {});
if (res != null) {
print(data);
debugPrint("New Leads prospecrs ${res.body}");
return crmNewLeadsProspectsViewResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint('hello bev=bug $e ');
return null;
}
}
static Future<CommonResponse?> crmNewLeadsProspectsSubmitAPI(
session_id,
emp_id,
mode,
acc_manager_id,
salutation_name,
name,
contact_name,
district,
state,
address,
segment,
source,
reference,
team,
sub_locality,
mob1,
mob2,
tel,
email,
designation,
lead_status,
products,
) async {
try {
Map<String, String> data = {
'session_id': session_id.toString(),
'emp_id': emp_id.toString(),
'mode': mode.toString(),
'acc_manager_id': acc_manager_id.toString(),
'salutation_name': salutation_name.toString(),
'name': name.toString(),
'contact_name': contact_name.toString(),
'district': district.toString(),
'state': state.toString(),
'address': address.toString(),
'segment': segment.toString(),
'source': source.toString(),
'reference': reference.toString(),
'team': team.toString(),
'sub_locality': sub_locality.toString(),
'mob1': mob1.toString(),
'mob2': mob2.toString(),
'tel': tel.toString(),
'email': email.toString(),
'designation': designation.toString(),
'lead_status': lead_status.toString(),
'products': products.toString(),
};
final res = await post(data, crmNewProspectLeadSubmitUrl, {});
if (res != null) {
print(data);
debugPrint("Submit New Leads ${res.body}");
return CommonResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint('hello bev=bug $e ');
return null;
}
}
static Future<crmDashboardResponse?> crmDashboardAPI( static Future<crmDashboardResponse?> crmDashboardAPI(
empId, empId,
session, session,
...@@ -3332,7 +3425,7 @@ class ApiCalling { ...@@ -3332,7 +3425,7 @@ class ApiCalling {
final res = await post(data, crmDashboardUrl, {}); final res = await post(data, crmDashboardUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
print(jsonDecode(res.body)['nearby_leads']); print("CRM Dash ${jsonDecode(res.body)}");
return crmDashboardResponse.fromJson(jsonDecode(res.body)); return crmDashboardResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3356,7 +3449,7 @@ class ApiCalling { ...@@ -3356,7 +3449,7 @@ class ApiCalling {
final res = await post(data, crmPendingTasksListUrl, {}); final res = await post(data, crmPendingTasksListUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("PEnding Tasks ${res.body}");
return crmPendingTasksResponse.fromJson(jsonDecode(res.body)); return crmPendingTasksResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3382,7 +3475,7 @@ class ApiCalling { ...@@ -3382,7 +3475,7 @@ class ApiCalling {
final res = await post(data, crmUnivesalSearchUrl, {}); final res = await post(data, crmUnivesalSearchUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("Universal Search ${res.body}");
return crmUniversalSearchResponse.fromJson(jsonDecode(res.body)); return crmUniversalSearchResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3408,7 +3501,7 @@ class ApiCalling { ...@@ -3408,7 +3501,7 @@ class ApiCalling {
final res = await post(data, crmLeadListViewUrl, {}); final res = await post(data, crmLeadListViewUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint("ListView2: ${res.body}"); debugPrint("Lead ListView2: ${res.body}");
return LeadListViewResponse.fromJson(jsonDecode(res.body)); return LeadListViewResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3424,8 +3517,6 @@ class ApiCalling { ...@@ -3424,8 +3517,6 @@ class ApiCalling {
empId, empId,
session, session,
mode, mode,
teamemployee,
slead_id,
status, status,
open_status, open_status,
mob, mob,
...@@ -3434,17 +3525,13 @@ class ApiCalling { ...@@ -3434,17 +3525,13 @@ class ApiCalling {
reference, reference,
team, team,
segment, segment,
state, alphabet,
district,
sub_loc,
) async { ) async {
try { try {
Map<String, String> data = { Map<String, String> data = {
'emp_id': (empId).toString(), 'emp_id': (empId).toString(),
'session_id': (session).toString(), 'session_id': (session).toString(),
'mode': (mode).toString(), 'mode': (mode).toString(),
'teamemployee': teamemployee.toString(),
'slead_id': slead_id.toString(),
'status': status.toString(), 'status': status.toString(),
'open_status': open_status.toString(), 'open_status': open_status.toString(),
'mob': mob.toString(), 'mob': mob.toString(),
...@@ -3453,13 +3540,11 @@ class ApiCalling { ...@@ -3453,13 +3540,11 @@ class ApiCalling {
'reference': reference.toString(), 'reference': reference.toString(),
'team': team.toString(), 'team': team.toString(),
'segment': segment.toString(), 'segment': segment.toString(),
'state': state.toString(), 'alphabet': alphabet.toString(),
'district': district.toString(),
'sub_loc': sub_loc.toString(),
}; };
final res = await post(data, crmLeadListFilterSubmitUrl, {}); final res = await post(data, crmLeadListFilterSubmitUrl, {});
if (res != null) { if (res != null) {
print("Filter:${data}"); print("Lead Filter:${data}");
debugPrint(res.body); debugPrint(res.body);
return SubmitLeadListFilterResponse.fromJson(jsonDecode(res.body)); return SubmitLeadListFilterResponse.fromJson(jsonDecode(res.body));
} else { } else {
...@@ -3486,7 +3571,7 @@ class ApiCalling { ...@@ -3486,7 +3571,7 @@ class ApiCalling {
final res = await post(data, crmLeadListSourceOnReferenceUrl, {}); final res = await post(data, crmLeadListSourceOnReferenceUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("Source on Ref ${res.body}");
return GetSourceOnReferenceResponse.fromJson(jsonDecode(res.body)); return GetSourceOnReferenceResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3512,7 +3597,7 @@ class ApiCalling { ...@@ -3512,7 +3597,7 @@ class ApiCalling {
final res = await post(data, crmLeadListSegmentOnTeamUrl, {}); final res = await post(data, crmLeadListSegmentOnTeamUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); print("Segemnt on team ${res.body}");
return GetSegmentOnTeamResponse.fromJson(jsonDecode(res.body)); return GetSegmentOnTeamResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3538,7 +3623,7 @@ class ApiCalling { ...@@ -3538,7 +3623,7 @@ class ApiCalling {
final res = await post(data, crmLeadListDistrictOnStateUrl, {}); final res = await post(data, crmLeadListDistrictOnStateUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("districts on State ${res.body}");
return GetDistrictOnStateResponse.fromJson(jsonDecode(res.body)); return GetDistrictOnStateResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3564,7 +3649,7 @@ class ApiCalling { ...@@ -3564,7 +3649,7 @@ class ApiCalling {
final res = await post(data, crmLeadListSubLocOnDistrictUrl, {}); final res = await post(data, crmLeadListSubLocOnDistrictUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("Sub loc on Dist ${res.body}");
return GetSubLocOnDistrictResponse.fromJson(jsonDecode(res.body)); return GetSubLocOnDistrictResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3590,7 +3675,7 @@ class ApiCalling { ...@@ -3590,7 +3675,7 @@ class ApiCalling {
final res = await post(data, crmLeadListContactPopUpUrl, {}); final res = await post(data, crmLeadListContactPopUpUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("Lead list contact ${res.body}");
return LeadListContactPopUpResponse.fromJson(jsonDecode(res.body)); return LeadListContactPopUpResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3618,7 +3703,7 @@ class ApiCalling { ...@@ -3618,7 +3703,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsUrl, {}); final res = await post(data, crmLeadDetailsUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("Lead Deatails ${res.body}");
return LeadDetailsResponse.fromJson(jsonDecode(res.body)); return LeadDetailsResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3731,7 +3816,7 @@ class ApiCalling { ...@@ -3731,7 +3816,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditAccountViewUrl, {}); final res = await post(data, crmLeadDetailsEditAccountViewUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("crmLeadDetailsEditAccountViewAPI: ${res.body}");
return crmLeadDetailsEditAccountViewResponse.fromJson( return crmLeadDetailsEditAccountViewResponse.fromJson(
jsonDecode(res.body), jsonDecode(res.body),
); );
...@@ -3765,7 +3850,7 @@ class ApiCalling { ...@@ -3765,7 +3850,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditAccountUrl, {}); final res = await post(data, crmLeadDetailsEditAccountUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("crmLeadDetailsEditAccountSubmitAPI ${res.body}");
return CommonResponse.fromJson(jsonDecode(res.body)); return CommonResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3788,7 +3873,7 @@ class ApiCalling { ...@@ -3788,7 +3873,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditProductsViewUrl, {}); final res = await post(data, crmLeadDetailsEditProductsViewUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
print(jsonDecode(res.body)['lead_products']); print("crmLeadDetailsEditProductsViewAPI: ${jsonDecode(res.body)['lead_products']}");
debugPrint(res.body); debugPrint(res.body);
return crmLeadDetailsEditProductsViewResponse.fromJson( return crmLeadDetailsEditProductsViewResponse.fromJson(
jsonDecode(res.body), jsonDecode(res.body),
...@@ -3819,7 +3904,7 @@ class ApiCalling { ...@@ -3819,7 +3904,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditProductsUrl, {}); final res = await post(data, crmLeadDetailsEditProductsUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(jsonDecode(res.body)); print("crmLeadDetailsEditProductsSubmitAPI: ${jsonDecode(res.body)}");
return CommonResponse.fromJson(jsonDecode(res.body)); return CommonResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3857,7 +3942,7 @@ class ApiCalling { ...@@ -3857,7 +3942,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsAddContactUrl, {}); final res = await post(data, crmLeadDetailsAddContactUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("crmLeadDetailsAddContactAPI${res.body}");
return CommonResponse.fromJson(jsonDecode(res.body)); return CommonResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -3895,7 +3980,7 @@ class ApiCalling { ...@@ -3895,7 +3980,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditContactUrl, {}); final res = await post(data, crmLeadDetailsEditContactUrl, {});
if (res != null) { if (res != null) {
print(data); print(data);
debugPrint(res.body); debugPrint("crmLeadDetailsEditContactAPI ${res.body}");
return CommonResponse.fromJson(jsonDecode(res.body)); return CommonResponse.fromJson(jsonDecode(res.body));
} else { } else {
debugPrint("Null Response"); debugPrint("Null Response");
...@@ -4252,6 +4337,40 @@ class ApiCalling { ...@@ -4252,6 +4337,40 @@ class ApiCalling {
} }
} }
static Future<CommonResponse?> crmProspectDetailsAddLeadAPI(
empId,
session,
account_id,
product_id,
quantity,
amount,
lead_status,
) async {
try {
Map<String, String> data = {
'emp_id': (empId).toString(),
'session_id': (session).toString(),
'account_id': account_id.toString(),
'product_id': product_id.toString(),
'quantity': quantity.toString(),
'amount': amount.toString(),
'lead_status': lead_status.toString(),
};
final res = await post(data, crmProspectDetailsAddLeadUrl, {});
if (res != null) {
print("crmProspectDetailsAddLead:${data}");
debugPrint(res.body);
return CommonResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint('hello bev=bug $e ');
return null;
}
}
static Future<CommonResponse?> crmProspectDetailsAddAccountAPI( static Future<CommonResponse?> crmProspectDetailsAddAccountAPI(
empId, empId,
session, session,
...@@ -4380,7 +4499,8 @@ class ApiCalling { ...@@ -4380,7 +4499,8 @@ class ApiCalling {
static Future<appointmentCalendarResponse?> crmAppointmentCalendarAPI( static Future<appointmentCalendarResponse?> crmAppointmentCalendarAPI(
empId, empId,
session, session,
appointment_date,type appointment_date,
type,
) async { ) async {
try { try {
Map<String, String> data = { Map<String, String> data = {
...@@ -4404,6 +4524,62 @@ class ApiCalling { ...@@ -4404,6 +4524,62 @@ class ApiCalling {
} }
} }
static Future<crmSelectedProductDetailsResponse?> crmSelectedProductDetailsApi(
empId,
session,
product_id,
) async {
try {
Map<String, String> data = {
'emp_id': (empId).toString(),
'session_id': (session).toString(),
'product_id': (product_id).toString(),
};
final res = await post(data, crmSelectedProductDetailsUrl, {});
if (res != null) {
print("crmSelectedProductDetailsApi: ${data}");
debugPrint(res.body);
return crmSelectedProductDetailsResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint('hello bev=bug $e ');
return null;
}
}
static Future<CommonResponse?> crmCheckAccountFieldsApi(
empId,
session,
type_value,
type,
) async {
try {
Map<String, String> data = {
'emp_id': (empId).toString(),
'session_id': (session).toString(),
'type_value': (type_value).toString(),
'type': (type).toString(),
};
final res = await post(data, crmCheckAccountFieldsUrl, {});
if (res != null) {
print("crmCheckAccountFieldsApi: ${data}");
debugPrint(res.body);
return CommonResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint('hello bev=bug $e ');
return null;
}
}
static Future<CommonResponse?> static Future<CommonResponse?>
crmProspectDetailsFollowupNextAppointmentOtherCaseAPI( crmProspectDetailsFollowupNextAppointmentOtherCaseAPI(
empId, empId,
......
...@@ -154,14 +154,17 @@ const crmProspectDetailsUrl = "${baseUrl_test}crm_prospect_details"; ...@@ -154,14 +154,17 @@ const crmProspectDetailsUrl = "${baseUrl_test}crm_prospect_details";
const crmProspectDetailsTransferAccountUrl = "${baseUrl_test}crm_prospect_details_transfer_account_submit"; const crmProspectDetailsTransferAccountUrl = "${baseUrl_test}crm_prospect_details_transfer_account_submit";
const crmProspectDetailsEditAccountViewUrl = "${baseUrl_test}crm_prospect_details_edit_account_view"; const crmProspectDetailsEditAccountViewUrl = "${baseUrl_test}crm_prospect_details_edit_account_view";
const crmProspectDetailsEditAccountSubmitUrl = "${baseUrl_test}crm_prospect_details_edit_account_submit"; const crmProspectDetailsEditAccountSubmitUrl = "${baseUrl_test}crm_prospect_details_edit_account_submit";
const crmProspectDetailsAddLeadUrl = "${baseUrl_test}crm_account_details_add_lead";
const crmProspectDetailsAddLeadViewUrl = "${baseUrl_test}crm_prospect_details_add_lead_view"; const crmProspectDetailsAddLeadViewUrl = "${baseUrl_test}crm_prospect_details_add_lead_view";
const crmProspectDetailsAddLeadSubmitUrl = "${baseUrl_test}crm_prospect_details_add_lead_submit"; const crmProspectDetailsAddLeadSubmitUrl = "${baseUrl_test}crm_prospect_details_add_lead_submit";
const crmProspectDetailsAddAccountUrl = "${baseUrl_test}crm_prospect_details_add_account"; const crmProspectDetailsAddAccountUrl = "${baseUrl_test}crm_prospect_details_add_account";
const crmProspectDetailsEditContactUrl = "${baseUrl_test}crm_prospect_details_edit_contact"; const crmProspectDetailsEditContactUrl = "${baseUrl_test}crm_prospect_details_edit_contact";
const crmProspectDetailsFollowupNextAppointmentUrl = "${baseUrl_test}crm_lead_details_add_followup_next_appointment"; const crmProspectDetailsFollowupNextAppointmentUrl = "${baseUrl_test}crm_lead_details_add_followup_next_appointment";
const crmAppointmentCalendarUrl = "${baseUrl_test}crm_appointment_calendar_filter_submit"; const crmAppointmentCalendarUrl = "${baseUrl_test}crm_appointment_calendar_filter_submit";
const crmSelectedProductDetailsUrl = "${baseUrl_test}get_sale_product_details";
const crmCheckAccountFieldsUrl = "${baseUrl_test}check_crm_add_account_fields"; const crmCheckAccountFieldsUrl = "${baseUrl_test}check_crm_add_account_fields";
const crmNewProspectLeadViewUrl = "${baseUrl_test}crm_add_new_lead_prospect_view";
const crmNewProspectLeadSubmitUrl = "${baseUrl_test}crm_add_new_lead_prospect_submit"; const crmNewProspectLeadSubmitUrl = "${baseUrl_test}crm_add_new_lead_prospect_submit";
const crmNewProspectListEditGstUrl = "${baseUrl_test}crm_prospect_list_edit_gst"; const crmNewProspectListEditGstUrl = "${baseUrl_test}crm_prospect_list_edit_gst";
const crmNearbyOpenLeadsUrl = "${baseUrl_test}nearby_crm_open_leads"; const crmNearbyOpenLeadsUrl = "${baseUrl_test}nearby_crm_open_leads";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment