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();
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); 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,19 +492,22 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -467,19 +492,22 @@ 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
...@@ -543,7 +571,6 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -543,7 +571,6 @@ class _LoginScreenState extends State<LoginScreen>
), ),
), ),
), ),
),
], ],
), ),
), ),
...@@ -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,14 +105,35 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -92,14 +105,35 @@ 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 {
provider.resetForm();
return true;
},
child: SafeArea(
top: false, top: false,
bottom: Platform.isIOS ? false : true, bottom: Platform.isIOS ? false : true,
child: Scaffold( child: Scaffold(
...@@ -384,7 +418,11 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -384,7 +418,11 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
), ),
) )
.toList(), .toList(),
value: provider.selectedSources, // 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) { onChanged: (Sources? value) {
if (value != null) { if (value != null) {
if (provider.sourcesList.isNotEmpty) { if (provider.sourcesList.isNotEmpty) {
...@@ -393,6 +431,13 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -393,6 +431,13 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
value!.id!; value!.id!;
provider.selectedSourcesValue = provider.selectedSourcesValue =
value!.name!; value!.name!;
if(provider.referencesList.isNotEmpty){
provider.referencesList.clear();
provider.selectedReferenceId = null;
provider.selectedReferenceValue = null;
}
provider provider
.crmLeadListSourceOnReferenceAPIFunction( .crmLeadListSourceOnReferenceAPIFunction(
context, context,
...@@ -441,7 +486,11 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -441,7 +486,11 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
), ),
) )
.toList(), .toList(),
value: provider.selectedReference, // 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) { onChanged: (References? value) {
if (value != null) { if (value != null) {
if (provider if (provider
...@@ -493,7 +542,11 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -493,7 +542,11 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
), ),
) )
.toList(), .toList(),
value: provider.selectedTeams, // 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) { onChanged: (Teams? value) {
if (value != null) { if (value != null) {
if (provider.teamsList.isNotEmpty) { if (provider.teamsList.isNotEmpty) {
...@@ -502,6 +555,12 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -502,6 +555,12 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
value!.id!; value!.id!;
provider.selectedTeamsValue = provider.selectedTeamsValue =
value!.name!; value!.name!;
if(provider.segmentsList.isNotEmpty){
provider.segmentsList.clear();
provider.selectedSegmentId = null;
provider.selectedSegmentValue = null;
}
provider provider
.crmLeadListSegmentOnTeamAPIFunction( .crmLeadListSegmentOnTeamAPIFunction(
context, context,
...@@ -549,7 +608,11 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -549,7 +608,11 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
), ),
) )
.toList(), .toList(),
value: provider.selectedSegment, // 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) { onChanged: (Segments? value) {
if (value != null) { if (value != null) {
if (provider if (provider
...@@ -1362,7 +1425,6 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> { ...@@ -1362,7 +1425,6 @@ class _AddleadsprospectsscreenState extends State<Addleadsprospectsscreen> {
), ),
), ),
), ),
),
); );
}, },
); );
......
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