Commit 7959ada6 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

01-08-2025 By Sai Srinivas

Finance Module and CRM issues
parent 14d01f4d
class crmNewLeadsProspectsSubmitResponse {
String? error;
String? message;
String? leadId;
crmNewLeadsProspectsSubmitResponse({this.error, this.message, this.leadId});
crmNewLeadsProspectsSubmitResponse.fromJson(Map<String, dynamic> json) {
error = json['error'];
message = json['message'];
leadId = json['lead_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['message'] = this.message;
data['lead_id'] = this.leadId;
return data;
}
}
...@@ -360,6 +360,141 @@ class Accountslistprovider extends ChangeNotifier { ...@@ -360,6 +360,141 @@ class Accountslistprovider extends ChangeNotifier {
} }
} }
bool validateStep1(){
accountError = null;
nameError = null;
mobileError = null;
contactPersonError = null;
bool isValid = true;
if (_selectedAccountType == null || _selectedAccountType!.isEmpty) {
accountError = "Please select an Account";
isValid = false;
}
if (nameController.text.trim().isEmpty) {
nameError = "Please Enter a Name";
isValid = false;
}
if(mobileController.text.trim().isNotEmpty&&mobileController.text.length<10){
mobileError = "Mobile Number should be 10 digits";
isValid = false;
}
if (mobileController.text.trim().isEmpty) {
mobileError = "Please Enter Mobile Number";
isValid = false;
}
if (contactPersonController.text.trim().isEmpty) {
contactPersonError = "Please Enter Contact Person Name";
isValid = false;
}
_submitClicked = false;
notifyListeners();
return isValid;
}
bool validateStep2(){
stateError = null;
districtError = null;
localityError = null;
addressError = null;
bool isValid = true;
// if (_selectedState == null || _selectedStateID!.isEmpty) {
// stateError = "Please select a State";
// isValid = false;
// }
// if (_selectedDistricts == null || _selectedDistrictID!.isEmpty) {
// districtError = "Please select a District";
// isValid = false;
// }
// if (_selectedSubLocations == null || _selectedSubLocID!.isEmpty) {
// localityError = "Please select a Locality";
// isValid = false;
// }
// if (addressController.text.trim().isEmpty) {
// addressError = "Please Enter an Address";
// isValid = false;
// }
_submitClicked = false;
notifyListeners();
return isValid;
}
bool validateStep3(){
banknameError = null;
bankBranchError = null;
bankIFSCError = null;
bankHolderNameError = null;
bankAcNumberError = null;
upiError = null;
bool isValid = true;
// if (bankNameController.text
// .trim()
// .isEmpty) {
// banknameError = "Please Enter a Bank Name";
// isValid = false;
// }
//
// if (branchNameController.text
// .trim()
// .isEmpty) {
// bankBranchError = "Please Enter Branch Name";
// isValid = false;
// }
// if (bankIfscCotroller.text
// .trim()
// .isEmpty) {
// bankIFSCError = "Please Enter Bank IFSC";
// isValid = false;
// }
// if (bankHolderNameController.text
// .trim()
// .isEmpty) {
// bankHolderNameError = "Please Enter Account Holder Name";
// isValid = false;
// }
// if (bankAcNumberController.text
// .trim()
// .isEmpty) {
// bankAcNumberError = "Please Enter Bank Account Number";
// isValid = false;
// }
// if (bankUpiController.text
// .trim()
// .isEmpty) {
// upiError = "Please Enter UPI ID";
// isValid = false;
// }
_submitClicked = false;
notifyListeners();
return isValid;
}
bool validateStep4(){
bool isValid = true;
// if (contectPersonDesignationController.text
// .trim()
// .isEmpty) {
// desigantionError = "Please Enter Designation";
// isValid = false;
// }
// if (contectPersonAltMobController.text
// .trim()
// .isEmpty) {
// altMobError = "Please Enter Mobile Number";
// isValid = false;
// }
//
// }
// if (contectPersonTeleController.text.trim().isEmpty) {
// teleError= "Please Enter Telephone"; isValid = false;
// }
// if (contectPersonMailController.text.trim().isEmpty) {
// teleError= "Please Enter"; isValid = false;
// }
_submitClicked = false;
notifyListeners();
return isValid;
}
bool validatereceiptForm(BuildContext context) { bool validatereceiptForm(BuildContext context) {
accountError = null; accountError = null;
nameError = null; nameError = null;
......
...@@ -8,6 +8,7 @@ import 'package:flutter_download_manager/flutter_download_manager.dart'; ...@@ -8,6 +8,7 @@ import 'package:flutter_download_manager/flutter_download_manager.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:generp/Models/crmModels/crmSelectedProductDetailsResponse.dart'; import 'package:generp/Models/crmModels/crmSelectedProductDetailsResponse.dart';
import 'package:generp/screens/LoginScreen.dart'; import 'package:generp/screens/LoginScreen.dart';
import 'package:generp/screens/crm/LeadDetailsByMode.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
...@@ -600,7 +601,18 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { ...@@ -600,7 +601,18 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
); );
if (data != null) { if (data != null) {
if (data.error == "0") { if (data.error == "0") {
Navigator.pop(context, true); Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => LeadDetailsByMode(mode: "executive", pageTitleName: "Lead Details", leadId: data.leadId??"-",),
settings: RouteSettings(
name: "LeadDetailsByMode"
)
),
(Route<dynamic> route) {
return route.settings.name == 'CrmdashboardScreen';
},
);
toast(context, data.message); toast(context, data.message);
resetForm(); resetForm();
notifyListeners(); notifyListeners();
......
...@@ -535,7 +535,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -535,7 +535,7 @@ class crmLeadDetailsProvider extends ChangeNotifier {
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 2,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: Row( child: Row(
...@@ -571,7 +571,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { ...@@ -571,7 +571,7 @@ class crmLeadDetailsProvider extends ChangeNotifier {
), ),
), ),
Expanded( Expanded(
flex: 3, flex: 4,
child: CupertinoDatePicker( child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy, dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(), initialDateTime: _date ?? DateTime.now(),
......
...@@ -415,7 +415,7 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -415,7 +415,7 @@ class crmProspectDetailsProvider extends ChangeNotifier {
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 2,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: Row( child: Row(
...@@ -451,7 +451,7 @@ class crmProspectDetailsProvider extends ChangeNotifier { ...@@ -451,7 +451,7 @@ class crmProspectDetailsProvider extends ChangeNotifier {
), ),
), ),
Expanded( Expanded(
flex: 3, flex: 4,
child: CupertinoDatePicker( child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy, dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(), initialDateTime: _date ?? DateTime.now(),
......
...@@ -8,6 +8,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; ...@@ -8,6 +8,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../screens/crm/LeadDetailsByMode.dart';
import '../../services/api_calling.dart'; import '../../services/api_calling.dart';
import 'crmLeadDetailsProvider.dart'; import 'crmLeadDetailsProvider.dart';
...@@ -156,6 +157,7 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -156,6 +157,7 @@ class followUpUpdateProvider extends ChangeNotifier {
Future<void> crmAddFollowUpAPIFunction( Future<void> crmAddFollowUpAPIFunction(
BuildContext context, BuildContext context,
fromScreen,
nextAppointmentStatus, nextAppointmentStatus,
orderStatus, orderStatus,
leadID, leadID,
...@@ -196,7 +198,23 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -196,7 +198,23 @@ class followUpUpdateProvider extends ChangeNotifier {
if (data != null && data.error == "0") { if (data != null && data.error == "0") {
_submitLoading = false; _submitLoading = false;
resetForm(); resetForm();
Navigator.pop(context); if(fromScreen=="Pending Tasks"){
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => LeadDetailsByMode(mode: "executive", pageTitleName: "Lead Details", leadId: leadID??"-",),
settings: RouteSettings(
name: "LeadDetailsByMode"
)
),
(Route<dynamic> route) {
return route.settings.name == 'CrmdashboardScreen';
},
);
}else{
Navigator.pop(context);
}
if(mode.isNotEmpty){ if(mode.isNotEmpty){
prov2.crmLeadDetailsAPIFunction(context, leadID, mode); prov2.crmLeadDetailsAPIFunction(context, leadID, mode);
} }
...@@ -332,7 +350,7 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -332,7 +350,7 @@ class followUpUpdateProvider extends ChangeNotifier {
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 2,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: Row( child: Row(
...@@ -369,7 +387,7 @@ class followUpUpdateProvider extends ChangeNotifier { ...@@ -369,7 +387,7 @@ class followUpUpdateProvider extends ChangeNotifier {
), ),
Expanded( Expanded(
flex: 3, flex: 4,
child: CupertinoDatePicker( child: CupertinoDatePicker(
initialDateTime: _date ?? DateTime.now(), initialDateTime: _date ?? DateTime.now(),
minimumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), minimumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day),
......
...@@ -13,6 +13,9 @@ import 'package:provider/provider.dart'; ...@@ -13,6 +13,9 @@ import 'package:provider/provider.dart';
import 'approveRejectPaymentRequestResponse.dart'; import 'approveRejectPaymentRequestResponse.dart';
class Requesitionlidtdetailsprovider extends ChangeNotifier { class Requesitionlidtdetailsprovider extends ChangeNotifier {
bool _showMoreDetails = false;
TextEditingController requestedAmount = TextEditingController(); TextEditingController requestedAmount = TextEditingController();
TextEditingController approvedAmountReadonly = TextEditingController(); TextEditingController approvedAmountReadonly = TextEditingController();
TextEditingController proposedPaymentAccount = TextEditingController(); TextEditingController proposedPaymentAccount = TextEditingController();
...@@ -55,6 +58,8 @@ String? proposedAmountError; ...@@ -55,6 +58,8 @@ String? proposedAmountError;
get image_picked => _image_picked; get image_picked => _image_picked;
bool get showMoreDetails => _showMoreDetails;
int get imagePicked => _image_picked; int get imagePicked => _image_picked;
File? get imagePath => _imageName; File? get imagePath => _imageName;
...@@ -76,6 +81,11 @@ String? proposedAmountError; ...@@ -76,6 +81,11 @@ String? proposedAmountError;
notifyListeners(); notifyListeners();
} }
set showMoreDetails(bool value){
_showMoreDetails = value;
notifyListeners();
}
PaymentDetails get paymentsDetails => _paymentDetails; PaymentDetails get paymentsDetails => _paymentDetails;
RequestDetails get requestsDetails => _requestDetails; RequestDetails get requestsDetails => _requestDetails;
......
...@@ -676,7 +676,7 @@ class Requestionlistprovider extends ChangeNotifier { ...@@ -676,7 +676,7 @@ class Requestionlistprovider extends ChangeNotifier {
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 2,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: Row( child: Row(
...@@ -712,7 +712,7 @@ class Requestionlistprovider extends ChangeNotifier { ...@@ -712,7 +712,7 @@ class Requestionlistprovider extends ChangeNotifier {
), ),
), ),
Expanded( Expanded(
flex: 3, flex: 4,
child: CupertinoDatePicker( child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy, dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(), initialDateTime: _date ?? DateTime.now(),
......
...@@ -29,6 +29,8 @@ import 'package:share_plus/share_plus.dart'; ...@@ -29,6 +29,8 @@ import 'package:share_plus/share_plus.dart';
import 'package:printing/printing.dart'; import 'package:printing/printing.dart';
class Paymentreceiptsprovider extends ChangeNotifier { class Paymentreceiptsprovider extends ChangeNotifier {
bool _showMoreDetails = false;
List<ReceiptsList> _receiptsList = []; List<ReceiptsList> _receiptsList = [];
ReceiptDetails _receiptDetails = ReceiptDetails(); ReceiptDetails _receiptDetails = ReceiptDetails();
List<String> _headings = []; List<String> _headings = [];
...@@ -83,6 +85,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { ...@@ -83,6 +85,7 @@ class Paymentreceiptsprovider extends ChangeNotifier {
String _receiptPaymentModesID = ""; String _receiptPaymentModesID = "";
String _receiptPaymentModesValues = ""; String _receiptPaymentModesValues = "";
bool get showMoreDetails => _showMoreDetails;
List<Accounts> get receiptAccounts => _receiptAccounts; List<Accounts> get receiptAccounts => _receiptAccounts;
List<ReceiptAccounts> get receiptPaymentAccounts => _receiptPaymentAccounts; List<ReceiptAccounts> get receiptPaymentAccounts => _receiptPaymentAccounts;
...@@ -110,6 +113,10 @@ class Paymentreceiptsprovider extends ChangeNotifier { ...@@ -110,6 +113,10 @@ class Paymentreceiptsprovider extends ChangeNotifier {
// Date picker methods // Date picker methods
set showMoreDetails(bool value){
_showMoreDetails = value;
notifyListeners();
}
set selectreceiptAccounts(Accounts? value) { set selectreceiptAccounts(Accounts? value) {
_selectedreceiptAccounts = value; _selectedreceiptAccounts = value;
_receiptAccountID = value!.id!; _receiptAccountID = value!.id!;
...@@ -945,7 +952,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { ...@@ -945,7 +952,7 @@ class Paymentreceiptsprovider extends ChangeNotifier {
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 2,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: Row( child: Row(
...@@ -982,7 +989,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { ...@@ -982,7 +989,7 @@ class Paymentreceiptsprovider extends ChangeNotifier {
), ),
), ),
Expanded( Expanded(
flex: 3, flex: 4,
child: CupertinoDatePicker( child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy, dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(), initialDateTime: _date ?? DateTime.now(),
......
...@@ -19,6 +19,8 @@ import 'package:provider/provider.dart'; ...@@ -19,6 +19,8 @@ import 'package:provider/provider.dart';
import '../../Utils/commonServices.dart'; import '../../Utils/commonServices.dart';
class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{
bool _showMoreDetails = false;
List<PaymentsList> _paymentsList = []; List<PaymentsList> _paymentsList = [];
PaymentDetails _paymentDetails = PaymentDetails(); PaymentDetails _paymentDetails = PaymentDetails();
List<String> _headings = []; List<String> _headings = [];
...@@ -29,6 +31,12 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ ...@@ -29,6 +31,12 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{
List<String> get Headings => _headings; List<String> get Headings => _headings;
List<String> get subHeadings => _subHeadings; List<String> get subHeadings => _subHeadings;
bool get isLoading => _isLoading; bool get isLoading => _isLoading;
bool get showMoreDetails => _showMoreDetails;
set showMoreDetails(bool value){
_showMoreDetails = value;
notifyListeners();
}
Future<void> paymentsListAPI(context,from,to) async { Future<void> paymentsListAPI(context,from,to) async {
try{ try{
......
...@@ -150,7 +150,7 @@ set isLoading(bool value){ ...@@ -150,7 +150,7 @@ set isLoading(bool value){
if (password.isEmpty) { if (password.isEmpty) {
_passwordError = "Please enter your password"; _passwordError = "Please enter your password";
} }
_isLoading = false;
notifyListeners(); notifyListeners();
return _emailError.isEmpty && _passwordError.isEmpty; return _emailError.isEmpty && _passwordError.isEmpty;
} }
...@@ -199,15 +199,23 @@ set isLoading(bool value){ ...@@ -199,15 +199,23 @@ set isLoading(bool value){
); );
notifyListeners(); notifyListeners();
} else if (data.error == 1) { } else if (data.error == 1) {
_isLoading = false;
notifyListeners();
toast(context, toast(context,
"You are not authorized to login in this device !"); "You are not authorized to login in this device !");
} else if (data.error == 2) { } else if (data.error == 2) {
_isLoading = false;
notifyListeners();
toast(context, "Invalid login credentials !"); toast(context, "Invalid login credentials !");
} else { } else {
_isLoading = false;
notifyListeners();
toast(context, "Invalid login credentials !"); toast(context, "Invalid login credentials !");
} }
} else {} } else {
_isLoading = false;
notifyListeners();
}
} on Exception catch (e) { } on Exception catch (e) {
debugPrint("$e"); debugPrint("$e");
} }
......
...@@ -1565,7 +1565,7 @@ class Addorderprovider extends ChangeNotifier { ...@@ -1565,7 +1565,7 @@ class Addorderprovider extends ChangeNotifier {
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 2,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: Row( child: Row(
...@@ -1595,7 +1595,7 @@ class Addorderprovider extends ChangeNotifier { ...@@ -1595,7 +1595,7 @@ class Addorderprovider extends ChangeNotifier {
), ),
), ),
Expanded( Expanded(
flex: 3, flex: 4,
child: CupertinoDatePicker( child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy, dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(), initialDateTime: _date ?? DateTime.now(),
......
...@@ -603,7 +603,7 @@ class Addpaymentprovider extends ChangeNotifier{ ...@@ -603,7 +603,7 @@ class Addpaymentprovider extends ChangeNotifier{
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 2,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: Row( child: Row(
...@@ -633,7 +633,7 @@ class Addpaymentprovider extends ChangeNotifier{ ...@@ -633,7 +633,7 @@ class Addpaymentprovider extends ChangeNotifier{
), ),
), ),
Expanded( Expanded(
flex: 3, flex: 4,
child: CupertinoDatePicker( child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy, dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(), initialDateTime: _date ?? DateTime.now(),
......
...@@ -5,6 +5,7 @@ import 'package:connectivity_plus/connectivity_plus.dart'; ...@@ -5,6 +5,7 @@ import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:generp/Utils/commonWidgets.dart'; import 'package:generp/Utils/commonWidgets.dart';
import '../Utils/commonServices.dart'; import '../Utils/commonServices.dart';
...@@ -209,11 +210,22 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -209,11 +210,22 @@ class _MyHomePageState extends State<MyHomePage> {
toolbarHeight: 0, toolbarHeight: 0,
backgroundColor: Colors.white, backgroundColor: Colors.white,
), ),
body: SizedBox( body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppColors.scaffold_bg_color,
AppColors.scaffold_bg_color,
Color(0xFFCEEDFF),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
flex: 3, flex: 4,
child: InkResponse( child: InkResponse(
onTap: () { onTap: () {
_showProfileBottomSheet( _showProfileBottomSheet(
...@@ -394,20 +406,8 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -394,20 +406,8 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
Expanded( Expanded(
flex: 12, flex: 13,
child: Container( child: SizedBox(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppColors.scaffold_bg_color,
AppColors.scaffold_bg_color,
Color(0xFFCEEDFF),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
...@@ -1400,10 +1400,24 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -1400,10 +1400,24 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
], ],
], ],
), ),
), ),
), ),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 40,
alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(bottom: 20),
child: Image.asset(
fit: BoxFit.scaleDown,
"assets/images/horizontal_logo.png",
),
),
),
// Expanded( // Expanded(
// flex: 10, // flex: 10,
// child: Container( // child: Container(
...@@ -1623,16 +1637,8 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -1623,16 +1637,8 @@ class _MyHomePageState extends State<MyHomePage> {
], ],
), ),
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, // floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: Container( // floatingActionButton:
height: 40,
alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(bottom: 20),
child: Image.asset(
fit: BoxFit.scaleDown,
"assets/images/horizontal_logo.png",
),
),
), ),
), ),
), ),
......
...@@ -323,20 +323,31 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -323,20 +323,31 @@ class _LoginScreenState extends State<LoginScreen>
15, 15,
0, 0,
), ),
child: TextField( child: TextFormField(
controller: email, controller: email,
keyboardType: keyboardType:
TextInputType.emailAddress, TextInputType.emailAddress,
minLines: 1, minLines: 1,
autofocus: true,
focusNode: _emailFocusNode, focusNode: _emailFocusNode,
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
onChanged: (value) { onChanged: (value) {
loginProv.updateEmail(email.text); loginProv.updateEmail(email.text);
}, },
textInputAction: TextInputAction.next,
onTapOutside: (event) { onTapOutside: (event) {
// Handle onTapOutside // Handle onTapOutside
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
}, },
onEditingComplete: () {
if (_emailFocusNode.hasFocus) {
setState(() {
_emailFocusNode.unfocus();
_passwordFocusNode
.requestFocus();
});
}
},
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
hintStyle: TextStyle( hintStyle: TextStyle(
...@@ -358,12 +369,12 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -358,12 +369,12 @@ class _LoginScreenState extends State<LoginScreen>
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 2.5, top: 2.5,
bottom: 2.5, bottom: 2.5,
left: 25, left: 10,
), ),
child: Text( child: Text(
loginProv.emailError, loginProv.emailError,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: TextStyle(color: Colors.red), style: TextStyle(color: Colors.red,fontSize: 10,),
), ),
), ),
] else ...[ ] else ...[
...@@ -410,12 +421,13 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -410,12 +421,13 @@ class _LoginScreenState extends State<LoginScreen>
0, 0,
0, 0,
), ),
child: TextField( child: TextFormField(
controller: password, controller: password,
focusNode: _passwordFocusNode, focusNode: _passwordFocusNode,
obscureText: !loginProv.pwdVisible, obscureText: !loginProv.pwdVisible,
keyboardType: keyboardType:
TextInputType.visiblePassword, TextInputType.visiblePassword,
textInputAction: TextInputAction.done,
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
onChanged: (value) { onChanged: (value) {
loginProv.updatePassword( loginProv.updatePassword(
...@@ -423,6 +435,19 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -423,6 +435,19 @@ class _LoginScreenState extends State<LoginScreen>
); );
}, },
onEditingComplete: () {}, onEditingComplete: () {},
onFieldSubmitted: (value) {
loginProv.isLoading = true;
loginProv.LoginApiFunction(
context,
email.text,
password.text,
);
var f = FocusScope.of(context);
if (!f.hasPrimaryFocus) {
f.unfocus();
}
},
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.fromLTRB( contentPadding: EdgeInsets.fromLTRB(
0, 0,
...@@ -467,80 +492,82 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -467,80 +492,82 @@ class _LoginScreenState extends State<LoginScreen>
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 2.5, top: 2.5,
bottom: 2.5, bottom: 2.5,
left: 25, left: 10,
), ),
child: Text( child: Text(
loginProv.passwordError, loginProv.passwordError,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: TextStyle(color: Colors.red), style: TextStyle(
color: Colors.red,
fontSize: 10,
),
), ),
), ),
] else ...[ ] else ...[
SizedBox(height: 25.0), SizedBox(height: 15.0),
], ],
Container( SizedBox(height: 10,),
child: InkWell( InkWell(
onTap: onTap:
loginProv.isLoading loginProv.isLoading
? null ? null
: () { : () {
// LoginApiFunction(); // LoginApiFunction();
loginProv.isLoading = true; loginProv.isLoading = true;
loginProv.LoginApiFunction( loginProv.LoginApiFunction(
context, context,
email.text, email.text,
password.text, password.text,
); );
var f = FocusScope.of( var f = FocusScope.of(
context, context,
); );
if (!f.hasPrimaryFocus) { if (!f.hasPrimaryFocus) {
f.unfocus(); f.unfocus();
} }
// Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile())); // Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile()));
}, },
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
height: 45, height: 45,
width: screenWidth, width: screenWidth,
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 5.0, left: 5.0,
right: 5.0, right: 5.0,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color:
loginProv.isButtonEnabled loginProv.isButtonEnabled
? AppColors.app_blue ? AppColors.app_blue
: AppColors.button_disabled, : AppColors.button_disabled,
//1487C9 //1487C9
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
15.0, 15.0,
),
), ),
child: Center( ),
child: child: Center(
loginProv.isLoading child:
? CircularProgressIndicator.adaptive( loginProv.isLoading
padding: EdgeInsets.all( ? CircularProgressIndicator.adaptive(
5, padding: EdgeInsets.all(
), 5,
valueColor:
AlwaysStoppedAnimation(
Colors.white,
),
)
: Text(
"Login",
textAlign:
TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily:
"JakartaRegular",
),
), ),
), valueColor:
AlwaysStoppedAnimation(
Colors.white,
),
)
: Text(
"Login",
textAlign:
TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily:
"JakartaRegular",
),
),
), ),
), ),
), ),
...@@ -763,9 +790,15 @@ class LogoWidget extends StatelessWidget { ...@@ -763,9 +790,15 @@ class LogoWidget extends StatelessWidget {
return Container( return Container(
width: MediaQuery.of(context).size.width / 4.5, width: MediaQuery.of(context).size.width / 4.5,
height: MediaQuery.of(context).size.width / 4.5, height: MediaQuery.of(context).size.width / 4.5,
padding: imagePath == "assets/images/logo_7.png"?EdgeInsets.symmetric(horizontal: 5):null, padding:
imagePath == "assets/images/logo_7.png"
? EdgeInsets.symmetric(horizontal: 5)
: null,
decoration: BoxDecoration( decoration: BoxDecoration(
color: imagePath == "assets/images/logo_7.png"?Colors.white:Colors.transparent, color:
imagePath == "assets/images/logo_7.png"
? Colors.white
: Colors.transparent,
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(25),
image: DecorationImage( image: DecorationImage(
image: AssetImage(imagePath), image: AssetImage(imagePath),
......
...@@ -143,7 +143,7 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -143,7 +143,7 @@ class _AccountledgerState extends State<Accountledger> {
} }
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: appbar2( appBar: appbar2New(
context, context,
"Account Ledger List", "Account Ledger List",
provider.resetAll, provider.resetAll,
...@@ -184,6 +184,7 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -184,6 +184,7 @@ class _AccountledgerState extends State<Accountledger> {
), ),
], ],
), ),
0xFFFFFFFF
), ),
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: body:
......
...@@ -27,7 +27,8 @@ class Addcommonpayment extends StatefulWidget { ...@@ -27,7 +27,8 @@ class Addcommonpayment extends StatefulWidget {
class _AddcommonpaymentState extends State<Addcommonpayment> { class _AddcommonpaymentState extends State<Addcommonpayment> {
Dropdowntheme ddtheme = Dropdowntheme(); Dropdowntheme ddtheme = Dropdowntheme();
int _currentStep = 0;
final _formKey = GlobalKey<FormState>();
List<FocusNode> focusNodes = List.generate(20, (index) => FocusNode()); List<FocusNode> focusNodes = List.generate(20, (index) => FocusNode());
Map _source = {ConnectivityResult.mobile: true}; Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance; final MyConnectivity _connectivity = MyConnectivity.instance;
...@@ -46,13 +47,49 @@ class _AddcommonpaymentState extends State<Addcommonpayment> { ...@@ -46,13 +47,49 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
}); });
} }
void _nextStep() {
if (_formKey.currentState!.validate()) {
if (_currentStep < 3) {
setState(() {
_currentStep += 1;
});
} else {
// Submit form data
_submitForm();
}
}
}
void _previousStep() {
if (_currentStep > 0) {
setState(() {
_currentStep -= 1;
});
}
}
void _submitForm() {
print('Form Submitted:');
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Form submitted successfully!')),
);
}
@override @override
void dispose() { void dispose() {
focusNodes.map((e) => e.dispose()); focusNodes.map((e) => e.dispose());
super.dispose(); super.dispose();
_connectivity.disposeStream(); _connectivity.disposeStream();
} }
Future<bool> onBackPressed(BuildContext context) async {
if (_currentStep > 0) {
_previousStep();
return false;
} else {
return true;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) { switch (_source.keys.toList()[0]) {
...@@ -81,6 +118,1076 @@ class _AddcommonpaymentState extends State<Addcommonpayment> { ...@@ -81,6 +118,1076 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
} }
Widget _scaffold(BuildContext context) { Widget _scaffold(BuildContext context) {
return Consumer<Accountslistprovider>(
builder: (context, provider, child) {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2New(
context,
"Add Account",
provider.resetValues,
SizedBox.shrink(),
0xFFFFFFFF
),
backgroundColor: AppColors.scaffold_bg_color,
body: Form(
canPop: _currentStep == 0,
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(() {
//
// if(value==0){
// _currentStep = value;
// }
// if(_currentStep==1 && value==0){
// _currentStep = value;
// }
// if(_currentStep==2 && value == 1){
// _currentStep = value;
// }
// if (value == 1) {
// if(provider.validateStep1()){
// _currentStep = value;
// }
//
// } else if (value == 2) {
// if(provider.validateStep2()){
// _currentStep = value;
// }
//
// }
// else {
// _currentStep = value;
// }
// });
setState(() {
if (value == 1 && !provider.validateStep1()) {
return;
}
if (value == 2 && !provider.validateStep2()) {
return;
}
if (value < _currentStep) {
_currentStep = value;
} else if (value > _currentStep) {
_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: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin:EdgeInsets.only(bottom: 5),
child: Text(
"Account Details",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 16,
fontFamily: "JakartaMedium",
),
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 10),
Text("Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
isExpanded: true,
hint: const Row(
children: [
Expanded(
child: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
],
),
items:
provider.accountTypes
.map(
(act) => DropdownMenuItem<String>(
value: act,
child: Text(
act,
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
// value: provider.selectedAccountType,
value:
provider.accountTypes.contains(
provider.selectedAccountType,
)
? provider.selectedAccountType
: null,
onChanged: (value) {
if (value != null) {
provider.selectedAccountType = value;
print(
"statusId:${provider.selectedAccountType}",
);
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.accountError),
textControllerWidget(
context,
provider.nameController,
"Company Name",
"Enter Company Name",
(p0) {
provider.updateName(p0);
provider.checkInputsAPI(
context,
"name",
provider.nameController.text,
);
},
TextInputType.text,
false,
null,
focusNodes[0],
focusNodes[1],
TextInputAction.next,
),
errorWidget(context, provider.nameError),
textControllerWidget(
context,
provider.mobileController,
"Mobile Number",
"Enter Mobile",
(p0) {
provider.updateMobile(p0);
provider.checkInputsAPI(
context,
"mob1",
provider.mobileController.text,
);
},
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[1],
focusNodes[2],
TextInputAction.next,
10,
),
errorWidget(context, provider.mobileError),
textControllerWidget(
context,
provider.contactPersonController,
"Contact Person Name",
"Enter Contact Person Name",
provider.updateContactPerson,
TextInputType.text,
false,
null,
focusNodes[12],
focusNodes[13],
TextInputAction.next,
),
errorWidget(context, provider.contactPersonError),
],
),
),
],
),
),
Step(
label: Text("Step 2", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 1,
content:Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin:EdgeInsets.only(bottom: 10),
child: Text(
"Address Details",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 16,
fontFamily: "JakartaMedium",
),
),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("State"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<States>(
focusNode: focusNodes[2],
autofocus:
focusNodes[2].hasFocus
? true
: false,
isExpanded: true,
hint: Text(
'Select State',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.states
.map(
(
states,
) => DropdownMenuItem<
States
>(
value: states,
child: Text(
states.name ?? '',
style:
const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
value:
provider.states.contains(
provider.selectedState,
)
? provider.selectedState
: null,
// value: provider.selectedState,
onChanged: (States? value) {
if (value != null) {
if (provider
.states
.isNotEmpty) {
provider.selectedState =
value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.selectedStateID =
value.id!;
print(
"hfjkshfg" +
provider.selectedStateID
.toString(),
);
if (provider
.selectedDistricts !=
null) {
provider.states.clear();
// provider.selectedDistricts = null;
provider.selectedDistrictId =
null;
provider.selectedDistrictValue =
null;
}
provider.getDistrictAPI(
context,
provider.selectedStateID,
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider
.stateSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(
8,
),
child: TextFormField(
controller:
provider
.stateSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText:
'Search States...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(
8,
),
),
),
),
),
searchMatchFn: (
item,
searchValue,
) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue
.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.stateSearchController
.clear();
}
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.stateError),
Text("District"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Districts>(
focusNode: focusNodes[3],
isExpanded: true,
hint: Text(
'Select District',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.districts
.map(
(
dist,
) => DropdownMenuItem<
Districts
>(
value: dist,
child: Text(
dist.district ?? '',
style:
const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
value:
provider.districts.contains(
provider
.selectedDistricts,
)
? provider.selectedDistricts
: null,
// value: provider.selectedDistricts,
onChanged: (Districts? value) {
if (value != null) {
if (provider
.districts
.isNotEmpty) {
provider.selectedDistricts =
value;
print(
"Selected ID: ${value.id}",
);
provider.selectedDistrictId =
value.id!;
provider.selectedDistrictValue =
value.district!;
print(
"hfjkshfg" +
provider
.selectedDistrictId
.toString(),
);
if (provider
.selectedSubLocations !=
null) {
// provider.selectedSubLocations =
// null;
provider.selectedSubLocID =
null;
provider.selectedSubLocValue =
null;
}
provider.getSubLocationAPI(
context,
provider.selectedDistrictId,
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider
.districtSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(
8,
),
child: TextFormField(
controller:
provider
.districtSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText:
'Search Districts...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(
8,
),
),
),
),
),
searchMatchFn: (
item,
searchValue,
) {
return item.value?.district
?.toLowerCase()
.contains(
searchValue
.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider
.districtSearchController
.clear();
}
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.districtError),
Text("Sub Locality"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<SubLocations>(
focusNode: focusNodes[4],
isExpanded: true,
hint: Text(
'Select Sub Locality',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.subLocations
.map(
(
subloc,
) => DropdownMenuItem<
SubLocations
>(
value: subloc,
child: Text(
subloc.subLocality ??
'',
style:
const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
// value: provider.selectedSubLocations,
value:
provider.subLocations.contains(
provider
.selectedSubLocations,
)
? provider
.selectedSubLocations
: null,
onChanged: (SubLocations? value) {
if (value != null) {
if (provider
.subLocations
.isNotEmpty) {
provider.selectedSubLocations =
value;
print(
"Selected ID: ${value.id}",
);
provider.selectedSubLocID =
value.id!;
provider.selectedSubLocValue =
value.subLocality!;
print(
"hfjkshfg" +
provider
.selectedSubLocID
.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider
.subLocSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(
8,
),
child: TextFormField(
controller:
provider
.subLocSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText:
'Search Sub Locality...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(
8,
),
),
),
),
),
searchMatchFn: (
item,
searchValue,
) {
return item.value?.subLocality
?.toLowerCase()
.contains(
searchValue
.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.subLocSearchController
.clear();
}
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.localityError),
textControllerWidget(
context,
provider.addressController,
"Address",
"Enter Address",
provider.updateAddress,
TextInputType.text,
false,
null,
focusNodes[5],
null,
TextInputAction.done,
),
errorWidget(context, provider.addressError),
],
),
),
],
),
),
Step(
label: Text("Step 3", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 1,
content:Column( crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin:EdgeInsets.only(bottom: 10),
child: Text(
"Bank Details",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 16,
fontFamily: "JakartaMedium",
),
),
),
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.bankNameController,
"Bank Name",
"Enter Bank Name",
provider.updateBankName,
TextInputType.text,
false,
null,
focusNodes[6],
focusNodes[7],
TextInputAction.next,
),
errorWidget(context, provider.banknameError),
textControllerWidget(
context,
provider.branchNameController,
"Bank Branch",
"Enter Bank Branch",
provider.updateBankBranch,
TextInputType.text,
false,
null,
focusNodes[7],
focusNodes[8],
TextInputAction.next,
),
errorWidget(
context,
provider.bankBranchError,
),
textControllerWidget(
context,
provider.bankIfscCotroller,
"Bank IFSC",
"Enter Bank IFSC",
provider.updateIFSC,
TextInputType.text,
false,
null,
focusNodes[8],
focusNodes[9],
TextInputAction.next,
),
errorWidget(context, provider.bankIFSCError),
textControllerWidget(
context,
provider.bankHolderNameController,
"Bank Holder Name",
"Enter Bank Holder Name",
provider.updateHolder,
TextInputType.text,
false,
null,
focusNodes[9],
focusNodes[10],
TextInputAction.next,
),
errorWidget(
context,
provider.bankHolderNameError,
),
textControllerWidget(
context,
provider.bankAcNumberController,
"Bank Account Number",
"Enter Bank Account Number",
provider.updateNumber,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[10],
focusNodes[11],
TextInputAction.next,
),
errorWidget(
context,
provider.bankAcNumberError,
),
textControllerWidget(
context,
provider.bankUpiController,
"Bank UPI ID",
"Enter Bank UPI ID",
provider.updateUPI,
TextInputType.text,
false,
null,
focusNodes[11],
focusNodes[12],
TextInputAction.next,
),
errorWidget(context, provider.upiError),
],
),
),
],
),
),
Step(
label: Text("Step 4", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 2,
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin:EdgeInsets.only(bottom: 10),
child: Text(
"Contact Details",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 16,
fontFamily: "JakartaMedium",
),
),
),
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.contectPersonDesignationController,
"Contact Person Designation",
"Enter Contact Person Designation",
provider.updateDesignation,
TextInputType.text,
false,
null,
focusNodes[13],
focusNodes[14],
TextInputAction.next,
),
errorWidget(
context,
provider.desigantionError,
),
textControllerWidget(
context,
provider.contectPersonAltMobController,
"Alternative Mobile Number",
"Enter Alternative Mobile Number",
(p0) {
provider.updateAltMobile(p0);
provider.checkInputsAPI(
context,
"mob2",
provider
.contectPersonAltMobController
.text,
);
},
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[14],
focusNodes[15],
TextInputAction.next,
10,
),
errorWidget(context, provider.altMobError),
textControllerWidget(
context,
provider.contectPersonTeleController,
"Telephone Number",
"Enter Telephone Number",
provider.updateTeleMobile,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[15],
focusNodes[16],
TextInputAction.next,
),
errorWidget(context, provider.teleError),
textControllerWidget(
context,
provider.contectPersonMailController,
"Customer Mail ID",
"Enter Customer Mail ID",
provider.updateMail,
TextInputType.text,
false,
null,
focusNodes[16],
focusNodes[17],
TextInputAction.next,
),
errorWidget(context, provider.mailError),
],
),
),
],
),
),
],
controlsBuilder: (context, details) {
return Column(
children: [
if (_currentStep == 3) ...[
InkResponse(
onTap: provider.submitClickced
? null: () {
if (provider.validateStep4()) {
provider.submitClickced = true;
provider.submitCommonAccountsAPI(context, widget.from);
}
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) {
if (provider.validateStep1()) {
_currentStep = 1;
}
} else if (_currentStep == 1) {
if (provider.validateStep2()) {
_currentStep = 2;
}
}else if (_currentStep == 2) {
if (provider.validateStep3()) {
_currentStep = 3;
}
}
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 == 3) {
_currentStep = 2;
}
if (_currentStep == 2) {
_currentStep = 1;
} else if (_currentStep == 1) {
_currentStep = 0;
} else {
_currentStep = 3;
}
});
details.onStepCancel;
},
child: Text(
'Back',
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
),
),
),
],
],
);
},
),
),
);
},
);
}
Widget _scaffold1(BuildContext context) {
return Consumer<Accountslistprovider>( return Consumer<Accountslistprovider>(
builder: (context, provider, child) { builder: (context, provider, child) {
return Scaffold( return Scaffold(
......
...@@ -61,6 +61,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -61,6 +61,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
context, context,
listen: false, listen: false,
); );
provider.showMoreDetails = false;
provider.crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode); provider.crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode);
}); });
} }
...@@ -1566,7 +1567,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1566,7 +1567,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex:3, flex: 3,
child: Text( child: Text(
textAlign: TextAlign.left, textAlign: TextAlign.left,
"Feedback", "Feedback",
...@@ -1580,7 +1581,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1580,7 +1581,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
Expanded( Expanded(
flex:7, flex: 7,
child: Text( child: Text(
textAlign: TextAlign.right, textAlign: TextAlign.right,
provider provider
...@@ -1799,33 +1800,45 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -1799,33 +1800,45 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
), ),
), ),
if(provider if (provider
.appointmentDetails[lp] .appointmentDetails[lp]
.astatus=="No")...[ .astatus ==
"No") ...[
Expanded( Expanded(
flex: 2, flex: 2,
child: Container( child: Container(
height: 45, height: 45,
padding: EdgeInsets.symmetric(horizontal: 5), padding:
EdgeInsets.symmetric(
horizontal: 5,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.processed_bg_color, color:
borderRadius: BorderRadius.circular(8) AppColors
.processed_bg_color,
borderRadius:
BorderRadius.circular(
8,
),
), ),
child: Center( child: Center(
child: Text( child: Text(
"Pending", "Pending",
textAlign: TextAlign.right, textAlign:
TextAlign.right,
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily:
"JakartaMedium",
fontSize: 14, fontSize: 14,
color: AppColors.processed_text_color, color:
AppColors
.processed_text_color,
), ),
), ),
), ),
), ),
), ),
] ],
], ],
), ),
Container( Container(
...@@ -3297,13 +3310,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> { ...@@ -3297,13 +3310,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
), ),
], ],
), ),
// Text( if (type != "add") ...[
// "Note: Submit Quantity as Zero (0) to delete Product", Text(
// style: TextStyle( "Note: Submit Quantity as Zero (0) to delete Product",
// color: AppColors.app_blue, style: TextStyle(
// fontSize: 12, color: AppColors.app_blue,
// ), fontSize: 12,
// ), ),
),
],
if (editProvider.qtyError != null) ...[ if (editProvider.qtyError != null) ...[
errorWidget(context, editProvider.qtyError), errorWidget(context, editProvider.qtyError),
], ],
......
...@@ -74,6 +74,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> { ...@@ -74,6 +74,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
context, context,
widget.leadId, widget.leadId,
); );
provider.showMoreDetails = false;
provider.crmProspectDetailsAPIFunction(context, widget.leadId); provider.crmProspectDetailsAPIFunction(context, widget.leadId);
}); });
} }
......
import 'dart:io'; import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:dotted_line/dotted_line.dart'; import 'package:dotted_line/dotted_line.dart';
import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -31,7 +32,8 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -31,7 +32,8 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
Dropdowntheme ddtheme = Dropdowntheme(); Dropdowntheme ddtheme = Dropdowntheme();
int _currentStep = 0; int _currentStep = 0;
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
// Controllers to store form data // Controllers to store form data
final _nameController = TextEditingController(); final _nameController = TextEditingController();
final _emailController = TextEditingController(); final _emailController = TextEditingController();
...@@ -76,10 +78,21 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -76,10 +78,21 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
const SnackBar(content: Text('Form submitted successfully!')), const SnackBar(content: Text('Form submitted successfully!')),
); );
} }
Future<bool> onBackPressed(BuildContext context) async {
if (_currentStep > 0) {
_previousStep();
return false;
} else {
return true;
}
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
WidgetsBinding.instance.addPostFrameCallback((_) async { WidgetsBinding.instance.addPostFrameCallback((_) async {
final provider = Provider.of<Addnewleadsandprospectsprovider>( final provider = Provider.of<Addnewleadsandprospectsprovider>(
context, context,
...@@ -92,727 +105,736 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -92,727 +105,736 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
@override @override
Widget build(BuildContext context) { 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>( return Consumer<Addnewleadsandprospectsprovider>(
builder: (context, provider, child) { builder: (context, provider, child) {
return WillPopScope( return SafeArea(
onWillPop: () async { top: false,
provider.resetForm(); bottom: Platform.isIOS ? false : true,
return true; child: Scaffold(
}, resizeToAvoidBottomInset: true,
child: SafeArea( backgroundColor: AppColors.scaffold_bg_color,
top: false, appBar: appbar2New(
bottom: Platform.isIOS ? false : true, context,
child: Scaffold( "Add Leads and Prospect",
resizeToAvoidBottomInset: true, provider.resetForm,
backgroundColor: AppColors.scaffold_bg_color, const SizedBox(width: 0),
appBar: appbar2New( 0xFFFFFFFF,
context, ),
"Add Leads and Prospect", //
provider.resetForm, body: Form(
const SizedBox(width: 0), key: _formKey,
0xFFFFFFFF, child: Stepper(
), margin: EdgeInsets.symmetric(horizontal: 0, vertical: 0),
// type: StepperType.horizontal,
body: Form( currentStep: _currentStep,
key: _formKey, onStepContinue: _nextStep,
child: Stepper( onStepCancel: _previousStep,
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 0), onStepTapped: (value) {
type: StepperType.horizontal, print(value);
currentStep: _currentStep, // setState(() {
onStepContinue: _nextStep, //
onStepCancel: _previousStep, // if(value==0){
onStepTapped: (value) { // _currentStep = value;
print(value); // }
// setState(() { // if(_currentStep==1 && value==0){
// // _currentStep = value;
// if(value==0){ // }
// _currentStep = value; // if(_currentStep==2 && value == 1){
// } // _currentStep = value;
// if(_currentStep==1 && value==0){ // }
// _currentStep = value; // if (value == 1) {
// } // if(provider.validateStep1()){
// if(_currentStep==2 && value == 1){ // _currentStep = value;
// _currentStep = value; // }
// } //
// if (value == 1) { // } else if (value == 2) {
// if(provider.validateStep1()){ // if(provider.validateStep2()){
// _currentStep = value; // _currentStep = value;
// } // }
// //
// } else if (value == 2) { // }
// if(provider.validateStep2()){ // else {
// _currentStep = value; // _currentStep = value;
// } // }
// // });
// } setState(() {
// else { if (value == 1 && !provider.validateStep1()) {
// _currentStep = value; return;
// } }
// }); if (value == 2 && !provider.validateStep2()) {
setState(() { return;
if (value == 1 && !provider.validateStep1()) { }
return; if (value < _currentStep) {
} _currentStep = value;
if (value == 2 && !provider.validateStep2()) { } else if (value > _currentStep) {
return; _currentStep = value;
} }
if (value < _currentStep) { });
_currentStep = value; },
} else if (value > _currentStep) { connectorColor: WidgetStatePropertyAll(AppColors.app_blue),
_currentStep = value; stepIconBuilder: (stepIndex, stepState) {
} return CircleAvatar(
}); radius: 12,
}, backgroundColor:
connectorColor: WidgetStatePropertyAll(AppColors.app_blue), stepIndex <= _currentStep
stepIconBuilder: (stepIndex, stepState) { ? AppColors.app_blue
return CircleAvatar( : Colors.grey[300],
radius: 12, );
backgroundColor: },
stepIndex <= _currentStep steps: [
? AppColors.app_blue Step(
: Colors.grey[300], label: Text("Step 1", style: TextStyle(fontSize: 12)),
); title: const Text(''),
}, isActive: _currentStep >= 0,
steps: [ content: Container(
Step( padding: EdgeInsets.symmetric(
label: Text("Step 1", style: TextStyle(fontSize: 12)), horizontal: 10,
title: const Text(''), vertical: 10,
isActive: _currentStep >= 0, ),
content: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
TextWidget(context, "Salutation"), TextWidget(context, "Salutation"),
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: DropdownButton2<String>( child: DropdownButton2<String>(
isExpanded: true, isExpanded: true,
hint: const Row( hint: const Row(
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
'Select Salutation', 'Select Salutation',
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
),
), ),
], ),
), ],
items: ),
provider.salutationList items:
.map( provider.salutationList
(slist) => .map(
DropdownMenuItem<String>( (slist) =>
value: slist, DropdownMenuItem<String>(
child: Text( value: slist,
slist ?? '', child: Text(
style: const TextStyle( slist ?? '',
fontSize: 14, style: const TextStyle(
), fontSize: 14,
overflow:
TextOverflow
.ellipsis,
), ),
overflow:
TextOverflow
.ellipsis,
), ),
) ),
.toList(), )
value: provider.selectedSalutation, .toList(),
onChanged: (value) { value: provider.selectedSalutation,
if (value != null) { onChanged: (value) {
provider.selectedSalutation = value; if (value != null) {
provider.salutationError = null; provider.selectedSalutation = value;
} provider.salutationError = null;
}, }
buttonStyleData: ddtheme.buttonStyleData, },
iconStyleData: ddtheme.iconStyleData, buttonStyleData: ddtheme.buttonStyleData,
menuItemStyleData: iconStyleData: ddtheme.iconStyleData,
ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.menuItemStyleData,
ddtheme.dropdownStyleData, dropdownStyleData:
), ddtheme.dropdownStyleData,
), ),
], ),
), ],
), ),
errorWidget(context, provider.salutationError), ),
errorWidget(context, provider.salutationError),
textControllerWidget( textControllerWidget(
context, context,
provider.companyNameController, provider.companyNameController,
"Company Name", "Company Name",
"Enter Company Name", "Enter Company Name",
provider.onChangeCompanyName, provider.onChangeCompanyName,
TextInputType.name, TextInputType.name,
false, false,
null, null,
), ),
errorWidget(context, provider.companynameError), errorWidget(context, provider.companynameError),
textControllerWidget( textControllerWidget(
context, context,
provider.contactPersonNameController, provider.contactPersonNameController,
"Contact Person Name", "Contact Person Name",
"Enter Name", "Enter Name",
provider.onChangeContactPersonName, provider.onChangeContactPersonName,
TextInputType.name, TextInputType.name,
false, false,
null, null,
), ),
errorWidget(context, provider.nameError), errorWidget(context, provider.nameError),
textControllerWidget( textControllerWidget(
context, context,
provider.mobileController, provider.mobileController,
"Mobile Number", "Mobile Number",
"Enter Mobile Number", "Enter Mobile Number",
provider.onChangemobile, provider.onChangemobile,
TextInputType.phone, TextInputType.phone,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null, null,
null, null,
TextInputAction.done, TextInputAction.done,
10, 10,
), ),
errorWidget(context, provider.mobileError), errorWidget(context, provider.mobileError),
textControllerWidget( textControllerWidget(
context, context,
provider.customerMailIdController, provider.customerMailIdController,
"Customer Email Id", "Customer Email Id",
"Enter Email Id", "Enter Email Id",
provider.onChangemailId, provider.onChangemailId,
TextInputType.emailAddress, TextInputType.emailAddress,
false, false,
null, null,
), ),
errorWidget(context, provider.mailIdError), errorWidget(context, provider.mailIdError),
textControllerWidget( textControllerWidget(
context, context,
provider.designationController, provider.designationController,
"Customer Designation", "Customer Designation",
"Enter Designation", "Enter Designation",
provider.onChangedesignation, provider.onChangedesignation,
TextInputType.text, TextInputType.text,
false, false,
null, null,
), ),
errorWidget(context, provider.designationError), errorWidget(context, provider.designationError),
], ],
),
), ),
), ),
Step( ),
label: Text("Step 2", style: TextStyle(fontSize: 12)), Step(
title: const Text(''), label: Text("Step 2", style: TextStyle(fontSize: 12)),
isActive: _currentStep >= 1, title: const Text(''),
content: Container( isActive: _currentStep >= 1,
padding: EdgeInsets.symmetric( content: Container(
horizontal: 10, padding: EdgeInsets.symmetric(
vertical: 10, horizontal: 10,
), vertical: 10,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
textControllerWidget( textControllerWidget(
context, context,
provider.alternateMobileController, provider.alternateMobileController,
"Alternate Mobile Number", "Alternate Mobile Number",
"Enter Alternate Mobile Number", "Enter Alternate Mobile Number",
provider.onChangeAlternatemobile, provider.onChangeAlternatemobile,
TextInputType.phone, TextInputType.phone,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
null, null,
null, null,
TextInputAction.done, TextInputAction.done,
10, 10,
), ),
errorWidget(context, provider.AlternatemobileError), errorWidget(context, provider.AlternatemobileError),
textControllerWidget( textControllerWidget(
context, context,
provider.telephoneController, provider.telephoneController,
"Telephone Number", "Telephone Number",
"Enter Telephone Number", "Enter Telephone Number",
provider.onChangeTelephone, provider.onChangeTelephone,
TextInputType.phone, TextInputType.phone,
false, false,
FilteringTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
), ),
errorWidget(context, provider.TelephoneError), errorWidget(context, provider.TelephoneError),
TextWidget(context, "Source"), TextWidget(context, "Source"),
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: DropdownButton2<Sources>( child: DropdownButton2<Sources>(
hint: Text( hint: Text(
"Select Source", "Select Source",
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
), ),
items: items:
provider.sourcesList provider.sourcesList
.map( .map(
(slist) => (slist) =>
DropdownMenuItem<Sources>( DropdownMenuItem<Sources>(
value: slist, value: slist,
child: Text( child: Text(
slist.name!, slist.name!,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
),
), ),
), ),
) ),
.toList(), )
value: provider.selectedSources, .toList(),
onChanged: (Sources? value) { // value: provider.selectedSources,
if (value != null) { value: provider.sourcesList.isNotEmpty?provider.selectedSources!=null?
if (provider.sourcesList.isNotEmpty) { provider.sourcesList.firstWhere((element) => element.id==provider.selectedSourcesId,
provider.selectedSources = value; orElse: () => provider.sourcesList[0],
provider.selectedSourcesId = ):null:null,
value!.id!; onChanged: (Sources? value) {
provider.selectedSourcesValue = if (value != null) {
value!.name!; if (provider.sourcesList.isNotEmpty) {
provider provider.selectedSources = value;
.crmLeadListSourceOnReferenceAPIFunction( provider.selectedSourcesId =
context, value!.id!;
"", provider.selectedSourcesValue =
provider.selectedSourcesId, value!.name!;
);
if(provider.referencesList.isNotEmpty){
provider.referencesList.clear();
provider.selectedReferenceId = null;
provider.selectedReferenceValue = null;
} }
provider
.crmLeadListSourceOnReferenceAPIFunction(
context,
"",
provider.selectedSourcesId,
);
} }
}, }
isExpanded: true, },
buttonStyleData: ddtheme.buttonStyleData, isExpanded: true,
iconStyleData: ddtheme.iconStyleData, buttonStyleData: ddtheme.buttonStyleData,
menuItemStyleData: iconStyleData: ddtheme.iconStyleData,
ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.menuItemStyleData,
ddtheme.dropdownStyleData, dropdownStyleData:
), ddtheme.dropdownStyleData,
), ),
], ),
), ],
), ),
errorWidget(context, provider.sourceError), ),
TextWidget(context, "Reference"), errorWidget(context, provider.sourceError),
DropdownButtonHideUnderline( TextWidget(context, "Reference"),
child: Row( DropdownButtonHideUnderline(
children: [ child: Row(
Expanded( children: [
child: DropdownButton2<References>( Expanded(
hint: Text( child: DropdownButton2<References>(
"Select Reference", hint: Text(
style: TextStyle(fontSize: 14), "Select Reference",
), style: TextStyle(fontSize: 14),
items: ),
provider.referencesList items:
.map( provider.referencesList
(slist) => DropdownMenuItem< .map(
References (slist) => DropdownMenuItem<
>( References
value: slist, >(
child: Text( value: slist,
slist.name!, child: Text(
style: TextStyle( slist.name!,
fontSize: 14, style: TextStyle(
), fontSize: 14,
), ),
), ),
) ),
.toList(), )
value: provider.selectedReference, .toList(),
onChanged: (References? value) { // value: provider.selectedReference,
if (value != null) { value: provider.referencesList.isNotEmpty?provider.selectedReference!=null?
if (provider provider.referencesList.firstWhere((element) => element.id==provider.selectedReferenceId,
.referencesList orElse: () => provider.referencesList[0],
.isNotEmpty) { ):null:null,
provider.selectedReference = value; onChanged: (References? value) {
provider.selectedReferenceId = if (value != null) {
value!.id!; if (provider
provider.selectedReferenceValue = .referencesList
value!.name!; .isNotEmpty) {
} provider.selectedReference = value;
provider.selectedReferenceId =
value!.id!;
provider.selectedReferenceValue =
value!.name!;
} }
}, }
isExpanded: true, },
buttonStyleData: ddtheme.buttonStyleData, isExpanded: true,
iconStyleData: ddtheme.iconStyleData, buttonStyleData: ddtheme.buttonStyleData,
menuItemStyleData: iconStyleData: ddtheme.iconStyleData,
ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.menuItemStyleData,
ddtheme.dropdownStyleData, dropdownStyleData:
), ddtheme.dropdownStyleData,
), ),
], ),
), ],
), ),
errorWidget(context, provider.referenceError), ),
TextWidget(context, "Team"), errorWidget(context, provider.referenceError),
DropdownButtonHideUnderline( TextWidget(context, "Team"),
child: Row( DropdownButtonHideUnderline(
children: [ child: Row(
Expanded( children: [
child: DropdownButton2<Teams>( Expanded(
hint: Text( child: DropdownButton2<Teams>(
"Select Team", hint: Text(
style: TextStyle(fontSize: 14), "Select Team",
), style: TextStyle(fontSize: 14),
items: ),
provider.teamsList items:
.map( provider.teamsList
(slist) => .map(
DropdownMenuItem<Teams>( (slist) =>
value: slist, DropdownMenuItem<Teams>(
child: Text( value: slist,
slist.name!, child: Text(
style: TextStyle( slist.name!,
fontSize: 14, style: TextStyle(
), fontSize: 14,
), ),
), ),
) ),
.toList(), )
value: provider.selectedTeams, .toList(),
onChanged: (Teams? value) { // value: provider.selectedTeams,
if (value != null) { value: provider.teamsList.isNotEmpty?provider.selectedTeams!=null?
if (provider.teamsList.isNotEmpty) { provider.teamsList.firstWhere((element) => element.id==provider.selectedTeamsId,
provider.selectedTeams = value; orElse: () => provider.teamsList[0],
provider.selectedTeamsId = ):null:null,
value!.id!; onChanged: (Teams? value) {
provider.selectedTeamsValue = if (value != null) {
value!.name!; if (provider.teamsList.isNotEmpty) {
provider provider.selectedTeams = value;
.crmLeadListSegmentOnTeamAPIFunction( provider.selectedTeamsId =
context, value!.id!;
"", provider.selectedTeamsValue =
provider.selectedTeamsId, value!.name!;
);
if(provider.segmentsList.isNotEmpty){
provider.segmentsList.clear();
provider.selectedSegmentId = null;
provider.selectedSegmentValue = null;
} }
provider
.crmLeadListSegmentOnTeamAPIFunction(
context,
"",
provider.selectedTeamsId,
);
} }
}, }
isExpanded: true, },
buttonStyleData: ddtheme.buttonStyleData, isExpanded: true,
iconStyleData: ddtheme.iconStyleData, buttonStyleData: ddtheme.buttonStyleData,
menuItemStyleData: iconStyleData: ddtheme.iconStyleData,
ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.menuItemStyleData,
ddtheme.dropdownStyleData, dropdownStyleData:
), ddtheme.dropdownStyleData,
), ),
], ),
), ],
), ),
errorWidget(context, provider.teamsError), ),
TextWidget(context, "Segment"), errorWidget(context, provider.teamsError),
DropdownButtonHideUnderline( TextWidget(context, "Segment"),
child: Row( DropdownButtonHideUnderline(
children: [ child: Row(
Expanded( children: [
child: DropdownButton2<Segments>( Expanded(
hint: Text( child: DropdownButton2<Segments>(
"Select Segment", hint: Text(
style: TextStyle(fontSize: 14), "Select Segment",
), style: TextStyle(fontSize: 14),
items: ),
provider.segmentsList items:
.map( provider.segmentsList
(slist) => .map(
DropdownMenuItem<Segments>( (slist) =>
value: slist, DropdownMenuItem<Segments>(
child: Text( value: slist,
slist.name!, child: Text(
style: TextStyle( slist.name!,
fontSize: 14, style: TextStyle(
), fontSize: 14,
), ),
), ),
) ),
.toList(), )
value: provider.selectedSegment, .toList(),
onChanged: (Segments? value) { // value: provider.selectedSegment,
if (value != null) { value: provider.segmentsList.isNotEmpty?provider.selectedSegment!=null?
if (provider provider.segmentsList.firstWhere((element) => element.id==provider.selectedSegmentId,
.segmentsList orElse: () => provider.segmentsList[0],
.isNotEmpty) { ):null:null,
provider.selectedSegment = value; onChanged: (Segments? value) {
provider.selectedSegmentId = if (value != null) {
value!.id!; if (provider
provider.selectedSegmentValue = .segmentsList
value!.name!; .isNotEmpty) {
} provider.selectedSegment = value;
provider.selectedSegmentId =
value!.id!;
provider.selectedSegmentValue =
value!.name!;
} }
}, }
isExpanded: true, },
buttonStyleData: ddtheme.buttonStyleData, isExpanded: true,
iconStyleData: ddtheme.iconStyleData, buttonStyleData: ddtheme.buttonStyleData,
menuItemStyleData: iconStyleData: ddtheme.iconStyleData,
ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.menuItemStyleData,
ddtheme.dropdownStyleData, dropdownStyleData:
), ddtheme.dropdownStyleData,
), ),
], ),
), ],
), ),
errorWidget(context, provider.segmentsError), ),
], errorWidget(context, provider.segmentsError),
), ],
), ),
), ),
Step( ),
label: Text("Step 3", style: TextStyle(fontSize: 12)), Step(
title: const Text(''), label: Text("Step 3", style: TextStyle(fontSize: 12)),
isActive: _currentStep >= 2, title: const Text(''),
content: Column( isActive: _currentStep >= 2,
crossAxisAlignment: CrossAxisAlignment.start, content: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Container( children: [
padding: EdgeInsets.symmetric( Container(
horizontal: 10, padding: EdgeInsets.symmetric(
vertical: 10, horizontal: 10,
), vertical: 10,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
InkResponse( InkResponse(
onTap: () async { onTap: () async {
var res = await Navigator.push( var res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => Addleadproductscreen( (context) => Addleadproductscreen(
type: "Add", type: "Add",
), ),
settings: RouteSettings( settings: RouteSettings(
name: name:
'Generatequotationaddeditproduct', 'Generatequotationaddeditproduct',
),
), ),
);
if (res != null) {
print("result ${res}");
}
},
child: Container(
margin: const EdgeInsets.symmetric(
vertical: 10,
), ),
height: 45, );
width: MediaQuery.of(context).size.width, if (res != null) {
decoration: BoxDecoration( print("result ${res}");
color: const Color(0xFFE6F6FF), }
borderRadius: BorderRadius.circular(12), },
border: Border.all( child: Container(
color: AppColors.app_blue, margin: const EdgeInsets.symmetric(
width: 0.5, 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( child: Center(
"+ Add Product", child: Text(
style: TextStyle( "+ Add Product",
fontFamily: "JakartaMedium", style: TextStyle(
color: AppColors.app_blue, fontFamily: "JakartaMedium",
), color: AppColors.app_blue,
), ),
), ),
), ),
), ),
),
if (provider.productRows.isNotEmpty) ...[ if (provider.productRows.isNotEmpty) ...[
const SizedBox(height: 10), const SizedBox(height: 10),
SizedBox( SizedBox(
height: 125, height: 125,
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: provider.productRows.length, itemCount: provider.productRows.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final product = final product =
provider.productRows[index]; provider.productRows[index];
final productName = final productName =
provider.productsList provider.productsList
.firstWhere( .firstWhere(
(p) => (p) =>
p.id == p.id ==
product['product_id'], product['product_id'],
orElse: orElse:
() => Products( () => Products(
id: '', id: '',
name: 'Unknown', name: 'Unknown',
), ),
) )
.name; .name;
final prodPrice = final prodPrice =
product['price'] ?? '-'; product['price'] ?? '-';
final prodQty = product['qty'] ?? '-'; final prodQty = product['qty'] ?? '-';
final totalPrice = final totalPrice =
product['net_price'] ?? '-'; product['net_price'] ?? '-';
return InkResponse( return InkResponse(
onTap: () async { onTap: () async {
var res = await Navigator.push( var res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => (context) =>
Addleadproductscreen( Addleadproductscreen(
type: "Edit", type: "Edit",
editIndex: index, editIndex: index,
), ),
settings: RouteSettings( settings: RouteSettings(
name: name:
'Generatequotationaddeditproduct', 'Generatequotationaddeditproduct',
),
), ),
);
if (res != null) {
print("result ${res}");
}
},
child: Container(
width:
MediaQuery.of(
context,
).size.width *
0.8,
margin: EdgeInsets.only(
left: index == 0 ? 10 : 5,
right:
index ==
provider
.productRows
.length -
1
? 10
: 5,
bottom: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius:
BorderRadius.circular(14),
), ),
child: Row( );
mainAxisAlignment: if (res != null) {
MainAxisAlignment.start, print("result ${res}");
crossAxisAlignment: }
CrossAxisAlignment.start, },
children: [ child: Container(
Expanded( width:
flex: 1, MediaQuery.of(
child: SvgPicture.asset( context,
"assets/svg/crm/product_details_ic.svg", ).size.width *
), 0.8,
margin: EdgeInsets.only(
left: index == 0 ? 10 : 5,
right:
index ==
provider
.productRows
.length -
1
? 10
: 5,
bottom: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius:
BorderRadius.circular(14),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/crm/product_details_ic.svg",
), ),
SizedBox(width: 10), ),
Expanded( SizedBox(width: 10),
flex: 6, Expanded(
child: Column( flex: 6,
crossAxisAlignment: child: Column(
CrossAxisAlignment crossAxisAlignment:
.start, CrossAxisAlignment
mainAxisAlignment: .start,
MainAxisAlignment.start, mainAxisAlignment:
children: [ MainAxisAlignment.start,
Row( children: [
children: [ Row(
Expanded( children: [
flex: 4, Expanded(
child: Text( flex: 4,
productName ?? child: Text(
"-", productName ??
maxLines: 2, "-",
overflow: maxLines: 2,
TextOverflow overflow:
.ellipsis, TextOverflow
style: TextStyle( .ellipsis,
fontFamily: style: TextStyle(
"JakartaMedium", fontFamily:
fontSize: 14, "JakartaMedium",
color: fontSize: 14,
AppColors color:
.semi_black, AppColors
), .semi_black,
),
),
Expanded(
flex: 3,
child: Text(
textAlign:
TextAlign
.right,
"₹$prodPrice",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
), ),
), ),
],
),
Text(
"x $prodQty",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.grey_semi,
), ),
), Expanded(
SizedBox(height: 5), flex: 3,
DottedLine( child: Text(
dashGapLength: 4, textAlign:
dashGapColor: TextAlign
Colors.white, .right,
dashColor: "₹$prodPrice",
AppColors.grey_semi,
dashLength: 2,
lineThickness: 0.5,
),
SizedBox(height: 5),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
"₹$totalPrice",
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
"JakartaMedium", "JakartaMedium",
...@@ -822,544 +844,584 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -822,544 +844,584 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
.semi_black, .semi_black,
), ),
), ),
], ),
],
),
Text(
"x $prodQty",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.grey_semi,
), ),
], ),
), SizedBox(height: 5),
DottedLine(
dashGapLength: 4,
dashGapColor:
Colors.white,
dashColor:
AppColors.grey_semi,
dashLength: 2,
lineThickness: 0.5,
),
SizedBox(height: 5),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
"₹$totalPrice",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
],
),
],
), ),
], ),
), ],
), ),
); ),
}, );
), },
), ),
], ),
if(provider.productsEmptyError!.trim().isNotEmpty)...[
errorWidget(context, provider.productsEmptyError)
]
], ],
),
),
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, if(provider.productsEmptyError!.trim().isNotEmpty)...[
value: errorWidget(context, provider.productsEmptyError)
provider.statesList.isNotEmpty ]
? provider.selectedStates != ],
null ),
? provider.statesList!.firstWhere( ),
(ord) => SizedBox(height: 10),
ord.id == Container(
provider padding: EdgeInsets.symmetric(
.selectedStatesId, horizontal: 10,
orElse: vertical: 10,
() => ),
provider
.statesList![0]!,
)
: null
: null,
onChanged: (States? value) {
if (value != null) {
if (provider
.statesList
.isNotEmpty) {
provider.selectedStates = value;
provider.selectedStatesId =
value!.id!;
provider.selectedStatesValue =
value!.name!;
provider
.crmLeadListDistrictsOnStateAPIFunction(
context,
"",
value!.id!,
);
if (provider
.districtsList
.isNotEmpty) {
provider.districtsList
.clear();
provider.subLocationsList.clear();
// provider.selectedDistricts = null;
provider.selectedDistrictId =
null;
provider.selectedDistrictValue =
"";
provider.selectedSubLocationId = null;
provider.selectedSubLocationValue = "";
}
} decoration: BoxDecoration(
} color: Colors.white,
}, borderRadius: BorderRadius.circular(16),
isExpanded: true, ),
buttonStyleData: child: Column(
ddtheme.buttonStyleData, crossAxisAlignment: CrossAxisAlignment.start,
iconStyleData: ddtheme.iconStyleData, children: [
menuItemStyleData: TextWidget(context, "State"),
ddtheme.menuItemStyleData, DropdownButtonHideUnderline(
dropdownStyleData: child: Row(
ddtheme.dropdownStyleData, children: [
Expanded(
child: DropdownButton2<States>(
hint: Text(
"Select State",
style: TextStyle(fontSize: 14),
), ),
), items:
], provider.statesList
), .map(
), (slist) => DropdownMenuItem<
errorWidget(context, provider.statesError), States
TextWidget(context, "District"), >(
DropdownButtonHideUnderline( value: slist,
child: Row( child: Text(
children: [ slist.name!,
Expanded( style: TextStyle(
child: DropdownButton2<Districts>( fontSize: 14,
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(), )
.toList(),
// value: provider.selectedDistricts, // value: provider.selectedStates,
value: value:
provider.districtsList.isNotEmpty provider.statesList.isNotEmpty
? provider.selectedDistricts != ? provider.selectedStates !=
null null
? provider.districtsList! ? provider.statesList!.firstWhere(
.firstWhere( (ord) =>
(ord) => ord.id ==
ord.id == provider
provider .selectedStatesId,
.selectedDistrictId, orElse:
orElse: () =>
() => provider
provider .statesList![0]!,
.districtsList![0]!, )
) : null
: null : null,
: null, onChanged: (States? value) {
onChanged: (Districts? value) { if (value != null) {
if (value != null) { if (provider
.statesList
.isNotEmpty) {
provider.selectedStates = value;
provider.selectedStatesId =
value!.id!;
provider.selectedStatesValue =
value!.name!;
provider
.crmLeadListDistrictsOnStateAPIFunction(
context,
"",
value!.id!,
);
if (provider if (provider
.districtsList .districtsList
.isNotEmpty) { .isNotEmpty) {
provider.selectedDistricts = provider.districtsList
value; .clear();
provider.subLocationsList.clear();
// provider.selectedDistricts = null;
provider.selectedDistrictId = provider.selectedDistrictId =
value!.id!; null;
provider.selectedDistrictValue = provider.selectedDistrictValue =
value!.district!; "";
provider
.crmLeadListSubLocOnDistrictAPIFunction(
context,
"",
value!.id!,
);
if (provider
.subLocationsList
.isNotEmpty) {
provider.subLocationsList
.clear();
// provider.selectedSubLocations =
// null;
provider.selectedSubLocationId =
null;
provider.selectedSubLocationValue =
"";
}
provider.selectedSubLocationId = null;
provider.selectedSubLocationValue = "";
} }
} }
}, }
isExpanded: true, },
buttonStyleData: isExpanded: true,
ddtheme.buttonStyleData, buttonStyleData:
iconStyleData: ddtheme.iconStyleData, ddtheme.buttonStyleData,
menuItemStyleData: iconStyleData: ddtheme.iconStyleData,
ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.menuItemStyleData,
ddtheme.dropdownStyleData, dropdownStyleData:
), ddtheme.dropdownStyleData,
), ),
], ),
), ],
), ),
errorWidget(context, provider.districtsError), ),
TextWidget(context, "Sub Location"), errorWidget(context, provider.statesError),
DropdownButtonHideUnderline( TextWidget(context, "District"),
child: Row( DropdownButtonHideUnderline(
children: [ child: Row(
Expanded( children: [
child: DropdownButton2<SubLocations>( Expanded(
hint: Text( child: DropdownButton2<Districts>(
"Select Sub Location", hint: Text(
style: TextStyle(fontSize: 14), "Select District",
), style: TextStyle(fontSize: 14),
items: ),
provider.subLocationsList items:
.map( provider.districtsList
(slist) => DropdownMenuItem< .map(
SubLocations (slist) => DropdownMenuItem<
>( Districts
value: slist, >(
child: Text( value: slist,
slist.subLocality!, child: Text(
style: TextStyle( slist.district!,
fontSize: 14, style: TextStyle(
), fontSize: 14,
), ),
), ),
) ),
.toList(), )
.toList(),
// value: provider.selectedSubLocations, // value: provider.selectedDistricts,
value: value:
provider.districtsList.isNotEmpty
? provider.selectedDistricts !=
null
? provider.districtsList!
.firstWhere(
(ord) =>
ord.id ==
provider
.selectedDistrictId,
orElse:
() =>
provider
.districtsList![0]!,
)
: null
: null,
onChanged: (Districts? value) {
if (value != null) {
if (provider
.districtsList
.isNotEmpty) {
provider.selectedDistricts =
value;
provider.selectedDistrictId =
value!.id!;
provider.selectedDistrictValue =
value!.district!;
provider provider
.subLocationsList .crmLeadListSubLocOnDistrictAPIFunction(
.isNotEmpty context,
? provider.selectedSubLocations != "",
null value!.id!,
? provider );
.subLocationsList!
.firstWhere(
(ord) =>
ord.id ==
provider
.selectedSubLocationId,
orElse:
() =>
provider
.subLocationsList![0]!,
)
: null
: null,
onChanged: (SubLocations? value) {
if (value != null) {
if (provider if (provider
.subLocationsList .subLocationsList
.isNotEmpty) { .isNotEmpty) {
provider.selectedSubLocations = provider.subLocationsList
value; .clear();
// provider.selectedSubLocations =
// null;
provider.selectedSubLocationId = provider.selectedSubLocationId =
value!.id!; null;
provider.selectedSubLocationValue = provider.selectedSubLocationValue =
value!.subLocality!; "";
} }
} }
}, }
isExpanded: true, },
buttonStyleData: isExpanded: true,
ddtheme.buttonStyleData, buttonStyleData:
iconStyleData: ddtheme.iconStyleData, ddtheme.buttonStyleData,
menuItemStyleData: iconStyleData: ddtheme.iconStyleData,
ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.menuItemStyleData,
ddtheme.dropdownStyleData, dropdownStyleData:
), ddtheme.dropdownStyleData,
), ),
], ),
), ],
), ),
errorWidget(context, provider.subLocError), ),
TextWidget(context, "Lead Status"), errorWidget(context, provider.districtsError),
DropdownButtonHideUnderline( TextWidget(context, "Sub Location"),
child: Row( DropdownButtonHideUnderline(
children: [ child: Row(
Expanded( children: [
child: DropdownButton2<String>( Expanded(
isExpanded: true, child: DropdownButton2<SubLocations>(
hint: const Row( hint: Text(
children: [ "Select Sub Location",
Expanded( style: TextStyle(fontSize: 14),
child: Text( ),
'Select Lead Status', items:
style: TextStyle( provider.subLocationsList
fontSize: 14, .map(
(slist) => DropdownMenuItem<
SubLocations
>(
value: slist,
child: Text(
slist.subLocality!,
style: TextStyle(
fontSize: 14,
),
),
), ),
overflow: )
TextOverflow.ellipsis, .toList(),
// value: provider.selectedSubLocations,
value:
provider
.subLocationsList
.isNotEmpty
? provider.selectedSubLocations !=
null
? provider
.subLocationsList!
.firstWhere(
(ord) =>
ord.id ==
provider
.selectedSubLocationId,
orElse:
() =>
provider
.subLocationsList![0]!,
)
: null
: null,
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'] items:
.map( <String>['Cold', 'Hot', 'Warm']
(value) => DropdownMenuItem< .map(
String (value) => DropdownMenuItem<
>( String
value: value, >(
child: Text( value: value,
value ?? '', child: Text(
style: const TextStyle( value ?? '',
fontSize: 14, style: const TextStyle(
), fontSize: 14,
overflow:
TextOverflow
.ellipsis,
), ),
overflow:
TextOverflow
.ellipsis,
), ),
) ),
.toList(), )
value: provider.selectedLeadStatus, .toList(),
onChanged: (String? newValue) { value: provider.selectedLeadStatus,
setState(() { onChanged: (String? newValue) {
provider.selectedLeadStatus = setState(() {
newValue!; provider.selectedLeadStatus =
}); newValue!;
}, });
buttonStyleData: },
ddtheme.buttonStyleData, buttonStyleData:
iconStyleData: ddtheme.iconStyleData, ddtheme.buttonStyleData,
menuItemStyleData: iconStyleData: ddtheme.iconStyleData,
ddtheme.menuItemStyleData, menuItemStyleData:
dropdownStyleData: ddtheme.menuItemStyleData,
ddtheme.dropdownStyleData, dropdownStyleData:
), ddtheme.dropdownStyleData,
), ),
], ),
), ],
),
errorWidget(context, provider.leadStatusError),
textControllerWidget(
context,
provider.addressController,
"Address",
"Enter Address ",
provider.onChangeaddress,
TextInputType.streetAddress,
false,
null,
), ),
),
errorWidget(context, provider.leadStatusError),
textControllerWidget(
context,
provider.addressController,
"Address",
"Enter Address ",
provider.onChangeaddress,
TextInputType.streetAddress,
false,
null,
),
errorWidget(context, provider.addressError), errorWidget(context, provider.addressError),
], ],
),
), ),
], ),
), ],
), ),
], ),
controlsBuilder: (context, details) { ],
// return Row( controlsBuilder: (context, details) {
// children: [ // return Row(
// ElevatedButton( // children: [
// onPressed: () { // ElevatedButton(
// setState(() { // onPressed: () {
// if (_currentStep == 0) { // setState(() {
// _currentStep = 1; // if (_currentStep == 0) {
// } else if (_currentStep == 1) { // _currentStep = 1;
// _currentStep = 2; // } else if (_currentStep == 1) {
// } else { // _currentStep = 2;
// _currentStep = 0; // } else {
// } // _currentStep = 0;
// }); // }
// details.onStepContinue; // });
// }, // details.onStepContinue;
// child: Text(_currentStep == 2 ? 'Submit' : 'Next'), // },
// ), // child: Text(_currentStep == 2 ? 'Submit' : 'Next'),
// const SizedBox(width: 10), // ),
// if (_currentStep > 0) // const SizedBox(width: 10),
// TextButton( // if (_currentStep > 0)
// onPressed: () { // TextButton(
// setState(() { // onPressed: () {
// if (_currentStep == 2) { // setState(() {
// _currentStep = 1; // if (_currentStep == 2) {
// } else if (_currentStep == 1) { // _currentStep = 1;
// _currentStep = 0; // } else if (_currentStep == 1) {
// } else { // _currentStep = 0;
// _currentStep = 2; // } else {
// } // _currentStep = 2;
// }); // }
// details.onStepCancel; // });
// }, // details.onStepCancel;
// child: const Text('Back'), // },
// ), // child: const Text('Back'),
// ], // ),
// ); // ],
return Column( // );
children: [ return Column(
if (_currentStep == 2) ...[ children: [
InkResponse( if (_currentStep == 2) ...[
onTap: () { InkResponse(
if (provider.validateStep3()) { onTap: () {
if(provider.productRows.isNotEmpty){ if (provider.validateStep3()) {
provider.crmAddNewLeadsAndProspectsAPIFunction( if(provider.productRows.isNotEmpty){
context, provider.crmAddNewLeadsAndProspectsAPIFunction(
"", context,
provider.selectedEmployeesId, "",
provider.selectedSalutation, provider.selectedEmployeesId,
provider.selectedDistrictId, provider.selectedSalutation,
provider.selectedStatesId, provider.selectedDistrictId,
provider.selectedSegmentId, provider.selectedStatesId,
provider.selectedSourcesId, provider.selectedSegmentId,
provider.selectedReferenceId, provider.selectedSourcesId,
provider.selectedReferenceId, provider.selectedReferenceId,
provider.selectedSubLocationId, provider.selectedReferenceId,
provider.selectedLeadStatus, provider.selectedSubLocationId,
provider.getJsonEncodedProducts(), provider.selectedLeadStatus,
); provider.getJsonEncodedProducts(),
}else{ );
toast(context, "Add min. 1 product"); }else{
} toast(context, "Add min. 1 product");
} }
details.onStepContinue; }
},
child: Container( details.onStepContinue;
height: 45, },
alignment: Alignment.center, child: Container(
margin: EdgeInsets.symmetric( height: 45,
horizontal: 10, alignment: Alignment.center,
vertical: 10, margin: EdgeInsets.symmetric(
), horizontal: 10,
padding: EdgeInsets.symmetric( vertical: 10,
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,
),
),
), ),
), padding: EdgeInsets.symmetric(
] else ...[ horizontal: 10,
InkResponse( vertical: 5,
onTap: () { ),
setState(() { decoration: BoxDecoration(
if (_currentStep == 0) { color: AppColors.app_blue,
if (provider.validateStep1()) { borderRadius: BorderRadius.circular(15),
_currentStep = 1; ),
} child: Text(
} else if (_currentStep == 1) { "Submit",
if (provider.validateStep2()) { style: TextStyle(
_currentStep = 2; fontSize: 15,
} fontFamily: "JakartaMedium",
} else { color: Colors.white,
_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) ...[ ] else ...[
TextButton( InkResponse(
onPressed: () { onTap: () {
setState(() { setState(() {
if (_currentStep == 2) { if (_currentStep == 0) {
if (provider.validateStep1()) {
_currentStep = 1; _currentStep = 1;
} else if (_currentStep == 1) { }
_currentStep = 0; } else if (_currentStep == 1) {
} else { if (provider.validateStep2()) {
_currentStep = 2; _currentStep = 2;
} }
}); } else {
details.onStepCancel; _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( child: Text(
'Back', "Proceed to Next Step",
textAlign: TextAlign.start,
style: TextStyle( style: TextStyle(
color: AppColors.app_blue, fontSize: 15,
fontSize: 14, 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,
),
),
),
], ],
); ],
}, );
), },
), ),
), ),
), ),
......
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