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 {
}
}
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) {
accountError = null;
nameError = null;
......
......@@ -8,6 +8,7 @@ import 'package:flutter_download_manager/flutter_download_manager.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:generp/Models/crmModels/crmSelectedProductDetailsResponse.dart';
import 'package:generp/screens/LoginScreen.dart';
import 'package:generp/screens/crm/LeadDetailsByMode.dart';
import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart';
......@@ -600,7 +601,18 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier {
);
if (data != null) {
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);
resetForm();
notifyListeners();
......
......@@ -535,7 +535,7 @@ class crmLeadDetailsProvider extends ChangeNotifier {
child: Column(
children: [
Expanded(
flex: 1,
flex: 2,
child: SizedBox(
height: 40,
child: Row(
......@@ -571,7 +571,7 @@ class crmLeadDetailsProvider extends ChangeNotifier {
),
),
Expanded(
flex: 3,
flex: 4,
child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(),
......
......@@ -415,7 +415,7 @@ class crmProspectDetailsProvider extends ChangeNotifier {
child: Column(
children: [
Expanded(
flex: 1,
flex: 2,
child: SizedBox(
height: 40,
child: Row(
......@@ -451,7 +451,7 @@ class crmProspectDetailsProvider extends ChangeNotifier {
),
),
Expanded(
flex: 3,
flex: 4,
child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(),
......
......@@ -8,6 +8,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import '../../screens/crm/LeadDetailsByMode.dart';
import '../../services/api_calling.dart';
import 'crmLeadDetailsProvider.dart';
......@@ -156,6 +157,7 @@ class followUpUpdateProvider extends ChangeNotifier {
Future<void> crmAddFollowUpAPIFunction(
BuildContext context,
fromScreen,
nextAppointmentStatus,
orderStatus,
leadID,
......@@ -196,7 +198,23 @@ class followUpUpdateProvider extends ChangeNotifier {
if (data != null && data.error == "0") {
_submitLoading = false;
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){
prov2.crmLeadDetailsAPIFunction(context, leadID, mode);
}
......@@ -332,7 +350,7 @@ class followUpUpdateProvider extends ChangeNotifier {
child: Column(
children: [
Expanded(
flex: 1,
flex: 2,
child: SizedBox(
height: 40,
child: Row(
......@@ -369,7 +387,7 @@ class followUpUpdateProvider extends ChangeNotifier {
),
Expanded(
flex: 3,
flex: 4,
child: CupertinoDatePicker(
initialDateTime: _date ?? DateTime.now(),
minimumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day),
......
......@@ -13,6 +13,9 @@ import 'package:provider/provider.dart';
import 'approveRejectPaymentRequestResponse.dart';
class Requesitionlidtdetailsprovider extends ChangeNotifier {
bool _showMoreDetails = false;
TextEditingController requestedAmount = TextEditingController();
TextEditingController approvedAmountReadonly = TextEditingController();
TextEditingController proposedPaymentAccount = TextEditingController();
......@@ -55,6 +58,8 @@ String? proposedAmountError;
get image_picked => _image_picked;
bool get showMoreDetails => _showMoreDetails;
int get imagePicked => _image_picked;
File? get imagePath => _imageName;
......@@ -76,6 +81,11 @@ String? proposedAmountError;
notifyListeners();
}
set showMoreDetails(bool value){
_showMoreDetails = value;
notifyListeners();
}
PaymentDetails get paymentsDetails => _paymentDetails;
RequestDetails get requestsDetails => _requestDetails;
......
......@@ -676,7 +676,7 @@ class Requestionlistprovider extends ChangeNotifier {
child: Column(
children: [
Expanded(
flex: 1,
flex: 2,
child: SizedBox(
height: 40,
child: Row(
......@@ -712,7 +712,7 @@ class Requestionlistprovider extends ChangeNotifier {
),
),
Expanded(
flex: 3,
flex: 4,
child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(),
......
......@@ -29,6 +29,8 @@ import 'package:share_plus/share_plus.dart';
import 'package:printing/printing.dart';
class Paymentreceiptsprovider extends ChangeNotifier {
bool _showMoreDetails = false;
List<ReceiptsList> _receiptsList = [];
ReceiptDetails _receiptDetails = ReceiptDetails();
List<String> _headings = [];
......@@ -83,6 +85,7 @@ class Paymentreceiptsprovider extends ChangeNotifier {
String _receiptPaymentModesID = "";
String _receiptPaymentModesValues = "";
bool get showMoreDetails => _showMoreDetails;
List<Accounts> get receiptAccounts => _receiptAccounts;
List<ReceiptAccounts> get receiptPaymentAccounts => _receiptPaymentAccounts;
......@@ -110,6 +113,10 @@ class Paymentreceiptsprovider extends ChangeNotifier {
// Date picker methods
set showMoreDetails(bool value){
_showMoreDetails = value;
notifyListeners();
}
set selectreceiptAccounts(Accounts? value) {
_selectedreceiptAccounts = value;
_receiptAccountID = value!.id!;
......@@ -945,7 +952,7 @@ class Paymentreceiptsprovider extends ChangeNotifier {
child: Column(
children: [
Expanded(
flex: 1,
flex: 2,
child: SizedBox(
height: 40,
child: Row(
......@@ -982,7 +989,7 @@ class Paymentreceiptsprovider extends ChangeNotifier {
),
),
Expanded(
flex: 3,
flex: 4,
child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(),
......
......@@ -19,6 +19,8 @@ import 'package:provider/provider.dart';
import '../../Utils/commonServices.dart';
class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{
bool _showMoreDetails = false;
List<PaymentsList> _paymentsList = [];
PaymentDetails _paymentDetails = PaymentDetails();
List<String> _headings = [];
......@@ -29,6 +31,12 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{
List<String> get Headings => _headings;
List<String> get subHeadings => _subHeadings;
bool get isLoading => _isLoading;
bool get showMoreDetails => _showMoreDetails;
set showMoreDetails(bool value){
_showMoreDetails = value;
notifyListeners();
}
Future<void> paymentsListAPI(context,from,to) async {
try{
......
......@@ -150,7 +150,7 @@ set isLoading(bool value){
if (password.isEmpty) {
_passwordError = "Please enter your password";
}
_isLoading = false;
notifyListeners();
return _emailError.isEmpty && _passwordError.isEmpty;
}
......@@ -199,15 +199,23 @@ set isLoading(bool value){
);
notifyListeners();
} else if (data.error == 1) {
_isLoading = false;
notifyListeners();
toast(context,
"You are not authorized to login in this device !");
} else if (data.error == 2) {
_isLoading = false;
notifyListeners();
toast(context, "Invalid login credentials !");
} else {
_isLoading = false;
notifyListeners();
toast(context, "Invalid login credentials !");
}
} else {}
} else {
_isLoading = false;
notifyListeners();
}
} on Exception catch (e) {
debugPrint("$e");
}
......
......@@ -1565,7 +1565,7 @@ class Addorderprovider extends ChangeNotifier {
child: Column(
children: [
Expanded(
flex: 1,
flex: 2,
child: SizedBox(
height: 40,
child: Row(
......@@ -1595,7 +1595,7 @@ class Addorderprovider extends ChangeNotifier {
),
),
Expanded(
flex: 3,
flex: 4,
child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(),
......
......@@ -603,7 +603,7 @@ class Addpaymentprovider extends ChangeNotifier{
child: Column(
children: [
Expanded(
flex: 1,
flex: 2,
child: SizedBox(
height: 40,
child: Row(
......@@ -633,7 +633,7 @@ class Addpaymentprovider extends ChangeNotifier{
),
),
Expanded(
flex: 3,
flex: 4,
child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy,
initialDateTime: _date ?? DateTime.now(),
......
......@@ -5,6 +5,7 @@ import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:generp/Utils/commonWidgets.dart';
import '../Utils/commonServices.dart';
......@@ -209,11 +210,22 @@ class _MyHomePageState extends State<MyHomePage> {
toolbarHeight: 0,
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(
children: [
Expanded(
flex: 3,
flex: 4,
child: InkResponse(
onTap: () {
_showProfileBottomSheet(
......@@ -394,20 +406,8 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
Expanded(
flex: 12,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppColors.scaffold_bg_color,
AppColors.scaffold_bg_color,
Color(0xFFCEEDFF),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
flex: 13,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
......@@ -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(
// flex: 10,
// child: Container(
......@@ -1623,16 +1637,8 @@ class _MyHomePageState extends State<MyHomePage> {
],
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: Container(
height: 40,
alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(bottom: 20),
child: Image.asset(
fit: BoxFit.scaleDown,
"assets/images/horizontal_logo.png",
),
),
// floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
// floatingActionButton:
),
),
),
......
......@@ -323,20 +323,31 @@ class _LoginScreenState extends State<LoginScreen>
15,
0,
),
child: TextField(
child: TextFormField(
controller: email,
keyboardType:
TextInputType.emailAddress,
minLines: 1,
autofocus: true,
focusNode: _emailFocusNode,
style: TextStyle(fontSize: 14),
onChanged: (value) {
loginProv.updateEmail(email.text);
},
textInputAction: TextInputAction.next,
onTapOutside: (event) {
// Handle onTapOutside
FocusScope.of(context).unfocus();
},
onEditingComplete: () {
if (_emailFocusNode.hasFocus) {
setState(() {
_emailFocusNode.unfocus();
_passwordFocusNode
.requestFocus();
});
}
},
decoration: InputDecoration(
isDense: true,
hintStyle: TextStyle(
......@@ -358,12 +369,12 @@ class _LoginScreenState extends State<LoginScreen>
margin: EdgeInsets.only(
top: 2.5,
bottom: 2.5,
left: 25,
left: 10,
),
child: Text(
loginProv.emailError,
textAlign: TextAlign.start,
style: TextStyle(color: Colors.red),
style: TextStyle(color: Colors.red,fontSize: 10,),
),
),
] else ...[
......@@ -410,12 +421,13 @@ class _LoginScreenState extends State<LoginScreen>
0,
0,
),
child: TextField(
child: TextFormField(
controller: password,
focusNode: _passwordFocusNode,
obscureText: !loginProv.pwdVisible,
keyboardType:
TextInputType.visiblePassword,
textInputAction: TextInputAction.done,
style: TextStyle(fontSize: 14),
onChanged: (value) {
loginProv.updatePassword(
......@@ -423,6 +435,19 @@ class _LoginScreenState extends State<LoginScreen>
);
},
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(
contentPadding: EdgeInsets.fromLTRB(
0,
......@@ -467,80 +492,82 @@ class _LoginScreenState extends State<LoginScreen>
margin: EdgeInsets.only(
top: 2.5,
bottom: 2.5,
left: 25,
left: 10,
),
child: Text(
loginProv.passwordError,
textAlign: TextAlign.start,
style: TextStyle(color: Colors.red),
style: TextStyle(
color: Colors.red,
fontSize: 10,
),
),
),
] else ...[
SizedBox(height: 25.0),
SizedBox(height: 15.0),
],
Container(
child: InkWell(
onTap:
loginProv.isLoading
? null
: () {
// LoginApiFunction();
loginProv.isLoading = true;
loginProv.LoginApiFunction(
context,
email.text,
password.text,
);
var f = FocusScope.of(
context,
);
SizedBox(height: 10,),
InkWell(
onTap:
loginProv.isLoading
? null
: () {
// LoginApiFunction();
loginProv.isLoading = true;
loginProv.LoginApiFunction(
context,
email.text,
password.text,
);
var f = FocusScope.of(
context,
);
if (!f.hasPrimaryFocus) {
f.unfocus();
}
// Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile()));
},
child: Container(
alignment: Alignment.center,
height: 45,
width: screenWidth,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
),
decoration: BoxDecoration(
color:
loginProv.isButtonEnabled
? AppColors.app_blue
: AppColors.button_disabled,
//1487C9
borderRadius: BorderRadius.circular(
15.0,
),
if (!f.hasPrimaryFocus) {
f.unfocus();
}
// Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile()));
},
child: Container(
alignment: Alignment.center,
height: 45,
width: screenWidth,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
),
decoration: BoxDecoration(
color:
loginProv.isButtonEnabled
? AppColors.app_blue
: AppColors.button_disabled,
//1487C9
borderRadius: BorderRadius.circular(
15.0,
),
child: Center(
child:
loginProv.isLoading
? CircularProgressIndicator.adaptive(
padding: EdgeInsets.all(
5,
),
valueColor:
AlwaysStoppedAnimation(
Colors.white,
),
)
: Text(
"Login",
textAlign:
TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily:
"JakartaRegular",
),
),
child: Center(
child:
loginProv.isLoading
? CircularProgressIndicator.adaptive(
padding: EdgeInsets.all(
5,
),
),
valueColor:
AlwaysStoppedAnimation(
Colors.white,
),
)
: Text(
"Login",
textAlign:
TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily:
"JakartaRegular",
),
),
),
),
),
......@@ -763,9 +790,15 @@ class LogoWidget extends StatelessWidget {
return Container(
width: 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(
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),
image: DecorationImage(
image: AssetImage(imagePath),
......
......@@ -143,7 +143,7 @@ class _AccountledgerState extends State<Accountledger> {
}
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
appBar: appbar2New(
context,
"Account Ledger List",
provider.resetAll,
......@@ -184,6 +184,7 @@ class _AccountledgerState extends State<Accountledger> {
),
],
),
0xFFFFFFFF
),
backgroundColor: AppColors.scaffold_bg_color,
body:
......
......@@ -27,7 +27,8 @@ class Addcommonpayment extends StatefulWidget {
class _AddcommonpaymentState extends State<Addcommonpayment> {
Dropdowntheme ddtheme = Dropdowntheme();
int _currentStep = 0;
final _formKey = GlobalKey<FormState>();
List<FocusNode> focusNodes = List.generate(20, (index) => FocusNode());
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
......@@ -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
void dispose() {
focusNodes.map((e) => e.dispose());
super.dispose();
_connectivity.disposeStream();
}
Future<bool> onBackPressed(BuildContext context) async {
if (_currentStep > 0) {
_previousStep();
return false;
} else {
return true;
}
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
......@@ -81,6 +118,1076 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
}
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>(
builder: (context, provider, child) {
return Scaffold(
......
......@@ -61,6 +61,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
context,
listen: false,
);
provider.showMoreDetails = false;
provider.crmLeadDetailsAPIFunction(context, widget.leadId, widget.mode);
});
}
......@@ -1566,7 +1567,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
CrossAxisAlignment.start,
children: [
Expanded(
flex:3,
flex: 3,
child: Text(
textAlign: TextAlign.left,
"Feedback",
......@@ -1580,7 +1581,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
Expanded(
flex:7,
flex: 7,
child: Text(
textAlign: TextAlign.right,
provider
......@@ -1799,33 +1800,45 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
),
if(provider
.appointmentDetails[lp]
.astatus=="No")...[
if (provider
.appointmentDetails[lp]
.astatus ==
"No") ...[
Expanded(
flex: 2,
child: Container(
height: 45,
padding: EdgeInsets.symmetric(horizontal: 5),
padding:
EdgeInsets.symmetric(
horizontal: 5,
),
decoration: BoxDecoration(
color: AppColors.processed_bg_color,
borderRadius: BorderRadius.circular(8)
color:
AppColors
.processed_bg_color,
borderRadius:
BorderRadius.circular(
8,
),
),
child: Center(
child: Text(
"Pending",
textAlign: TextAlign.right,
textAlign:
TextAlign.right,
style: TextStyle(
fontFamily: "JakartaMedium",
fontFamily:
"JakartaMedium",
fontSize: 14,
color: AppColors.processed_text_color,
color:
AppColors
.processed_text_color,
),
),
),
),
),
]
],
],
),
Container(
......@@ -3297,13 +3310,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
],
),
// Text(
// "Note: Submit Quantity as Zero (0) to delete Product",
// style: TextStyle(
// color: AppColors.app_blue,
// fontSize: 12,
// ),
// ),
if (type != "add") ...[
Text(
"Note: Submit Quantity as Zero (0) to delete Product",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 12,
),
),
],
if (editProvider.qtyError != null) ...[
errorWidget(context, editProvider.qtyError),
],
......
......@@ -74,6 +74,7 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
context,
widget.leadId,
);
provider.showMoreDetails = false;
provider.crmProspectDetailsAPIFunction(context, widget.leadId);
});
}
......
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:dotted_line/dotted_line.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
......@@ -31,7 +32,8 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
Dropdowntheme ddtheme = Dropdowntheme();
int _currentStep = 0;
final _formKey = GlobalKey<FormState>();
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
// Controllers to store form data
final _nameController = TextEditingController();
final _emailController = TextEditingController();
......@@ -76,10 +78,21 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
const SnackBar(content: Text('Form submitted successfully!')),
);
}
Future<bool> onBackPressed(BuildContext context) async {
if (_currentStep > 0) {
_previousStep();
return false;
} else {
return true;
}
}
@override
void initState() {
super.initState();
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
WidgetsBinding.instance.addPostFrameCallback((_) async {
final provider = Provider.of<Addnewleadsandprospectsprovider>(
context,
......@@ -92,727 +105,736 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
case ConnectivityResult.mobile:
connection = 'Online';
break;
case ConnectivityResult.wifi:
connection = 'Online';
break;
case ConnectivityResult.none:
default:
connection = 'Offline';
}
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Addnewleadsandprospectsprovider>(
builder: (context, provider, child) {
return WillPopScope(
onWillPop: () async {
provider.resetForm();
return true;
},
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar2New(
context,
"Add Leads and Prospect",
provider.resetForm,
const SizedBox(width: 0),
0xFFFFFFFF,
),
//
body: Form(
key: _formKey,
child: Stepper(
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 0),
type: StepperType.horizontal,
currentStep: _currentStep,
onStepContinue: _nextStep,
onStepCancel: _previousStep,
onStepTapped: (value) {
print(value);
// setState(() {
//
// 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: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
return SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar2New(
context,
"Add Leads and Prospect",
provider.resetForm,
const SizedBox(width: 0),
0xFFFFFFFF,
),
//
body: Form(
key: _formKey,
child: Stepper(
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 0),
type: StepperType.horizontal,
currentStep: _currentStep,
onStepContinue: _nextStep,
onStepCancel: _previousStep,
onStepTapped: (value) {
print(value);
// setState(() {
//
// 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: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Salutation"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
isExpanded: true,
hint: const Row(
children: [
Expanded(
child: Text(
'Select Salutation',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Salutation"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
isExpanded: true,
hint: const Row(
children: [
Expanded(
child: Text(
'Select Salutation',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
],
),
items:
provider.salutationList
.map(
(slist) =>
DropdownMenuItem<String>(
value: slist,
child: Text(
slist ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
],
),
items:
provider.salutationList
.map(
(slist) =>
DropdownMenuItem<String>(
value: slist,
child: Text(
slist ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
)
.toList(),
value: provider.selectedSalutation,
onChanged: (value) {
if (value != null) {
provider.selectedSalutation = value;
provider.salutationError = null;
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
)
.toList(),
value: provider.selectedSalutation,
onChanged: (value) {
if (value != null) {
provider.selectedSalutation = value;
provider.salutationError = null;
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
],
),
),
],
),
errorWidget(context, provider.salutationError),
),
errorWidget(context, provider.salutationError),
textControllerWidget(
context,
provider.companyNameController,
"Company Name",
"Enter Company Name",
provider.onChangeCompanyName,
TextInputType.name,
false,
null,
),
errorWidget(context, provider.companynameError),
textControllerWidget(
context,
provider.companyNameController,
"Company Name",
"Enter Company Name",
provider.onChangeCompanyName,
TextInputType.name,
false,
null,
),
errorWidget(context, provider.companynameError),
textControllerWidget(
context,
provider.contactPersonNameController,
"Contact Person Name",
"Enter Name",
provider.onChangeContactPersonName,
TextInputType.name,
false,
null,
),
errorWidget(context, provider.nameError),
textControllerWidget(
context,
provider.contactPersonNameController,
"Contact Person Name",
"Enter Name",
provider.onChangeContactPersonName,
TextInputType.name,
false,
null,
),
errorWidget(context, provider.nameError),
textControllerWidget(
context,
provider.mobileController,
"Mobile Number",
"Enter Mobile Number",
provider.onChangemobile,
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.done,
10,
),
errorWidget(context, provider.mobileError),
textControllerWidget(
context,
provider.mobileController,
"Mobile Number",
"Enter Mobile Number",
provider.onChangemobile,
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.done,
10,
),
errorWidget(context, provider.mobileError),
textControllerWidget(
context,
provider.customerMailIdController,
"Customer Email Id",
"Enter Email Id",
provider.onChangemailId,
TextInputType.emailAddress,
false,
null,
),
errorWidget(context, provider.mailIdError),
textControllerWidget(
context,
provider.customerMailIdController,
"Customer Email Id",
"Enter Email Id",
provider.onChangemailId,
TextInputType.emailAddress,
false,
null,
),
errorWidget(context, provider.mailIdError),
textControllerWidget(
context,
provider.designationController,
"Customer Designation",
"Enter Designation",
provider.onChangedesignation,
TextInputType.text,
false,
null,
),
errorWidget(context, provider.designationError),
],
),
textControllerWidget(
context,
provider.designationController,
"Customer Designation",
"Enter Designation",
provider.onChangedesignation,
TextInputType.text,
false,
null,
),
errorWidget(context, provider.designationError),
],
),
),
Step(
label: Text("Step 2", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 1,
content: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
),
Step(
label: Text("Step 2", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 1,
content: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
textControllerWidget(
context,
provider.alternateMobileController,
"Alternate Mobile Number",
"Enter Alternate Mobile Number",
provider.onChangeAlternatemobile,
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.done,
10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
textControllerWidget(
context,
provider.alternateMobileController,
"Alternate Mobile Number",
"Enter Alternate Mobile Number",
provider.onChangeAlternatemobile,
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
null,
null,
TextInputAction.done,
10,
),
errorWidget(context, provider.AlternatemobileError),
errorWidget(context, provider.AlternatemobileError),
textControllerWidget(
context,
provider.telephoneController,
"Telephone Number",
"Enter Telephone Number",
provider.onChangeTelephone,
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.TelephoneError),
TextWidget(context, "Source"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Sources>(
hint: Text(
"Select Source",
style: TextStyle(fontSize: 14),
),
items:
provider.sourcesList
.map(
(slist) =>
DropdownMenuItem<Sources>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
textControllerWidget(
context,
provider.telephoneController,
"Telephone Number",
"Enter Telephone Number",
provider.onChangeTelephone,
TextInputType.phone,
false,
FilteringTextInputFormatter.digitsOnly,
),
errorWidget(context, provider.TelephoneError),
TextWidget(context, "Source"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Sources>(
hint: Text(
"Select Source",
style: TextStyle(fontSize: 14),
),
items:
provider.sourcesList
.map(
(slist) =>
DropdownMenuItem<Sources>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
)
.toList(),
value: provider.selectedSources,
onChanged: (Sources? value) {
if (value != null) {
if (provider.sourcesList.isNotEmpty) {
provider.selectedSources = value;
provider.selectedSourcesId =
value!.id!;
provider.selectedSourcesValue =
value!.name!;
provider
.crmLeadListSourceOnReferenceAPIFunction(
context,
"",
provider.selectedSourcesId,
);
),
)
.toList(),
// value: provider.selectedSources,
value: provider.sourcesList.isNotEmpty?provider.selectedSources!=null?
provider.sourcesList.firstWhere((element) => element.id==provider.selectedSourcesId,
orElse: () => provider.sourcesList[0],
):null:null,
onChanged: (Sources? value) {
if (value != null) {
if (provider.sourcesList.isNotEmpty) {
provider.selectedSources = value;
provider.selectedSourcesId =
value!.id!;
provider.selectedSourcesValue =
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,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
],
),
),
],
),
errorWidget(context, provider.sourceError),
TextWidget(context, "Reference"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<References>(
hint: Text(
"Select Reference",
style: TextStyle(fontSize: 14),
),
items:
provider.referencesList
.map(
(slist) => DropdownMenuItem<
References
>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
errorWidget(context, provider.sourceError),
TextWidget(context, "Reference"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<References>(
hint: Text(
"Select Reference",
style: TextStyle(fontSize: 14),
),
items:
provider.referencesList
.map(
(slist) => DropdownMenuItem<
References
>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
)
.toList(),
value: provider.selectedReference,
onChanged: (References? value) {
if (value != null) {
if (provider
.referencesList
.isNotEmpty) {
provider.selectedReference = value;
provider.selectedReferenceId =
value!.id!;
provider.selectedReferenceValue =
value!.name!;
}
),
)
.toList(),
// value: provider.selectedReference,
value: provider.referencesList.isNotEmpty?provider.selectedReference!=null?
provider.referencesList.firstWhere((element) => element.id==provider.selectedReferenceId,
orElse: () => provider.referencesList[0],
):null:null,
onChanged: (References? value) {
if (value != null) {
if (provider
.referencesList
.isNotEmpty) {
provider.selectedReference = value;
provider.selectedReferenceId =
value!.id!;
provider.selectedReferenceValue =
value!.name!;
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
],
),
),
],
),
errorWidget(context, provider.referenceError),
TextWidget(context, "Team"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Teams>(
hint: Text(
"Select Team",
style: TextStyle(fontSize: 14),
),
items:
provider.teamsList
.map(
(slist) =>
DropdownMenuItem<Teams>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
errorWidget(context, provider.referenceError),
TextWidget(context, "Team"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Teams>(
hint: Text(
"Select Team",
style: TextStyle(fontSize: 14),
),
items:
provider.teamsList
.map(
(slist) =>
DropdownMenuItem<Teams>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
)
.toList(),
value: provider.selectedTeams,
onChanged: (Teams? value) {
if (value != null) {
if (provider.teamsList.isNotEmpty) {
provider.selectedTeams = value;
provider.selectedTeamsId =
value!.id!;
provider.selectedTeamsValue =
value!.name!;
provider
.crmLeadListSegmentOnTeamAPIFunction(
context,
"",
provider.selectedTeamsId,
);
),
)
.toList(),
// value: provider.selectedTeams,
value: provider.teamsList.isNotEmpty?provider.selectedTeams!=null?
provider.teamsList.firstWhere((element) => element.id==provider.selectedTeamsId,
orElse: () => provider.teamsList[0],
):null:null,
onChanged: (Teams? value) {
if (value != null) {
if (provider.teamsList.isNotEmpty) {
provider.selectedTeams = value;
provider.selectedTeamsId =
value!.id!;
provider.selectedTeamsValue =
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,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
],
),
),
],
),
errorWidget(context, provider.teamsError),
TextWidget(context, "Segment"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Segments>(
hint: Text(
"Select Segment",
style: TextStyle(fontSize: 14),
),
items:
provider.segmentsList
.map(
(slist) =>
DropdownMenuItem<Segments>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
errorWidget(context, provider.teamsError),
TextWidget(context, "Segment"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Segments>(
hint: Text(
"Select Segment",
style: TextStyle(fontSize: 14),
),
items:
provider.segmentsList
.map(
(slist) =>
DropdownMenuItem<Segments>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
)
.toList(),
value: provider.selectedSegment,
onChanged: (Segments? value) {
if (value != null) {
if (provider
.segmentsList
.isNotEmpty) {
provider.selectedSegment = value;
provider.selectedSegmentId =
value!.id!;
provider.selectedSegmentValue =
value!.name!;
}
),
)
.toList(),
// value: provider.selectedSegment,
value: provider.segmentsList.isNotEmpty?provider.selectedSegment!=null?
provider.segmentsList.firstWhere((element) => element.id==provider.selectedSegmentId,
orElse: () => provider.segmentsList[0],
):null:null,
onChanged: (Segments? value) {
if (value != null) {
if (provider
.segmentsList
.isNotEmpty) {
provider.selectedSegment = value;
provider.selectedSegmentId =
value!.id!;
provider.selectedSegmentValue =
value!.name!;
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
}
},
isExpanded: true,
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
],
),
),
],
),
errorWidget(context, provider.segmentsError),
],
),
),
errorWidget(context, provider.segmentsError),
],
),
),
Step(
label: Text("Step 3", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 2,
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
),
Step(
label: Text("Step 3", style: TextStyle(fontSize: 12)),
title: const Text(''),
isActive: _currentStep >= 2,
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Addleadproductscreen(
type: "Add",
),
settings: RouteSettings(
name:
'Generatequotationaddeditproduct',
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Addleadproductscreen(
type: "Add",
),
settings: RouteSettings(
name:
'Generatequotationaddeditproduct',
),
);
if (res != null) {
print("result ${res}");
}
},
child: Container(
margin: const EdgeInsets.symmetric(
vertical: 10,
),
height: 45,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: const Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
),
);
if (res != null) {
print("result ${res}");
}
},
child: Container(
margin: const EdgeInsets.symmetric(
vertical: 10,
),
height: 45,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: const Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
),
child: Center(
child: Text(
"+ Add Product",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
),
child: Center(
child: Text(
"+ Add Product",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
),
),
),
),
if (provider.productRows.isNotEmpty) ...[
const SizedBox(height: 10),
SizedBox(
height: 125,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: provider.productRows.length,
itemBuilder: (context, index) {
final product =
provider.productRows[index];
final productName =
provider.productsList
.firstWhere(
(p) =>
p.id ==
product['product_id'],
orElse:
() => Products(
id: '',
name: 'Unknown',
),
)
.name;
final prodPrice =
product['price'] ?? '-';
final prodQty = product['qty'] ?? '-';
final totalPrice =
product['net_price'] ?? '-';
if (provider.productRows.isNotEmpty) ...[
const SizedBox(height: 10),
SizedBox(
height: 125,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: provider.productRows.length,
itemBuilder: (context, index) {
final product =
provider.productRows[index];
final productName =
provider.productsList
.firstWhere(
(p) =>
p.id ==
product['product_id'],
orElse:
() => Products(
id: '',
name: 'Unknown',
),
)
.name;
final prodPrice =
product['price'] ?? '-';
final prodQty = product['qty'] ?? '-';
final totalPrice =
product['net_price'] ?? '-';
return InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Addleadproductscreen(
type: "Edit",
editIndex: index,
),
settings: RouteSettings(
name:
'Generatequotationaddeditproduct',
),
return InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Addleadproductscreen(
type: "Edit",
editIndex: index,
),
settings: RouteSettings(
name:
'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:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/crm/product_details_ic.svg",
),
);
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:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/crm/product_details_ic.svg",
),
SizedBox(width: 10),
Expanded(
flex: 6,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Row(
children: [
Expanded(
flex: 4,
child: Text(
productName ??
"-",
maxLines: 2,
overflow:
TextOverflow
.ellipsis,
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
),
Expanded(
flex: 3,
child: Text(
textAlign:
TextAlign
.right,
"₹$prodPrice",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
SizedBox(width: 10),
Expanded(
flex: 6,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Row(
children: [
Expanded(
flex: 4,
child: Text(
productName ??
"-",
maxLines: 2,
overflow:
TextOverflow
.ellipsis,
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.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",
Expanded(
flex: 3,
child: Text(
textAlign:
TextAlign
.right,
"₹$prodPrice",
style: TextStyle(
fontFamily:
"JakartaMedium",
......@@ -822,544 +844,584 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
.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,
value:
provider.statesList.isNotEmpty
? provider.selectedStates !=
null
? provider.statesList!.firstWhere(
(ord) =>
ord.id ==
provider
.selectedStatesId,
orElse:
() =>
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 = "";
}
if(provider.productsEmptyError!.trim().isNotEmpty)...[
errorWidget(context, provider.productsEmptyError)
]
],
),
),
SizedBox(height: 10),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
}
}
},
isExpanded: true,
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
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),
),
),
],
),
),
errorWidget(context, provider.statesError),
TextWidget(context, "District"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Districts>(
hint: Text(
"Select District",
style: TextStyle(fontSize: 14),
),
items:
provider.districtsList
.map(
(slist) => DropdownMenuItem<
Districts
>(
value: slist,
child: Text(
slist.district!,
style: TextStyle(
fontSize: 14,
),
items:
provider.statesList
.map(
(slist) => DropdownMenuItem<
States
>(
value: slist,
child: Text(
slist.name!,
style: TextStyle(
fontSize: 14,
),
),
)
.toList(),
),
)
.toList(),
// value: provider.selectedDistricts,
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) {
// value: provider.selectedStates,
value:
provider.statesList.isNotEmpty
? provider.selectedStates !=
null
? provider.statesList!.firstWhere(
(ord) =>
ord.id ==
provider
.selectedStatesId,
orElse:
() =>
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.selectedDistricts =
value;
provider.districtsList
.clear();
provider.subLocationsList.clear();
// provider.selectedDistricts = null;
provider.selectedDistrictId =
value!.id!;
null;
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:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
}
},
isExpanded: true,
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
],
),
),
],
),
errorWidget(context, provider.districtsError),
TextWidget(context, "Sub Location"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<SubLocations>(
hint: Text(
"Select Sub Location",
style: TextStyle(fontSize: 14),
),
items:
provider.subLocationsList
.map(
(slist) => DropdownMenuItem<
SubLocations
>(
value: slist,
child: Text(
slist.subLocality!,
style: TextStyle(
fontSize: 14,
),
),
errorWidget(context, provider.statesError),
TextWidget(context, "District"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Districts>(
hint: Text(
"Select District",
style: TextStyle(fontSize: 14),
),
items:
provider.districtsList
.map(
(slist) => DropdownMenuItem<
Districts
>(
value: slist,
child: Text(
slist.district!,
style: TextStyle(
fontSize: 14,
),
),
)
.toList(),
),
)
.toList(),
// value: provider.selectedSubLocations,
value:
// value: provider.selectedDistricts,
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
.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) {
.crmLeadListSubLocOnDistrictAPIFunction(
context,
"",
value!.id!,
);
if (provider
.subLocationsList
.isNotEmpty) {
provider.selectedSubLocations =
value;
provider.subLocationsList
.clear();
// provider.selectedSubLocations =
// null;
provider.selectedSubLocationId =
value!.id!;
null;
provider.selectedSubLocationValue =
value!.subLocality!;
"";
}
}
},
isExpanded: true,
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
}
},
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,
),
errorWidget(context, provider.districtsError),
TextWidget(context, "Sub Location"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<SubLocations>(
hint: Text(
"Select Sub Location",
style: TextStyle(fontSize: 14),
),
items:
provider.subLocationsList
.map(
(slist) => DropdownMenuItem<
SubLocations
>(
value: slist,
child: Text(
slist.subLocality!,
style: TextStyle(
fontSize: 14,
),
),
),
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']
.map(
(value) => DropdownMenuItem<
String
>(
value: value,
child: Text(
value ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
],
),
items:
<String>['Cold', 'Hot', 'Warm']
.map(
(value) => DropdownMenuItem<
String
>(
value: value,
child: Text(
value ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
)
.toList(),
value: provider.selectedLeadStatus,
onChanged: (String? newValue) {
setState(() {
provider.selectedLeadStatus =
newValue!;
});
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
)
.toList(),
value: provider.selectedLeadStatus,
onChanged: (String? newValue) {
setState(() {
provider.selectedLeadStatus =
newValue!;
});
},
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
],
),
),
errorWidget(context, provider.leadStatusError),
textControllerWidget(
context,
provider.addressController,
"Address",
"Enter Address ",
provider.onChangeaddress,
TextInputType.streetAddress,
false,
null,
),
],
),
),
errorWidget(context, provider.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(
// children: [
// ElevatedButton(
// onPressed: () {
// setState(() {
// if (_currentStep == 0) {
// _currentStep = 1;
// } else if (_currentStep == 1) {
// _currentStep = 2;
// } else {
// _currentStep = 0;
// }
// });
// details.onStepContinue;
// },
// child: Text(_currentStep == 2 ? 'Submit' : 'Next'),
// ),
// const SizedBox(width: 10),
// if (_currentStep > 0)
// TextButton(
// onPressed: () {
// setState(() {
// if (_currentStep == 2) {
// _currentStep = 1;
// } else if (_currentStep == 1) {
// _currentStep = 0;
// } else {
// _currentStep = 2;
// }
// });
// details.onStepCancel;
// },
// child: const Text('Back'),
// ),
// ],
// );
return Column(
children: [
if (_currentStep == 2) ...[
InkResponse(
onTap: () {
if (provider.validateStep3()) {
if(provider.productRows.isNotEmpty){
provider.crmAddNewLeadsAndProspectsAPIFunction(
context,
"",
provider.selectedEmployeesId,
provider.selectedSalutation,
provider.selectedDistrictId,
provider.selectedStatesId,
provider.selectedSegmentId,
provider.selectedSourcesId,
provider.selectedReferenceId,
provider.selectedReferenceId,
provider.selectedSubLocationId,
provider.selectedLeadStatus,
provider.getJsonEncodedProducts(),
);
}else{
toast(context, "Add min. 1 product");
}
),
],
controlsBuilder: (context, details) {
// return Row(
// children: [
// ElevatedButton(
// onPressed: () {
// setState(() {
// if (_currentStep == 0) {
// _currentStep = 1;
// } else if (_currentStep == 1) {
// _currentStep = 2;
// } else {
// _currentStep = 0;
// }
// });
// details.onStepContinue;
// },
// child: Text(_currentStep == 2 ? 'Submit' : 'Next'),
// ),
// const SizedBox(width: 10),
// if (_currentStep > 0)
// TextButton(
// onPressed: () {
// setState(() {
// if (_currentStep == 2) {
// _currentStep = 1;
// } else if (_currentStep == 1) {
// _currentStep = 0;
// } else {
// _currentStep = 2;
// }
// });
// details.onStepCancel;
// },
// child: const Text('Back'),
// ),
// ],
// );
return Column(
children: [
if (_currentStep == 2) ...[
InkResponse(
onTap: () {
if (provider.validateStep3()) {
if(provider.productRows.isNotEmpty){
provider.crmAddNewLeadsAndProspectsAPIFunction(
context,
"",
provider.selectedEmployeesId,
provider.selectedSalutation,
provider.selectedDistrictId,
provider.selectedStatesId,
provider.selectedSegmentId,
provider.selectedSourcesId,
provider.selectedReferenceId,
provider.selectedReferenceId,
provider.selectedSubLocationId,
provider.selectedLeadStatus,
provider.getJsonEncodedProducts(),
);
}else{
toast(context, "Add min. 1 product");
}
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,
),
),
}
details.onStepContinue;
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
),
] else ...[
InkResponse(
onTap: () {
setState(() {
if (_currentStep == 0) {
if (provider.validateStep1()) {
_currentStep = 1;
}
} else if (_currentStep == 1) {
if (provider.validateStep2()) {
_currentStep = 2;
}
} else {
_currentStep = 0;
}
});
details.onStepContinue;
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child: Text(
"Proceed to Next Step",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
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,
),
),
),
],
if (_currentStep > 0) ...[
TextButton(
onPressed: () {
setState(() {
if (_currentStep == 2) {
),
] else ...[
InkResponse(
onTap: () {
setState(() {
if (_currentStep == 0) {
if (provider.validateStep1()) {
_currentStep = 1;
} else if (_currentStep == 1) {
_currentStep = 0;
} else {
}
} else if (_currentStep == 1) {
if (provider.validateStep2()) {
_currentStep = 2;
}
});
details.onStepCancel;
},
} 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(
'Back',
"Proceed to Next Step",
textAlign: TextAlign.start,
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
],
),
],
if (_currentStep > 0) ...[
TextButton(
onPressed: () {
setState(() {
if (_currentStep == 2) {
_currentStep = 1;
} else if (_currentStep == 1) {
_currentStep = 0;
} else {
_currentStep = 2;
}
});
details.onStepCancel;
},
child: Text(
'Back',
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
),
),
),
],
);
},
),
],
);
},
),
),
),
......
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