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 {
ChangeNotifierProvider(create: (_) => Addpaymentprovider()),
ChangeNotifierProvider(create: (_) => Addorderprovider()),
ChangeNotifierProvider(create: (_) => Editpaymentprovider()),
///crm
ChangeNotifierProvider(create: (_) => Crmdashboardprovider()),
ChangeNotifierProvider(create: (_) => Leadlistprovider()),
ChangeNotifierProvider(create: (_) => crmLeadDetailsProvider()),
......@@ -222,6 +224,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (_) => Dispatchorderprovider()),
ChangeNotifierProvider(create: (_) => followUpUpdateProvider()),
ChangeNotifierProvider(create: (_) => Appointmentcalendarprovider()),
ChangeNotifierProvider(create: (_) => Addnewleadsandprospectsprovider()),
],
child: Builder(
builder: (BuildContext context) {
......@@ -297,6 +300,12 @@ class MyApp extends StatelessWidget {
AppColors.grey_semi.withOpacity(0.6),
),
),
checkboxTheme: CheckboxThemeData(
side: BorderSide(width: 0.5),
checkColor: WidgetStatePropertyAll(AppColors.white),
),
useMaterial3: true,
// inputDecorationTheme: InputDecorationTheme(
// hintStyle: TextStyle(
......
......@@ -87,7 +87,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
onWillPop: () async {
Provider.of<Editproductlistprovider>(
context,
listen: false,
).resetForm();
return onBackPressed(context);
},
child: SafeArea(
top: false,
bottom: true,
......@@ -138,6 +144,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
// 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(
resizeToAvoidBottomInset: true,
// appBar: appbar2New(
......@@ -154,12 +166,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
//
// ),
appBar: AppBar(
toolbarHeight: provider.showMoreDetails ? 25 : 40,
// toolbarHeight: provider.showMoreDetails ? 25 : 40,
backgroundColor: Colors.white,
automaticallyImplyLeading: false,
centerTitle: false,
elevation: 2.0,
// elevation: 2.0,
title: SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
......@@ -168,6 +180,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
InkResponse(
onTap: () {
provider.resetAll();
editProvider.resetForm();
Navigator.pop(context, true);
},
child: SvgPicture.asset(
......@@ -181,6 +194,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child: InkResponse(
onTap: () {
provider.resetAll();
editProvider.resetForm();
Navigator.pop(context, true);
},
child: Text(
......@@ -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:
provider.showMoreDetails
? Size.fromHeight(
MediaQuery.of(context).size.height * 0.8,
)
: Size.fromHeight(120),
child: Column(
),
backgroundColor: AppColors.scaffold_bg_color,
body: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
),
elevation: 2,
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
......@@ -231,7 +238,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
// margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
child: Column(
children: [
Row(
......@@ -251,7 +261,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
flex: 5,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
leadDetails.name ?? "-",
......@@ -351,7 +362,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
...List.generate(subHeadings1.length, (j) {
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
padding: EdgeInsets.symmetric(
vertical: 7,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
......@@ -410,7 +423,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
...List.generate(subHeadings2.length, (j) {
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
padding: EdgeInsets.symmetric(
vertical: 7,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
......@@ -469,7 +484,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
...List.generate(subHeadings3.length, (j) {
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
padding: EdgeInsets.symmetric(
vertical: 7,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
......@@ -528,7 +545,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
...List.generate(subHeadings4.length, (j) {
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
padding: EdgeInsets.symmetric(
vertical: 7,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
......@@ -549,7 +568,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
subHeadings4[j] == "Lead Age"
? Tooltip(
triggerMode:
TooltipTriggerMode.tap,
TooltipTriggerMode
.tap,
message:
"${provider.leadDetails.createdDatetime}",
......@@ -563,7 +583,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
0xFF818181,
),
decorationColor:
AppColors.grey_semi,
AppColors
.grey_semi,
decoration:
TextDecoration
.underline,
......@@ -576,7 +597,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
: subHeadings4[j],
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
color: Color(
0xFF818181,
),
),
),
),
......@@ -612,7 +635,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
Transform.flip(
flipY:
provider.showMoreDetails ? true : false,
provider.showMoreDetails
? true
: false,
child: SvgPicture.asset(
"assets/svg/arrow_dropdown.svg",
height: 25,
......@@ -630,18 +655,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30), // Adjust the radius as needed
),
),
),
backgroundColor: AppColors.scaffold_bg_color,
body: SingleChildScrollView(
Expanded(
child: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(),
child: Column(
children: [
///product details
if(provider.leadProducts.isNotEmpty)...[
Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row(
......@@ -657,12 +676,22 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
if (productsNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: () async {
editProvider.resetForm();
await editProvider.crmLeadDetailsEditProductsViewAPIFunction(context, provider.leadDetails.id!);
_showAddEditProductsSheet(context,widget.mode, "add", "");
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
);
_showAddEditProductsSheet(
context,
widget.mode,
"add",
"",
);
},
child: Text(
textAlign: TextAlign.right,
......@@ -676,8 +705,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
],
],
),
),
if (productsNotEmpty) ...[
SizedBox(
width: double.infinity,
height: 130,
......@@ -685,7 +716,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
itemCount: provider.leadProducts.length,
itemBuilder: (context, lp) {
return InkResponse(
......@@ -699,16 +733,35 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
// ),
// ),
// );
await editProvider.crmLeadDetailsEditProductsViewAPIFunction(context, provider.leadDetails.id!);
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
await editProvider
.crmLeadDetailsEditProductsViewAPIFunction(
context,
provider.leadDetails.id!,
);
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(
height: 130,
......@@ -745,7 +798,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
// mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Row(
children: [
......@@ -757,11 +811,14 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
.productName ??
"-",
maxLines: 2,
overflow: TextOverflow.ellipsis,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontFamily: "JakartaMedium",
fontFamily:
"JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
color:
AppColors.semi_black,
),
),
),
......@@ -771,9 +828,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
textAlign: TextAlign.right,
"₹${provider.leadProducts[lp].price ?? "-"}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontFamily:
"JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
color:
AppColors.semi_black,
),
),
),
......@@ -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
if(provider.contactDetails.isNotEmpty)...[
Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row(
......@@ -834,6 +931,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
if (contactsNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: () {
......@@ -851,12 +949,17 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
],
],
),
),
if (contactsNotEmpty) ...[
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
itemCount: provider.contactDetails.length,
itemBuilder: (context, lp) {
return InkResponse(
......@@ -902,15 +1005,19 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child: SizedBox(
child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Row(
children: [
Expanded(
flex: 4,
child: Text(
provider.contactDetails[lp].name ??
provider
.contactDetails[lp]
.name ??
"-",
style: TextStyle(
fontFamily: "JakartaMedium",
......@@ -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
if (provider.followupDetails.isNotEmpty) ...[
Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row(
......@@ -970,13 +1104,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
if (followupNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Followupupdatescreen(
builder:
(context) => Followupupdatescreen(
leadID: provider.leadDetails.id,
mode: widget.mode,
),
......@@ -998,8 +1134,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
],
],
),
),
if (followupNotEmpty) ...[
SizedBox(
width: double.infinity,
height: 250,
......@@ -1030,7 +1168,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
......@@ -1055,7 +1194,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
flex: 4,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [
Text(
provider
......@@ -1081,7 +1221,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium",
fontSize: 14,
color:
AppColors.grey_semi,
AppColors
.grey_semi,
),
),
],
......@@ -1095,9 +1236,12 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
BorderRadius.circular(
8,
),
color: Color(0xFFF3FFD5),
color: Color(
0xFFF3FFD5,
),
),
padding: EdgeInsets.symmetric(
padding:
EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
......@@ -1156,11 +1300,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...List.generate(2, (j) {
final heads = ["In Time", "Out Time"];
final subHeads = [
provider.followupDetails[lp].finTime ?? "-",
provider.followupDetails[lp].foutTime ?? "-",
provider.followupDetails[lp].finTime ??
"-",
provider.followupDetails[lp].foutTime ??
"-",
];
return Container(
padding: EdgeInsets.symmetric(vertical: 3),
padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
......@@ -1179,7 +1327,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded(
child: Text(
textAlign: TextAlign.right,
subHeads[j] == "" ? "-" : subHeads[j],
subHeads[j] == ""
? "-"
: subHeads[j],
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
......@@ -1220,7 +1370,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Container(
padding: EdgeInsets.symmetric(vertical: 3),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
......@@ -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
if(provider.appointmentDetails.isNotEmpty)...[
Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row(
......@@ -1280,6 +1470,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
if (appointmentNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: () {
......@@ -1297,8 +1488,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
],
],
),
),
if (appointmentNotEmpty) ...[
SizedBox(
width: double.infinity,
height: 250,
......@@ -1306,7 +1499,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
itemCount: provider.appointmentDetails.length,
itemBuilder: (context, lp) {
return Container(
......@@ -1326,7 +1522,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
......@@ -1351,7 +1548,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
flex: 4,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [
Text(
provider
......@@ -1363,7 +1561,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium",
fontSize: 14,
color:
AppColors.semi_black,
AppColors
.semi_black,
),
),
Text(
......@@ -1376,7 +1575,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium",
fontSize: 14,
color:
AppColors.grey_semi,
AppColors
.grey_semi,
),
),
],
......@@ -1420,13 +1620,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...List.generate(2, (j) {
final headsa = ["Type", "Executed"];
final subHeadsa = [
provider.appointmentDetails[lp].atype ?? "-",
provider.appointmentDetails[lp].astatus ?? "-",
provider.appointmentDetails[lp].atype ??
"-",
provider.appointmentDetails[lp].astatus ??
"-",
];
return Container(
padding: EdgeInsets.symmetric(vertical: 3),
padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
......@@ -1442,7 +1647,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded(
child: Text(
textAlign: TextAlign.right,
subHeadsa[j] == "" ? "-" : subHeadsa[j],
subHeadsa[j] == ""
? "-"
: subHeadsa[j],
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
......@@ -1483,7 +1690,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Container(
padding: EdgeInsets.symmetric(vertical: 3),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
......@@ -1499,7 +1707,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded(
child: Text(
textAlign: TextAlign.right,
provider.appointmentDetails[lp].anote ==
provider
.appointmentDetails[lp]
.anote ==
""
? "-"
: provider
......@@ -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
if(provider.quotationsDetails.isNotEmpty)...[
Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row(
......@@ -1541,6 +1778,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
if (quotationNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: () async {
......@@ -1573,8 +1811,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
],
],
),
),
if (quotationNotEmpty) ...[
SizedBox(
width: double.infinity,
height: 200,
......@@ -1582,8 +1822,11 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
itemCount: provider.appointmentDetails.length,
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
itemCount: provider.quotationsDetails.length,
itemBuilder: (context, lp) {
return Container(
height: 200,
......@@ -1602,7 +1845,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
......@@ -1627,7 +1871,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
flex: 4,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [
Text(
provider
......@@ -1639,7 +1884,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium",
fontSize: 14,
color:
AppColors.semi_black,
AppColors
.semi_black,
),
),
Text(
......@@ -1652,7 +1898,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"JakartaMedium",
fontSize: 14,
color:
AppColors.grey_semi,
AppColors
.grey_semi,
),
),
],
......@@ -1697,12 +1944,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
final headsa = ["File Attached", "Info"];
final subHeadsa = [
"View",
provider.quotationsDetails[lp].info ?? "-",
provider.quotationsDetails[lp].info ??
"-",
];
return Container(
padding: EdgeInsets.symmetric(vertical: 3),
padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
......@@ -1725,7 +1976,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
style: TextStyle(
fontSize: 14,
color: AppColors.app_blue,
decorationColor: AppColors.app_blue,
decorationColor:
AppColors.app_blue,
decoration:
TextDecoration.underline,
),
......@@ -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),
],
),
),
),
],
),
);
},
);
......@@ -1856,7 +2154,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
errorWidget(context, provider.dateError),
TextWidget(context, "Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
......@@ -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) {
......@@ -2021,10 +2328,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.nameController,
"Name",
"Enter Name",
provider.onChangeName,
TextInputType.number,
(p0) {
provider.crmCheckFields(context, provider.nameController.text, "name");
provider.onChangeName(p0);
},
TextInputType.text,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.nameError),
textControllerWidget(
......@@ -2033,9 +2343,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Designation",
"Enter Designation",
provider.onChangeDesignation,
TextInputType.number,
TextInputType.text,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.designationError),
textControllerWidget(
......@@ -2043,10 +2353,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.mobileNumberController,
"Mobile Number",
"Enter Mobile Number",
provider.onChangeMobile,
(p0){
provider.crmCheckFields(context, provider.mobileNumberController.text, "mob1");
provider.onChangeMobile(p0);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10
),
errorWidget(context, provider.mobileNumError),
textControllerWidget(
......@@ -2054,10 +2372,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.alternativeMobileController,
"Alternative Mobile Number",
"Enter Alternative Mobile Number",
provider.onChangeAltMobile,
(p0) {
provider.crmCheckFields(context, provider.alternativeMobileController.text, "mob2");
provider.onChangeAltMobile(p0);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10
),
errorWidget(context, provider.altMobError),
textControllerWidget(
......@@ -2077,9 +2403,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Email ID",
"Enter Email ID",
provider.onChangeEmailId,
TextInputType.number,
TextInputType.emailAddress,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.emailError),
InkWell(
......@@ -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) {
......@@ -2181,10 +2516,13 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.editNameController,
"Name",
"Enter Name",
provider.onChangeEditName,
TextInputType.number,
(p0) {
provider.crmCheckFields(context, provider.editNameController.text, "name");
provider.onChangeEditName(p0);
},
TextInputType.text,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.editNameError),
textControllerWidget(
......@@ -2193,9 +2531,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Designation",
"Enter Designation",
provider.onChangeEditDesignation,
TextInputType.number,
TextInputType.text,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.editDesignationError),
textControllerWidget(
......@@ -2203,10 +2541,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.editMobileNumberController,
"Mobile Number",
"Enter Mobile Number",
provider.onChangeEditMobile,
(p0) {
provider.crmCheckFields(context, provider.editMobileNumberController.text, "mob1");
provider.onChangeEditMobile(p0);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10
),
errorWidget(context, provider.editMobileNumError),
......@@ -2215,10 +2561,18 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
provider.editAlternativeMobileController,
"Alternative Mobile Number",
"Enter Alternative Mobile Number",
provider.onChangeEditAltMobile,
(p0) {
provider.crmCheckFields(context, provider.editAlternativeMobileController.text, "mob2");
provider.onChangeEditAltMobile(p0);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10
),
errorWidget(context, provider.editAltMobError),
textControllerWidget(
......@@ -2239,9 +2593,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
"Email ID",
"Enter Email ID",
provider.onChangeEditEmailId,
TextInputType.number,
TextInputType.emailAddress,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.editEmailError),
......@@ -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) {
......@@ -2454,7 +2817,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return SafeArea(
child: Consumer2<crmLeadDetailsProvider, Editproductlistprovider>(
builder: (context, provider, editProvider, child) {
void updatedAmountfun(value){
void updatedAmountfun(value) {
final price =
double.tryParse(
editProvider.addEditProductPriceController.text,
......@@ -2468,6 +2831,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
editProvider.addEditTotalAmountController.text =
(price * qty).toString();
}
return Container(
margin: EdgeInsets.only(
bottom: 15,
......@@ -2491,7 +2855,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
fontFamily: "JakartaMedium",
),
),
SizedBox(height: 10,),
SizedBox(height: 10),
TextWidget(context, "Product"),
DropdownButtonHideUnderline(
child: Row(
......@@ -2537,6 +2901,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
editProvider
.selectedAddEditProductName =
value.name;
editProvider.crmSelectedProductDetailsApiFunction(context,value.id.toString());
// editProvider.updateSelectedProductIds(j, value);
// editProvider.selectedProductIds[j] =
// value.id?.toString() ?? '';
......@@ -2554,7 +2919,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
),
),
const SizedBox(height: 10),
if (editProvider.productError != null) ...[
errorWidget(context, editProvider.productError),
],
Row(
children: [
Expanded(
......@@ -2572,7 +2939,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
],
),
const SizedBox(height: 10),
if (editProvider.priceError != null) ...[
errorWidget(context, editProvider.priceError),
],
Row(
children: [
Expanded(
......@@ -2590,10 +2959,16 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
],
),
errorWidget(
context,
"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,
// ),
// ),
if (editProvider.qtyError != null) ...[
errorWidget(context, editProvider.qtyError),
],
const SizedBox(height: 10),
Row(
children: [
......@@ -2678,8 +3053,14 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
);
},
).whenComplete(() {
Provider.of<crmLeadDetailsProvider>(context).crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode);
Provider.of<Editproductlistprovider>(context).resetForm();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmLeadDetailsProvider>(
context,
listen: false,
);
provider.crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode);
},);
},);
}
}
......@@ -57,16 +57,13 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
provider.crmLeadListAPIFunction(
context,
widget.mode,
"",
widget.filter!.status,
widget.filter!.openStatus,
"",
"",
"",
"",
"",
"",
"",
"A",
);
} else {
provider.crmLeadListAPIFunction(
......@@ -78,10 +75,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
"",
"",
"",
"",
"",
"",
"",
"A",
);
}
});
......@@ -135,7 +129,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
children: [
InkResponse(
onTap: () async {
_showFilterSheet(context);
_showFilterSheetNew(context);
},
child: SvgPicture.asset(
"assets/svg/filter_ic.svg",
......@@ -144,7 +138,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
),
],
),
0xFFFFFFFF
0xFFFFFFFF,
),
backgroundColor: AppColors.scaffold_bg_color,
body:
......@@ -177,13 +171,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
MaterialPageRoute(
builder:
(context) => LeadDetailsByMode(
pageTitleName:
widget.pageTitleName,
pageTitleName: widget.pageTitleName,
mode: widget.mode,
leadId:
provider
.crmLeadList[index]
.leadid,
provider.crmLeadList[index].leadid,
),
),
);
......@@ -234,7 +225,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
),
),
Text(
crmLists[index].product??"-",
crmLists[index].product ?? "-",
maxLines: 1,
style: TextStyle(
fontFamily: "JakartaMedium",
......@@ -266,7 +257,6 @@ 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(
useSafeArea: true,
isDismissible: true,
......@@ -294,200 +966,243 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
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,
),
child: Padding(
padding: EdgeInsets.only(
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(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 15),
Row(
children: [
Expanded(
Padding(
padding: EdgeInsets.only(left: 15),
child: Text(
"Filter",
style: TextStyle(
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(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Left Column: Headings
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,
flex: 3,
child: Column(
children: List.generate(headings.length, (jj) {
// value: provider.selectedEmployees,
onChanged: (Employees? value) {
if (value != null) {
if (provider
.employeesList
.isNotEmpty) {
provider.selectedEmployees = value;
provider.selectedEmployeeId =
value!.id!;
provider.selectedEmployeeValue =
value!.name!;
provider
.crmLeadListSourceOnReferenceAPIFunction(
context,
widget.mode,
provider.selectedSourceId,
return Expanded(
child: InkResponse(
onTap: () {
setState(() {
// Reset all to false
isSelected = List.generate(
headings.length,
(index) => false,
);
}
}
// Set the clicked item to true
isSelected[jj] = true;
});
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 7.5,
horizontal: 10,
),
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,
),
],
),
),
],
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,
color: const Color(0xFFE6F6FF),
),
child: Center(
child: Text(
leadStatus!,
headings[jj],
textAlign: TextAlign.center,
style: TextStyle(
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,
),
),
],
);
}),
),
),
TextWidget(context, "Open/Close Status"),
DropdownButtonHideUnderline(
child: Row(
children: [
// Right Column: Dynamic Input Fields
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(
flex: 5,
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
if (selectedIndex == 0) ...[
...provider.alphabetList.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.selectedAlphabet ==
status,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedAlphabet =
status;
}
});
},
contentPadding: EdgeInsets.zero,
),
)
.toList(),
value: provider.selectedOpenStatus,
onChanged: (String? value) {
if (value != null) {
provider.selectedOpenStatus = value;
);
}).toList(),
] else if (selectedIndex == 1) ...[
...provider.leadStatusList.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.selectedLeadStatus ==
status,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedLeadStatus =
status;
}
});
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
contentPadding: EdgeInsets.zero,
),
);
}).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(
context,
provider.mobileNumberController,
......@@ -496,8 +1211,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
provider.onChangedMobileNum,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
FilteringTextInputFormatter
.digitsOnly,
),
] else if (selectedIndex == 4) ...[
textControllerWidget(
context,
provider.companyNameController,
......@@ -508,435 +1225,246 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
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(
] else if (selectedIndex == 5) ...[
...provider.sourcesList.map((source) {
return SizedBox(
height: 35,
child: CheckboxListTile(
activeColor: AppColors.app_blue,
controlAffinity: ListTileControlAffinity.leading,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
title: Text(
source.name!,
style: const TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedSources,
onChanged: (Sources? value) {
if (value != null) {
if (provider.sourcesList.isNotEmpty) {
provider.selectedSources = value;
value:
provider.selectedSource ==
source,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedSource =
source!;
provider.selectedSourceId =
value!.id!;
source.id!;
provider.selectedSourceValue =
value!.name!;
source.name!;
}
// Call API if needed
provider
.crmLeadListSourceOnReferenceAPIFunction(
context,
widget.mode,
provider.selectedSourceId,
provider
.selectedSourceId,
);
}
}
});
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
contentPadding: EdgeInsets.zero,
),
),
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(
);
}).toList(),
] else if (selectedIndex == 6) ...[
if(provider.referencesList.isEmpty)...[
errorWidget(context, "Please Select Source First"),
]else...[
...provider.referencesList.map((
reference,
) {
return SizedBox(
height: 35,
child: CheckboxListTile(
activeColor: AppColors.app_blue,
controlAffinity: ListTileControlAffinity.leading,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
title: Text(
reference.name!,
style: const TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedReferences,
onChanged: (References? value) {
if (value != null) {
if (provider
.referencesList
.isNotEmpty) {
provider.selectedReferences = value;
value:
provider.selectedReference ==
reference,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedReference =
reference;
provider.selectedReferenceId =
value!.id!;
reference.id!;
provider.selectedReferenceValue =
value!.name!;
}
reference.name!;
}
});
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
contentPadding: EdgeInsets.zero,
),
),
],
),
),
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(
);
}).toList(),
]
] else if (selectedIndex == 7) ...[
...provider.teamsList.map((team) {
return SizedBox(
height: 35,
child: CheckboxListTile(
activeColor: AppColors.app_blue,
title: Text(
team.name!,
style: const TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedTeams,
onChanged: (Teams? value) {
if (value != null) {
if (provider.teamsList.isNotEmpty) {
provider.selectedTeams = value;
provider.selectedTeamId = value!.id!;
controlAffinity: ListTileControlAffinity.leading,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
value:
provider.selectedTeam == team,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedTeam =
team;
provider.selectedTeamId =
team.id!;
provider.selectedTeamValue =
value!.name!;
team.name!;
}
provider
.crmLeadListSegmentOnTeamAPIFunction(
context,
widget.mode,
provider.selectedTeamId,
);
}
}
});
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
contentPadding: EdgeInsets.zero,
),
),
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(
);
}).toList(),
] else if (selectedIndex == 8) ...[
if(provider.segmentsList.isEmpty)...[
errorWidget(context, "Please Select Team ID First"),
]else...[
...provider.segmentsList.map((
segment,
) {
return SizedBox(
height: 35,
child: CheckboxListTile(
activeColor: AppColors.app_blue,
controlAffinity: ListTileControlAffinity.leading,
checkboxShape: CircleBorder(side: BorderSide(width:0.5 )),
title: Text(
segment.name!,
style: const TextStyle(
fontSize: 14,
),
),
),
)
.toList(),
value: provider.selectedSegments,
onChanged: (Segments? value) {
if (value != null) {
if (provider.segmentsList.isNotEmpty) {
provider.selectedSegments = value;
value:
provider.selectedSegment ==
segment,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedSegment =
segment;
provider.selectedSegmentId =
value!.id!;
segment.id!;
provider.selectedSegmentValue =
value!.name!;
}
segment.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,
),
contentPadding: EdgeInsets.zero,
),
),
)
.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,
),
),
}).toList(),
],
),
),
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(
] 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,
),
),
),
)
.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 =
"";
value:
provider.selectedEmployee ==
employee,
onChanged: (bool? value) {
setState(() {
if (value == true) {
provider.selectedEmployee =
employee;
provider.selectedEmployeeId =
employee.id!;
provider.selectedEmployeeValue =
employee.name!;
}
provider
.crmLeadListSubLocOnDistrictAPIFunction(
.crmLeadListSourceOnReferenceAPIFunction(
context,
widget.mode,
provider.selectedDistrictId,
provider
.selectedSourceId,
);
}
}
});
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
contentPadding: EdgeInsets.zero,
),
);
}).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,
),
InkResponse(
child: 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,
provider.selectedAlphabet,
);
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",
child: const Text(
"Search",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
......@@ -945,12 +1473,13 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
),
),
),
],
),
],
),
);
},
),
),
);
},
);
......
......@@ -18,7 +18,8 @@ import 'package:provider/provider.dart';
import '../../Models/crmModels/GetDistrictOnStateResponse.dart';
import '../../Models/crmModels/GetSubLocOnDistrictResponse.dart';
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 '../../Notifiers/crmProvider/addProspectLeadsProvider.dart';
import '../../Notifiers/crmProvider/crmProspectDetailsProvider.dart';
......@@ -194,7 +195,13 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
onWillPop: () async {
Provider.of<Addprospectleadsprovider>(
context,
listen: false,
).resetForm();
return onBackPressed(context);
},
child: SafeArea(
top: false,
bottom: true,
......@@ -211,7 +218,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
Crmeditprospectaccountprovider,
Addprospectleadsprovider
>(
builder: (context, provider, editProvider,addleadProvider, child) {
builder: (context, provider, editProvider, addleadProvider, child) {
var leadDetails = provider.accountDetails;
final leadsList = provider.leadList;
final orderList = provider.ordersList;
......@@ -246,15 +253,19 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
];
var headings4 = ["Lead Age"];
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(
resizeToAvoidBottomInset: true,
appBar: AppBar(
toolbarHeight: provider.showMoreDetails ? 25 : 40,
backgroundColor: Colors.white,
automaticallyImplyLeading: false,
centerTitle: false,
elevation: 2.0,
// elevation: 2.0,
title: SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
......@@ -263,6 +274,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
InkResponse(
onTap: () {
provider.resetAll();
addleadProvider.resetForm();
Navigator.pop(context, true);
},
child: SvgPicture.asset(
......@@ -276,6 +288,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
child: InkResponse(
onTap: () {
provider.resetAll();
addleadProvider.resetForm();
Navigator.pop(context, true);
},
child: Text(
......@@ -304,13 +317,33 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
],
),
),
bottom: PreferredSize(
preferredSize:
provider.showMoreDetails
? Size.fromHeight(
MediaQuery.of(context).size.height * 0.72,
)
: Size.fromHeight(120),
// bottom: PreferredSize(
// preferredSize:
// provider.showMoreDetails
// ? Size.fromHeight(
// MediaQuery.of(context).size.height * 0.72,
// )
// : 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(
children: [
Padding(
......@@ -325,7 +358,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
// margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
child: Column(
children: [
Row(
......@@ -345,7 +381,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"${leadDetails.salutationName ?? "-"} ${leadDetails.name ?? "-"}",
......@@ -637,7 +674,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
subHeadings4[j] == "Lead Age"
? Tooltip(
triggerMode:
TooltipTriggerMode.tap,
TooltipTriggerMode
.tap,
message:
"${leadDetails.createdDatetime}",
......@@ -651,7 +689,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
0xFF818181,
),
decorationColor:
AppColors.grey_semi,
AppColors
.grey_semi,
decoration:
TextDecoration
.underline,
......@@ -664,7 +703,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
: subHeadings4[j],
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
color: Color(
0xFF818181,
),
),
),
),
......@@ -718,20 +759,12 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
],
),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30), // Adjust the radius as needed
),
),
),
backgroundColor: AppColors.scaffold_bg_color,
body: Container(
Expanded(
child: SingleChildScrollView(
child: Container(
physics: AlwaysScrollableScrollPhysics(),
child: Column(
children: [
///Lead Details
if (leadsList.isNotEmpty) ...[
Container(
padding: EdgeInsets.only(
left: 10,
......@@ -752,14 +785,16 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
if (leadListNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: () async {
await addleadProvider.crmProspectDetailsAddLeadsViewAPIFunction(
await addleadProvider
.crmProspectDetailsAddLeadsViewAPIFunction(
context,
widget.mode,
);
_showAddLeadsSheet(context,widget.mode);
_showAddLeadsSheet(context, widget.mode);
},
child: Text(
textAlign: TextAlign.right,
......@@ -773,8 +808,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
],
],
),
),
if (leadListNotEmpty) ...[
SizedBox(
width: double.infinity,
height: 250,
......@@ -804,7 +841,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
......@@ -851,9 +889,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 2,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
8,
),
borderRadius:
BorderRadius.circular(8),
color: Color(0xFFF3FFD5),
),
padding: EdgeInsets.symmetric(
......@@ -875,9 +912,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
],
),
SizedBox(height: 5,),
SizedBox(height: 5),
Container(
padding: EdgeInsets.symmetric(vertical: 4),
padding: EdgeInsets.symmetric(
vertical: 4,
),
child: Row(
children: [
Expanded(
......@@ -946,7 +985,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
}),
Container(
padding: EdgeInsets.symmetric(vertical: 4),
padding: EdgeInsets.symmetric(
vertical: 4,
),
child: Row(
children: [
Expanded(
......@@ -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
if (provider.contactList.isNotEmpty) ...[
Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
child: Row(
......@@ -1088,6 +1161,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
if (contactNotEmpty) ...[
Expanded(
child: InkResponse(
onTap: () {
......@@ -1108,8 +1182,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
],
],
),
),
if (contactNotEmpty) ...[
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
......@@ -1181,9 +1257,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
.name ??
"-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontFamily:
"JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
color:
AppColors.semi_black,
),
),
),
......@@ -1193,18 +1271,24 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
textAlign: TextAlign.right,
"${provider.contactList[lp].mob1 ?? "-"}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontFamily:
"JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
color:
AppColors.semi_black,
),
),
),
],
),
Text(
provider.contactList[lp].email == ""
provider.contactList[lp].email ==
""
? "-"
: provider.contactList[lp].email ?? "-",
: provider
.contactList[lp]
.email ??
"-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
......@@ -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
if (orderList.isNotEmpty) ...[
if (orderNotEmpty) ...[
Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
padding: EdgeInsets.only(
left: 10,
right: 10,
top: 10,
),
child: Row(
children: [
Expanded(
......@@ -1240,7 +1359,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
],
),
),
......@@ -1274,7 +1392,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
......@@ -1321,9 +1440,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 2,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
8,
),
borderRadius:
BorderRadius.circular(8),
color: Color(0xFFF3FFD5),
),
padding: EdgeInsets.symmetric(
......@@ -1346,7 +1464,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
],
),
Container(
padding: EdgeInsets.symmetric(vertical: 3),
padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row(
children: [
Expanded(
......@@ -1415,7 +1535,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
}),
Container(
padding: EdgeInsets.symmetric(vertical: 4),
padding: EdgeInsets.symmetric(
vertical: 4,
),
child: Row(
children: [
Expanded(
......@@ -1442,12 +1564,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
...List.generate(1, (j) {
final textheads = [
"View Details",
];
final textSubheads = [
"View",
];
final textheads = ["View Details"];
final textSubheads = ["View"];
return Container(
padding: EdgeInsets.symmetric(
vertical: 7,
......@@ -1511,7 +1629,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
],
),
);
......@@ -1525,9 +1642,13 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
],
///Payment Details
if (paymentList.isNotEmpty) ...[
if (paymentsNotEmpty) ...[
Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
padding: EdgeInsets.only(
left: 10,
right: 10,
top: 10,
),
child: Row(
children: [
Expanded(
......@@ -1541,7 +1662,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
],
),
),
......@@ -1576,7 +1696,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
......@@ -1623,9 +1744,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 2,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
8,
),
borderRadius:
BorderRadius.circular(8),
color: Color(0xFFF3FFD5),
),
padding: EdgeInsets.symmetric(
......@@ -1647,9 +1767,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
],
),
SizedBox(height: 5,),
SizedBox(height: 5),
Container(
padding: EdgeInsets.symmetric(vertical: 4),
padding: EdgeInsets.symmetric(
vertical: 4,
),
child: Row(
children: [
Expanded(
......@@ -1723,7 +1845,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
}),
Container(
padding: EdgeInsets.symmetric(vertical: 3),
padding: EdgeInsets.symmetric(
vertical: 3,
),
child: Row(
children: [
Expanded(
......@@ -1750,12 +1874,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
...List.generate(1, (j) {
final textheads = [
"Action",
];
final textSubheads = [
"View Details",
];
final textheads = ["Action"];
final textSubheads = ["View Details"];
return Container(
padding: EdgeInsets.symmetric(
vertical: 3,
......@@ -1789,7 +1909,8 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
pageTitleName:
"Payment Details",
paymentId:
paymentList[index].id,
paymentList[index]
.id,
),
),
);
......@@ -1819,7 +1940,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
],
),
);
......@@ -1836,6 +1956,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
),
),
),
],
),
);
},
......@@ -1888,10 +2009,17 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.nameController,
"Name",
"Enter Name",
provider.onChangeName,
TextInputType.number,
(p0) {
provider.crmCheckFields(
context,
provider.nameController.text,
"name",
);
provider.onChangeName(p0);
},
TextInputType.text,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.nameError),
textControllerWidget(
......@@ -1900,9 +2028,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
"Designation",
"Enter Designation",
provider.onChangeDesignation,
TextInputType.number,
TextInputType.text,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.designationError),
textControllerWidget(
......@@ -1910,10 +2038,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.mobileNumberController,
"Mobile Number",
"Enter Mobile Number",
provider.onChangeMobile,
(p0) {
provider.crmCheckFields(
context,
provider.mobileNumberController.text,
"mob1",
);
provider.onChangeMobile(p0);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10,
),
errorWidget(context, provider.mobileNumError),
textControllerWidget(
......@@ -1921,10 +2060,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.alternativeMobileController,
"Alternative Mobile Number",
"Enter Alternative Mobile Number",
provider.onChangeAltMobile,
(p0) {
provider.crmCheckFields(
context,
provider.alternativeMobileController.text,
"mob2",
);
provider.onChangeAltMobile(p0);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10,
),
errorWidget(context, provider.altMobError),
textControllerWidget(
......@@ -1944,9 +2094,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
"Email ID",
"Enter Email ID",
provider.onChangeEmailId,
TextInputType.number,
TextInputType.emailAddress,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.emailError),
InkWell(
......@@ -2048,10 +2198,17 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.editNameController,
"Name",
"Enter Name",
provider.onChangeEditName,
TextInputType.number,
(p0) {
provider.crmCheckFields(
context,
provider.editNameController.text,
"name",
);
provider.onChangeEditName(p0);
},
TextInputType.text,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.editNameError),
textControllerWidget(
......@@ -2060,9 +2217,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
"Designation",
"Enter Designation",
provider.onChangeEditDesignation,
TextInputType.number,
TextInputType.text,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.editDesignationError),
textControllerWidget(
......@@ -2070,10 +2227,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.editMobileNumberController,
"Mobile Number",
"Enter Mobile Number",
provider.onChangeEditMobile,
(p0) {
provider.crmCheckFields(
context,
provider.editMobileNumberController.text,
"mob1",
);
provider.onChangeEditMobile(p0);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10,
),
errorWidget(context, provider.editMobileNumError),
......@@ -2082,10 +2250,21 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider.editAlternativeMobileController,
"Alternative Mobile Number",
"Enter Alternative Mobile Number",
provider.onChangeEditAltMobile,
(p0) {
provider.crmCheckFields(
context,
provider.editAlternativeMobileController.text,
"mob2",
);
provider.onChangeEditAltMobile(p0);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.next,
10,
),
errorWidget(context, provider.editAltMobError),
textControllerWidget(
......@@ -2106,9 +2285,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
"Email ID",
"Enter Email ID",
provider.onChangeEditEmailId,
TextInputType.number,
TextInputType.emailAddress,
false,
FilteringTextInputFormatter.digitsOnly,
null,
),
errorWidget(context, provider.editEmailError),
......@@ -2882,10 +3061,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
);
}
Future<void> _showAddLeadsSheet(
BuildContext context,
mode,
) {
Future<void> _showAddLeadsSheet(BuildContext context, mode) {
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
......@@ -2898,11 +3074,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child:Consumer2<
child: Consumer2<
crmProspectDetailsProvider,
Addprospectleadsprovider
>(
builder: (context, provider,addleadProvider, child) {
builder: (context, provider, addleadProvider, child) {
final price =
double.tryParse(
addleadProvider.addLeadProductPriceController.text,
......@@ -2915,7 +3091,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
0;
addleadProvider.addLeadProductTotalPriceController.text =
(price * qty).toString();
void updatedAmountfun(value){
void updatedAmountfun(value) {
final price =
double.tryParse(
addleadProvider.addLeadProductPriceController.text,
......@@ -2929,6 +3105,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
addleadProvider.addLeadProductTotalPriceController.text =
(price * qty).toString();
}
return Container(
margin: EdgeInsets.only(
bottom: 15,
......@@ -2952,90 +3129,108 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
fontFamily: "JakartaMedium",
),
),
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,
),
),
],
),
),
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, "Product"),
DropdownButtonHideUnderline(
child: Row(
......@@ -3051,9 +3246,9 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
items:
addleadProvider.leadProductsList
.map(
(ord) => DropdownMenuItem<
Products
>(
(
ord,
) => DropdownMenuItem<Products>(
value: ord,
child: Text(
"(Product Name: ${ord.name})",
......@@ -3067,14 +3262,14 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
)
.toList(),
value:
addleadProvider.selectedProductIds !=
addleadProvider.selectedProducts !=
null
? addleadProvider.leadProductsList
.firstWhere(
(ord) =>
ord.id ==
addleadProvider
.selectedProductIds,
.selectedProductsID,
orElse:
() =>
addleadProvider
......@@ -3082,19 +3277,30 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
)
: null,
onChanged: (Products? value) {
// if (value != null) {
if (value != null) {
// addleadProvider
// .updateSelectedProductIds(
// j,
// value,
// );
// // );
// addleadProvider.selectedProductIds[j] =
// value.id?.toString() ?? '';
// addleadProvider.updateTotalAmount(j);
// }
addleadProvider.selectedProducts =
value;
addleadProvider.selectedProductsName =
value.id;
addleadProvider.selectedProductsID =
value.name;
addleadProvider
.crmSelectedProductDetailsApiFunction(
context,
value.id.toString(),
);
}
},
buttonStyleData:
ddtheme.buttonStyleData,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
......@@ -3111,28 +3317,41 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
addleadProvider.addLeadProductPriceController,
"Product Price",
"Enter Product Price",
(value) =>
updatedAmountfun(value),
(p0) {
updatedAmountfun(p0);
addleadProvider.onChnageProductPrice(p0);
},
TextInputType.number,
false,
null,
),
const SizedBox(height: 10),
if (addleadProvider.priceError != null) ...[
errorWidget(context, addleadProvider.priceError),
],
textControllerWidget(
context,
addleadProvider.addLeadProductQtyController,
"Quantity",
"Enter Quantity",
(value) =>
updatedAmountfun(value),
(p0) {
updatedAmountfun(p0);
addleadProvider.onChnageProductQty(p0);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(
context,
"Note: Submit Quantity as Zero (0) to delete Product",
),
if (addleadProvider.qtyError != null) ...[
errorWidget(context, addleadProvider.qtyError),
],
// Text(
// "Note: Submit Quantity as Zero (0) to delete Product",
// style: TextStyle(
// color: AppColors.app_blue,
// fontSize: 12,
// ),
// ),
const SizedBox(height: 10),
Row(
children: [
......@@ -3140,12 +3359,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
flex: 2,
child: textControllerWidget(
context,
addleadProvider.addLeadProductTotalPriceController,
addleadProvider
.addLeadProductTotalPriceController,
"Amount",
"Total Amount",
(p0) {
},
(p0) {},
TextInputType.number,
true,
FilteringTextInputFormatter.digitsOnly,
......@@ -3166,11 +3384,14 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
items:
addleadProvider.statusList
.map(
(slist) => DropdownMenuItem<String>(
(slist) =>
DropdownMenuItem<String>(
value: slist,
child: Text(
slist,
style: TextStyle(fontSize: 14),
style: TextStyle(
fontSize: 14,
),
),
),
)
......@@ -3178,34 +3399,51 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
value: addleadProvider.selectedStatus,
onChanged: (String? value) {
if (value != null) {
if (addleadProvider.statusList.isNotEmpty) {
addleadProvider.selectedStatus = value;
if (addleadProvider
.statusList
.isNotEmpty) {
addleadProvider.selectedStatus =
value;
}
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
if (addleadProvider.statusError != null) ...[
errorWidget(context, addleadProvider.statusError),
],
InkResponse(
onTap:
addleadProvider.submitLoading
? null
: () {
// addleadProvider
// .crmProspectDetailsAddLeadsSubmitAPIFunction(
// context,
// widget.mode,
// provider.accountDetails.id,
// addleadProvider.selectedEmployeeId,
// {},
// addleadProvider.selectedStatus,
// );
addleadProvider
.crmProspectDetailsAddLeadsSubmitAPIFunction(
.crmProspectDetailsAddLeadsSubmitAPIFunctionNew(
context,
widget.mode,
mode,
widget.leadId,
provider.accountDetails.id,
addleadProvider.selectedEmployeeId,
{},
addleadProvider.selectedProductsID,
addleadProvider.selectedStatus,
);
},
......@@ -3253,8 +3491,10 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
);
},
).whenComplete(() {
Provider.of<crmProspectDetailsProvider>(context).crmProspectDetailsAPIFunction(context, widget.leadId);
Provider.of<crmProspectDetailsProvider>(
context,
).crmProspectDetailsAPIFunction(context, widget.leadId);
Provider.of<Addprospectleadsprovider>(context).resetForm();
},);
});
}
}
......@@ -323,6 +323,11 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
}
Future<void> _showFilterSheet(BuildContext context) {
List<bool> isSelected = List.generate(
2,
(index) => index == 0 ? true : false,
);
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
......@@ -335,160 +340,227 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
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,
),
child: Padding(
padding: EdgeInsets.only(
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(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 15),
Row(
children: [
Expanded(
Padding(
padding: EdgeInsets.only(left: 15),
child: Text(
"Filter",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
fontSize: 18,
fontFamily: "JakartaSemiBold",
),
),
),
],
),
if (widget.mode != "executive") ...[
TextWidget(context, "Employee"),
DropdownButtonHideUnderline(
child: Row(
children: [
const SizedBox(height: 20),
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,
flex:4,
child: Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: const Color(0xFFA5DAF9)),
bottom: BorderSide(
color: const Color(0xFFA5DAF9),
),
),
),
)
.toList(),
value:
provider.employeesList.contains(
provider.selectedEmployees,
)
? provider.selectedEmployees
: null,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 3,
child: Column(
children: List.generate(headings.length, (jj) {
// value: provider.selectedEmployees,
onChanged: (Employees? value) {
if (value != null) {
if (provider
.employeesList
.isNotEmpty) {
provider.selectedEmployees = value;
provider.selectedEmployeeId =
value!.id!;
provider.selectedEmployeeValue =
value!.name!;
}
}
return Expanded(
child: InkResponse(
onTap: () {
setState(() {
// Reset all to false
isSelected = List.generate(
headings.length,
(index) => false,
);
// Set the clicked item to true
isSelected[jj] = true;
});
},
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(
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 7.5,
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(8),
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),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
child: Center(
child: Text(
headings[jj],
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
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(
context,
provider.mobileNumberController,
"Mobile Number",
"",
"Enter Mobile Number",
provider.onChangedMobileNum,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
FilteringTextInputFormatter
.digitsOnly,
),
] else if (selectedIndex == 1) ...[
SizedBox(height: 10,),
textControllerWidget(
context,
provider.companyNameController,
"Company Name",
"",
"Enter Company Name",
provider.onChangedCompanyName,
TextInputType.text,
false,
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: () {
provider.crmProspectListAPIFunction(
context,
......@@ -500,17 +572,12 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
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",
child: const Text(
"Search",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
......@@ -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';
import 'package:flutter/material.dart';
import 'package:flutter/services.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/pendingTasksDetails.dart';
import 'package:generp/screens/crm/pendingTasksList.dart';
......@@ -490,7 +492,8 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
),
),
Text(
"Product and \nservice orders",
"Leads",
// "Product and \nservice orders",
style: TextStyle(
color: AppColors.grey_semi,
fontSize: 12,
......@@ -556,7 +559,8 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
),
),
Text(
"Assigned agents, \nperformance",
"Accounts",
// "Assigned agents, \nperformance",
style: TextStyle(
color: AppColors.grey_semi,
fontSize: 12,
......@@ -589,10 +593,9 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
MaterialPageRoute(
builder: (context) => Appointmentcalendar(),
settings: RouteSettings(
name: 'Appointmentcalendar'
)
name: 'Appointmentcalendar',
),
),
);
},
......@@ -625,7 +628,8 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
),
),
Text(
"Records,\nLedger",
"Calendar",
// "Records,\nLedger",
style: TextStyle(
color: AppColors.grey_semi,
fontSize: 12,
......@@ -788,9 +792,11 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
child: Container(
decoration: BoxDecoration(
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(
borderRadius: BorderRadius.circular(16),
......@@ -1028,13 +1034,21 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
floatingActionButton: InkResponse(
onTap: () {
if (provider.accessPages
.where((page) => [8, 9].contains(page.id))
.toList()
.contains([8, 9])) {
_showPaymentOptionsSheet(context);
}
onTap: () async {
// if (provider.accessPages
// .where((page) => [8, 9].contains(page.id))
// .toList()
// .contains([8, 9])) {
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Addleadsprospectsscreen(),
settings: RouteSettings(
name: 'Addleadsprospectsscreen'
)
),
);
// }
},
child: Container(
height: 45,
......
......@@ -623,6 +623,7 @@ class _FollowupupdatescreenState extends State<Followupupdatescreen> {
if (provider.selectNextAppointmentType ==
"Visit") ...[
CheckboxListTile(
activeColor: AppColors.app_blue,
checkboxShape: CircleBorder(),
controlAffinity: ListTileControlAffinity.leading,
value: provider.checked,
......
......@@ -53,7 +53,6 @@ class _GeneratequotationaddeditproductState
context,
listen: false,
);
provider.crmLeadDetailsGenerateQuoteViewAPIFunction(
context,
widget.leadId,
......@@ -135,7 +134,7 @@ class _GeneratequotationaddeditproductState
child: Row(
children: [
Expanded(
child: DropdownButton2<LeadProducts>(
child: DropdownButton2<Products>(
isExpanded: true,
hint: const Text(
'Select Product',
......@@ -143,14 +142,14 @@ class _GeneratequotationaddeditproductState
overflow: TextOverflow.ellipsis,
),
items:
provider.leadProductsList
provider.productsList
.map(
(
ord,
) => DropdownMenuItem<LeadProducts>(
) => DropdownMenuItem<Products>(
value: ord,
child: Text(
"(Product Name: ${ord.productName})",
"(Product Name: ${ord.name})",
style: const TextStyle(
fontSize: 14,
),
......@@ -169,22 +168,24 @@ class _GeneratequotationaddeditproductState
// provider
// .selectedOrderIds[index],
// )
value:
provider.selectedLeadProducts != null
? provider.leadProductsList.firstWhere(
provider.selectedProducts != null
? provider.productsList.firstWhere(
(element) =>
element.id ==
provider
.selectedAddEditLeadProductId,
.selectedAddEditProductId,
)
: null,
onChanged: (LeadProducts? value) {
onChanged: (Products? value) {
if (value != null) {
provider.selectedLeadProducts = value;
provider.selectedAddEditLeadProductId =
value!.productId!;
provider.selectedAddEditLeadProductName =
value.productName;
provider.selectedProducts = value;
provider.selectedAddEditProductId =
value!.id!;
provider.selectedAddEditProductName =
value.name;
provider.crmSelectedProductDetailsApiFunction(context, value.id.toString());
}
},
buttonStyleData: ddtheme.buttonStyleData,
......
......@@ -558,16 +558,56 @@ class _GeneratequotationscreenState extends State<Generatequotationscreen> {
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
textControllerWidget(
context,
provider.taxesController,
"Taxes",
"Enter Taxes",
provider.onChangetaxes,
TextInputType.text,
false,
null,
TextWidget(context, "Taxes"),
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>["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),
......
......@@ -55,3 +55,4 @@ export 'package:generp/Notifiers/crmProvider/crmEditProspectAccountProvider.dart
export 'package:generp/Notifiers/crmProvider/addProspectLeadsProvider.dart';
export 'package:generp/Notifiers/crmProvider/followUpUpdateProvider.dart';
export 'package:generp/Notifiers/crmProvider/appointmentCalendarProvider.dart';
export 'package:generp/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart';
......@@ -63,9 +63,6 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
"",
"",
"",
"",
"",
"",
);
} else {
provider.crmLeadListAPIFunction(
......@@ -78,9 +75,6 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
"",
"",
"",
"",
"",
"",
);
}
});
......@@ -434,9 +428,9 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
.toList(),
value:
provider.employeesList.contains(
provider.selectedEmployees,
provider.selectedEmployee,
)
? provider.selectedEmployees
? provider.selectedEmployee
: null,
// value: provider.selectedEmployees,
......@@ -445,7 +439,7 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
if (provider
.employeesList
.isNotEmpty) {
provider.selectedEmployees = value;
provider.selectedEmployee = value;
provider.selectedEmployeeId =
value!.id!;
provider.selectedEmployeeValue =
......@@ -605,11 +599,11 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
),
)
.toList(),
value: provider.selectedSources,
value: provider.selectedSource,
onChanged: (Sources? value) {
if (value != null) {
if (provider.sourcesList.isNotEmpty) {
provider.selectedSources = value;
provider.selectedSource = value;
provider.selectedSourceId =
value!.id!;
provider.selectedSourceValue =
......@@ -661,13 +655,13 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
),
)
.toList(),
value: provider.selectedReferences,
value: provider.selectedReference,
onChanged: (References? value) {
if (value != null) {
if (provider
.referencesList
.isNotEmpty) {
provider.selectedReferences = value;
provider.selectedReference = value;
provider.selectedReferenceId =
value!.id!;
provider.selectedReferenceValue =
......@@ -713,11 +707,11 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
),
)
.toList(),
value: provider.selectedTeams,
value: provider.selectedTeam,
onChanged: (Teams? value) {
if (value != null) {
if (provider.teamsList.isNotEmpty) {
provider.selectedTeams = value;
provider.selectedTeam = value;
provider.selectedTeamId = value!.id!;
provider.selectedTeamValue =
value!.name!;
......@@ -768,11 +762,11 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
),
)
.toList(),
value: provider.selectedSegments,
value: provider.selectedSegment,
onChanged: (Segments? value) {
if (value != null) {
if (provider.segmentsList.isNotEmpty) {
provider.selectedSegments = value;
provider.selectedSegment = value;
provider.selectedSegmentId =
value!.id!;
provider.selectedSegmentValue =
......@@ -981,16 +975,13 @@ class _LeadlistbymodeOldState extends State<LeadlistbymodeOld> {
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);
},
......
......@@ -16,6 +16,7 @@ import 'package:generp/Models/crmModels/LeadListViewResponse.dart';
import 'package:generp/Models/crmModels/ProspectListViewResponse.dart';
import 'package:generp/Models/crmModels/SubmitLeadListFilterResponse.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/crmProspectDetailsAddLeadsResponse.dart';
import 'package:generp/Models/crmModels/crmProspectDetailsResponse.dart';
......@@ -65,6 +66,7 @@ import '../Models/crmModels/appointmentCalendarResponse.dart';
import '../Models/crmModels/crmAddFollowUpResponse.dart';
import '../Models/crmModels/crmDashboardResponse.dart';
import '../Models/crmModels/crmPendingTasksResponse.dart';
import '../Models/crmModels/crmSelectedProductDetailsResponse.dart';
import '../Models/crmModels/crmUniversalSearchResponse.dart';
import '../Models/financeModels/paymentRequestionBankDetailsResponse.dart';
import '../Models/commonModels/commonAccountLedgerFilterResponse.dart';
......@@ -3306,7 +3308,7 @@ class ApiCalling {
final res = await post(data, crmAccessiblePagesUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("Accessibl pages: ${res.body}");
return AccessiblePagesResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -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(
empId,
session,
......@@ -3332,7 +3425,7 @@ class ApiCalling {
final res = await post(data, crmDashboardUrl, {});
if (res != null) {
print(data);
print(jsonDecode(res.body)['nearby_leads']);
print("CRM Dash ${jsonDecode(res.body)}");
return crmDashboardResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3356,7 +3449,7 @@ class ApiCalling {
final res = await post(data, crmPendingTasksListUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("PEnding Tasks ${res.body}");
return crmPendingTasksResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3382,7 +3475,7 @@ class ApiCalling {
final res = await post(data, crmUnivesalSearchUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("Universal Search ${res.body}");
return crmUniversalSearchResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3408,7 +3501,7 @@ class ApiCalling {
final res = await post(data, crmLeadListViewUrl, {});
if (res != null) {
print(data);
debugPrint("ListView2: ${res.body}");
debugPrint("Lead ListView2: ${res.body}");
return LeadListViewResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3424,8 +3517,6 @@ class ApiCalling {
empId,
session,
mode,
teamemployee,
slead_id,
status,
open_status,
mob,
......@@ -3434,17 +3525,13 @@ class ApiCalling {
reference,
team,
segment,
state,
district,
sub_loc,
alphabet,
) async {
try {
Map<String, String> data = {
'emp_id': (empId).toString(),
'session_id': (session).toString(),
'mode': (mode).toString(),
'teamemployee': teamemployee.toString(),
'slead_id': slead_id.toString(),
'status': status.toString(),
'open_status': open_status.toString(),
'mob': mob.toString(),
......@@ -3453,13 +3540,11 @@ class ApiCalling {
'reference': reference.toString(),
'team': team.toString(),
'segment': segment.toString(),
'state': state.toString(),
'district': district.toString(),
'sub_loc': sub_loc.toString(),
'alphabet': alphabet.toString(),
};
final res = await post(data, crmLeadListFilterSubmitUrl, {});
if (res != null) {
print("Filter:${data}");
print("Lead Filter:${data}");
debugPrint(res.body);
return SubmitLeadListFilterResponse.fromJson(jsonDecode(res.body));
} else {
......@@ -3486,7 +3571,7 @@ class ApiCalling {
final res = await post(data, crmLeadListSourceOnReferenceUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("Source on Ref ${res.body}");
return GetSourceOnReferenceResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3512,7 +3597,7 @@ class ApiCalling {
final res = await post(data, crmLeadListSegmentOnTeamUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
print("Segemnt on team ${res.body}");
return GetSegmentOnTeamResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3538,7 +3623,7 @@ class ApiCalling {
final res = await post(data, crmLeadListDistrictOnStateUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("districts on State ${res.body}");
return GetDistrictOnStateResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3564,7 +3649,7 @@ class ApiCalling {
final res = await post(data, crmLeadListSubLocOnDistrictUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("Sub loc on Dist ${res.body}");
return GetSubLocOnDistrictResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3590,7 +3675,7 @@ class ApiCalling {
final res = await post(data, crmLeadListContactPopUpUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("Lead list contact ${res.body}");
return LeadListContactPopUpResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3618,7 +3703,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("Lead Deatails ${res.body}");
return LeadDetailsResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3731,7 +3816,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditAccountViewUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("crmLeadDetailsEditAccountViewAPI: ${res.body}");
return crmLeadDetailsEditAccountViewResponse.fromJson(
jsonDecode(res.body),
);
......@@ -3765,7 +3850,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditAccountUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("crmLeadDetailsEditAccountSubmitAPI ${res.body}");
return CommonResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3788,7 +3873,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditProductsViewUrl, {});
if (res != null) {
print(data);
print(jsonDecode(res.body)['lead_products']);
print("crmLeadDetailsEditProductsViewAPI: ${jsonDecode(res.body)['lead_products']}");
debugPrint(res.body);
return crmLeadDetailsEditProductsViewResponse.fromJson(
jsonDecode(res.body),
......@@ -3819,7 +3904,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditProductsUrl, {});
if (res != null) {
print(data);
debugPrint(jsonDecode(res.body));
print("crmLeadDetailsEditProductsSubmitAPI: ${jsonDecode(res.body)}");
return CommonResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3857,7 +3942,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsAddContactUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("crmLeadDetailsAddContactAPI${res.body}");
return CommonResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -3895,7 +3980,7 @@ class ApiCalling {
final res = await post(data, crmLeadDetailsEditContactUrl, {});
if (res != null) {
print(data);
debugPrint(res.body);
debugPrint("crmLeadDetailsEditContactAPI ${res.body}");
return CommonResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
......@@ -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(
empId,
session,
......@@ -4380,7 +4499,8 @@ class ApiCalling {
static Future<appointmentCalendarResponse?> crmAppointmentCalendarAPI(
empId,
session,
appointment_date,type
appointment_date,
type,
) async {
try {
Map<String, String> data = {
......@@ -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?>
crmProspectDetailsFollowupNextAppointmentOtherCaseAPI(
empId,
......
......@@ -154,14 +154,17 @@ const crmProspectDetailsUrl = "${baseUrl_test}crm_prospect_details";
const crmProspectDetailsTransferAccountUrl = "${baseUrl_test}crm_prospect_details_transfer_account_submit";
const crmProspectDetailsEditAccountViewUrl = "${baseUrl_test}crm_prospect_details_edit_account_view";
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 crmProspectDetailsAddLeadSubmitUrl = "${baseUrl_test}crm_prospect_details_add_lead_submit";
const crmProspectDetailsAddAccountUrl = "${baseUrl_test}crm_prospect_details_add_account";
const crmProspectDetailsEditContactUrl = "${baseUrl_test}crm_prospect_details_edit_contact";
const crmProspectDetailsFollowupNextAppointmentUrl = "${baseUrl_test}crm_lead_details_add_followup_next_appointment";
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 crmNewProspectLeadViewUrl = "${baseUrl_test}crm_add_new_lead_prospect_view";
const crmNewProspectLeadSubmitUrl = "${baseUrl_test}crm_add_new_lead_prospect_submit";
const crmNewProspectListEditGstUrl = "${baseUrl_test}crm_prospect_list_edit_gst";
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